diff --git a/interface/lib/classes/searchform.inc.php b/interface/lib/classes/searchform.inc.php
deleted file mode 100644
index 0a290c1d699bcae630af474c76190d92f5ec1d42..0000000000000000000000000000000000000000
--- a/interface/lib/classes/searchform.inc.php
+++ /dev/null
@@ -1,349 +0,0 @@
-listDef = $liste;
- $this->module = $module;
-
- //* Fill datasources
- foreach($this->listDef['item'] as $key => $field) {
- if(is_array($field['datasource'])) {
- $this->listDef['item'][$key]['value'] = $this->getDatasourceData($field);
- }
- }
- return true;
- }
-
- /**
- * Get the key => value array of a form filed from a datasource definitiom
- *
- * @param field = array with field definition
- * @param record = Dataset as array
- * @return key => value array for the value field of a form
- */
-
-
- public function getDatasourceData($field)
- {
- global $app;
- $values = array();
-
- if($field['datasource']['type'] == 'SQL') {
- //* Preparing SQL string. We will replace some common placeholders
- $querystring = $field['datasource']['querystring'];
- $querystring = str_replace('{USERID}', $_SESSION['s']['user']['userid'], $querystring);
- $querystring = str_replace('{GROUPID}', $_SESSION['s']['user']['default_group'], $querystring);
- $querystring = str_replace('{GROUPS}', $_SESSION['s']['user']['groups'], $querystring);
- $table_idx = $this->formDef['db_table_idx'];
- //$querystring = str_replace('{RECORDID}',$record[$table_idx],$querystring);
- $app->uses('tform');
- $querystring = str_replace('{AUTHSQL}', $app->tform->getAuthSQL('r'), $querystring);
-
- //* Getting the records
- $tmp_records = $app->db->queryAllRecords($querystring);
- if($app->db->errorMessage != ''){
- die($app->db->errorMessage);
- }
- if(is_array($tmp_records)) {
- $key_field = $field['datasource']['keyfield'];
- $value_field = $field['datasource']['valuefield'];
- foreach($tmp_records as $tmp_rec) {
- $values[$tmp_rec[$key_field]] = $tmp_rec[$value_field];
- }
- }
- }
- if($field['datasource']['type'] == 'CUSTOM') {
- //* Calls a custom class to validate this record
- if($field['datasource']['class'] != '' and $field['datasource']['function'] != '') {
- $datasource_class = $field['datasource']['class'];
- $datasource_function = $field['datasource']['function'];
- $app->uses($datasource_class);
- $record = array();
- $values = $app->$datasource_class->$datasource_function($field, $record);
- }else{
- $this->errorMessage .= "Custom datasource class or function is empty
\r\n";
- }
- }
- return $values;
- }
-
- public function getSearchSQL($sql_where = '')
- {
- global $db;
-
- //* Config vars
- $list_name = $this->listDef['name'];
- $search_prefix = $this->listDef['search_prefix'];
-
- //* store retrieval query
- foreach($this->listDef['item'] as $i) {
- $field = $i['field'];
-
- //* TODO ? hat sich die suche ge�ndert - has itself search ?
- $ki = $search_prefix.$field;
- if(isset($_REQUEST) and $_REQUEST[$ki] != $_SESSION['search'][$list_name][$ki]){
- $this->searchChanged = 1;
- }
-
- //* suchfield in session store.
- if(isset($_REQUEST[$ki])){
- $_SESSION['search'][$list_name][$ki] = $_REQUEST[$ki];
- }
-
- if($i['formtype'] == 'SELECT'){
- if(is_array($i['value'])) {
- $out = '';
- foreach($i['value'] as $k => $v) {
- $selected = ($k == $_SESSION['search'][$list_name][$ki] && $_SESSION['search'][$list_name][$ki] != '') ? ' SELECTED' : '';
- $out .= "\r\n";
- }
- }
- $this->searchValues[$ki] = $out;
- }else{
- $this->searchValues[$ki] = $_SESSION['search'][$list_name][$ki];
- }
- }
-
- //* store variables in object. $this->searchValues = $_SESSION["search"][$list_name];
- foreach($this->listDef['item'] as $i) {
- $field = $i['field'];
- //if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
- if($_SESSION['search'][$list_name][$ki] != ''){
- $sql_where .= " $field ".$i['op']." '".$i['prefix'].$_SESSION['search'][$list_name][$ki].$i['suffix']."' and";
- }
- }
- return ($sql_where != '') ? substr($sql_where, 0, -3) : '1';
- }
-
- public function getPagingSQL($sql_where = '1') {
- global $app, $conf;
-
- $list_name = $this->listDef['name'];
- $search_prefix = $this->listDef['search_prefix'];
- $records_per_page = $this->listDef['records_per_page'];
- $table = $this->listDef['table'];
-
- //* set page to seror id session not set
- if($_SESSION['search'][$list_name]['page'] == '') $_SESSION['search'][$list_name]['page'] = 0;
-
- //* Set page size to request if set
- if(isset($_REQUEST['page'])) $_SESSION['search'][$list_name]['page'] = $_REQUEST['page'];
-
- //* TODO PAGE to 0 set, if look for themselves ge?ndert. = page auf 0 setzen, wenn suche sich ge�ndert hat.
- if($this->searchChanged == 1) $_SESSION['search'][$list_name]['page'] = 0;
-
- $sql_von = $_SESSION['search'][$list_name]['page'] * $records_per_page;
- $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM ?? WHERE $sql_where", $table);
- $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
-
- $vars['list_file'] = $this->listDef['file'];
- $vars['page'] = $_SESSION['search'][$list_name]['page'];
- $vars['last_page'] = $_SESSION['search'][$list_name]['page'] - 1;
- $vars['next_page'] = $_SESSION['search'][$list_name]['page'] + 1;
- $vars['pages'] = $pages;
- $vars['max_pages'] = $pages + 1;
- $vars['records_gesamt'] = $record_count['anzahl'];
- $vars['page_params'] = $this->listDef['page_params'];
-
- if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1;
- if($_SESSION['search'][$list_name]['page'] <= $vars['pages'] - 1) $vars['show_page_next'] = 1;
-
- $this->pagingValues = $vars;
- $this->pagingHTML = $this->getPagingHTML($vars);
-
- return "LIMIT $sql_von, $records_per_page";
- }
-
- public function getPagingHTML($vars) {
- global $app;
- $page_params = $vars['page_params'];
- $list_file = $vars['list_file'];
- $content = ' ';
- if($vars['show_page_back'] == 1){
- $content .= ' ';
- }
- $content .= ' '.$app->lng('Page').' '.$vars['next_page'].' '.$app->lng('of').' '.$vars['max_pages'].' ';
- if($vars['show_page_next'] == 1){
- $content .= ' ';
- } else{
- $content .= ' ';
- }
- $content .= ' ';
- return $content;
- }
-
- public function getPagingHTMLasTXT($vars)
- {
- global $app;
- $page_params = $vars['page_params'];
- $list_file = $vars['list_file'];
- $content = '[|<< ]';
- if($vars['show_page_back'] == 1){
- $content .= '[<< '.$app->lng('Back').'] ';
- }
- $content .= ' '.$app->lng('Page').' '.$vars['next_page'].' '.$app->lng('of').' '.$vars['max_pages'].' ';
- if($vars['show_page_next'] == 1){
- $content .= '['.$app->lng('Next').' >>] ';
- }
- $content .= '[ >>|]';
- return $content;
- }
-
- public function getSortSQL()
- {
- $sort_field = $this->listDef['sort_field'];
- $sort_direction = $this->listDef['sort_direction'];
- return ($sort_field != '' && $sort_direction != '') ? "ORDER BY $sort_field $sort_direction" : '';
- }
-
- public function saveSearchSettings($searchresult_name)
- {
- global $app, $conf;
-
- $list_name = $this->listDef['name'];
- $settings = $_SESSION['search'][$list_name];
- unset($settings['page']);
- $data = serialize($settings);
-
- $userid = $_SESSION['s']['user']['userid'];
- $groupid = $_SESSION['s']['user']['default_group'];
- $sys_perm_user = 'riud';
- $sys_perm_group = 'r';
- $sys_perm_other = '';
- $module = $_SESSION['s']['module']['name'];
- $searchform = $this->listDef['name'];
- $title = $searchresult_name;
-
- $sql = 'INSERT INTO `searchform` ( '
- .'`sys_userid` , `sys_groupid` , `sys_perm_user` , `sys_perm_group` , `sys_perm_other` , `module` , `searchform` , `title` , `data` '
- .')VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)';
- $app->db->query($sql, $userid, $groupid, $sys_perm_user, $sys_perm_group, $sys_perm_other, $module, $searchform, $title, $data);
- }
-
- public function decode($record)
- {
- global $app;
- if(is_array($record)) {
- foreach($this->listDef['item'] as $field) {
- $key = $field['field'];
- switch ($field['datatype'])
- {
- case 'DATE':
- if($val > 0) {
- $record[$key] = date($this->dateformat, $record[$key]);
- }
- break;
-
- case 'INTEGER':
- $record[$key] = $app->functions->intval($record[$key]);
- break;
-
- case 'DOUBLE':
- $record[$key] = $record[$key];
- break;
-
- case 'CURRENCY':
- $record[$key] = number_format($record[$key], 2, ',', '');
- break;
-
-
- case 'VARCHAR':
- case 'TEXT':
- default:
- $record[$key] = stripslashes($record[$key]);
- break;
- }
- }
- }
- return $record;
- }
-
- /* TODO: check for double quoting mysql value */
- public function encode($record)
- {
- global $app;
- if(is_array($record)) {
- foreach($this->listDef['item'] as $field) {
- $key = $field['field'];
- switch ($field['datatype'])
- {
- case 'VARCHAR':
- case 'TEXT':
- if(!is_array($record[$key])) {
- $record[$key] = $app->db->quote($record[$key]);
- } else {
- $record[$key] = implode($this->tableDef[$key]['separator'], $record[$key]);
- }
- break;
-
- case 'DATE':
- if($record[$key] > 0) {
- list($tag, $monat, $jahr) = explode('.', $record[$key]);
- $record[$key] = mktime(0, 0, 0, $monat, $tag, $jahr);
- }
- break;
-
- case 'INTEGER':
- $record[$key] = $app->functions->intval($record[$key]);
- break;
-
- case 'DOUBLE':
- $record[$key] = $app->db->quote($record[$key]);
- break;
-
- case 'CURRENCY':
- $record[$key] = str_replace(',', '.', $record[$key]);
- break;
- }
- }
- }
- return $record;
- }
-
-}
-
-?>
diff --git a/interface/lib/classes/searchform_actions.inc.php b/interface/lib/classes/searchform_actions.inc.php
deleted file mode 100644
index c4372982c0ae5fbd0a7d94683b57d9dd1e96a538..0000000000000000000000000000000000000000
--- a/interface/lib/classes/searchform_actions.inc.php
+++ /dev/null
@@ -1,202 +0,0 @@
-tpl)) $app->uses('tpl');
- if(!is_object($app->searchform)) $app->uses('searchform');
- if(!is_object($app->tform)) $app->uses('tform');
-
- // Load list definition
- $app->searchform->loadListDef($list_def_file);
-
- // Delete the search form contents, if requested
- if($_REQUEST["empty_searchfields"] == 'yes') {
- $list_name = $app->searchform->listDef["name"];
- unset($_SESSION["search"][$list_name]);
- }
-
- // Save the search for later usage
- if($_REQUEST["btn_submit_search_save"] && $_REQUEST["search_save_as"] != '') {
- $app->searchform->saveSearchSettings($_REQUEST["search_save_as"]);
- }
-
- // Set th returnto value for forms
- $_SESSION["s"]["form"]["return_to_url"] = $app->searchform->listDef["file"];
-
- if(!is_file('templates/'.$app->searchform->listDef["name"].'_search.htm')) {
- $app->uses('searchform_tpl_generator');
- $app->searchform_tpl_generator->buildHTML($app->searchform->listDef);
- }
-
- $app->tpl->newTemplate("searchpage.tpl.htm");
- $app->tpl->setInclude('content_tpl', 'templates/'.$app->searchform->listDef["name"].'_search.htm');
-
- // Getting Datasets from DB
- $records = $app->db->queryAllRecords($this->getQueryString());
-
-
- $this->DataRowColor = "#FFFFFF";
- if(is_array($records)) {
- $this->idx_key = $app->searchform->listDef["table_idx"];
- foreach($records as $rec) {
- $records_new[] = $this->prepareDataRow($rec);
- }
- }
-
- $app->tpl->setLoop('records', $records_new);
-
- //print_r($records_new);
-
- $this->onShow();
-
-
- }
-
- function prepareDataRow($rec) {
- global $app;
-
- $rec = $app->searchform->decode($rec);
-
- // Alternating datarow colors
- $this->DataRowColor = ($this->DataRowColor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
- $rec["bgcolor"] = $this->DataRowColor;
-
- // substitute value for select fields
- foreach($app->searchform->listDef["item"] as $field) {
- $key = $field["field"];
- if($field['formtype'] == "SELECT") {
- if($rec[$key] == 'y' or $rec[$key] == 'n') {
- // Set a additional image variable for bolean fields
- $rec['_'.$key.'_'] = ($rec[$key] == 'y')?'list_icon_true.png':'list_icon_false.png';
- }
- // substitute value for select field
- $rec[$key] = $field['value'][$rec[$key]];
- }
- }
-
- // The variable "id" contains always the index variable
- $rec["id"] = $rec[$this->idx_key];
-
- return $rec;
- }
-
- function getQueryString() {
- global $app;
-
- // Generate the search sql
- if($app->searchform->listDef["auth"] != 'no') {
- if($_SESSION["s"]["user"]["typ"] == "admin") {
- $sql_where = "";
- } else {
- $sql_where = $app->tform->getAuthSQL('r')." and";
- }
- }
-
- if($this->SQLExtWhere != '') {
- $sql_where .= " ".$this->SQLExtWhere." and";
- }
-
- $sql_where = $app->searchform->getSearchSQL($sql_where);
- $app->tpl->setVar($app->searchform->searchValues);
-
- $order_by_sql = $this->SQLOrderBy;
-
- // Generate SQL for paging
- $limit_sql = $app->searchform->getPagingSQL($sql_where);
- $app->tpl->setVar("paging", $app->searchform->pagingHTML);
-
- return "SELECT * FROM ".$app->searchform->listDef["table"]." WHERE $sql_where $order_by_sql $limit_sql";
-
- }
-
-
- function onShow() {
- global $app;
-
- // Language File setzen
- $lng_file = ISPC_WEB_PATH.'/lang/lib/lang/'.$app->functions->check_language($_SESSION['s']['language']).'_list.lng';
- if(!file_exists($lng_file)) $lng_file = ISPC_WEB_PATH.'/lang/lib/lang/en_'.'_list.lng';
- include $lng_file;
- $lng_file = "lib/lang/".$app->functions->check_language($_SESSION["s"]["language"])."_".$app->searchform->listDef['name']."_search.lng";
- if(!file_exists($lng_file)) $lng_file = 'lib/lang/en_'.$app->searchform->listDef['name']."_search.lng";
- include $lng_file;
- $app->tpl->setVar($wb);
- $app->tpl->setVar("form_action", $app->searchform->listDef["file"]);
-
- // Parse the templates and send output to the browser
- $this->onShowEnd();
- }
-
- function onShowEnd() {
- global $app;
-
- if(count($_REQUEST) > 0) {
- $app->tpl->setVar('searchresult_visible', 1);
- if($_REQUEST['searchresult_visible'] == 'no') $app->tpl->setVar('searchresult_visible', 0);
-
- if($_REQUEST['searchform_visible'] == 'yes') {
- $app->tpl->setVar('searchform_visible', 1);
- } else {
- $app->tpl->setVar('searchform_visible', 0);
- }
- } else {
- $app->tpl->setVar('searchform_visible', 1);
- if($_REQUEST['searchform_visible'] == 'no') $app->tpl->setVar('searchform_visible', 0);
-
- if($_REQUEST['searchresult_visible'] == 'yes') {
- $app->tpl->setVar('searchresult_visible', 1);
- } else {
- $app->tpl->setVar('searchresult_visible', 0);
- }
- }
-
- // make columns visible
- $visible_columns = explode(",", $app->searchform->listDef['default_columns']);
- foreach($visible_columns as $col) {
- $app->tpl->setVar($col.'_visible', 1);
- }
-
- $app->tpl_defaults();
- $app->tpl->pparse();
- }
-
-}
-
-?>
diff --git a/interface/lib/classes/searchform_tpl_generator.inc.php b/interface/lib/classes/searchform_tpl_generator.inc.php
deleted file mode 100644
index 81e2f4ef1a6ee42c0b948c64742b958faf1a4007..0000000000000000000000000000000000000000
--- a/interface/lib/classes/searchform_tpl_generator.inc.php
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
- | |
- | |
- |
-[Neue Suche] -[Suchkriterien ändern] -Suche speichern unter: -
-- | |
{tmpl_var name=\"".$key."\"} | \r\n"; - $html .= "[{tmpl_var name='delete_txt'}] | -