public function get_value()
 {
     if (!$this->value) {
         $parent = new cms_module_common_selector_sections($this->get_sub_selector_id("cms_module_common_selector_sections"));
         $cp = new cms_module_common_selector_type_section_filter($this->get_sub_selector_id("cms_module_common_selector_type_section_filter"));
         $parents = $parent->get_value();
         $field = $cp->get_value();
         $var = new cms_module_common_selector_env_var($this->get_sub_selector_id("cms_module_common_selector_env_var"));
         $this->value = array();
         if (is_array($parents) && count($parents)) {
             $query = "select id_section from cms_sections where section_num_parent in (" . implode(",", $parents) . ")";
             $result = pmb_mysql_query($query);
             $fields = new cms_editorial_parametres_perso($field['type']);
             if (pmb_mysql_num_rows($result)) {
                 while ($row = pmb_mysql_fetch_object($result)) {
                     $fields->get_values($row->id_section);
                     if (in_array($var->get_value(), $fields->values[$field['field']])) {
                         $this->value[] = $row->id_section;
                     }
                 }
             }
         }
     }
     return $this->value;
 }
 public function execute_ajax()
 {
     global $id_type;
     $response = array();
     $fields = new cms_editorial_parametres_perso($id_type);
     $select = "\n\t\t<div class='row'>\n\t\t\t<div class='colonne3'>\n\t\t\t\t<label for=''>" . $this->format_text($this->msg['cms_module_common_selector_type_editorial_fields_label']) . "</label>\n\t\t\t</div>\n\t\t\t<div class='colonne-suite'> \n\t\t\t\t<select name='" . $this->get_form_value_name("select_field") . "' >";
     $select .= $fields->get_selector_options($this->parameters["type_editorial_field"]);
     $select .= "\n\t\t\t\t</select>\n\t\t\t</div>\n\t\t</div>";
     $response['content'] = $select;
     $response['content-type'] = 'text/html';
     return $response;
 }
 public function get_value()
 {
     if (!$this->value) {
         $query = "select id_editorial_type from cms_editorial_types where editorial_type_element = 'section_generic'";
         $result = pmb_mysql_query($query);
         if (pmb_mysql_num_rows($result)) {
             $fields = new cms_editorial_parametres_perso(pmb_mysql_result($result, 0, 0));
             if ($this->parameters['sub_selector']) {
                 $sub = new $this->parameters['sub_selector']($this->get_sub_selector_id($this->parameters['sub_selector']));
                 $fields->get_values($sub->get_value());
                 $this->value = $fields->values[$this->parameters['type_editorial_field']];
             }
         }
     }
     return $this->value;
 }
 public function get_value()
 {
     if (!$this->value) {
         $fields = new cms_editorial_parametres_perso($this->parameters["type_editorial"]);
         if ($this->parameters['sub_selector']) {
             $sub = new $this->parameters['sub_selector']($this->get_sub_selector_id($this->parameters['sub_selector']));
             $fields->get_values($sub->get_value());
             if (isset($fields->values[$this->parameters['type_editorial_field']])) {
                 $this->value = $fields->values[$this->parameters['type_editorial_field']];
             } else {
                 $query = "select id_editorial_type from cms_editorial_types where editorial_type_element = '" . $this->cms_module_common_selector_type_editorial_type . "_generic'";
                 $result = mysql_query($query);
                 if (mysql_num_rows($result)) {
                     $fields_type = new cms_editorial_parametres_perso(mysql_result($result, 0, 0));
                     $fields_type->get_values($sub->get_value());
                     $this->value = $fields_type->values[$this->parameters['type_editorial_field']];
                 }
             }
         } else {
             $this->value = array('type' => $this->parameters['type_editorial'], 'field' => $this->parameters['type_editorial_field']);
         }
     }
     return $this->value;
 }
コード例 #5
0
 public function duplicate_type_form($num_type, $elem_id, $duplicate_from_id)
 {
     //duplication des CP
     $type_fields = new cms_editorial_parametres_perso($num_type);
     $type_fields->duplicate_fields_perso($elem_id, $duplicate_from_id, $this->element);
 }
