Esempio n. 1
0
 function analysis_form($notice_type = false)
 {
     global $style;
     global $msg;
     global $pdeptab;
     global $analysis_top_form;
     global $fonction_auteur;
     global $charset;
     global $include_path, $class_path;
     global $pmb_type_audit, $select_categ_prop;
     global $value_deflt_fonction;
     global $value_deflt_lang, $value_deflt_relation_analysis;
     global $thesaurus_mode_pmb, $thesaurus_classement_mode_pmb;
     global $thesaurus_concepts_active;
     global $pmb_notices_show_dates;
     require_once "{$class_path}/author.class.php";
     require_once $class_path . "/index_concept.class.php";
     $fonction = new marc_list('function');
     // inclusion de la feuille de style des expandables
     print $style;
     // mise à jour des flags de niveau hiérarchique
     $select_doc = new marc_select('doctype', 'typdoc', $this->analysis_typdoc, "get_pos(); initIt(); ajax_parse_dom();");
     $analysis_top_form = str_replace('!!doc_type!!', $select_doc->display, $analysis_top_form);
     //$analysis_top_form = str_replace('!!doc_type!!', $this->analysis_typdoc, $analysis_top_form);
     $analysis_top_form = str_replace('!!b_level!!', $this->analysis_biblio_level, $analysis_top_form);
     $analysis_top_form = str_replace('!!h_level!!', $this->analysis_hierar_level, $analysis_top_form);
     $analysis_top_form = str_replace('!!id!!', $this->serial_id, $analysis_top_form);
     // mise à jour de l'onglet 0
     $pdeptab[0] = str_replace('!!tit1!!', htmlentities($this->analysis_tit1, ENT_QUOTES, $charset), $pdeptab[0]);
     $pdeptab[0] = str_replace('!!tit2!!', htmlentities($this->analysis_tit2, ENT_QUOTES, $charset), $pdeptab[0]);
     $pdeptab[0] = str_replace('!!tit3!!', htmlentities($this->analysis_tit3, ENT_QUOTES, $charset), $pdeptab[0]);
     $pdeptab[0] = str_replace('!!tit4!!', htmlentities($this->analysis_tit4, ENT_QUOTES, $charset), $pdeptab[0]);
     $analysis_top_form = str_replace('!!tab0!!', $pdeptab[0], $analysis_top_form);
     // initialisation avec les paramètres du user :
     if (!$this->analysis_langues) {
         global $value_deflt_lang;
         if ($value_deflt_lang) {
             $lang = new marc_list('lang');
             $this->analysis_langues[] = array('lang_code' => $value_deflt_lang, 'langue' => $lang->table[$value_deflt_lang]);
         }
     }
     // mise à jour de l'onglet 1
     // constitution de la mention de responsabilité
     //$this->responsabilites
     $as = array_search("0", $this->responsabilites_dep["responsabilites"]);
     if ($as !== FALSE && $as !== NULL) {
         $auteur_0 = $this->responsabilites_dep["auteurs"][$as];
         $auteur = new auteur($auteur_0["id"]);
     }
     if ($value_deflt_fonction && $auteur_0["id"] == 0) {
         $auteur_0["fonction"] = $value_deflt_fonction;
     }
     $pdeptab[1] = str_replace('!!aut0_id!!', $auteur_0["id"], $pdeptab[1]);
     $pdeptab[1] = str_replace('!!aut0!!', htmlentities($auteur->display, ENT_QUOTES, $charset), $pdeptab[1]);
     $pdeptab[1] = str_replace('!!f0_code!!', $auteur_0["fonction"], $pdeptab[1]);
     $pdeptab[1] = str_replace('!!f0!!', $fonction->table[$auteur_0["fonction"]], $pdeptab[1]);
     $as = array_keys($this->responsabilites_dep["responsabilites"], "1");
     $max_aut1 = count($as);
     if ($max_aut1 == 0) {
         $max_aut1 = 1;
     }
     for ($i = 0; $i < $max_aut1; $i++) {
         $indice = $as[$i];
         $auteur_1 = $this->responsabilites_dep["auteurs"][$indice];
         $auteur = new auteur($auteur_1["id"]);
         if ($value_deflt_fonction && $auteur_1["id"] == 0 && $i == 0) {
             $auteur_1["fonction"] = $value_deflt_fonction;
         }
         $ptab_aut_autres = str_replace('!!iaut!!', $i, $pdeptab[11]);
         $ptab_aut_autres = str_replace('!!aut1_id!!', $auteur_1["id"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!aut1!!', htmlentities($auteur->display, ENT_QUOTES, $charset), $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f1_code!!', $auteur_1["fonction"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f1!!', $fonction->table[$auteur_1["fonction"]], $ptab_aut_autres);
         $autres_auteurs .= $ptab_aut_autres;
     }
     $pdeptab[1] = str_replace('!!max_aut1!!', $max_aut1, $pdeptab[1]);
     $as = array_keys($this->responsabilites_dep["responsabilites"], "2");
     $max_aut2 = count($as);
     if ($max_aut2 == 0) {
         $max_aut2 = 1;
     }
     for ($i = 0; $i < $max_aut2; $i++) {
         $indice = $as[$i];
         $auteur_2 = $this->responsabilites_dep["auteurs"][$indice];
         $auteur = new auteur($auteur_2["id"]);
         if ($value_deflt_fonction && $auteur_2["id"] == 0 && $i == 0) {
             $auteur_2["fonction"] = $value_deflt_fonction;
         }
         $ptab_aut_autres = str_replace('!!iaut!!', $i, $pdeptab[12]);
         $ptab_aut_autres = str_replace('!!aut2_id!!', $auteur_2["id"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!aut2!!', htmlentities($auteur->display, ENT_QUOTES, $charset), $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f2_code!!', $auteur_2["fonction"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f2!!', $fonction->table[$auteur_2["fonction"]], $ptab_aut_autres);
         $auteurs_secondaires .= $ptab_aut_autres;
     }
     $pdeptab[1] = str_replace('!!max_aut2!!', $max_aut2, $pdeptab[1]);
     $pdeptab[1] = str_replace('!!autres_auteurs!!', $autres_auteurs, $pdeptab[1]);
     $pdeptab[1] = str_replace('!!auteurs_secondaires!!', $auteurs_secondaires, $pdeptab[1]);
     $analysis_top_form = str_replace('!!tab1!!', $pdeptab[1], $analysis_top_form);
     // mise à jour de l'onglet 2
     $pdeptab[2] = str_replace('!!pages!!', htmlentities($this->analysis_pages, ENT_QUOTES, $charset), $pdeptab[2]);
     $analysis_top_form = str_replace('!!tab2!!', $pdeptab[2], $analysis_top_form);
     // mise à jour de l'onglet 3 (notes)
     $pdeptab[3] = str_replace('!!n_gen!!', htmlentities($this->analysis_n_gen, ENT_QUOTES, $charset), $pdeptab[3]);
     $pdeptab[3] = str_replace('!!n_contenu!!', htmlentities($this->analysis_n_contenu, ENT_QUOTES, $charset), $pdeptab[3]);
     $pdeptab[3] = str_replace('!!n_resume!!', htmlentities($this->analysis_n_resume, ENT_QUOTES, $charset), $pdeptab[3]);
     $analysis_top_form = str_replace('!!tab3!!', $pdeptab[3], $analysis_top_form);
     // mise à jour de l'onglet 4
     // catégories
     if (sizeof($this->analysis_categories) == 0) {
         $max_categ = 1;
     } else {
         $max_categ = sizeof($this->analysis_categories);
     }
     $tab_categ_order = "";
     for ($i = 0; $i < $max_categ; $i++) {
         $categ_id = $this->analysis_categories[$i]["categ_id"];
         $categ = new category($categ_id);
         if ($i == 0) {
             $ptab_categ = str_replace('!!icateg!!', $i, $pdeptab[40]);
         } else {
             $ptab_categ = str_replace('!!icateg!!', $i, $pdeptab[401]);
         }
         if ($thesaurus_mode_pmb && $categ_id) {
             $nom_thesaurus = '[' . thesaurus::getLibelle($categ->thes->id_thesaurus) . '] ';
         } else {
             $nom_thesaurus = '';
         }
         $ptab_categ = str_replace('!!categ_id!!', $categ_id, $ptab_categ);
         $ptab_categ = str_replace('!!categ_libelle!!', htmlentities($nom_thesaurus . $categ->catalog_form, ENT_QUOTES, $charset), $ptab_categ);
         $categ_repetables .= $ptab_categ;
         if (sizeof($this->analysis_categories) > 0) {
             if ($tab_categ_order != "") {
                 $tab_categ_order .= ",";
             }
             $tab_categ_order .= $i;
         }
     }
     $pdeptab[4] = str_replace('!!max_categ!!', $max_categ, $pdeptab[4]);
     $pdeptab[4] = str_replace('!!categories_repetables!!', $categ_repetables, $pdeptab[4]);
     $pdeptab[4] = str_replace('!!tab_categ_order!!', $tab_categ_order, $pdeptab[4]);
     // Concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->analysis_id, TYPE_NOTICE);
         $pdeptab[4] = str_replace('!!concept_form!!', $index_concept->get_form('notice'), $pdeptab[4]);
     } else {
         $pdeptab[4] = str_replace('!!concept_form!!', "", $pdeptab[4]);
     }
     // indexation interne
     $pdeptab[4] = str_replace('!!indexint_id!!', $this->analysis_indexint, $pdeptab[4]);
     $pdeptab[4] = str_replace('!!indexint!!', htmlentities($this->analysis_indexint_lib, ENT_QUOTES, $charset), $pdeptab[4]);
     if ($this->indexint) {
         $indexint = new indexint($this->indexint);
         if ($indexint->comment) {
             $disp_indexint = $indexint->name . " - " . $indexint->comment;
         } else {
             $disp_indexint = $indexint->name;
         }
         if ($thesaurus_classement_mode_pmb) {
             // plusieurs classements/indexations décimales autorisés en parametrage
             if ($indexint->name_pclass) {
                 $disp_indexint = "[" . $indexint->name_pclass . "] " . $disp_indexint;
             }
         }
         $pdeptab[4] = str_replace('!!indexint!!', htmlentities($disp_indexint, ENT_QUOTES, $charset), $pdeptab[4]);
         $pdeptab[4] = str_replace('!!num_pclass!!', $indexint->id_pclass, $pdeptab[4]);
     } else {
         $pdeptab[4] = str_replace('!!indexint!!', '', $pdeptab[4]);
         $pdeptab[4] = str_replace('!!num_pclass!!', '', $pdeptab[4]);
     }
     // indexation libre
     $pdeptab[4] = str_replace('!!f_indexation!!', htmlentities($this->analysis_index_l, ENT_QUOTES, $charset), $pdeptab[4]);
     global $pmb_keyword_sep;
     $sep = "'{$pmb_keyword_sep}'";
     if (!$pmb_keyword_sep) {
         $sep = "' '";
     }
     if (ord($pmb_keyword_sep) == 0xa || ord($pmb_keyword_sep) == 0xd) {
         $sep = $msg['catalogue_saut_de_ligne'];
     }
     $pdeptab[4] = str_replace("!!sep!!", htmlentities($sep, ENT_QUOTES, $charset), $pdeptab[4]);
     $analysis_top_form = str_replace('!!tab4!!', $pdeptab[4], $analysis_top_form);
     // mise à jour de l'onglet 5 : Langues
     // langues répétables
     if (sizeof($this->analysis_langues) == 0) {
         $max_lang = 1;
     } else {
         $max_lang = sizeof($this->analysis_langues);
     }
     for ($i = 0; $i < $max_lang; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilang!!', $i, $pdeptab[501]);
         } else {
             $ptab_lang = str_replace('!!ilang!!', $i, $pdeptab[50]);
         }
         if (sizeof($this->analysis_langues) == 0) {
             $ptab_lang = str_replace('!!lang_code!!', '', $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', '', $ptab_lang);
         } else {
             $ptab_lang = str_replace('!!lang_code!!', $this->analysis_langues[$i]["lang_code"], $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', htmlentities($this->analysis_langues[$i]["langue"], ENT_QUOTES, $charset), $ptab_lang);
         }
         $lang_repetables .= $ptab_lang;
     }
     $pdeptab[5] = str_replace('!!max_lang!!', $max_lang, $pdeptab[5]);
     $pdeptab[5] = str_replace('!!langues_repetables!!', $lang_repetables, $pdeptab[5]);
     // langues originales répétables
     if (sizeof($this->analysis_languesorg) == 0) {
         $max_langorg = 1;
     } else {
         $max_langorg = sizeof($this->analysis_languesorg);
     }
     for ($i = 0; $i < $max_langorg; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $pdeptab[511]);
         } else {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $pdeptab[51]);
         }
         if (sizeof($this->analysis_languesorg) == 0) {
             $ptab_lang = str_replace('!!langorg_code!!', '', $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', '', $ptab_lang);
         } else {
             $ptab_lang = str_replace('!!langorg_code!!', $this->analysis_languesorg[$i]["lang_code"], $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', htmlentities($this->analysis_languesorg[$i]["langue"], ENT_QUOTES, $charset), $ptab_lang);
         }
         $langorg_repetables .= $ptab_lang;
     }
     $pdeptab[5] = str_replace('!!max_langorg!!', $max_langorg, $pdeptab[5]);
     $pdeptab[5] = str_replace('!!languesorg_repetables!!', $langorg_repetables, $pdeptab[5]);
     $analysis_top_form = str_replace('!!tab5!!', $pdeptab[5], $analysis_top_form);
     // mise à jour de l'onglet 6
     global $pmb_curl_timeout;
     $pdeptab[6] = str_replace('!!lien!!', htmlentities($this->analysis_lien, ENT_QUOTES, $charset), $pdeptab[6]);
     $pdeptab[6] = str_replace('!!eformat!!', htmlentities($this->analysis_eformat, ENT_QUOTES, $charset), $pdeptab[6]);
     $pdeptab[6] = str_replace('!!pmb_curl_timeout!!', $pmb_curl_timeout, $pdeptab[6]);
     $analysis_top_form = str_replace('!!tab6!!', $pdeptab[6], $analysis_top_form);
     //Mise à jour de l'onglet 7
     $p_perso = new parametres_perso("notices");
     if (!$p_perso->no_special_fields) {
         // si on duplique, construire le formulaire avec les donnees de la notice d'origine
         if ($this->duplicate_from_id) {
             $perso_ = $p_perso->show_editable_fields($this->duplicate_from_id);
         } else {
             $perso_ = $p_perso->show_editable_fields($this->analysis_id);
         }
         $perso = "";
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             $perso .= "<div id='move_" . $p["NAME"] . "' movable='yes' title=\"" . htmlentities($p["TITRE"], ENT_QUOTES, $charset) . "\">\n\t\t\t\t\t\t<div class='row'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . "</label></div>\n\t\t\t\t\t\t<div class='row'>" . $p["AFF"] . "</div>\n\t\t\t\t\t\t</div>";
         }
         $perso .= $perso_["CHECK_SCRIPTS"];
         $pdeptab[7] = str_replace("!!champs_perso!!", $perso, $pdeptab[7]);
     } else {
         $pdeptab[7] = "\n<script>function check_form() { return true; }</script>\n";
     }
     $analysis_top_form = str_replace('!!tab7!!', $pdeptab[7], $analysis_top_form);
     //Liens vers d'autres notices
     $string_relations = "";
     $n_rel = 0;
     foreach ($this->notice_link as $direction => $relations) {
         foreach ($relations as $relation) {
             //Selection du template
             if ($n_rel == 0) {
                 $pattern_rel = $pdeptab[130];
             } else {
                 $pattern_rel = $pdeptab[131];
             }
             //Construction du textbox
             $pattern_rel = str_replace("!!notice_relations_id!!", $relation['id_notice'], $pattern_rel);
             $pattern_rel = str_replace("!!notice_relations_libelle!!", htmlentities($relation['title_notice'], ENT_QUOTES, $charset), $pattern_rel);
             $pattern_rel = str_replace("!!notice_relations_rank!!", $relation['rank'], $pattern_rel);
             $pattern_rel = str_replace("!!n_rel!!", $n_rel, $pattern_rel);
             //Construction du combobox de type de lien
             $pattern_rel = str_replace("!!f_notice_type_relations_name!!", "f_rel_type_{$n_rel}", $pattern_rel);
             //Recuperation des types de relation
             $liste_type_relation_up = new marc_list("relationtypeup");
             $liste_type_relation_down = new marc_list("relationtypedown");
             $liste_type_relation_both = array();
             $corresp_relation_up_down = array();
             foreach ($liste_type_relation_up->table as $key_up => $val_up) {
                 foreach ($liste_type_relation_down->table as $key_down => $val_down) {
                     if ($val_up == $val_down) {
                         $liste_type_relation_both['down'][$key_down] = $val_down;
                         $liste_type_relation_both['up'][$key_up] = $val_up;
                         $corresp_relation_up_down[$key_up] = $key_down;
                         unset($liste_type_relation_down->table[$key_down]);
                         unset($liste_type_relation_up->table[$key_up]);
                     }
                 }
             }
             $opts = '';
             foreach ($liste_type_relation_up->table as $key => $val) {
                 if (preg_match('/^' . $key . '/', $relation['relation_type']) && $direction == 'up') {
                     $opts .= '<option  style="color:#000000" value="' . $key . '-up" selected="selected" >' . $val . '</option>';
                 } else {
                     $opts .= '<option  style="color:#000000" value="' . $key . '-up">' . $val . '</option>';
                 }
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_up!!", $opts, $pattern_rel);
             $opts = '';
             foreach ($liste_type_relation_down->table as $key => $val) {
                 if (preg_match('/^' . $key . '/', $relation['relation_type']) && $direction == 'down') {
                     $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
                 } else {
                     $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
                 }
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_down!!", $opts, $pattern_rel);
             $opts = '';
             if (array_key_exists($relation['relation_type'], $liste_type_relation_both['up']) || array_key_exists($relation['relation_type'], $liste_type_relation_both['down'])) {
                 $opts .= '<option  style="color:#000000" value="' . $relation['relation_type'] . '-' . $direction . '" selected="selected" >' . $liste_type_relation_both[$direction][$relation['relation_type']] . '</option>';
                 if ($direction == "up") {
                     $notDirection = "down";
                 } else {
                     $notDirection = "up";
                     $corresp_relation_up_down = array_flip($corresp_relation_up_down);
                 }
                 $notRelationType = $corresp_relation_up_down[$relation['relation_type']];
                 unset($liste_type_relation_both[$direction][$relation['relation_type']]);
                 unset($liste_type_relation_both[$notDirection][$notRelationType]);
             }
             foreach ($liste_type_relation_both['down'] as $key => $val) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_both!!", $opts, $pattern_rel);
             $string_relations .= $pattern_rel;
             $n_rel++;
         }
     }
     if (!$n_rel) {
         $pattern_rel = $pdeptab[130];
         $pattern_rel = str_replace("!!notice_relations_id!!", "", $pattern_rel);
         $pattern_rel = str_replace("!!notice_relations_libelle!!", "", $pattern_rel);
         $pattern_rel = str_replace("!!notice_relations_rank!!", "0", $pattern_rel);
         $pattern_rel = str_replace("!!n_rel!!", $n_rel, $pattern_rel);
         $pattern_rel = str_replace("!!f_notice_type_relations_name!!", "f_rel_type_0", $pattern_rel);
         //Recuperation des types de relation
         $liste_type_relation_up = new marc_list("relationtypeup");
         $liste_type_relation_down = new marc_list("relationtypedown");
         $liste_type_relation_both = array();
         foreach ($liste_type_relation_up->table as $key_up => $val_up) {
             foreach ($liste_type_relation_down->table as $key_down => $val_down) {
                 if ($val_up == $val_down) {
                     $liste_type_relation_both[$key_down] = $val_down;
                     unset($liste_type_relation_down->table[$key_down]);
                     unset($liste_type_relation_up->table[$key_up]);
                 }
             }
         }
         $opts = '';
         foreach ($liste_type_relation_up->table as $key => $val) {
             if ($key . '-up' == $value_deflt_relation_analysis) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-up" selected="selected" >' . $val . '</option>';
             } else {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-up">' . $val . '</option>';
             }
         }
         $pattern_rel = str_replace("!!f_notice_type_relations_up!!", $opts, $pattern_rel);
         $opts = '';
         foreach ($liste_type_relation_down->table as $key => $val) {
             if ($key . '-down' == $value_deflt_relation_analysis) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
             } else {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
             }
         }
         $pattern_rel = str_replace("!!f_notice_type_relations_down!!", $opts, $pattern_rel);
         $opts = '';
         foreach ($liste_type_relation_both as $key => $val) {
             if ($key . '-down' == $value_deflt_relation_analysis) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
             } else {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
             }
         }
         $pattern_rel = str_replace("!!f_notice_type_relations_both!!", $opts, $pattern_rel);
         $string_relations .= $pattern_rel;
         $n_rel++;
     }
     //Type de relation par défaut
     $pdeptab[13] = str_replace("!!value_deflt_relation!!", $value_deflt_relation_analysis, $pdeptab[13]);
     //Nombre de relations
     $pdeptab[13] = str_replace("!!max_rel!!", $n_rel, $pdeptab[13]);
     //Liens multiples
     $pdeptab[13] = str_replace("!!notice_relations!!", $string_relations, $pdeptab[13]);
     $analysis_top_form = str_replace('!!tab13!!', $pdeptab[13], $analysis_top_form);
     // champs de gestion
     $select_statut = gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "form_notice_statut", "", $this->analysis_statut, "", "", "", "", 0);
     $pdeptab[8] = str_replace('!!notice_statut!!', $select_statut, $pdeptab[8]);
     $pdeptab[8] = str_replace('!!commentaire_gestion!!', htmlentities($this->analysis_commentaire_gestion, ENT_QUOTES, $charset), $pdeptab[8]);
     $pdeptab[8] = str_replace('!!thumbnail_url!!', htmlentities($this->analysis_thumbnail_url, ENT_QUOTES, $charset), $pdeptab[8]);
     if ($this->analysis_is_new) {
         $pdeptab[8] = str_replace('!!checked_yes!!', "checked", $pdeptab[8]);
         $pdeptab[8] = str_replace('!!checked_no!!', "", $pdeptab[8]);
     } else {
         $pdeptab[8] = str_replace('!!checked_no!!', "checked", $pdeptab[8]);
         $pdeptab[8] = str_replace('!!checked_yes!!', "", $pdeptab[8]);
     }
     global $pmb_notice_img_folder_id;
     $message_folder = "";
     if ($pmb_notice_img_folder_id) {
         $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
         $res = pmb_mysql_query($req);
         if (pmb_mysql_num_rows($res)) {
             $rep = pmb_mysql_fetch_object($res);
             if (!is_dir($rep->repertoire_path)) {
                 $notice_img_folder_error = 1;
             }
         } else {
             $notice_img_folder_error = 1;
         }
         if ($notice_img_folder_error) {
             if (SESSrights & ADMINISTRATION_AUTH) {
                 $requete = "select * from parametres where gestion=0 and type_param='pmb' and sstype_param='notice_img_folder_id' ";
                 $res = pmb_mysql_query($requete);
                 $i = 0;
                 if ($param = pmb_mysql_fetch_object($res)) {
                     $message_folder = " <a class='erreur' href='./admin.php?categ=param&action=modif&id_param=" . $param->id_param . "' >" . $msg['notice_img_folder_admin_no_access'] . "</a> ";
                 }
             } else {
                 $message_folder = $msg['notice_img_folder_no_access'];
             }
         }
     }
     $pdeptab[8] = str_replace('!!message_folder!!', $message_folder, $pdeptab[8]);
     if ($this->analysis_id && $pmb_notices_show_dates) {
         $create_date = new DateTime($this->create_date);
         $update_date = new DateTime($this->update_date);
         $dates_notices = "<br>\n\t\t\t\t\t\t<label for='notice_date_crea' class='etiquette'>" . $msg["noti_crea_date"] . "</label>&nbsp;" . $create_date->format('d/m/Y H:i:s') . "\n\t\t\t    \t\t<br>\n\t\t\t    \t\t<label for='notice_date_mod' class='etiquette'>" . $msg["noti_mod_date"] . "</label>&nbsp;" . $update_date->format('d/m/Y H:i:s');
         $pdeptab[8] = str_replace('!!dates_notice!!', $dates_notices, $pdeptab[8]);
     } else {
         $pdeptab[8] = str_replace('!!dates_notice!!', "", $pdeptab[8]);
     }
     //affichage des formulaires des droits d'acces
     $rights_form = $this->get_rights_form();
     $pdeptab[8] = str_replace('<!-- rights_form -->', $rights_form, $pdeptab[8]);
     global $lang, $xmlta_indexation_lang;
     $user_lang = $this->analysis_indexation_lang;
     if (!$user_lang) {
         $user_lang = $xmlta_indexation_lang;
     }
     $langues = new XMLlist("{$include_path}/messages/languages.xml");
     $langues->analyser();
     $clang = $langues->table;
     $combo = "<select name='indexation_lang' id='indexation_lang' class='saisie-20em' >";
     if (!$user_lang) {
         $combo .= "<option value='' selected>--</option>";
     } else {
         $combo .= "<option value='' >--</option>";
     }
     while (list($cle, $value) = each($clang)) {
         // arabe seulement si on est en utf-8
         if ($charset != 'utf-8' and $user_lang != 'ar' or $charset == 'utf-8') {
             if (strcmp($cle, $user_lang) != 0) {
                 $combo .= "<option value='{$cle}'>{$value} ({$cle})</option>";
             } else {
                 $combo .= "<option value='{$cle}' selected>{$value} ({$cle})</option>";
             }
         }
     }
     $combo .= "</select>";
     $pdeptab[8] = str_replace('!!indexation_lang!!', $combo, $pdeptab[8]);
     $analysis_top_form = str_replace('!!tab8!!', $pdeptab[8], $analysis_top_form);
     // autorité personnalisées
     $authperso = new authperso_notice($this->analysis_id);
     $authperso_tpl = $authperso->get_form();
     $analysis_top_form = str_replace('!!authperso!!', $authperso_tpl, $analysis_top_form);
     // map
     global $pmb_map_activate;
     if ($pmb_map_activate) {
         $map_edition = new map_edition_controler(TYPE_RECORD, $this->analysis_id);
         $map_form = $map_edition->get_form();
         $map_info = new map_info($this->analysis_id);
         $map_form_info = $map_info->get_form();
         $map_notice_form = $pdeptab[14];
         $map_notice_form = str_replace('!!notice_map!!', $map_form . $map_form_info, $map_notice_form);
         $analysis_top_form = str_replace('!!tab14!!', $map_notice_form, $analysis_top_form);
     } else {
         $analysis_top_form = str_replace('!!tab14!!', "", $analysis_top_form);
     }
     // définition de la page cible du form
     $analysis_top_form = str_replace('!!action!!', $this->action, $analysis_top_form);
     // mise à jour du type de document
     $analysis_top_form = str_replace('!!doc_type!!', $this->analysis_typdoc, $analysis_top_form);
     // Ajout des localisations pour édition
     $select_loc = "";
     global $PMBuserid, $pmb_form_editables;
     if ($PMBuserid == 1 && $pmb_form_editables == 1) {
         $req_loc = "select idlocation,location_libelle from docs_location";
         $res_loc = pmb_mysql_query($req_loc);
         if (pmb_mysql_num_rows($res_loc) > 1) {
             $select_loc = "<select name='grille_location' id='grille_location' style='display:none' onChange=\"get_pos();initIt(); if (inedit) move_parse_dom(relative);\">\n";
             $select_loc .= "<option value='0'>" . $msg['notice_grille_all_location'] . "</option>\n";
             while ($r = pmb_mysql_fetch_object($res_loc)) {
                 $select_loc .= "<option value='" . $r->idlocation . "'>" . $r->location_libelle . "</option>\n";
             }
             $select_loc .= "</select>\n";
         }
     }
     $analysis_top_form = str_replace("!!location!!", $select_loc, $analysis_top_form);
     // affichage du lien pour suppression
     if ($this->analysis_id) {
         $link_supp = "\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t<!--\n\t\t\t\t\tfunction confirmation_delete() {\n\t\t\t\t\tresult = confirm(\"{$msg['confirm_suppr']} ?\");\n\t\t\t\t\tif(result) {\n\t\t\t\t\t\tunload_off();\n\t\t\t\t\t\tdocument.location = './catalog.php?categ=serials&sub=analysis&action=delete&bul_id=!!bul_id!!&analysis_id=!!analysis_id!!';\t\t\t\t\n\t\t\t\t\t}\t\n\t\t\t\t}\n\t\t\t\t\t-->\n\t\t\t\t</script>\n\t\t\t\t<input type='button' class='bouton' value=\"{$msg[63]}\" onClick=\"confirmation_delete();\">&nbsp;";
         $form_titre = $msg[4023];
         if ($pmb_type_audit) {
             $link_audit = "<input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=1&object_id={$this->analysis_id}', 'audit_popup', 700, 500, -2, -2, '{$select_categ_prop}')\" title='{$msg['audit_button']}' value='{$msg['audit_button']}' />";
         } else {
             $link_audit = "";
         }
         $link_duplicate = "<input type='button' class='bouton' value='" . $msg["analysis_duplicate_bouton"] . "' onclick='document.location=\"./catalog.php?categ=serials&sub=analysis&action=analysis_duplicate&bul_id={$this->id_bulletinage}&analysis_id={$this->analysis_id}\"' />";
         $link_move = "<input type='button' class='bouton' value='" . $msg["analysis_move_bouton"] . "' onclick='document.location=\"./catalog.php?categ=serials&sub=analysis&action=analysis_move&bul_id={$this->id_bulletinage}&analysis_id=" . $this->analysis_id . "\"' />";
     } else {
         $link_supp = "";
         $form_titre = $msg[4022];
         $link_audit = "";
         $link_duplicate = "";
         $link_move = "";
     }
     $analysis_top_form = str_replace('!!link_supp!!', $link_supp, $analysis_top_form);
     $analysis_top_form = str_replace('!!form_title!!', $form_titre, $analysis_top_form);
     // mise à jour des infos du dépouillement
     $analysis_top_form = str_replace('!!bul_id!!', $this->id_bulletinage, $analysis_top_form);
     $analysis_top_form = str_replace('!!analysis_id!!', $this->analysis_id, $analysis_top_form);
     $analysis_top_form = str_replace('!!link_audit!!', $link_audit, $analysis_top_form);
     $analysis_top_form = str_replace('!!link_duplicate!!', $link_duplicate, $analysis_top_form);
     $analysis_top_form = str_replace('!!link_move!!', $link_move, $analysis_top_form);
     $analysis_top_form = str_replace('!!notice_id_no_replace!!', $this->analysis_id, $analysis_top_form);
     if ($notice_type) {
         global $analysis_type_form;
         $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=notice&date_caller=&param1=f_bull_new_date&param2=date_date_lib&auto_submit=NO&date_anterieure=YES', 'date_date', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"  ";
         $date_date = "<input type='hidden' id='f_bull_new_date' name='f_bull_new_date' value='' />\n\t\t\t\t<input class='saisie-10em' type='text' name='date_date_lib' value='' />\n\t\t\t\t<input class='bouton' type='button' name='date_date_lib_bouton' value='" . $msg["bouton_calendrier"] . "' " . $date_clic . " />";
         $analysis_type_form = str_replace("!!date_date!!", $date_date, $analysis_type_form);
         $analysis_type_form = str_replace("!!perio_type_new!!", "checked", $analysis_type_form);
         $analysis_type_form = str_replace("!!bull_type_new!!", "checked", $analysis_type_form);
         $analysis_type_form = str_replace("!!perio_type_use_existing!!", "", $analysis_type_form);
         $analysis_type_form = str_replace("!!bull_type_use_existing!!", "", $analysis_type_form);
         $analysis_top_form = str_replace("!!type_catal!!", $analysis_type_form, $analysis_top_form);
         return $analysis_top_form;
     } else {
         $analysis_top_form = str_replace("!!type_catal!!", "", $analysis_top_form);
     }
     return $analysis_top_form;
 }
Esempio n. 2
0
 function getRdfThesaurus($idThes)
 {
     $arrayTriples = array();
     $uriThes = $this->baseUriThesaurus . $idThes;
     $thes = new thesaurus($idThes);
     //Type
     $triple = array();
     $triple[0] = '<' . $uriThes . '>';
     $triple[1] = "rdf:type";
     $triple[2] = "skos:ConceptScheme";
     $arrayTriples[] = $triple;
     //Label
     $triple = array();
     $triple[0] = '<' . $uriThes . '>';
     $triple[1] = "skos:prefLabel";
     $triple[2] = '"' . addslashes($thes->getLibelle()) . '"';
     $arrayTriples[] = $triple;
     //topConcepts
     $resBis = mysql_query("SELECT id_noeud FROM noeuds WHERE num_parent='" . $thes->num_noeud_racine . "' AND  num_renvoi_voir='0' AND autorite != 'ORPHELINS' AND num_thesaurus='" . $idThes . "'");
     while ($rowBis = mysql_fetch_object($resBis)) {
         $triple = array();
         $triple[0] = '<' . $uriThes . '>';
         $triple[1] = "skos:hasTopConcept";
         $triple[2] = '<' . $this->baseUriConcept . $rowBis->id_noeud . '>';
         $arrayTriples[] = $triple;
     }
     return $arrayTriples;
 }
Esempio n. 3
0
function extrait_info_notice($sql = "", $entete = 1, $flag = "")
{
    global $dbh;
    global $dest;
    global $worksheet;
    global $myCart;
    global $entete_bloc;
    global $msg;
    global $debligne_excel;
    global $etat_table;
    // permet de savoir si les tag table sont ouverts ou fermés
    global $max_aut;
    // le nombre max de colonnes d'auteurs
    global $thesaurus_mode_pmb;
    global $thesaurus_defaut;
    global $lang;
    global $pmb_keyword_sep;
    global $max_perso;
    global $res_compte3;
    if (!$debligne_excel) {
        $debligne_excel = 0;
    }
    $res = @mysql_query($sql, $dbh);
    $nbr_lignes = @mysql_num_rows($res);
    $nbr_champs = @mysql_num_fields($res);
    if ($nbr_lignes) {
        // Pour les champs personnalisés
        $caddie_type = $myCart->type;
        switch ($caddie_type) {
            case 'EXPL':
                $libelle_caddie_type = "expl";
                break;
            case 'NOTI':
            default:
                $libelle_caddie_type = "notices";
                break;
        }
        switch ($dest) {
            case "TABLEAU":
                if ($entete) {
                    $worksheet->write_string(1 + $debligne_excel, 0, $msg["caddie_mess_edition_" . $entete_bloc]);
                    $debligne_excel++;
                    $worksheet->write_string(1 + $debligne_excel, 0, $msg['caddie_action_marque']);
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        // entête de colonnes
                        $fieldname = mysql_field_name($res, $i);
                        $worksheet->write_string(1 + $debligne_excel, $i + 1, $fieldname);
                    }
                    for ($i = 0; $i < $max_aut; $i++) {
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 1 + $nbr_champs, "aut_entree_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 2 + $nbr_champs, "aut_rejete_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 3 + $nbr_champs, "aut_dates_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 4 + $nbr_champs, "aut_fonction_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 5 + $nbr_champs, "aut_type_{$i}");
                        $worksheet->write_string(1 + $debligne_excel, $i * 6 + 6 + $nbr_champs, "aut_resp_type_{$i}");
                    }
                    $worksheet->write_string(1 + $debligne_excel, $max_aut * 6 + $nbr_champs + 1, "DESCR");
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = mysql_fetch_object($res_compte3);
                        $worksheet->write_string(1 + $debligne_excel, $max_aut * 6 + $nbr_champs + 2 + $i, $perso->titre);
                    }
                    $debligne_excel++;
                }
                //Fonctions d'auteurs
                $codes_auteurs = get_functions_authors();
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $debligne_excel++;
                    $row = mysql_fetch_row($res);
                    switch ($caddie_type) {
                        case 'EXPL':
                            $id_notice = $row[2];
                            break;
                        case 'NOTI':
                        default:
                            $id_notice = $row[0];
                            break;
                    }
                    if ($flag) {
                        $worksheet->write_string($debligne_excel, 0, "X");
                    }
                    $j = 0;
                    foreach ($row as $dummykey => $col) {
                        if (!$col) {
                            $col = " ";
                        }
                        $worksheet->write_string($debligne_excel, $j + 1, $col);
                        $j++;
                    }
                    $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
                    $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
                    $rqt_aut .= "WHERE responsability_notice={$id_notice} ";
                    $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
                    $res_aut = @mysql_query($rqt_aut);
                    for ($iaut = 0; $iaut < $max_aut; $iaut++) {
                        $aut = @mysql_fetch_row($res_aut);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 1 + $nbr_champs, $aut[0]);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 2 + $nbr_champs, $aut[1]);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 3 + $nbr_champs, $aut[2]);
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 4 + $nbr_champs, $codes_auteurs[$aut[3]]);
                        if ($aut[4] == "70") {
                            $lib_type_aut = $msg[203];
                        } else {
                            if ($aut[4] == "71") {
                                $lib_type_aut = $msg[204];
                            } else {
                                if ($aut[4] == "72") {
                                    $lib_type_aut = $msg["congres_libelle"];
                                } else {
                                    $lib_type_aut = $aut[4];
                                }
                            }
                        }
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 5 + $nbr_champs, $lib_type_aut);
                        $lib_resp_type = "";
                        if ($aut[0]) {
                            if ($aut[5] == 0) {
                                $lib_resp_type = $msg["export_main_author"];
                            } else {
                                if ($aut[5] == 1) {
                                    $lib_resp_type = $msg["export_other_author"];
                                } else {
                                    if ($aut[5] == 2) {
                                        $lib_resp_type = $msg["export_secondary_author"];
                                    }
                                }
                            }
                        }
                        $worksheet->write_string($debligne_excel, $iaut * 6 + 6 + $nbr_champs, $lib_resp_type);
                    }
                    $q = "drop table if exists catlg ";
                    $r = mysql_query($q, $dbh);
                    $q = "CREATE TEMPORARY TABLE catlg ENGINE=MyISAM as ";
                    $q .= "SELECT categories.num_noeud, categories.libelle_categorie ";
                    $q .= "FROM noeuds, categories, notices_categories ";
                    $q .= "WHERE notices_categories.notcateg_notice = '" . $id_notice . "' ";
                    $q .= "AND categories.langue = '" . $lang . "' ";
                    $q .= "AND categories.num_noeud = notices_categories.num_noeud ";
                    $q .= "AND categories.num_noeud = noeuds.id_noeud ";
                    $q .= "ORDER BY ordre_categorie";
                    $r = mysql_query($q, $dbh);
                    $q = "DROP TABLE IF EXISTS catdef ";
                    $r = mysql_query($q, $dbh);
                    $q = "CREATE TEMPORARY TABLE catdef ( ";
                    $q .= "num_noeud int(9) unsigned not null default '0', ";
                    $q .= "num_thesaurus int(3) unsigned not null default '0', ";
                    $q .= "libelle_categorie text not null ) ENGINE=MyISAM ";
                    $r = mysql_query($q, $dbh);
                    $thes_list = thesaurus::getThesaurusList();
                    $q = '';
                    foreach ($thes_list as $id_thesaurus => $libelle_thesaurus) {
                        $thes = new thesaurus($id_thesaurus);
                        $q = "INSERT INTO catdef ";
                        $q .= "SELECT categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie ";
                        $q .= "FROM noeuds, categories, notices_categories ";
                        $q .= "WHERE noeuds.num_thesaurus={$id_thesaurus} and notices_categories.notcateg_notice = '" . $id_notice . "' ";
                        $q .= "AND categories.langue = '" . $thes->langue_defaut . "' ";
                        $q .= "AND categories.num_noeud = notices_categories.num_noeud ";
                        $q .= "AND categories.num_noeud = noeuds.id_noeud ";
                        $q .= "ORDER BY ordre_categorie";
                        $r = mysql_query($q, $dbh);
                    }
                    $q = "select catdef.num_thesaurus as num_thesaurus, ";
                    $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
                    $q .= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud ";
                    if (!$thesaurus_mode_pmb) {
                        $q .= "where catdef.num_thesaurus = '" . $thesaurus_defaut . "' ";
                    }
                    $res_desc = mysql_query($q, $dbh);
                    $lib_desc = "";
                    while ($desc = mysql_fetch_object($res_desc)) {
                        $lib_desc .= $lib_desc ? $pmb_keyword_sep : "";
                        if ($thesaurus_mode_pmb) {
                            $lib_desc .= '[' . thesaurus::getLibelle($desc->num_thesaurus) . '] ';
                        }
                        $lib_desc .= $desc->libelle_categorie;
                    }
                    $worksheet->write_string($debligne_excel, $max_aut * 6 + $nbr_champs + 1, "{$lib_desc}");
                    $p_perso = new parametres_perso($libelle_caddie_type);
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            $worksheet->write_string($debligne_excel, $max_aut * 6 + $nbr_champs + 2 + $i, html_entity_decode($p["AFF"], ENT_QUOTES | ENT_COMPAT, "iso-8859-15"));
                        }
                    }
                }
                break;
            case "TABLEAUHTML":
                if ($entete) {
                    if ($etat_table) {
                        echo "\n</table>";
                    }
                    echo "<h3>" . $msg["caddie_mess_edition_" . $entete_bloc] . "</h3>";
                    echo "\n<table><th align='left'>" . $msg['caddie_action_marque'] . "</th>";
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        $fieldname = mysql_field_name($res, $i);
                        print "<th align='left'>{$fieldname}</th>";
                    }
                    for ($i = 0; $i < $max_aut; $i++) {
                        print pmb_bidi("<th align='left'>aut_entree_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_rejete_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_dates_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_fonction_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_type_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_resp_type_{$i}</th>");
                    }
                    print "<th align='left'>DESCR</th>";
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = mysql_fetch_object($res_compte3);
                        print "<th align='left'>" . $perso->titre . "</th>";
                    }
                    $etat_table = 1;
                }
                //Fonctions d'auteurs
                $codes_auteurs = get_functions_authors();
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $row = mysql_fetch_row($res);
                    switch ($caddie_type) {
                        case 'EXPL':
                            $id_notice = $row[2];
                            break;
                        case 'NOTI':
                        default:
                            $id_notice = $row[0];
                            break;
                    }
                    echo "<tr>";
                    if ($flag) {
                        print "<td>X</td>";
                    } else {
                        print "<td>&nbsp;</td>";
                    }
                    foreach ($row as $dummykey => $col) {
                        if (is_numeric($col)) {
                            $col = "'" . $col;
                        }
                        if (!$col) {
                            $col = "&nbsp;";
                        }
                        print pmb_bidi("<td>{$col}</td>");
                    }
                    $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
                    $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
                    $rqt_aut .= "WHERE responsability_notice={$id_notice} ";
                    $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
                    $res_aut = @mysql_query($rqt_aut, $dbh);
                    for ($i = 0; $i < $max_aut; $i++) {
                        $aut = @mysql_fetch_row($res_aut);
                        print pmb_bidi("<td>{$aut['0']}</td>");
                        print pmb_bidi("<td>{$aut['1']}</td>");
                        print pmb_bidi("<td>{$aut['2']}</td>");
                        print pmb_bidi("<td>" . $codes_auteurs[$aut[3]] . "</td>");
                        if ($aut[4] == "70") {
                            $lib_type_aut = $msg[203];
                        } else {
                            if ($aut[4] == "71") {
                                $lib_type_aut = $msg[204];
                            } else {
                                if ($aut[4] == "72") {
                                    $lib_type_aut = $msg["congres_libelle"];
                                } else {
                                    $lib_type_aut = $aut[4];
                                }
                            }
                        }
                        print pmb_bidi("<td>{$lib_type_aut}</td>");
                        $lib_resp_type = "";
                        if ($aut[0]) {
                            if ($aut[5] == 0) {
                                $lib_resp_type = $msg["export_main_author"];
                            } else {
                                if ($aut[5] == 1) {
                                    $lib_resp_type = $msg["export_other_author"];
                                } else {
                                    if ($aut[5] == 2) {
                                        $lib_resp_type = $msg["export_secondary_author"];
                                    }
                                }
                            }
                        }
                        print pmb_bidi("<td>{$lib_resp_type}</td>");
                    }
                    $q = "drop table if exists catlg ";
                    $r = mysql_query($q, $dbh);
                    $q = "create temporary table catlg ENGINE=MyISAM as ";
                    $q .= "select categories.num_noeud, categories.libelle_categorie ";
                    $q .= "from noeuds, categories, notices_categories ";
                    $q .= "where notices_categories.notcateg_notice = '" . $id_notice . "' ";
                    $q .= "and categories.langue = '" . $lang . "' ";
                    $q .= "and categories.num_noeud = notices_categories.num_noeud ";
                    $q .= "and categories.num_noeud = noeuds.id_noeud ";
                    $q .= "ORDER BY ordre_categorie";
                    $r = mysql_query($q, $dbh);
                    $q = "drop table if exists catdef ";
                    $r = mysql_query($q, $dbh);
                    $q = "create temporary table catdef ( ";
                    $q .= "num_noeud int(9) unsigned not null default '0', ";
                    $q .= "num_thesaurus int(3) unsigned not null default '0', ";
                    $q .= "libelle_categorie text not null ";
                    $q .= ") ENGINE=MyISAM ";
                    $r = mysql_query($q, $dbh);
                    $thes_list = thesaurus::getThesaurusList();
                    $q = '';
                    foreach ($thes_list as $id_thesaurus => $libelle_thesaurus) {
                        $thes = new thesaurus($id_thesaurus);
                        $q = "insert into catdef ";
                        $q .= "select categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie ";
                        $q .= "from noeuds, categories, notices_categories ";
                        $q .= "where noeuds.num_thesaurus={$id_thesaurus} and notices_categories.notcateg_notice = '" . $id_notice . "' ";
                        $q .= "and categories.langue = '" . $thes->langue_defaut . "' ";
                        $q .= "and categories.num_noeud = notices_categories.num_noeud ";
                        $q .= "and categories.num_noeud = noeuds.id_noeud ";
                        $q .= "ORDER BY ordre_categorie";
                        $r = mysql_query($q, $dbh);
                    }
                    $q = "select catdef.num_thesaurus as num_thesaurus, ";
                    $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
                    $q .= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud ";
                    if (!$thesaurus_mode_pmb) {
                        $q .= "where catdef.num_thesaurus = '" . $thesaurus_defaut . "' ";
                    }
                    $res_desc = mysql_query($q, $dbh);
                    $lib_desc = "";
                    while ($desc = mysql_fetch_object($res_desc)) {
                        $lib_desc .= $lib_desc ? $pmb_keyword_sep : "";
                        if ($thesaurus_mode_pmb) {
                            $lib_desc .= '[' . thesaurus::getLibelle($desc->num_thesaurus) . '] ';
                        }
                        $lib_desc .= $desc->libelle_categorie;
                    }
                    print pmb_bidi("<td>{$lib_desc}</td>");
                    $p_perso = new parametres_perso($libelle_caddie_type);
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            print "<td>" . $p["AFF"] . "</td>";
                        }
                    }
                    echo "</tr>";
                }
                break;
            default:
                if ($entete) {
                    if ($etat_table) {
                        echo "\n</table>";
                    }
                    echo "<h3>" . $msg["caddie_mess_edition_" . $entete_bloc] . "</h3>";
                    echo "\n<table><th align='left'>" . $msg['caddie_action_marque'] . "</th>";
                    for ($i = 0; $i < $nbr_champs; $i++) {
                        $fieldname = mysql_field_name($res, $i);
                        print "<th align='left'>{$fieldname}</th>";
                    }
                    for ($i = 0; $i < $max_aut; $i++) {
                        print pmb_bidi("<th align='left'>aut_entree_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_rejete_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_dates_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_fonction_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_type_{$i}</th>");
                        print pmb_bidi("<th align='left'>aut_resp_type_{$i}</th>");
                    }
                    print "<th align='left'>DESCR</th>";
                    for ($i = 0; $i < $max_perso; $i++) {
                        $perso = mysql_fetch_object($res_compte3);
                        print "<th align='left'>" . $perso->titre . "</th>";
                    }
                    $etat_table = 1;
                }
                //Fonctions d'auteurs
                $codes_auteurs = get_functions_authors();
                $odd_even = 0;
                for ($i = 0; $i < $nbr_lignes; $i++) {
                    $row = mysql_fetch_row($res);
                    switch ($caddie_type) {
                        case 'EXPL':
                            $id_notice = $row[2];
                            break;
                        case 'NOTI':
                        default:
                            $id_notice = $row[0];
                            break;
                    }
                    if ($odd_even == 0) {
                        echo "\t<tr class='odd'>";
                        $odd_even = 1;
                    } else {
                        if ($odd_even == 1) {
                            echo "\t<tr class='even'>";
                            $odd_even = 0;
                        }
                    }
                    if ($flag) {
                        print "<td>X</td>";
                    } else {
                        print "<td>&nbsp;</td>";
                    }
                    foreach ($row as $dummykey => $col) {
                        if (!$col) {
                            $col = "&nbsp;";
                        }
                        print pmb_bidi("<td>{$col}</td>");
                    }
                    $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
                    $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
                    $rqt_aut .= "WHERE responsability_notice={$id_notice} ";
                    $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
                    $res_aut = @mysql_query($rqt_aut, $dbh);
                    for ($i = 0; $i < $max_aut; $i++) {
                        $aut = @mysql_fetch_row($res_aut);
                        print pmb_bidi("<td>{$aut['0']}</td>");
                        print pmb_bidi("<td>{$aut['1']}</td>");
                        print pmb_bidi("<td>{$aut['2']}</td>");
                        print pmb_bidi("<td>" . $codes_auteurs[$aut[3]] . "</td>");
                        if ($aut[4] == "70") {
                            $lib_type_aut = $msg[203];
                        } else {
                            if ($aut[4] == "71") {
                                $lib_type_aut = $msg[204];
                            } else {
                                if ($aut[4] == "72") {
                                    $lib_type_aut = $msg["congres_libelle"];
                                } else {
                                    $lib_type_aut = $aut[4];
                                }
                            }
                        }
                        print pmb_bidi("<td>{$lib_type_aut}</td>");
                        $lib_resp_type = "";
                        if ($aut[0]) {
                            if ($aut[5] == 0) {
                                $lib_resp_type = $msg["export_main_author"];
                            } else {
                                if ($aut[5] == 1) {
                                    $lib_resp_type = $msg["export_other_author"];
                                } else {
                                    if ($aut[5] == 2) {
                                        $lib_resp_type = $msg["export_secondary_author"];
                                    }
                                }
                            }
                        }
                        print pmb_bidi("<td>{$lib_resp_type}</td>");
                    }
                    $q = "drop table if exists catlg ";
                    $r = mysql_query($q, $dbh);
                    $q = "create temporary table catlg ENGINE=MyISAM as ";
                    $q .= "select categories.num_noeud, categories.libelle_categorie ";
                    $q .= "from noeuds, categories, notices_categories ";
                    $q .= "where notices_categories.notcateg_notice = '" . $id_notice . "' ";
                    $q .= "and categories.langue = '" . $lang . "' ";
                    $q .= "and categories.num_noeud = notices_categories.num_noeud ";
                    $q .= "and categories.num_noeud = noeuds.id_noeud ";
                    $q .= "ORDER BY ordre_categorie";
                    $r = mysql_query($q, $dbh);
                    $q = "drop table if exists catdef ";
                    $r = mysql_query($q, $dbh);
                    $q = "create temporary table catdef ( ";
                    $q .= "num_noeud int(9) unsigned not null default '0', ";
                    $q .= "num_thesaurus int(3) unsigned not null default '0', ";
                    $q .= "libelle_categorie text not null ";
                    $q .= ") ENGINE=MyISAM ";
                    $r = mysql_query($q, $dbh);
                    $thes_list = thesaurus::getThesaurusList();
                    $q = '';
                    foreach ($thes_list as $id_thesaurus => $libelle_thesaurus) {
                        $thes = new thesaurus($id_thesaurus);
                        $q = "insert into catdef ";
                        $q .= "select categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie ";
                        $q .= "from noeuds, categories, notices_categories ";
                        $q .= "where noeuds.num_thesaurus={$id_thesaurus} and notices_categories.notcateg_notice = '" . $id_notice . "' ";
                        $q .= "and categories.langue = '" . $thes->langue_defaut . "' ";
                        $q .= "and categories.num_noeud = notices_categories.num_noeud ";
                        $q .= "and categories.num_noeud = noeuds.id_noeud ";
                        $q .= "ORDER BY ordre_categorie";
                        $r = mysql_query($q, $dbh);
                    }
                    $q = "select catdef.num_thesaurus as num_thesaurus, ";
                    $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
                    $q .= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud ";
                    if (!$thesaurus_mode_pmb) {
                        $q .= "where catdef.num_thesaurus = '" . $thesaurus_defaut . "' ";
                    }
                    $res_desc = mysql_query($q, $dbh);
                    $lib_desc = "";
                    while ($desc = mysql_fetch_object($res_desc)) {
                        $lib_desc .= $lib_desc ? $pmb_keyword_sep : "";
                        if ($thesaurus_mode_pmb) {
                            $lib_desc .= '[' . thesaurus::getLibelle($desc->num_thesaurus) . '] ';
                        }
                        $lib_desc .= $desc->libelle_categorie;
                    }
                    print pmb_bidi("<td>{$lib_desc}</td>");
                    $p_perso = new parametres_perso($libelle_caddie_type);
                    //Champs personalisés
                    if (!$p_perso->no_special_fields) {
                        $perso_ = $p_perso->show_fields($id_notice);
                        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
                            $p = $perso_["FIELDS"][$i];
                            print "<td>" . $p["AFF"] . "</td>";
                        }
                    }
                    echo "</tr>";
                }
                break;
        }
        // fin switch
    }
    // fin if nbr_lignes
}
Esempio n. 4
0
    // on arrive du formulaire d'ajout à la volée
    if (!strlen($category_parent)) {
        $category_parent_id = $thes->num_noeud_racine;
    }
    $category_voir_id = 0;
    $noeud = new noeuds();
    $noeud->num_parent = $category_parent_id;
    $noeud->num_thesaurus = $thes->id_thesaurus;
    $noeud->save();
    $cat = new categories($noeud->id_noeud, $thes->langue_defaut);
    $cat->libelle_categorie = stripslashes($category_libelle);
    $cat->note_application = stripslashes($category_comment);
    $cat->index_categorie = " " . strip_empty_words($cat->libelle_categorie) . " ";
    $cat->save();
    if ($thesaurus_mode_pmb && $caller == 'notice') {
        $nom_tesaurus = '[' . $thes->getLibelle() . '] ';
    } else {
        $nom_tesaurus = '';
    }
    $browser_content = "<a href='#' {$java_comment} onclick=\"set_parent('{$caller}', '{$noeud->id_noeud}', '" . htmlentities(addslashes($nom_tesaurus . $cat->libelle_categorie), ENT_QUOTES, $charset) . "','{$callback}','" . $cat->num_thesaurus . "')\">";
    $browser_content .= $cat->libelle_categorie;
    $browser_content .= "</a>";
}
// nombre de références par pages
if ($nb_per_page_author != "") {
    $nb_per_page = $nb_per_page_author;
} else {
    $nb_per_page = 10;
}
if (!$page) {
    $page = 1;
 function show_list_of_terms()
 {
     global $charset;
     global $msg;
     global $lang;
     global $dbh;
     global $opac_thesaurus;
     global $nbresultterme;
     //Si il y a eu erreur lors de la première analyse...
     if ($this->error_message) {
         return $this->error_message;
     }
     //Recherche des termes correspondants à la requête
     $where_term = $this->get_where_term();
     if ($where_term) {
         $members_catdef = $this->aq->get_query_members("catdef", "catdef.libelle_categorie", "catdef.index_categorie", "catdef.num_noeud");
         $members_catlg = $this->aq->get_query_members("catlg", "catlg.libelle_categorie", "catlg.index_categorie", "catlg.num_noeud");
     } else {
         echo $msg["term_search_info"];
         return;
     }
     if ($nbresultterme) {
         $this->n_total = $nbresultterme;
         $requete = "select count(catdef.num_noeud) as nb, ";
     } else {
         $requete = "select SQL_CALC_FOUND_ROWS count(catdef.num_noeud) as nb, ";
     }
     if ($this->id_thes != -1) {
         //1 seul thesaurus
         if ($lang == $this->thes->langue_defaut || in_array($lang, thesaurus::getTranslationsList()) === false) {
             //Recherche dans la langue par défaut du thesaurus
             $requete .= "num_thesaurus, ";
             $requete .= "num_noeud as categ_id, ";
             $requete .= "libelle_categorie as categ_libelle, ";
             $requete .= "catdef.index_categorie as indexcat ";
             if ($where_term) {
                 $requete .= ", " . $members_catdef["select"] . " as pert ";
             }
             $requete .= "from categories as catdef ";
             $requete .= "where 1 ";
             if ($where_term) {
                 $requete .= "and " . $members_catdef["where"] . " ";
             }
             $requete .= "and num_thesaurus = '" . $this->id_thes . "' ";
             $requete .= "and catdef.langue = '" . $this->thes->langue_defaut . "' ";
             $requete .= "and catdef.libelle_categorie not like '~%' ";
             $requete .= "group by categ_libelle ";
             $requete .= "order by ";
             if ($where_term) {
                 $requete .= "pert desc, ";
             }
             $requete .= "indexcat asc ";
             $requete .= "limit " . $this->offset . "," . $this->n_per_page;
         } else {
             //Recherche dans la langue de l'interface ou dans la langue par défaut du thesaurus
             $requete .= "catdef.num_thesaurus, ";
             $requete .= "catdef.num_noeud as categ_id, ";
             $requete .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie ) as categ_libelle, ";
             $requete .= "if (catlg.num_noeud is null, catdef.index_categorie , catlg.index_categorie ) as indexcat ";
             if ($where_term) {
                 $requete .= ", if (catlg.num_noeud is null, " . $members_catdef["select"] . ", " . $members_catlg["select"] . ") as pert ";
             }
             $requete .= "from categories as catdef ";
             $requete .= "left join categories as catlg on catdef.num_noeud = catlg.num_noeud and catlg.langue = '" . $lang . "' ";
             $requete .= "where 1 ";
             if ($where_term) {
                 $requete .= "and (if(catlg.num_noeud is null, " . $members_catdef["where"] . ", " . $members_catlg["where"] . ") ) ";
             }
             $requete .= "and catdef.num_thesaurus = '" . $this->id_thes . "' ";
             $requete .= "and catdef.langue = '" . $this->thes->langue_defaut . "' ";
             $requete .= "and catdef.libelle_categorie not like '~%' ";
             $requete .= "group by categ_libelle ";
             $requete .= "order by ";
             if ($where_term) {
                 $requete .= "pert desc, ";
             }
             $requete .= "indexcat asc ";
             $requete .= "limit " . $this->offset . "," . $this->n_per_page;
         }
     } else {
         //tous les thesaurus
         //on recherche dans la langue de l'interface ou dans la langue par défaut du thesaurus
         $requete .= "catdef.num_thesaurus, ";
         $requete .= "catdef.num_noeud as categ_id, ";
         $requete .= "if (catlg.num_noeud is null, catdef.libelle_categorie , catlg.libelle_categorie ) as categ_libelle, ";
         $requete .= "if (catlg.num_noeud is null, catdef.index_categorie , catlg.index_categorie ) as indexcat ";
         if ($where_term) {
             $requete .= ", if (catlg.num_noeud is null, " . $members_catdef["select"] . ", " . $members_catlg["select"] . ") as pert ";
         }
         $requete .= "from thesaurus ";
         $requete .= "left join categories as catdef on id_thesaurus=catdef.num_thesaurus and catdef.langue=thesaurus.langue_defaut ";
         $requete .= "left join categories as catlg on catdef.num_noeud=catlg.num_noeud and catlg.langue = '" . $lang . "' ";
         if ($where_term) {
             $requete .= "where if(catlg.num_noeud is null, " . $members_catdef["where"] . ", " . $members_catlg["where"] . ") ";
         }
         $requete .= "group by categ_libelle, catdef.num_thesaurus ";
         $requete .= "order by ";
         if ($where_term) {
             $requete .= "pert desc, ";
         }
         $requete .= "catdef.num_thesaurus, indexcat asc ";
         $requete .= "limit " . $this->offset . "," . $this->n_per_page;
     }
     $resultat = pmb_mysql_query($requete, $dbh);
     //On récupère le nombre de résultat
     if (!$this->n_total) {
         $qry = "SELECT FOUND_ROWS() AS NbRows";
         if ($resnum = pmb_mysql_query($qry)) {
             $this->n_total = pmb_mysql_result($resnum, 0, 0);
         }
     }
     $res = "<b>";
     if ($this->search_term != "") {
         $res .= $msg["term_search_found_term"] . "<i>" . htmlentities($this->search_term_origin, ENT_QUOTES, $charset);
     } else {
         $res .= "<i>" . $msg["term_search_all_terms"];
     }
     $res .= "</i></b>\n";
     //Navigateur de page
     if ($this->n_total) {
         $res .= "<br /><span style='text-align:right;'>" . $this->page_navigator() . "</span><br /><br />";
     } else {
         $res .= "<br /><br /><span style='text-align:right;'><i>" . $msg['term_no_results'] . "</span><br /><br />";
     }
     //Affichage des termes trouvés
     $class = "colonne2";
     while ($r = pmb_mysql_fetch_object($resultat)) {
         $show = 1;
         //S'il n'y a qu'un seul résultat, vérification que ce n'est pas un terme masqué
         if ($r->nb == 1 && !$this->keep_tilde) {
             $t_test = new category($resultat->categ_id);
             if ($t_test->is_under_tilde && !$t_test->voir_id) {
                 $show = 0;
             }
         }
         if ($show) {
             $res .= "<div class='" . $class . "'>";
             if ($r->nb > 1) {
                 $nbre_termes = '(' . $r->nb . ') ';
             } else {
                 $nbre_termes = '';
             }
             $res .= $nbre_termes . "<a href=\"" . $this->url_for_term_show . '?term=' . rawurlencode($r->categ_libelle) . '&id_thes=' . $r->num_thesaurus . '&' . $this->base_query . "\" target=\"term_show\">";
             if ($this->id_thes == -1) {
                 //le nom du thesaurus n'est pas affiché si 1 seul thesaurus
                 $res .= '[' . htmlentities(addslashes(thesaurus::getLibelle($r->num_thesaurus)), ENT_QUOTES, $charset) . '] ';
             }
             $res .= htmlentities($r->categ_libelle, ENT_QUOTES, $charset) . "</a><br />\n";
             $res .= "</div>";
             if ($class == "colonne2") {
                 $class = "colonne_suite";
             } else {
                 $class = "colonne2";
             }
         }
     }
     if ($class = "colonne_suite") {
         $res .= "<div class=\"colonne_suite\"></div>\n";
     }
     return $res;
 }