| | |
| | | $this->errorMessage .= "Custom datasource class or function is empty<br />\r\n"; |
| | | } |
| | | } |
| | | |
| | | if($api == false && isset($field['filters']) && is_array($field['filters'])) { |
| | | $new_values = array(); |
| | | foreach($values as $index => $value) { |
| | | $new_index = $app->tform->filterField($index, $index, $field['filters'], 'SHOW'); |
| | | $new_values[$new_index] = $app->tform->filterField($index, (isset($values[$index]))?$values[$index]:'', $field['filters'], 'SHOW'); |
| | | } |
| | | $values = $new_values; |
| | | unset($new_values); |
| | | unset($new_index); |
| | | } |
| | | return $values; |
| | | } |
| | | |
| | |
| | | $table = $i['table']; |
| | | |
| | | $searchval = $_SESSION['search'][$list_name][$search_prefix.$field]; |
| | | // IDN |
| | | if($searchval != ''){ |
| | | if(is_array($i['filters'])) { |
| | | foreach($i['filters'] as $searchval_filter) { |
| | | if($searchval_filter['event'] == 'SHOW') { |
| | | switch ($searchval_filter['type']) { |
| | | case 'IDNTOUTF8': |
| | | $searchval = $app->functions->idn_encode($searchval); |
| | | //echo $searchval; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // format user date format to MySQL date format 0000-00-00 |
| | | if($i['datatype'] == 'DATE' && $this->lng('conf_format_dateshort') != 'Y-m-d'){ |
| | | $dateformat = preg_replace("@[^Ymd]@", "", $this->lng('conf_format_dateshort')); |
| | |
| | | $searchval = $year.'-'.$month.'-'.$day; |
| | | } |
| | | } |
| | | |
| | | if($i['datatype'] == 'BOOLEAN' && $searchval != ''){ |
| | | if (!function_exists('boolval')) { |
| | | $searchval = (bool) $searchval; |
| | | if($searchval === true){ |
| | | $searchval = 'TRUE'; |
| | | } else { |
| | | $searchval = 'FALSE'; |
| | | } |
| | | } else { |
| | | $searchval = boolval($searchval)? 'TRUE' : 'FALSE'; |
| | | } |
| | | } |
| | | |
| | | // if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and"; |
| | | if(isset($searchval) && $searchval != ''){ |
| | | $sql_where .= " ".($table != ''? $table.'.' : $this->listDef['table'].'.')."$field ".$i['op']." '".$app->db->quote($i['prefix'].$searchval.$i['suffix'])."' and"; |
| | | $sql_where .= " ".($table != ''? $table.'.' : $this->listDef['table'].'.')."$field ".$i['op']." ".($i['datatype'] == 'BOOLEAN'? "" : "'").$app->db->quote($i['prefix'].$searchval.$i['suffix']).($i['datatype'] == 'BOOLEAN'? "" : "'")." and"; |
| | | } |
| | | } |
| | | } |
| | |
| | | return $this->pagingValues[$key]; |
| | | } |
| | | |
| | | /* TODO: maybe rewrite sql */ |
| | | public function getPagingSQL($sql_where = '1') |
| | | { |
| | | global $app, $conf; |
| | |
| | | if($this->searchChanged == 1) $_SESSION['search'][$list_name]['page'] = 0; |
| | | |
| | | $sql_von = $app->functions->intval($_SESSION['search'][$list_name]['page'] * $records_per_page); |
| | | $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table".($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')." WHERE $sql_where"); |
| | | $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM ??".($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')." WHERE $sql_where", $table); |
| | | $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page); |
| | | |
| | | |
| | |
| | | |
| | | sort($show_pages); |
| | | $show_pages = array_unique($show_pages); |
| | | |
| | | |
| | | $content = '<nav> |
| | | <ul class="pagination">'; |
| | | |
| | | //* Show Back |
| | | if(isset($vars['show_page_back']) && $vars['show_page_back'] == 1){ |
| | | $content = '<a class="btn-page first-page" href="'."javascript:loadContent('".$vars['list_file'].'?page=0'.$vars['page_params']."');".'">' |
| | | .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_stop_180.png"></a> '; |
| | | $content .= '<a class="btn-page previous-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params']."');".'">' |
| | | .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_180.png"></a> '; |
| | | $content .= '<li><a href="#" data-load-content="'.$vars['list_file'].'?page=0'.$vars['page_params'].'" aria-label="First"> |
| | | <span aria-hidden="true">«</span></a></li>'; |
| | | $content .= '<li><a href="#" data-load-content="'.$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params'].'" aria-label="Previous"> |
| | | <span aria-hidden="true">‹</span></a></li>'; |
| | | } |
| | | $content .= ' '.$this->lng('page_txt').' '; |
| | | $prev = -1; |
| | | foreach($show_pages as $p) { |
| | | if($prev != -1 && $p > $prev + 1) $content .= '<span class="page-spacer">...</span>'; |
| | | $content .= '<a class="link-page' . ($p == $vars['page'] ? ' current-page' : '') . '" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$p.$vars['page_params']."');".'">'. ($p+1) .'</a>'; |
| | | if($prev != -1 && $p > $prev + 1) $content .= '<li class="disabled"><a href="#">…</a></li>'; |
| | | $content .= '<li' . ($p == $vars['page'] ? ' class="active"' : '') . '><a href="#" data-load-content="'.$vars['list_file'].'?page='.$p.$vars['page_params'].'">'. ($p+1) .'</a></li>'; |
| | | $prev = $p; |
| | | } |
| | | //.$vars['next_page'].' '.$this->lng('page_of_txt').' '.$vars['max_pages'].' '; |
| | | //* Show Next |
| | | if(isset($vars['show_page_next']) && $vars['show_page_next'] == 1){ |
| | | $content .= '<a class="btn-page next-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['next_page'].$vars['page_params']."');".'">' |
| | | .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow.png"></a> '; |
| | | $content .= '<a class="btn-page last-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['pages'].$vars['page_params']."');".'">' |
| | | .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_stop.png"></a>'; |
| | | $content .= '<li><a href="#" data-load-content="'.$vars['list_file'].'?page='.$vars['next_page'].$vars['page_params'].'" aria-label="Next"> |
| | | <span aria-hidden="true">›</span></a></li>'; |
| | | $content .= '<li><a href="#" data-load-content="'.$vars['list_file'].'?page='.$vars['pages'].$vars['page_params'].'" aria-label="Last"> |
| | | <span aria-hidden="true">»</span></a></li>'; |
| | | } |
| | | $content .= '</ul></nav>'; |
| | | |
| | | return $content; |
| | | } |
| | | |
| | |
| | | case 'CURRENCY': |
| | | $record[$key] = $app->functions->currency_format($record[$key]); |
| | | break; |
| | | |
| | | case 'BOOLEAN': |
| | | if (!function_exists('boolval')) { |
| | | $record[$key] = (bool) $record[$key]; |
| | | } else { |
| | | $record[$key] = boolval($record[$key]); |
| | | } |
| | | break; |
| | | |
| | | default: |
| | | $record[$key] = htmlentities(stripslashes($record[$key]), ENT_QUOTES, $conf["html_content_encoding"]); |
| | |
| | | } |
| | | return $record; |
| | | } |
| | | |
| | | |
| | | /* TODO: check double quoting of SQL */ |
| | | public function encode($record) |
| | | { |
| | | global $app; |
| | |
| | | break; |
| | | |
| | | case 'DATE': |
| | | if($record[$key] != '' && $record[$key] != '0000-00-00') { |
| | | if($record[$key] != '' && !is_null($record[$key]) && $record[$key] != '0000-00-00') { |
| | | $record[$key] = $record[$key]; |
| | | } |
| | | break; |
| | |
| | | case 'CURRENCY': |
| | | $record[$key] = str_replace(',', '.', $record[$key]); |
| | | break; |
| | | |
| | | case 'BOOLEAN': |
| | | if (!function_exists('boolval')) { |
| | | $record[$key] = (bool) $record[$key]; |
| | | } else { |
| | | $record[$key] = boolval($record[$key]); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |