| | |
| | | $querystring = str_replace("{AUTHSQL}", $app->tform->getAuthSQL('r'), $querystring); |
| | | $querystring = str_replace("{AUTHSQL-A}", $app->tform->getAuthSQL('r', 'a'), $querystring); |
| | | $querystring = str_replace("{AUTHSQL-B}", $app->tform->getAuthSQL('r', 'b'), $querystring); |
| | | $querystring = preg_replace_callback('@{AUTHSQL::(.+?)}@', create_function('$matches','global $app; $tmp = $app->tform->getAuthSQL("r", $matches[1]); return $tmp;'), $querystring); |
| | | |
| | | //* Getting the records |
| | | $tmp_records = $app->db->queryAllRecords($querystring); |
| | |
| | | } else { |
| | | $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 != ''){ |
| | | 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')); |
| | |
| | | return $this->pagingValues[$key]; |
| | | } |
| | | |
| | | /* TODO: maybe rewrite sql */ |
| | | public function getPagingSQL($sql_where = '1') |
| | | { |
| | | global $app, $conf; |
| | | |
| | | $old_search_limit = intval($_SESSION['search']['limit']); |
| | | |
| | | //* Add Global Limit from selectbox |
| | | if(!empty($_POST['search_limit']) and $app->functions->intval($_POST['search_limit']) > 0){ |
| | |
| | | |
| | | //* set PAGE to worth request variable "PAGE" - ? setze page auf wert der request variablen "page" |
| | | if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = $app->functions->intval($_REQUEST["page"]); |
| | | |
| | | //* Set search to changed when search limit has been changed. |
| | | if(intval($_SESSION['search']['limit']) != $old_search_limit) $this->searchChanged = 1; |
| | | |
| | | //* PAGE to 0 set, if look for themselves ? page auf 0 setzen, wenn suche sich ge�ndert hat. |
| | | 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; |
| | | } |
| | | |
| | |
| | | } |
| | | return $record; |
| | | } |
| | | |
| | | |
| | | /* TODO: check double quoting of SQL */ |
| | | public function encode($record) |
| | | { |
| | | global $app; |