. */ /** * @brief Script called by an ajax object to process the document type change from the details page * * @file change_doctype.php * @author Claire Figueras * @date $date$ * @version $Revision$ * @ingroup indexing_searching_mlb */ require_once('apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR."class_types.php"); $db = new dbquery(); $core = new core_tools(); $core->load_lang(); $type = new types(); $func = new functions(); if(!isset($_REQUEST['type_id']) || empty($_REQUEST['type_id'])) { $_SESSION['error'] = _DOCTYPE.' '._IS_EMPTY; echo "{status : 1, error_txt : '".addslashes($_SESSION['error'])."'}"; exit(); } $mandatory_indexes = $type->get_mandatory_indexes($_REQUEST['type_id'], $_SESSION['tablename']['postindexing_collection']); $indexes = $type->get_indexes($_REQUEST['type_id'], $_SESSION['tablename']['postindexing_collection']); $opt_indexes = ''; if(count($indexes) > 0) { //recuperer les champs pour la requete foreach(array_keys($indexes) as $key) { // if(preg_match('/^custom_/', $key)) // In the view all custom from res table begin with doc_ // { // $comp_field .= ', doc_'.$key; // } // else // { $comp_field .= ', '.$key; //} } $table = 'res_letterbox'; $db->query("select res_id ".$comp_field." from ".$table." where res_id = ".$_SESSION['postindexing']['res_actif'].""); $res = $db->fetch_object(); $opt_indexes .= '
'; //$opt_indexes .= '

'._OPT_INDEXES.'

'; $opt_indexes .= '
'; $opt_indexes .= ''; $i=0; foreach(array_keys($indexes) as $key) { //echo $key.' '; $mandatory = false; if(in_array($key, $mandatory_indexes)) { $mandatory = true; } // if($i%2 != 1 || $i==0) // pair // { $opt_indexes .= ''; // } $opt_indexes .= ''; $opt_indexes .= ''; $opt_indexes .= ''; // if($i%2 == 1 && $i!=0) // impair // { $opt_indexes .= ''; // } // else // { // { // if($i+1 == count($indexes)) // $opt_indexes .= ''; // } // } $i++; } $opt_indexes .= '
'; if(isset($indexes[$key]['img'])) { $opt_indexes .= ''.$indexes[$key]['label'].''; } $opt_indexes .= ''; $opt_indexes .= $indexes[$key]['label'].' :'; $opt_indexes .= ''; $field_value = $res->$key; if($indexes[$key]['type_field'] == 'input') { if($indexes[$key]['type'] == 'string' || $indexes[$key]['type'] == 'float' || $indexes[$key]['type'] == 'integer') { $opt_indexes .= ''; } else if($indexes[$key]['type'] == 'date') { $opt_indexes .= ''; } } else { $opt_indexes .= ''; } if($mandatory) { $opt_indexes .= '*'; } $opt_indexes .= '
 
'; $opt_indexes .= '
'; $opt_indexes .= '
 
'; } echo "{status : 0, new_opt_indexes : '".addslashes($opt_indexes)."'}"; exit(); ?>