connect(); $_SESSION['m_admin']['aggregationtype']['structures'] = array(); $this->query("select doctypes_first_level_id from ".$_SESSION['tablename']['fold_aggregationtypes_doctypes_level1']." where foldertype_id = ".$id); while($res = $this->fetch_object()) { array_push($_SESSION['m_admin']['aggregationtype']['structures'], $res->doctypes_first_level_id); } $_SESSION['m_admin']['doctypes'] = array(); for($i=0;$i< count($_SESSION['m_admin']['aggregationtype']['structures']);$i++) { $tmp = array(); $this->query("select d.description, d.type_id from ".$_SESSION['tablename']['doctypes']." d where d.doctypes_first_level_id = ".$_SESSION['m_admin']['aggregationtype']['structures'][$i]); while($res = $this->fetch_object()) { $type_id = $res->type_id; if(!in_array($type_id, $tmp)) { array_push($tmp, $type_id); array_push($_SESSION['m_admin']['doctypes'], array('ID' => $type_id, 'COMMENT' => $this->show_string($res->description))); } } } $_SESSION['m_admin']['aggregationtype']['doctypes'] = array(); $this->query("select d.description, fd.doctype_id from ".$_SESSION['tablename']['fold_aggregationtypes_doctypes']." fd, ".$_SESSION['tablename']['doctypes']." d where d.type_id = fd.doctype_id and fd.foldertype_id = ".$id." order by d.description "); while($res = $this->fetch_object()) { //array_push($_SESSION['m_admin']['aggregationtype']['doctypes'], array('id'=>$res->doctype_id, 'label' => $res->description)); array_push($_SESSION['m_admin']['aggregationtype']['doctypes'], $res->doctype_id); } $_SESSION['m_admin']['load_doctypes'] = false; } /** * Form for the management of the aggregationtype. * * @param string $mode administrator mode (modification, suspension, authorization, delete) * @param string $id aggregationtype identifier (empty by default) */ public function formaggregationtype($mode,$id = "") { $func = new functions(); $state = true; require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_security.php"); $sec = new security(); $_SESSION['m_admin']['aggregationtype']['COLL_ID']= ""; if($mode == "up") { $_SESSION['m_admin']['mode'] = "up"; if(empty($_SESSION['error'])) { $this->connect(); $this->query("select * from ".$_SESSION['tablename']['fold_aggregationtypes']." where foldertype_id = ".$id); if($this->nb_result() == 0) { $_SESSION['error'] = _AGGREGATIONTYPE_MISSING; $state = false; } else { $_SESSION['m_admin']['aggregationtype']['aggregationtypeId'] = $id; $line = $this->fetch_object(); $_SESSION['m_admin']['aggregationtype']['desc'] = $this->show_string($line->aggregationtype_label); $_SESSION['m_admin']['aggregationtype']['comment'] = $this->show_string($line->maarch_comment); $_SESSION['m_admin']['aggregationtype']['indexes'] = $this->get_indexes($id, 'minimal'); $_SESSION['m_admin']['aggregationtype']['mandatory_indexes'] = $this->get_mandatory_indexes($id); if (!isset($_SESSION['m_admin']['load_doctypes']) || $_SESSION['m_admin']['load_doctypes'] == true) { $this->load_doctypes($id); $_SESSION['m_admin']['load_doctypes'] = false; } $_SESSION['m_admin']['aggregationtype']['COLL_ID'] = $line->coll_id; $table_view = $sec->retrieve_view_from_coll_id($_SESSION['m_admin']['aggregationtype']['COLL_ID']); $this->query("select count(*) as total_doc from ".$table_view." where foldertype_id = ".$_SESSION['m_admin']['aggregationtype']['aggregationtypeId']); //$this->show(); $line = $this->fetch_object(); $total_doc = $line->total_doc; } } } else { $_SESSION['m_admin']['aggregationtype']['indexes'] = array(); $_SESSION['m_admin']['aggregationtype']['mandatory_indexes'] = array(); } //$this->show_array($_SESSION['m_admin']); if($mode == "add") { echo '

'._AGGREGATIONTYPE_ADDITION.'

'; } elseif($mode == "up") { echo '

'._AGGREGATIONTYPE_MODIFICATION.'

'; } ?>



"._AGGREGATIONTYPE.' '._UNKNOWN."



"; } else { $this->connect(); $db2 = new dbquery(); $db2->connect(); $db3 = new dbquery(); $db3->connect(); ?>
" class="forms">

/>

0) { ?>

get_all_indexes(); if(count($indexes) > 0) {?>
/> onclick="$('field_').checked=true;" />

:


"; } else { $_SESSION['m_admin']['aggregationtype']['aggregationtypeId'] = $func->wash($_REQUEST['id'], "alphanum", _THE_ID); } } if(isset($_REQUEST['desc']) && !empty($_REQUEST['desc'])) { $_SESSION['m_admin']['aggregationtype']['desc'] = $func->wash($_REQUEST['desc'], "no", _THE_DESC); } else { $_SESSION['error'].= _DESC_MISSING."
"; } if(isset($_REQUEST['collection']) && !empty($_REQUEST['collection'])) { $_SESSION['m_admin']['aggregationtype']['COLL_ID'] = $func->wash($_REQUEST['collection'], "no", _COLLECTION); } else { $_SESSION['error'].= _COLLECTION.' '._MISSING."
"; } if(isset($_REQUEST['comment']) && !empty($_REQUEST['comment'])) { $_SESSION['m_admin']['aggregationtype']['comment'] = $_REQUEST['comment']; } $_SESSION['m_admin']['aggregationtype']['indexes'] = array(); $_SESSION['m_admin']['aggregationtype']['mandatory_indexes'] = array(); for($i=0; $iaggregationtypeinfo($mode); $order = $_SESSION['m_admin']['aggregationtype']['order']; $order_field = $_SESSION['m_admin']['aggregationtype']['order_field']; $what = $_SESSION['m_admin']['aggregationtype']['what']; $start = $_SESSION['m_admin']['aggregationtype']['start']; if(!empty($_SESSION['error'])) { if($mode == "up") { if(!empty($_SESSION['m_admin']['aggregationtype']['aggregationtypeId'] )) { header("location: ".$_SESSION['config']['businessappurl']."index.php?page=aggregationtype_up&id=".$_SESSION['m_admin']['aggregationtype']['aggregationtypeId'] ."&module=aggregation"); exit(); } else { header("location: ".$_SESSION['config']['businessappurl']."index.php?page=aggregationtypes&module=aggregation&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what); exit(); } } elseif($mode == "add") { header("location: ".$_SESSION['config']['businessappurl']."index.php?page=aggregationtype_add&module=aggregation"); exit(); } } else { if($mode == "add") { $this->connect(); $this->query("select aggregationtype_label from ".$_SESSION['tablename']['fold_aggregationtypes']." where foldertype_label= '".$_SESSION['m_admin']['aggregationtype']['desc'] ."'"); if($this->nb_result() > 0) { $_SESSION['error'] = $_SESSION['m_admin']['aggregationtype']['desc'] ." "._ALREADY_EXISTS."
"; header("location: ".$_SESSION['config']['businessappurl']."index.php?page=aggregationtype_add&module=aggregation"); exit(); } else { $this->connect(); //echo $_SESSION['m_admin']['aggregationtype']['custom_query_insert_colums']; $this->query("INSERT INTO ".$_SESSION['tablename']['fold_aggregationtypes']." (foldertype_label, maarch_comment, coll_id) VALUES ('".$this->show_string($_SESSION['m_admin']['aggregationtype']['desc'])."', '".$this->show_string($_SESSION['m_admin']['aggregationtype']['comment'])."', '".$_SESSION['m_admin']['aggregationtype']['COLL_ID']."')"); $this->query('select foldertype_id from '.$_SESSION['tablename']['fold_aggregationtypes']." where foldertype_label = '".$this->show_string($_SESSION['m_admin']['aggregationtype']['desc'])."' and maarch_comment = '".$this->show_string($_SESSION['m_admin']['aggregationtype']['comment'])."'"); $res = $this->fetch_object(); $_SESSION['m_admin']['aggregationtype']['aggregationtypeId'] = $res->foldertype_id; $this->load_db(); for($i=0; $iquery("insert into ".$_SESSION['tablename']['fold_aggregationtypes_indexes']." (foldertype_id, field_name, mandatory) values(".$_SESSION['m_admin']['aggregationtype']['aggregationtypeId'].", '".$_SESSION['m_admin']['aggregationtype']['indexes'][$i]."', '".$mandatory."')"); } if($_SESSION['history']['aggregationtypeadd'] == "true") { require("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php"); $hist = new history(); $hist->add($_SESSION['tablename']['fold_aggregationtypes'], $_SESSION['m_admin']['aggregationtype']['aggregationtypeId'] ,"ADD",_AGGREGATIONTYPE_ADDED." : ".$_SESSION['m_admin']['aggregationtype']['aggregationtypeId'] , $_SESSION['config']['databasetype'], 'folder'); } $this->clearaggregationtypeinfos(); $_SESSION['error'] = _AGGREGATIONTYPE_ADDED; unset($_SESSION['m_admin']); header("location: ".$_SESSION['config']['businessappurl']."index.php?page=aggregationtypes&module=aggregation&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what); exit(); } } elseif($mode == "up") { $this->connect(); $this->query("UPDATE ".$_SESSION['tablename']['fold_aggregationtypes']." set foldertype_label = '".$this->show_string($_SESSION['m_admin']['aggregationtype']['desc'])."' , maarch_comment = '".$this->show_string($_SESSION['m_admin']['aggregationtype']['comment'])."' , coll_id = '".$_SESSION['m_admin']['aggregationtype']['COLL_ID']."' where foldertype_id= '".$_SESSION['m_admin']['aggregationtype']['aggregationtypeId'] ."'"); $this->load_db(); $this->query("delete from ".$_SESSION['tablename']['fold_aggregationtypes_indexes']." where foldertype_id = ".$_SESSION['m_admin']['aggregationtype']['aggregationtypeId']); //$this->show_array($_SESSION['m_admin']['aggregationtype']['indexes']); for($i=0; $iquery("insert into ".$_SESSION['tablename']['fold_aggregationtypes_indexes']." ( foldertype_id, field_name, mandatory) values( ".$_SESSION['m_admin']['aggregationtype']['aggregationtypeId'].", '".$_SESSION['m_admin']['aggregationtype']['indexes'][$i]."', '".$mandatory."')"); } if($_SESSION['history']['aggregationtypeup'] == "true") { require("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php"); $hist = new history(); $hist->add($_SESSION['tablename']['fold_aggregationtypes'], $_SESSION['m_admin']['foldertype']['aggregationtypeId'] ,"UP",_AGGREGATIONTYPE_UPDATE." : ".$_SESSION['m_admin']['aggregationtype']['aggregationtypeId'] , $_SESSION['config']['databasetype'], 'aggregation'); } $this->clearaggregationtypeinfos(); $_SESSION['error'] = _AGGREGATIONTYPE_UPDATE; unset($_SESSION['m_admin']); header("location: ".$_SESSION['config']['businessappurl']."index.php?page=aggregationtypes&module=aggregation&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what); exit(); } } } /** * Clear the session variable for the aggregationtypes */ private function clearaggregationtypeinfos() { unset($_SESSION['m_admin']); } /** * Load the aggregationtype data in the database */ private function load_db() { $this->connect(); $this->query("DELETE FROM ".$_SESSION['tablename']['fold_aggregationtypes_doctypes'] ." where foldertype_id= ".$_SESSION['m_admin']['aggregationtype']['aggregationtypeId'] .""); //$this->show(); for($i=0; $i < count($_SESSION['m_admin']['aggregationtype']['doctypes'] ); $i++) { $this->query("insert into ".$_SESSION['tablename']['fold_aggregationtypes_doctypes']." values (".$_SESSION['m_admin']['aggregationtype']['aggregationtypeId'].", ".$_SESSION['m_admin']['aggregationtype']['doctypes'][$i].")"); } } /** * delete aggregationtype in the database * * @param string $id aggregationtype identifier * @param string $mode allow, ban or del */ public function adminaggregationtype($id,$mode) { $order = $_REQUEST['order']; $order_field = $_REQUEST['order_field']; $start = $_REQUEST['start']; $what = $_REQUEST['what']; if(!empty($_SESSION['error'])) { header("location: ".$_SESSION['config']['businessappurl']."index.php?page=aggregationtypes&module=aggregation&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what); exit(); } else { $this->connect(); $this->query("select foldertype_id from ".$_SESSION['tablename']['fold_aggregationtypes']." where foldertype_id= ".$id); if($this->nb_result() == 0) { $_SESSION['error'] = _AGGREGATIONTYPE_MISSING; header("location: ".$_SESSION['config']['businessappurl']."index.php?page=aggregationtypes&module=aggregation&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what); exit(); } else { $info = $this->fetch_object(); if($mode == "del" ) { $this->query("delete from ".$_SESSION['tablename']['fold_aggregationtypes']." where foldertype_id = ".$id.""); $this->query("delete from ".$_SESSION['tablename']['fold_aggregationtypes_doctypes']." where foldertype_id = ".$id.""); $this->query("delete from ".$_SESSION['tablename']['fold_aggregationtypes_indexes']." where foldertype_id = ".$id.""); if($_SESSION['history']['aggregationtypedel'] == "true") { require("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php"); $users = new history(); $users->add($_SESSION['tablename']['fold_aggregationtypes'], $id,"DEL",_AGGREGATIONTYPE_DELETION." : ".$id, $_SESSION['config']['databasetype'], 'aggregation'); } $_SESSION['error'] = _AGGREGATIONTYPE_DELETION; } header("location: ".$_SESSION['config']['businessappurl']."index.php?page=aggregationtypes&module=aggregation&order=".$order."&order_field=".$order_field."&start=".$start."&what=".$what); exit(); } } } /** * Returns in an array all indexes possible * * @return array $indexes[$i] * ['column'] : database field of the index * ['label'] : Index label * ['type'] : Index type ('date', 'string', 'integer' or 'float') * ['img'] : url to the image index */ public function get_all_indexes() { if(file_exists($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'aggregation'.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'aggregation_index.xml')) { $path = $_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'aggregation'.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'aggregation_index.xml'; } else { $path = 'modules'.DIRECTORY_SEPARATOR.'aggregation'.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'aggregation_index.xml'; } $xmlfile = simplexml_load_file($path); $path_lang = 'modules'.DIRECTORY_SEPARATOR.'aggregation'.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php'; $indexes = array(); foreach($xmlfile->INDEX as $item) { $tmp = (string) $item->label; //echo $tmp; $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); if($tmp2 <> false) { $label = $tmp2; } else { $label = $tmp; } $img = (string) $item->img; if(isset($item->default_value) && !empty($item->default_value)) { $tmp = (string) $item->default_value; $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); if($tmp2 <> false) { $default = $tmp2; } else { $default= $tmp; } } else { $default = false; } if(isset($item->values_list)) { $values = array(); $list = $item->values_list ; foreach($list->value as $val) { $tmp = (string) $val->label; $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); if($tmp2 <> false) { $label_val = $tmp2; } else { $label_val = $tmp; } array_push($values, array('id' => (string) $val->id, 'label' => $label_val)); } $arr_tmp = array('column' => (string) $item->column, 'label' => $label, 'type' => (string) $item->type, 'img' => $_SESSION['config']['businessappurl'].'static.php?module=aggregation&filename='.$img, 'type_field' => 'select', 'values' => $values, 'default_value' => $default); } else { $arr_tmp = array('column' => (string) $item->column, 'label' => $label, 'type' => (string) $item->type, 'img' =>$_SESSION['config']['businessappurl'].'static.php?module=aggregation&filename='.$img, 'type_field' => 'input', 'default_value' => $default); } array_push($indexes, $arr_tmp); } return $indexes; } /** * Returns in an array all indexes for a doctype * * @param string $aggregationtype_id Document type identifier * @param string $mode Mode 'full' or 'minimal', 'full' by default * @return array array of the indexes, depends on the chosen mode : * 1) mode = 'full' : $indexes[field_name] : the key is the field name in the database * ['label'] : Index label * ['type'] : Index type ('date', 'string', 'integer' or 'float') * ['img'] : url to the image index * 2) mode = 'minimal' : $indexes[$i] = field name in the database */ public function get_indexes($aggregationtype_id, $mode= 'full') { $fields = array(); $this->connect(); $this->query("select field_name from ".$_SESSION['tablename']['fold_aggregationtypes_indexes']." where foldertype_id = ".$aggregationtype_id); //$this->show(); while($res = $this->fetch_object()) { array_push($fields,$res->field_name ); } if($mode == 'minimal') { return $fields; } $indexes = array(); if(file_exists($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'aggregation'.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'aggregation_index.xml')) { $path = $_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'aggregation'.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'aggregation_index.xml'; } else { $path = 'modules'.DIRECTORY_SEPARATOR.'aggregation'.DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'aggregation_index.xml'; } $xmlfile = simplexml_load_file($path); $path_lang = 'modules'.DIRECTORY_SEPARATOR.'aggregation'.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php'; foreach($xmlfile->INDEX as $item) { $tmp = (string) $item->label; $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang ); if($tmp2 <> false) { $label = $tmp2; } else { $label = $tmp; } $col = (string) $item->column; $img = (string) $item->img; if(isset($item->default_value) && !empty($item->default_value)) { $tmp = (string) $item->default_value; $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); if($tmp2 <> false) { $default = $tmp2; } else { $default= $tmp; } } else { $default = false; } if(in_array($col, $fields)) { if(isset($item->values_list)) { $values = array(); $list = $item->values_list ; foreach($list->value as $val) { $tmp = (string) $val->label; $tmp2 = $this->retrieve_constant_lang($tmp, $path_lang); if($tmp2 <> false) { $label_val = $tmp2; } else { $label_val = $tmp; } array_push($values, array('id' => (string) $val->id, 'label' => $label_val)); } $indexes[$col] = array( 'label' => $label, 'type' => (string) $item->type, 'img' => $_SESSION['config']['businessappurl'].'static.php?module=aggregation&filename='.$img, 'type_field' => 'select', 'values' => $values, 'default_value' => $default); } else { $indexes[$col] = array( 'label' => $label, 'type' => (string) $item->type, 'img' => $_SESSION['config']['businessappurl'].'static.php?module=aggregation&filename='.$img, 'type_field' => 'input', 'default_value' => $default); } } } return $indexes; } /** * Returns in an array all manadatory indexes possible for a given type * * @param string $aggregationtype_id Document type identifier * @return array Array of the manadatory indexes, $indexes[$i] = field name in the db */ public function get_mandatory_indexes($aggregationtype_id) { $fields = array(); $this->connect(); $this->query("select field_name from ".$_SESSION['tablename']['fold_aggregationtypes_indexes']." where foldertype_id = ".$aggregationtype_id." and mandatory = 'Y'"); while($res = $this->fetch_object()) { array_push($fields,$res->field_name ); } return $fields; } /** * Checks validity of indexes * * @param string $aggregationtype_id Folder type identifier * @param array $values Values to check * @return bool true if checks is ok, false if an error occurs */ public function check_indexes($aggregationtype_id, $values) { if(empty($aggregationtype_id)) { return false; } // Checks the manadatory indexes $indexes = $this->get_indexes($aggregationtype_id); $mandatory_indexes = $this->get_mandatory_indexes($aggregationtype_id); for($i=0; $i"; return false; } } else if($indexes[$key]['type'] == 'string' && !empty($values[$key])) { $field_value = $this->wash($values[$key],"no",$indexes[$key]['label']); } else if($indexes[$key]['type'] == 'float' && !empty($values[$key]) ) { $field_value = $this->wash($values[$key],"float",$indexes[$key]['label']); } else if($indexes[$key]['type'] == 'integer' && !empty($values[$key]) ) { $field_value = $this->wash($values[$key],"num",$indexes[$key]['label']); } if(isset($indexes[$key]['values']) && count($indexes[$key]['values']) > 0) { $found = false; for($i=0; $i < count($indexes[$key]['values']); $i++) { if($values[$key] == $indexes[$key]['values'][$i]['id']) { $found = true; break; } } if(!$found) { $_SESSION['error'] .= $indexes[$key]['label']." : "._ITEM_NOT_IN_LIST.".
"; return false; } } } return true; } /** * Returns a string to use in an sql update query * * @param string $aggregationtype_id Folder type identifierer * @param array $values Values to update * @return string Part of the update sql query */ public function get_sql_update($aggregationtype_id, $values) { $indexes = $this->get_indexes($aggregationtype_id); $req = ''; foreach(array_keys($values)as $key) { if($indexes[$key]['type'] == 'date' && !empty($values[$key])) { $req .= ", ".$key." = '".$this->format_date_db($values[$key])."'"; } else if($indexes[$key]['type'] == 'string' && !empty($values[$key])) { $req .= ", ".$key." = '".$this->protect_string_db($values[$key])."'"; } else if($indexes[$key]['type'] == 'float' && !empty($values[$key])) { $req .= ", ".$key." = ".$values[$key].""; } else if($indexes[$key]['type'] == 'integer' && !empty($values[$key])) { $req .= ", ".$key." = ".$values[$key].""; } } return $req; } /** * Returns an array used to insert data in the database * * @param string $aggregationtype_id Folder type identifier * @param array $values Values to update * @param array $data Return array * @return array */ public function fill_data_array($aggregationtype_id, $values, $data = array()) { $indexes = $this->get_indexes($aggregationtype_id); foreach(array_keys($values)as $key) { if($indexes[$key]['type'] == 'date' && !empty($values[$key])) { array_push($data, array('column' => $key, 'value' => $this->format_date_db($values[$key]), 'type' => "date")); } else if($indexes[$key]['type'] == 'string' && !empty($values[$key])) { array_push($data, array('column' => $key, 'value' => $this->protect_string_db($values[$key]), 'type' => "string")); } else if($indexes[$key]['type'] == 'float' && !empty($values[$key])) { array_push($data, array('column' => $key, 'value' => $values[$key], 'type' => "float")); } else if($indexes[$key]['type'] == 'integer' && !empty($values[$key])) { array_push($data, array('column' => $key, 'value' => $values[$key], 'type' => "integer")); } } return $data; } /** * Inits in the database the indexes for a given aggregation id to null * * @param string $aggregation_sys_id Folder identifier */ public function inits_opt_indexes($aggregation_sys_id) { $indexes = $this->get_all_indexes( ); $query = "update ".$_SESSION['tablename']['fold_aggregation']." set "; for($i=0; $iprotect_string_db($val)."%' and "; } else { $where_request .= " ".$_SESSION['tablename']['fold_aggregation'].".".$key." like '%".$this->protect_string_db($val)."%' and "; } } break; } else if($key.'_from' == $field_name || $key.'_to' == $field_name) { // type == 'date' if( preg_match($date_pattern,$val)==false ) { $_SESSION['error'] .= _WRONG_DATE_FORMAT.' : '.$val; } else { $where_request .= " (".$_SESSION['tablename']['fold_aggregation'].".".$key." >= '".$this->format_date_db($val)."') and "; } break; } else if($key.'_min' == $field_name || $key.'_max' == $field_name ) { if($indexes[$key]['type'] == 'integer' || $indexes[$key]['type'] == 'float') { if($indexes[$key]['type'] == 'integer') { $val_check = $this->wash($val,"num",$indexes[$key]['label'],"no"); } else { $val_check = $this->wash($val,"float",$indexes[$key]['label'],"no"); } if(empty($_SESSION['error'])) { $where_request .= " (".$_SESSION['tablename']['fold_aggregation'].".".$key." >= ".$val_check.") and "; } } break; } } return $where_request; } }