コード例 #6
0
 public function filter($datas)
 {
     $filtered_datas = array();
     //on récupère le champ à tester...
     $selector_from = $this->get_selected_selector("from");
     $field_from = $selector_from->get_value();
     //a quoi...
     $selector_by = $this->get_selected_selector("by");
     $field_by = $selector_by->get_value();
     if ($field_by) {
         $fields = new cms_editorial_parametres_perso($field_from['type']);
         foreach ($datas as $article_id) {
             $fields->get_values($article_id);
             if (in_array($field_by, $fields->values[$field_from['field']])) {
                 $filtered_datas[] = $article_id;
             }
         }
     } else {
         //pas de valeur pour le filtre, on filtre pas...
         $filtered_datas = $datas;
     }
     return $filtered_datas;
 }
コード例 #7
0
ファイル: cms_editorial.class.php プロジェクト: hogsim/PMB
 public function maj_indexation($datatype = 'all')
 {
     global $include_path;
     global $dbh, $champ_base;
     //recuperation du fichier xml de configuration
     if (!count($champ_base)) {
         $file = $include_path . "/indexation/editorial_content/" . $this->type . "_subst.xml";
         if (!file_exists($file)) {
             $file = $include_path . "/indexation/editorial_content/" . $this->type . ".xml";
         }
         $fp = fopen($file, "r");
         if ($fp) {
             $xml = fread($fp, filesize($file));
         }
         fclose($fp);
         $champ_base = _parser_text_no_function_($xml, "INDEXATION");
     }
     $tableau = $champ_base;
     //analyse des donnees des tables
     $temp_not = array();
     $temp_not['t'][0][0] = $tableau['REFERENCE'][0][value];
     $temp_ext = array();
     $temp_marc = array();
     $champ_trouve = false;
     $tab_code_champ = array();
     $tab_languages = array();
     $tab_keep_empty = array();
     $tab_pp = array();
     for ($i = 0; $i < count($tableau['FIELD']); $i++) {
         //pour chacun des champs decrits
         //recuperation de la liste des informations a mettre a jour
         if ($datatype == 'all' || $datatype == $tableau['FIELD'][$i]['DATATYPE']) {
             //conservation des mots vides
             if ($tableau['FIELD'][$i]['KEEPEMPTYWORD'] == "yes") {
                 $tab_keep_empty[] = $tableau['FIELD'][$i]['ID'];
             }
             //champ perso
             if ($tableau['FIELD'][$i]['DATATYPE'] == "custom_field") {
                 $tab_pp[$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i]['TABLE'][0]['value'];
             } else {
                 if ($tableau['FIELD'][$i]['EXTERNAL'] == "yes") {
                     //champ externe à la table notice
                     //Stockage de la structure pour un accès plus facile
                     $temp_ext[$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i];
                 } else {
                     //champ de la table notice
                     $temp_not['f'][0][$tableau['FIELD'][$i]['ID']] = $tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value'];
                     $tab_code_champ[0][$tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value']] = array('champ' => $tableau['FIELD'][$i]['ID'], 'ss_champ' => 0, 'pond' => $tableau['FIELD'][$i]['POND'], 'no_words' => $tableau['FIELD'][$i]['DATATYPE'] == "marclist" ? true : false);
                     if ($tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['MARCTYPE']) {
                         $tab_code_champ[0][$tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['value']]['marctype'] = $tableau['FIELD'][$i]['TABLE'][0]['TABLEFIELD'][0]['MARCTYPE'];
                     }
                 }
             }
             $champ_trouve = true;
         }
     }
     if ($champ_trouve) {
         $tab_req = array();
         //Recherche des champs directs
         if ($datatype == 'all') {
             $tab_req[0]["rqt"] = "select " . implode(',', $temp_not['f'][0]) . " from " . $temp_not['t'][0][0];
             $tab_req[0]["rqt"] .= " where " . $tableau['REFERENCEKEY'][0][value] . "='" . $this->id . "'";
             $tab_req[0]["table"] = $temp_not['t'][0][0];
         }
         foreach ($temp_ext as $k => $v) {
             //Construction de la requete
             //Champs pour le select
             $select = array();
             //on harmonise les fichiers XML décrivant des requetes...
             for ($i = 0; $i < count($v["TABLE"]); $i++) {
                 $table = $v['TABLE'][$i];
                 $select = array();
                 for ($j = 0; $j < count($table['TABLEFIELD']); $j++) {
                     $select[] = ($table['ALIAS'] ? $table['ALIAS'] . "." : "") . $table['TABLEFIELD'][$j]["value"];
                     if ($table['LANGUAGE']) {
                         $select[] = $table['LANGUAGE'][0]['value'];
                         $tab_languages[$k] = $table['LANGUAGE'][0]['value'];
                     }
                     $field_name = $table['TABLEFIELD'][$j]["value"];
                     if (strpos($table['TABLEFIELD'][$j]["value"], ".") !== false) {
                         $field_name = substr($table['TABLEFIELD'][$j]["value"], strpos($table['TABLEFIELD'][$j]["value"], ".") + 1);
                     }
                     $tab_code_champ[$v['ID']][$field_name] = array('champ' => $v['ID'], 'ss_champ' => $table['TABLEFIELD'][$j]["ID"], 'pond' => $table['TABLEFIELD'][$j]['POND'], 'no_words' => $tableau['FIELD'][$i]['DATATYPE'] == "marclist" ? true : false);
                     if ($v['TABLEFIELD'][$j]['marclist']) {
                         $tab_code_champ[$v['ID']][$v['TABLEFIELD'][$j]["value"]]['marctype'] = $v['TABLEFIELD'][$j]['marctype'];
                     }
                 }
                 $query = "select " . implode(",", $select) . " from " . $tableau['REFERENCE'][0]['value'];
                 $jointure = "";
                 for ($j = 0; $j < count($table['LINK']); $j++) {
                     $link = $table['LINK'][$j];
                     if ($link["TABLE"][0]['ALIAS']) {
                         $alias = $link["TABLE"][0]['ALIAS'];
                     } else {
                         $alias = $link["TABLE"][0]['value'];
                     }
                     switch ($link["TYPE"]) {
                         case "n1":
                             if ($link["TABLEKEY"][0]['value']) {
                                 $jointure .= " JOIN " . $link["TABLE"][0]['value'] . ($link["TABLE"][0]['value'] != $alias ? " AS " . $alias : "");
                                 if ($link["EXTERNALTABLE"][0]['value']) {
                                     $jointure .= " ON " . $link["EXTERNALTABLE"][0]['value'] . "." . $link["EXTERNALFIELD"][0]['value'];
                                 } else {
                                     $jointure .= " ON " . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value'];
                                 }
                                 $jointure .= "=" . $alias . "." . $link["TABLEKEY"][0]['value'];
                             } else {
                                 $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : "");
                                 $jointure .= " ON " . $tableau['REFERENCE'][0]['value'] . "." . $tableau['REFERENCEKEY'][0]['value'];
                                 $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value'];
                             }
                             break;
                         case "1n":
                             $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : "");
                             $jointure .= " ON (" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $table["TABLEKEY"][0]['value'];
                             $jointure .= "=" . $tableau['REFERENCE'][0]['value'] . "." . $link["REFERENCEFIELD"][0]['value'] . ") ";
                             break;
                         case "nn":
                             $jointure .= " JOIN " . $link["TABLE"][0]['value'] . ($link["TABLE"][0]['value'] != $alias ? " AS " . $alias : "");
                             $jointure .= " ON (" . $tableau['REFERENCE'][0]['value'] . "." . $tableau['REFERENCEKEY'][0]['value'];
                             $jointure .= "=" . $alias . "." . $link["REFERENCEFIELD"][0]['value'] . ") ";
                             if ($link["TABLEKEY"][0]['value']) {
                                 $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : "");
                                 $jointure .= " ON (" . $alias . "." . $link["TABLEKEY"][0]['value'];
                                 $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $link["EXTERNALFIELD"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value'] . ") ";
                             } else {
                                 $jointure .= " JOIN " . $table['NAME'] . ($table['ALIAS'] ? " as " . $table['ALIAS'] : "");
                                 $jointure .= " ON (" . $alias . "." . $link["EXTERNALFIELD"][0]['value'];
                                 $jointure .= "=" . ($table['ALIAS'] ? $table['ALIAS'] : $table['NAME']) . "." . $table["TABLEKEY"][0]['value'] . " " . $link["LINKRESTRICT"][0]['value'] . ") ";
                             }
                             break;
                     }
                 }
                 if ($table['LANGUAGE']) {
                     $tab_req_lang[$k] = "select " . $table['LANGUAGE'][0]['value'] . " from ";
                 }
                 $query .= $jointure . " where " . $temp_not['t'][0][0] . "." . $tableau['REFERENCEKEY'][0][value] . "=" . $this->id;
                 if ($table['LANGUAGE']) {
                     $tab_req_lang[$k] .= $jointure . " where " . $temp_not['t'][0][0] . "." . $tableau['REFERENCEKEY'][0][value] . "=" . $this->id;
                 }
                 $tab_req[$k]["new_rqt"]['rqt'][] = $query;
             }
             $tab_req[$k]["rqt"] = implode(" union ", $tab_req[$k]["new_rqt"]['rqt']);
         }
         //qu'est-ce qu'on efface?
         if ($datatype == "all") {
             $req_del = "delete from cms_editorial_words_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "'";
             pmb_mysql_query($req_del, $dbh);
             //la table pour les recherche exacte
             $req_del = "delete from cms_editorial_fields_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "'";
             pmb_mysql_query($req_del, $dbh);
         } else {
             foreach ($tab_code_champ as $subfields) {
                 foreach ($subfields as $subfield) {
                     $req_del = "delete from cms_editorial_words_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $subfield['champ'] . "'";
                     pmb_mysql_query($req_del, $dbh);
                     //la table pour les recherche exacte
                     $req_del = "delete from cms_editorial_fields_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $subfield['champ'] . "'";
                     pmb_mysql_query($req_del, $dbh);
                     break;
                 }
             }
             //Les champs perso
             if (count($tab_pp)) {
                 foreach ($tab_pp as $id) {
                     $req_del = "delete from cms_editorial_words_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $id . "' ";
                     pmb_mysql_query($req_del, $dbh);
                     //la table pour les recherche exacte
                     $req_del = "delete from cms_editorial_fields_global_index where num_obj='" . $this->id . "' and type = '" . $this->type . "' and code_champ='" . $id . "' ";
                     pmb_mysql_query($req_del, $dbh);
                 }
             }
         }
         //qu'est-ce qu'on met a jour ?
         $tab_insert = array();
         $tab_field_insert = array();
         foreach ($tab_req as $k => $v) {
             $r = pmb_mysql_query($v["rqt"], $dbh);
             $tab_mots = array();
             $tab_fields = array();
             if (pmb_mysql_num_rows($r)) {
                 while ($tab_row = pmb_mysql_fetch_array($r, MYSQL_ASSOC)) {
                     if (isset($tab_row[$tab_languages[$k]])) {
                         $lang = $tab_row[$tab_languages[$k]];
                         unset($tab_row[$tab_languages[$k]]);
                     } else {
                         $lang = "";
                     }
                     foreach ($tab_row as $nom_champ => $liste_mots) {
                         if ($tab_code_champ[$k][$nom_champ]['marctype']) {
                             $marclist = new marc_list($tab_code_champ[$k][$nom_champ]['marctype']);
                             $liste_mots = $marclist->table[$liste_mots];
                         }
                         if ($liste_mots != '') {
                             $liste_mots = strip_tags($liste_mots);
                             $tab_tmp = array();
                             if (!in_array($k, $tab_keep_empty)) {
                                 $tab_tmp = explode(' ', strip_empty_words($liste_mots));
                             } else {
                                 $tab_tmp = explode(' ', strip_empty_chars(clean_string($liste_mots)));
                             }
                             //	if($lang!="") $tab_tmp[]=$lang;
                             //la table pour les recherche exacte
                             if (!$tab_fields[$nom_champ]) {
                                 $tab_fields[$nom_champ] = array();
                             }
                             $tab_fields[$nom_champ][] = array('value' => trim($liste_mots), 'lang' => $lang);
                             if (!$tab_code_champ[$k][$nom_champ]['no_words']) {
                                 foreach ($tab_tmp as $mot) {
                                     if (trim($mot)) {
                                         $tab_mots[$nom_champ][$mot] = $lang;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             foreach ($tab_mots as $nom_champ => $tab) {
                 $pos = 1;
                 foreach ($tab as $mot => $lang) {
                     //on cherche le mot dans la table de mot...
                     $num_word = 0;
                     $query = "select id_word from words where word = '" . $mot . "' and lang = '" . $lang . "'";
                     $result = pmb_mysql_query($query);
                     if (pmb_mysql_num_rows($result)) {
                         $num_word = pmb_mysql_result($result, 0, 0);
                     } else {
                         $dmeta = new DoubleMetaPhone($mot);
                         $stemming = new stemming($mot);
                         $element_to_update = "";
                         if ($dmeta->primary || $dmeta->secondary) {
                             $element_to_update .= "\n\t\t\t\t\t\t\t\tdouble_metaphone = '" . $dmeta->primary . " " . $dmeta->secondary . "'";
                         }
                         if ($element_to_update) {
                             $element_to_update .= ",";
                         }
                         $element_to_update .= "stem = '" . $stemming->stem . "'";
                         $query = "insert into words set word = '" . $mot . "', lang = '" . $langage . "'" . ($element_to_update ? ", " . $element_to_update : "");
                         pmb_mysql_query($query);
                         $num_word = pmb_mysql_insert_id();
                     }
                     if ($num_word != 0) {
                         $tab_insert[] = "(" . $this->id . ",'" . $this->type . "'," . $tab_code_champ[$k][$nom_champ]['champ'] . "," . $tab_code_champ[$k][$nom_champ]['ss_champ'] . "," . $num_word . "," . $tab_code_champ[$k][$nom_champ]['pond'] . ",{$pos})";
                         $pos++;
                     }
                 }
             }
             //la table pour les recherche exacte
             foreach ($tab_fields as $nom_champ => $tab) {
                 foreach ($tab as $order => $values) {
                     //$tab_field_insert[]="(".$this->id.",".$tab_code_champ[$v["table"]][$nom_champ][0].",".$tab_code_champ[$v["table"]][$nom_champ][1].",".$order.",'".addslashes($values['value'])."','".addslashes($values['lang'])."',".$tab_code_champ[$v["table"]][$nom_champ][2].")";
                     $tab_field_insert[] = "(" . $this->id . ",'" . $this->type . "'," . $tab_code_champ[$k][$nom_champ]['champ'] . "," . $tab_code_champ[$k][$nom_champ]['ss_champ'] . "," . $order . ",'" . addslashes($values['value']) . "','" . addslashes($values['lang']) . "'," . $tab_code_champ[$k][$nom_champ]['pond'] . ")";
                 }
             }
         }
         //Les champs perso
         if (count($tab_pp)) {
             foreach ($tab_pp as $code_champ => $table) {
                 $p_perso = new cms_editorial_parametres_perso($this->num_type);
                 $data = $p_perso->get_fields_recherche_mot($this->id);
                 $j = 0;
                 foreach ($data as $code_ss_champ => $value) {
                     $tab_mots = array();
                     $tab_tmp = explode(' ', strip_empty_words($value));
                     //la table pour les recherche exacte
                     $tab_field_insert[] = "(" . $this->id . ",'" . $this->type . "'," . $code_champ . "," . $code_ss_champ . "," . $j . ",'" . addslashes(trim($value)) . "',''," . $p_perso->get_pond($code_ss_champ) . ")";
                     $j++;
                     foreach ($tab_tmp as $mot) {
                         if (trim($mot)) {
                             $tab_mots[$mot] = "";
                         }
                     }
                     $pos = 1;
                     foreach ($tab_mots as $mot => $lang) {
                         //on cherche le mot dans la table de mot...
                         $query = "select id_word from words where word = '" . $mot . "' and lang = '" . $lang . "'";
                         $result = pmb_mysql_query($query);
                         if (pmb_mysql_num_rows($result)) {
                             $num_word = pmb_mysql_result($result, 0, 0);
                         } else {
                             $query = "insert into words set word = '" . $mot . "', lang = '" . $lang . "'";
                             pmb_mysql_query($query);
                             $num_word = pmb_mysql_insert_id();
                         }
                         $tab_insert[] = "(" . $this->id . ",'" . $this->type . "'," . $code_champ . "," . $code_ss_champ . "," . $num_word . "," . $p_perso->get_pond($code_ss_champ) . ",{$pos})";
                         $pos++;
                     }
                 }
             }
         }
         $req_insert = "insert into cms_editorial_words_global_index(num_obj,type,code_champ,code_ss_champ,num_word,pond,position) values " . implode(',', $tab_insert);
         pmb_mysql_query($req_insert, $dbh);
         //la table pour les recherche exacte
         $req_insert = "insert into cms_editorial_fields_global_index(num_obj,type,code_champ,code_ss_champ,ordre,value,lang,pond) values " . implode(',', $tab_field_insert);
         pmb_mysql_query($req_insert, $dbh);
     }
 }
コード例 #8
0
 function rec_fields_perso($id, $type = "")
 {
     $this->check_submited_fields();
     $query = "select editorial_type_element from cms_editorial_types where id_editorial_type=" . $this->num_type;
     $result = mysql_query($query);
     if ($result && mysql_num_rows($result)) {
         $requete = "delete " . $this->prefix . "_custom_values from " . $this->prefix . "_custom_values\n \t\t\t\t\tjoin cms_editorial_custom on cms_editorial_custom_champ = idchamp\n \t\t\t\t\tjoin cms_editorial_types on num_type=id_editorial_type\n \t\t\t\t\tand editorial_type_element = '" . mysql_result($result, 0, 0) . "' \n \t\t\t\t\twhere " . $this->prefix . "_custom_origine={$id}";
         mysql_query($requete);
     }
     if ($type) {
         //Enregistrement des champs personalisés
         //on va chercher les champs génériques
         $generic_type = $this->get_generic_type($type);
         if ($generic_type) {
             $generic = new cms_editorial_parametres_perso($generic_type, $this->base_url);
             $generic->rec_fields_perso($id);
         }
     }
     reset($this->t_fields);
     while (list($key, $val) = each($this->t_fields)) {
         $name = $val["NAME"];
         global ${$name};
         $value = ${$name};
         for ($i = 0; $i < count($value); $i++) {
             if ($value[$i] !== "") {
                 $requete = "insert into " . $this->prefix . "_custom_values (" . $this->prefix . "_custom_champ," . $this->prefix . "_custom_origine," . $this->prefix . "_custom_" . $val["DATATYPE"] . ") values({$key},{$id},'" . $value[$i] . "')";
                 mysql_query($requete);
             }
         }
     }
 }
コード例 #9
0
 function show_editable_fields($id, $type = "")
 {
     global $aff_list_empr, $charset;
     $perso = array();
     //on va chercher les champs génériques
     $generic_type = $this->get_generic_type($type);
     if ($generic_type) {
         $generic = new cms_editorial_parametres_perso($generic_type, $this->base_url);
         $p = $generic->show_editable_fields($id);
         $perso['FIELDS'] = $p['FIELDS'];
         $perso['CHECK_SCRIPTS'] = $p['CHECK_SCRIPTS'];
     }
     if (!$this->no_special_fields) {
         $this->get_values($id);
         $check_scripts = "";
         reset($this->t_fields);
         while (list($key, $val) = each($this->t_fields)) {
             $t = array();
             $t["NAME"] = $val["NAME"];
             $t["TITRE"] = $val["TITRE"];
             $field = array();
             $field["ID"] = $key;
             $field["NAME"] = $this->t_fields[$key]["NAME"];
             $field["MANDATORY"] = $this->t_fields[$key]["MANDATORY"];
             $field["SEARCH"] = $this->t_fields[$key]["SEARCH"];
             $field["EXPORT"] = $this->t_fields[$key]["EXPORT"];
             $field["EXCLUSION"] = $this->t_fields[$key]["EXCLUSION"];
             $field["OPAC_SORT"] = $this->t_fields[$key]["OPAC_SORT"];
             $field["ALIAS"] = $this->t_fields[$key]["TITRE"];
             $field["DATATYPE"] = $this->t_fields[$key]["DATATYPE"];
             $field["OPTIONS"][0] = _parser_text_no_function_("<?xml version='1.0' encoding='" . $charset . "'?>\n" . $this->t_fields[$key]["OPTIONS"], "OPTIONS");
             $field["VALUES"] = $this->values[$key];
             $field["PREFIX"] = $this->prefix;
             eval("\$aff=" . $aff_list_empr[$this->t_fields[$key][TYPE]] . "(\$field,\$check_scripts);");
             $t["AFF"] = $aff;
             $t["NAME"] = $field["NAME"];
             $perso["FIELDS"][] = $t;
         }
         //Compilation des javascripts de validité renvoyés par les fonctions d'affichage
         $check_scripts = "<script>function cancel_submit(message) { alert(message); return false;}\nfunction check_form() {\n" . $check_scripts . "\nreturn true;\n}\n</script>";
         $perso["CHECK_SCRIPTS"] = $check_scripts;
     } else {
         $perso["CHECK_SCRIPTS"] = "<script>function check_form() { return true; }</script>";
     }
     return $perso;
 }
コード例 #10
0
 public function execute_ajax()
 {
     global $calendar, $id_type;
     $response = array();
     $fields = new cms_editorial_parametres_perso($id_type);
     $select = "\n\t\t<div class='row'>\n\t\t\t<div class='colonne3'>\n\t\t\t\t<label for='cms_module_agenda_calendar_start_date'>" . $this->format_text($this->msg['cms_module_agenda_calendar_start_date']) . "</label>\n\t\t\t</div>\n\t\t\t<div class='colonne-suite'> \n\t\t\t\t<select name='cms_module_agenda_calendar_start_date' >";
     $select .= $fields->get_selector_options($this->managed_datas['module']['calendars'][$calendar]['start_date']);
     $select .= "\n\t\t\t\t</select>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class='row'>\n\t\t\t<div class='colonne3'>\n\t\t\t\t<label for='cms_module_agenda_calendar_end_date'>" . $this->format_text($this->msg['cms_module_agenda_calendar_end_date']) . "</label>\n\t\t\t</div>\n\t\t\t<div class='colonne-suite'> \n\t\t\t\t<select name='cms_module_agenda_calendar_end_date' >";
     $select .= $fields->get_selector_options($this->managed_datas['module']['calendars'][$calendar]['end_date']);
     $select .= "\n\t\t\t\t</select>\n\t\t\t</div>\n\t\t</div>";
     $response['content'] = $select;
     $response['content-type'] = 'text/html';
     return $response;
 }
コード例 #11
0
ファイル: types.inc.php プロジェクト: noble82/proyectos-ULS
$autoloader = new autoloader();
$autoloader->add_register("cms_modules", true);
switch ($quoi) {
    case "fields":
        switch ($elem) {
            case "article_generic":
            case "section_generic":
                $query = "select id_editorial_type from cms_editorial_types where editorial_type_element = '" . $elem . "'";
                $result = pmb_mysql_query($query);
                if (pmb_mysql_num_rows($result)) {
                    $row = pmb_mysql_fetch_object($result);
                    $type_id = $row->id_editorial_type;
                }
                break;
        }
        $fields = new cms_editorial_parametres_perso($type_id, "./admin.php?categ=cms_editorial&sub=type&elem=" . $elem . "&quoi=fields&type_id=" . $type_id);
        $fields->proceed();
        break;
    default:
        $types = new cms_editorial_types($elem);
        switch ($action) {
            case "edit":
                print $types->get_form($id);
                break;
            case "save":
                $types->save();
                print $types->get_table();
                break;
            case "delete":
                $types->delete($id);
                print $types->get_table();