$values .= ", expl_nbparts='{$f_ex_nbparts}'";
     $requete = "INSERT INTO exemplaires set {$values} , create_date=sysdate() ";
     $myQuery = pmb_mysql_query($requete, $dbh);
     $expl_id = pmb_mysql_insert_id();
     audit::insert_creation(AUDIT_EXPL, $expl_id);
 }
 if ($abt_id && $serial_circ_add) {
     $serialcirc_diff = new serialcirc_diff(0, $abt_id);
 }
 // Si c'est à faire circuler
 if ($serialcirc_diff->id) {
     $serialcirc_diff->add_circ_expl($expl_id);
 }
 // traitement des concepts
 if ($thesaurus_concepts_active == 1) {
     $index_concept = new index_concept($expl_id, TYPE_EXPL);
     $index_concept->save();
 }
 //Insertion des champs personalises
 $p_perso->rec_fields_perso($expl_id);
 // Mise a jour de la table notices_mots_global_index pour toutes les notices en relation avec l'exemplaire
 $req_maj = "SELECT bulletin_notice,num_notice, analysis_notice FROM bulletins LEFT JOIN analysis ON analysis_bulletin=bulletin_id WHERE bulletin_id='" . $expl_bulletin . "'";
 $res_maj = pmb_mysql_query($req_maj);
 if ($res_maj && pmb_mysql_num_rows($res_maj)) {
     $first = true;
     //Pour la premiere ligne de résultat on doit indexer aussi la notice de périodique et de bulletin au besoin
     while ($ligne = pmb_mysql_fetch_object($res_maj)) {
         if ($first) {
             if ($ligne->bulletin_notice) {
                 notice::majNoticesMotsGlobalIndex($ligne->bulletin_notice, 'expl');
             }
                $arrayIdImpactes[] = $noeud->num_parent;
            }
            //renvoi_voir
            if ($noeud->num_renvoi_voir) {
                $arrayIdImpactes[] = $noeud->num_renvoi_voir;
            }
            //on supprime le rdf
            if (count($arrayIdImpactes)) {
                foreach ($arrayIdImpactes as $idNoeud) {
                    $synchro_rdf->delConcept($idNoeud);
                }
            }
            $synchro_rdf->delConcept($id_to_delete);
        }
        // nettoyage indexation concepts
        $index_concept = new index_concept($id_to_delete, TYPE_CATEGORY);
        $index_concept->delete();
        noeuds::delete($id_to_delete);
        //On remet à jour les noeuds impactes
        if ($pmb_synchro_rdf) {
            if (count($arrayIdImpactes)) {
                foreach ($arrayIdImpactes as $idNoeud) {
                    $synchro_rdf->storeConcept($idNoeud);
                }
            }
            //On met à jour le thésaurus pour les topConcepts
            $synchro_rdf->updateAuthority($noeud->num_thesaurus, 'thesaurus');
        }
    }
}
include './autorites/subjects/default.inc.php';
Beispiel #3
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;
 }
Beispiel #4
0
 static function del_expl($id = 0)
 {
     global $dbh;
     global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises;
     $sql_pret = pmb_mysql_query("select 1 from pret where pret_idexpl ='{$id}' ");
     if (pmb_mysql_num_rows($sql_pret)) {
         return 0;
     }
     // visibilite de l'exemplaire
     if ($pmb_droits_explr_localises) {
         $query = "select expl_location from exemplaires where expl_id='" . $id . "'";
         $result = pmb_mysql_query($query, $dbh);
         $location_id = pmb_mysql_result($result, 0, 0);
         $tab_mod = explode(",", $explr_visible_mod);
         $as_modif = array_search($location_id, $tab_mod);
         if ($as_modif === false) {
             return 0;
         }
     }
     $requete = "select idcaddie FROM caddie where type='EXPL' ";
     $result = pmb_mysql_query($requete, $dbh);
     for ($i = 0; $i < pmb_mysql_num_rows($result); $i++) {
         $temp = pmb_mysql_fetch_object($result);
         $requete_suppr = "delete from caddie_content where caddie_id='" . $temp->idcaddie . "' and object_id='" . $id . "' ";
         $result_suppr = pmb_mysql_query($requete_suppr, $dbh);
     }
     audit::delete_audit(AUDIT_EXPL, $id);
     $p_perso = new parametres_perso("expl");
     $p_perso->delete_values($id);
     // nettoyage transfert
     $requete_suppr = "delete from transferts_demande where num_expl='{$id}'";
     $result_suppr = pmb_mysql_query($requete_suppr);
     // nettoyage circulation des périodiques
     serialcirc::delete_expl($id);
     // nettoyage doc. à ranger
     $requete_suppr = "delete from resa_ranger where resa_cb in (select expl_cb from exemplaires where expl_id='" . $id . "') ";
     $result_suppr = pmb_mysql_query($requete_suppr, $dbh);
     // nettoyage indexation concepts
     $index_concept = new index_concept($id, TYPE_EXPL);
     $index_concept->delete();
     $sql_del = pmb_mysql_query("delete from exemplaires where expl_id='{$id}' ");
     return 1;
 }
 function update($value)
 {
     global $dbh;
     global $msg;
     global $include_path;
     global $pmb_synchro_rdf;
     global $thesaurus_concepts_active, $max_aut0, $max_aut1;
     global $mc_oeuvre_nature;
     global $pmb_authors_qualification;
     if (!$value['name']) {
         return false;
     }
     // nettoyage des chaînes en entrée
     $value['name'] = clean_string($value['name']);
     $value['num_author'] = clean_string($value['num_author']);
     $value['form'] = clean_string($value['form']);
     $value['form_selector'] = clean_string($value['form_selector']);
     $value['date'] = clean_string($value['date']);
     $value['subject'] = clean_string($value['subject']);
     $value['place'] = clean_string($value['place']);
     $value['history'] = clean_string($value['history']);
     $value['characteristic'] = clean_string($value['characteristic']);
     $value['intended_termination'] = clean_string($value['intended_termination']);
     $value['intended_audience'] = clean_string($value['intended_audience']);
     $value['context'] = clean_string($value['context']);
     $value['equinox'] = clean_string($value['equinox']);
     $value['coordinates'] = clean_string($value['coordinates']);
     $value['tonalite'] = clean_string($value['tonalite']);
     $value['tonalite_selector'] = clean_string($value['tonalite_selector']);
     $value['comment'] = clean_string($value['comment']);
     $value['oeuvre_nature'] = clean_string($value['oeuvre_nature']);
     $value['oeuvre_nature_nature'] = clean_string($mc_oeuvre_nature->attributes[$value['oeuvre_nature']]['NATURE']);
     $value['oeuvre_type'] = clean_string($value['oeuvre_type']);
     $titre = titre_uniforme::import_tu_exist($value, 1, $this->id);
     if ($titre) {
         require_once "{$include_path}/user_error.inc.php";
         warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_doublon_erreur"]);
         return FALSE;
     }
     $tu_auteur = new auteur($value['num_author']);
     if (!$tu_auteur->id) {
         $value['num_author'] = 0;
     } else {
         $value['num_author'] = $tu_auteur->id;
     }
     $flag_index = 0;
     $requete = "SET ";
     $requete .= "tu_name='" . $value["name"] . "', ";
     $requete .= "tu_num_author='" . $value['num_author'] . "', ";
     $requete .= "tu_forme='" . $value["form"] . "', ";
     $requete .= "tu_forme_marclist='" . $value["form_selector"] . "', ";
     $requete .= "tu_date='" . $value["date"] . "', ";
     $requete .= "tu_sujet='" . $value["subject"] . "', ";
     $requete .= "tu_lieu='" . $value["place"] . "', ";
     $requete .= "tu_histoire='" . $value["history"] . "', ";
     $requete .= "tu_caracteristique='" . $value["characteristic"] . "', ";
     $requete .= "tu_completude='" . $value["intended_termination"] . "', ";
     $requete .= "tu_public='" . $value["intended_audience"] . "', ";
     $requete .= "tu_contexte='" . $value["context"] . "', ";
     $requete .= "tu_equinoxe='" . $value["equinox"] . "', ";
     $requete .= "tu_coordonnees='" . $value["coordinates"] . "', ";
     $requete .= "tu_tonalite='" . $value["tonalite"] . "', ";
     $requete .= "tu_tonalite_marclist='" . $value["tonalite_selector"] . "', ";
     $requete .= "tu_comment='" . $value["comment"] . "', ";
     $requete .= "tu_import_denied='" . $value["import_denied"] . "', ";
     $requete .= "tu_oeuvre_nature='" . $value["oeuvre_nature"] . "', ";
     $requete .= "tu_oeuvre_nature_nature='" . $value["oeuvre_nature_nature"] . "', ";
     $requete .= "tu_oeuvre_type='" . $value["oeuvre_type"] . "' ";
     if ($this->id) {
         // update
         $requete = 'UPDATE titres_uniformes ' . $requete;
         $requete .= ' WHERE tu_id=' . $this->id . ' ;';
         if (pmb_mysql_query($requete, $dbh)) {
             $flag_index = 1;
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_modif_erreur"]);
             return FALSE;
         }
         audit::insert_modif(AUDIT_TITRE_UNIFORME, $this->id);
     } else {
         // creation
         $requete = 'INSERT INTO titres_uniformes ' . $requete . ' ';
         $result = pmb_mysql_query($requete, $dbh);
         if ($result) {
             $this->id = pmb_mysql_insert_id();
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_creation_erreur"]);
             return FALSE;
         }
         audit::insert_creation(AUDIT_TITRE_UNIFORME, $this->id);
     }
     $this->update_oeuvre_expression($value['oeuvre_expression']);
     $this->update_other_link($value['other_link']);
     $this->update_oeuvre_event($value['oeuvre_event']);
     // auteurs
     for ($i = 0; $i < $max_aut0; $i++) {
         eval("global \$f_aut0_id{$i}; \$var_autid=\$f_aut0_id{$i};");
         eval("global \$f_f0_code{$i}; \$var_autfonc=\$f_f0_code{$i};");
         $f_aut[] = array('id' => $var_autid, 'fonction' => $var_autfonc, 'type' => '0', 'ordre' => $i);
     }
     // interpretes
     for ($i = 0; $i < $max_aut1; $i++) {
         eval("global \$f_aut1_id{$i}; \$var_autid=\$f_aut1_id{$i};");
         eval("global \$f_f1_code{$i}; \$var_autfonc=\$f_f1_code{$i};");
         $f_aut[] = array('id' => $var_autid, 'fonction' => $var_autfonc, 'type' => '1', 'ordre' => $i);
     }
     // Clean des vedettes
     titre_uniforme::delete_vedette_links($this->id);
     // traitement des auteurs
     $rqt_del = "delete from responsability_tu where responsability_tu_num='" . $this->id . "' ";
     $res_del = pmb_mysql_query($rqt_del);
     $rqt_ins = "INSERT INTO responsability_tu (responsability_tu_author_num, responsability_tu_num, responsability_tu_fonction, responsability_tu_type, responsability_tu_ordre) VALUES ";
     $i = 0;
     $var_name = 'saisie_titre_uniforme_role_composed';
     global ${$var_name};
     $role_composed = ${$var_name};
     $var_name = 'saisie_titre_uniforme_role_autre_composed';
     global ${$var_name};
     $role_composed_autre = ${$var_name};
     while ($i <= count($f_aut) - 1) {
         $id_aut = $f_aut[$i]['id'];
         if ($id_aut) {
             $fonc_aut = $f_aut[$i]['fonction'];
             $type_aut = $f_aut[$i]['type'];
             $ordre_aut = $f_aut[$i]['ordre'];
             $rqt = $rqt_ins . " ('{$id_aut}','" . $this->id . "','{$fonc_aut}','{$type_aut}', {$ordre_aut}) ";
             $res_ins = @pmb_mysql_query($rqt);
             $id_responsability_tu = pmb_mysql_insert_id();
             if ($pmb_authors_qualification) {
                 switch ($type_aut) {
                     case 0:
                         $this->update_vedette(stripslashes_array($role_composed[$ordre_aut]), $id_responsability_tu, TYPE_TU_RESPONSABILITY);
                         break;
                     case 1:
                         $this->update_vedette(stripslashes_array($role_composed_autre[$ordre_aut]), $id_responsability_tu, TYPE_TU_RESPONSABILITY_INTERPRETER);
                         break;
                 }
             }
         }
         $i++;
     }
     $aut_link = new aut_link(AUT_TABLE_TITRES_UNIFORMES, $this->id);
     $aut_link->save_form();
     $aut_pperso = new aut_pperso("tu", $this->id);
     $aut_pperso->save_form();
     //update authority informations
     $authority = new authority(0, $this->id, AUT_TABLE_TITRES_UNIFORMES);
     $authority->set_num_statut($value['statut']);
     $authority->update();
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->id, TYPE_TITRE_UNIFORME);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->id, "titre_uniforme");
     // Gestion des champ répétables
     $requete = "DELETE FROM tu_distrib WHERE distrib_num_tu='{$this->id}' ";
     pmb_mysql_query($requete, $dbh);
     $requete = "DELETE FROM tu_ref WHERE ref_num_tu='{$this->id}' ";
     pmb_mysql_query($requete, $dbh);
     $requete = "DELETE FROM tu_subdiv WHERE subdiv_num_tu='{$this->id}' ";
     pmb_mysql_query($requete, $dbh);
     // Distribution instrumentale et vocale (pour la musique)
     for ($i = 0; $i < count($value['distrib']); $i++) {
         $requete = "INSERT INTO tu_distrib SET\n\t\t\tdistrib_num_tu='{$this->id}',\n\t\t\tdistrib_name='" . $value['distrib'][$i] . "',\n\t\t\tdistrib_ordre='{$i}' ";
         pmb_mysql_query($requete, $dbh);
     }
     // Référence numérique (pour la musique)
     for ($i = 0; $i < count($value['ref']); $i++) {
         $requete = "INSERT INTO tu_ref SET\n\t\t\tref_num_tu='{$this->id}',\n\t\t\tref_name='" . $value['ref'][$i] . "',\n\t\t\tref_ordre='{$i}' ";
         pmb_mysql_query($requete, $dbh);
     }
     // Subdivison de forme
     for ($i = 0; $i < count($value['subdiv']); $i++) {
         $requete = "INSERT INTO tu_subdiv SET\n\t\t\tsubdiv_num_tu='{$this->id}',\n\t\t\tsubdiv_name='" . $value['subdiv'][$i] . "',\n\t\t\tsubdiv_ordre='{$i}' ";
         pmb_mysql_query($requete, $dbh);
     }
     // mise à jour du champ index du titre uniforme
     if ($this->id) {
         titre_uniforme::update_index_tu($this->id);
     }
     // réindexation de la notice
     // 		if ($flag_index)
     titre_uniforme::update_index($this->id);
     //Enrichissement
     if ($this->id && $opac_enrichment_bnf_sparql) {
         titre_uniforme::tu_enrichment($this->id);
     }
     //mise à jour de l'oeuvre rdf
     if ($flag_index && $pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->updateAuthority($this->id, 'oeuvre');
     }
     return TRUE;
 }
Beispiel #6
0
 function update($nom, $comment, $id_pclass = 0)
 {
     global $dbh;
     global $msg;
     global $include_path;
     global $thesaurus_classement_mode_pmb, $thesaurus_classement_defaut;
     global $thesaurus_concepts_active;
     if (!$nom) {
         return false;
     }
     // nettoyage de la chaîne en entrée
     $nom = clean_string($nom);
     if ($thesaurus_classement_mode_pmb == 0 || $id_pclass == 0) {
         $id_pclass = $thesaurus_classement_defaut;
     }
     $requete = "SET indexint_name='{$nom}', ";
     $requete .= "indexint_comment='{$comment}', ";
     $requete .= "num_pclass='{$id_pclass}', ";
     $requete .= "index_indexint=' " . strip_empty_words($nom . " " . $comment) . " '";
     if ($this->indexint_id) {
         // update
         $requete = 'UPDATE indexint ' . $requete;
         $requete .= ' WHERE indexint_id=' . $this->indexint_id . ' LIMIT 1;';
         if (pmb_mysql_query($requete, $dbh)) {
             $aut_link = new aut_link(AUT_TABLE_INDEXINT, $this->indexint_id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("indexint", $this->indexint_id);
             $aut_pperso->save_form();
             indexint::update_index($this->indexint_id);
             audit::insert_modif(AUDIT_INDEXINT, $this->indexint_id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[indexint_update], $msg[indexint_unable]);
             return FALSE;
         }
     } else {
         // création : s'assurer que le nom n'existe pas déjà
         $dummy = "SELECT * FROM indexint WHERE indexint_name = '" . $nom . "' and num_pclass='" . $id_pclass . "' LIMIT 1 ";
         $check = pmb_mysql_query($dummy, $dbh);
         if (pmb_mysql_num_rows($check)) {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[indexint_create], $msg[indexint_exists]);
             return FALSE;
         }
         $requete = 'INSERT INTO indexint ' . $requete . ';';
         if (pmb_mysql_query($requete, $dbh)) {
             $this->indexint_id = pmb_mysql_insert_id();
             $aut_link = new aut_link(AUT_TABLE_INDEXINT, $this->indexint_id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("indexint", $this->indexint_id);
             $aut_pperso->save_form();
             audit::insert_creation(AUDIT_INDEXINT, $this->indexint_id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[indexint_create], $msg[indexint_unable_create]);
             return FALSE;
         }
     }
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->indexint_id, TYPE_INDEXINT);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->indexint_id, "indexint");
     return TRUE;
 }
Beispiel #7
0
 function delete($id)
 {
     global $dbh;
     $p_perso = new custom_parametres_perso("authperso", "authperso", $this->id);
     $p_perso->delete_values($id);
     // nettoyage indexation concepts
     $index_concept = new index_concept($id, TYPE_AUTHPERSO);
     $index_concept->delete();
     $req = "DELETE FROM authperso_authorities where id_authperso_authority=" . $id;
     $resultat = pmb_mysql_query($req);
     audit::delete_audit($this->id + 1000, $id);
 }
Beispiel #8
0
 function update($value, $force = false)
 {
     global $dbh;
     global $msg, $charset;
     global $include_path;
     global $pmb_synchro_rdf;
     global $thesaurus_concepts_active;
     global $opac_enrichment_bnf_sparql;
     if (!$value['name']) {
         return false;
     }
     // nettoyage des chaînes en entrée
     $value['name'] = clean_string($value['name']);
     $value['rejete'] = clean_string($value['rejete']);
     $value['date'] = clean_string($value['date']);
     $value['lieu'] = clean_string($value['lieu']);
     $value['ville'] = clean_string($value['ville']);
     $value['pays'] = clean_string($value['pays']);
     $value['subdivision'] = clean_string($value['subdivision']);
     $value['numero'] = clean_string($value['numero']);
     if (!$force) {
         if ($this->id) {
             // s'assurer que l'auteur n'existe pas déjà
             switch ($value['type']) {
                 case 71:
                     // Collectivité
                     $and_dedoublonnage = " and author_subdivision ='" . $value['subdivision'] . "' and author_lieu='" . $value['lieu'] . "' and author_ville = '" . $value['ville'] . "' and author_pays = '" . $value['pays'] . "' and author_numero ='" . $value['numero'] . "' ";
                     break;
                 case 72:
                     // Congrès
                     $and_dedoublonnage = " and author_subdivision ='" . $value['subdivision'] . "' and author_lieu='" . $value['lieu'] . "' and author_ville = '" . $value['ville'] . "' and author_pays = '" . $value['pays'] . "' and author_numero ='" . $value['numero'] . "' ";
                     break;
                 default:
                     $and_dedoublonnage = '';
                     break;
             }
             $dummy = "SELECT * FROM authors WHERE author_type='" . $value['type'] . "' AND author_name='" . $value['name'] . "'";
             $dummy .= " AND author_rejete='" . $value['rejete'] . "' ";
             $dummy .= "AND author_date='" . $value[date] . "' and author_id!='" . $this->id . "' {$and_dedoublonnage} ";
             $check = pmb_mysql_query($dummy, $dbh);
             if (pmb_mysql_num_rows($check)) {
                 $auteur_exists = new auteur(pmb_mysql_result($check, 0, "author_id"));
                 require_once "{$include_path}/user_error.inc.php";
                 warning($msg[200], htmlentities($msg[220] . " -> " . $auteur_exists->display, ENT_QUOTES, $charset));
                 return FALSE;
             }
         } else {
             // s'assurer que l'auteur n'existe pas déjà
             if ($id_auteur_exists = auteur::check_if_exists($value)) {
                 $auteur_exists = new auteur($id_auteur_exists);
                 require_once "{$include_path}/user_error.inc.php";
                 warning($msg[200], htmlentities($msg[220] . " -> " . $auteur_exists->display, ENT_QUOTES, $charset));
                 return FALSE;
             }
         }
         // s'assurer que la forme_retenue ne pointe pas dans les deux sens
         if ($this->id) {
             $dummy = "SELECT * FROM authors WHERE author_id='" . $value[voir_id] . "' and  author_see='" . $this->id . "'";
             $check = pmb_mysql_query($dummy, $dbh);
             if (pmb_mysql_num_rows($check)) {
                 require_once "{$include_path}/user_error.inc.php";
                 warning($msg[200], htmlentities($msg['author_forme_retenue_error'] . " -> " . $this->display, ENT_QUOTES, $charset));
                 return FALSE;
             }
         }
     }
     $requete = "SET author_type='{$value['type']}', ";
     $requete .= "author_name='{$value['name']}', ";
     $requete .= "author_rejete='{$value['rejete']}', ";
     $requete .= "author_date='{$value['date']}', ";
     $requete .= "author_lieu='" . $value["lieu"] . "', ";
     $requete .= "author_ville='" . $value["ville"] . "', ";
     $requete .= "author_pays='" . $value["pays"] . "', ";
     $requete .= "author_subdivision='" . $value["subdivision"] . "', ";
     $requete .= "author_numero='" . $value["numero"] . "', ";
     $requete .= "author_web='{$value['author_web']}', ";
     $requete .= "author_see='{$value['voir_id']}', ";
     $requete .= "author_comment='{$value['author_comment']}', ";
     $word_to_index = $value["name"] . " " . $value["rejete"] . " " . $value["lieu"] . " " . $value["ville"] . " " . $value["pays"] . " " . $value["numero"] . " " . $value["subdivision"];
     if ($value['type'] == 72) {
         $word_to_index .= " " . $value["date"];
     }
     $requete .= "index_author=' " . strip_empty_chars($word_to_index) . " ',";
     $requete .= "author_import_denied= " . ($value['import_denied'] ? 1 : 0);
     if ($this->id) {
         audit::insert_modif(AUDIT_AUTHOR, $this->id);
         // update
         // on checke s'il n'y a pas un renvoi circulaire
         if ($this->id == $value['voir_id']) {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[199], htmlentities($msg[222] . " -> " . $this->display, ENT_QUOTES, $charset));
             return FALSE;
         }
         $requete = 'UPDATE authors ' . $requete;
         $requete .= ' WHERE author_id=' . $this->id . ' ;';
         if (pmb_mysql_query($requete, $dbh)) {
             // liens entre autorités
             $aut_link = new aut_link(AUT_TABLE_AUTHORS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("author", $this->id);
             $aut_pperso->save_form();
             auteur::update_index($this->id);
             // mise à jour de l'auteur dans la base rdf
             if ($pmb_synchro_rdf) {
                 $synchro_rdf = new synchro_rdf();
                 $synchro_rdf->updateAuthority($this->id, 'auteur');
             }
             // ////////////////////////modif de l'update///////////////////////////////
             $query = "select 1 from authors where (author_enrichment_last_update < now()-interval '0' day) and author_id={$this->id}";
             $result = pmb_mysql_query($query, $dbh);
             if ($opac_enrichment_bnf_sparql && pmb_mysql_num_rows($result)) {
                 auteur::author_enrichment($this->id);
             }
             // ////////////////////////////////////////////////////////////////////////
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[199], htmlentities($msg[208] . " -> " . $this->display, ENT_QUOTES, $charset));
             return FALSE;
         }
     } else {
         // creation
         $requete = 'INSERT INTO authors ' . $requete . ' ';
         if (pmb_mysql_query($requete, $dbh)) {
             $this->id = pmb_mysql_insert_id();
             // liens entre autorités
             $aut_link = new aut_link(AUT_TABLE_AUTHORS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("author", $this->id);
             $aut_pperso->save_form();
             audit::insert_creation(AUDIT_AUTHOR, $this->id);
             // ajout des enrichissements si activés
             if ($opac_enrichment_bnf_sparql) {
                 auteur::author_enrichment($this->id);
             }
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[200], htmlentities($msg[221] . " -> " . $requete, ENT_QUOTES, $charset));
             return FALSE;
         }
     }
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->id, TYPE_AUTHOR);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->id, "author");
     return TRUE;
 }
Beispiel #9
0
 static function del_notice($id)
 {
     global $dbh, $class_path, $pmb_synchro_rdf, $pmb_notice_img_folder_id;
     //Suppression de la vignette de la notice si il y en a une d'uploadée
     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, $dbh);
         if (pmb_mysql_num_rows($res)) {
             $rep = pmb_mysql_fetch_object($res);
             $img = $rep->repertoire_path . "img_" . $id;
             @unlink($img);
         }
     }
     //synchro_rdf (à laisser en premier : a besoin des éléments de la notice pour retirer du graphe rdf)
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delRdf($id, 0);
     }
     $p_perso = new parametres_perso("notices");
     $p_perso->delete_values($id);
     $requete = "DELETE FROM notices_categories WHERE notcateg_notice='{$id}'";
     @pmb_mysql_query($requete, $dbh);
     $requete = "DELETE FROM notices_langues WHERE num_notice='{$id}'";
     @pmb_mysql_query($requete, $dbh);
     $requete = "DELETE FROM notices WHERE notice_id='{$id}'";
     @pmb_mysql_query($requete, $dbh);
     audit::delete_audit(AUDIT_NOTICE, $id);
     // Effacement de l'occurence de la notice ds la table notices_global_index :
     $requete = "DELETE FROM notices_global_index WHERE num_notice=" . $id;
     @pmb_mysql_query($requete, $dbh);
     // Effacement des occurences de la notice ds la table notices_mots_global_index :
     $requete = "DELETE FROM notices_mots_global_index WHERE id_notice=" . $id;
     @pmb_mysql_query($requete, $dbh);
     // Effacement des occurences de la notice ds la table notices_fields_global_index :
     $requete = "DELETE FROM notices_fields_global_index WHERE id_notice=" . $id;
     @pmb_mysql_query($requete, $dbh);
     $requete = "delete from notices_relations where num_notice='{$id}' OR linked_notice='{$id}' ";
     @pmb_mysql_query($requete, $dbh);
     // elimination des docs numeriques
     $req_explNum = "select explnum_id from explnum where explnum_notice=" . $id . " ";
     $result_explNum = @pmb_mysql_query($req_explNum, $dbh);
     while ($explNum = pmb_mysql_fetch_object($result_explNum)) {
         $myExplNum = new explnum($explNum->explnum_id);
         $myExplNum->delete();
     }
     // Clean des vedettes
     notice::delete_vedette_links($id);
     $requete = "DELETE FROM responsability WHERE responsability_notice='{$id}'";
     @pmb_mysql_query($requete, $dbh);
     $requete = "DELETE FROM bannette_contenu WHERE num_notice='{$id}'";
     @pmb_mysql_query($requete, $dbh);
     $requete = "delete from caddie_content using caddie, caddie_content where caddie_id=idcaddie and type='NOTI' and object_id='" . $id . "' ";
     @pmb_mysql_query($requete, $dbh);
     $requete = "delete from analysis where analysis_notice='" . $id . "' ";
     @pmb_mysql_query($requete, $dbh);
     $requete = "update bulletins set num_notice=0 where num_notice='" . $id . "' ";
     @pmb_mysql_query($requete, $dbh);
     //Suppression de la reference a la notice dans la table suggestions
     $requete = "UPDATE suggestions set num_notice = 0 where num_notice=" . $id;
     @pmb_mysql_query($requete, $dbh);
     //Suppression de la reference a la notice dans la table lignes_actes
     $requete = "UPDATE lignes_actes set num_produit=0, type_ligne=0 where num_produit='" . $id . "' and type_ligne in ('1','5') ";
     @pmb_mysql_query($requete, $dbh);
     //suppression des droits d'acces user_notice
     $requete = "delete from acces_res_1 where res_num=" . $id;
     @pmb_mysql_query($requete, $dbh);
     // suppression des tags
     $rqt_del = "delete from tags where num_notice=" . $id;
     @pmb_mysql_query($rqt_del, $dbh);
     //suppression des avis
     $requete = "delete from avis where num_notice=" . $id;
     @pmb_mysql_query($requete, $dbh);
     //suppression des droits d'acces empr_notice
     $requete = "delete from acces_res_2 where res_num=" . $id;
     @pmb_mysql_query($requete, $dbh);
     // Supression des liens avec les titres uniformes
     $requete = "DELETE FROM notices_titres_uniformes WHERE ntu_num_notice='{$id}'";
     @pmb_mysql_query($requete, $dbh);
     //Suppression dans les listes de lecture partagées
     $requete = "SELECT id_liste, notices_associees from opac_liste_lecture";
     $res = pmb_mysql_query($requete, $dbh);
     $id_tab = array();
     while ($notices = pmb_mysql_fetch_object($res)) {
         $id_tab = explode(',', $notices->notices_associees);
         for ($i = 0; $i < sizeof($id_tab); $i++) {
             if ($id_tab[$i] == $id) {
                 unset($id_tab[$i]);
             }
         }
         $requete = "UPDATE opac_liste_lecture set notices_associees='" . addslashes(implode(',', $id_tab)) . "' where id_liste='" . $notices->id_liste . "'";
         pmb_mysql_query($requete, $dbh);
     }
     // Suppression des résas
     $requete = "DELETE FROM resa WHERE resa_idnotice=" . $id;
     pmb_mysql_query($requete, $dbh);
     // Suppression des transferts_demande
     $requete = "DELETE FROM transferts_demande using transferts_demande, transferts WHERE num_transfert=id_transfert and num_notice=" . $id;
     pmb_mysql_query($requete, $dbh);
     // Suppression des transferts
     $requete = "DELETE FROM transferts WHERE num_notice=" . $id;
     pmb_mysql_query($requete, $dbh);
     //si intégré depuis une source externe, on supprime aussi la référence
     $query = "delete from notices_externes where num_notice=" . $id;
     @pmb_mysql_query($query, $dbh);
     $req = "delete from notices_authperso where notice_authperso_notice_num=" . $id;
     pmb_mysql_query($req, $dbh);
     //Suppression des emprises liées à la notice
     $req = "select map_emprise_id from map_emprises where map_emprise_type=11 and map_emprise_obj_num=" . $id;
     $result = pmb_mysql_query($req, $dbh);
     if (pmb_mysql_num_rows($result)) {
         $row = pmb_mysql_fetch_object($result);
         $query = "delete from map_emprises where map_emprise_obj_num=" . $id . " and map_emprise_type=11";
         pmb_mysql_query($query, $dbh);
         $req_areas = "delete from map_hold_areas where type_obj=11 and id_obj=" . $row->map_emprise_id;
         pmb_mysql_query($req_areas, $dbh);
     }
     $query = "update docwatch_items set item_num_notice=0 where item_num_notice = " . $id;
     pmb_mysql_query($query, $dbh);
     // Nettoyage indexation concepts
     $index_concept = new index_concept($id, TYPE_NOTICE);
     $index_concept->delete();
 }
Beispiel #10
0
 public function update_display_label($label)
 {
     global $base_path;
     $this->get_data_store();
     // On commence par supprimer le label existant
     $query = "delete {\n\t\t\t\t<" . $this->get_uri() . "> <http://www.w3.org/2004/02/skos/core#prefLabel> ?obj\n\t\t\t\t}";
     $this->data_store->query($query);
     // On insert le nouveau label
     $query = "insert into <pmb> {\n\t\t\t\t<" . $this->get_uri() . "> <http://www.w3.org/2004/02/skos/core#prefLabel> '" . $label . "'\n\t\t\t\t}";
     $this->data_store->query($query);
     // On réindexe
     $onto_store_config = array('db_name' => DATA_BASE, 'db_user' => USER_NAME, 'db_pwd' => USER_PASS, 'db_host' => SQL_SERVER, 'store_name' => 'ontology', 'max_errors' => 100, 'store_strip_mb_comp_str' => 0);
     $data_store_config = array('db_name' => DATA_BASE, 'db_user' => USER_NAME, 'db_pwd' => USER_PASS, 'db_host' => SQL_SERVER, 'store_name' => 'rdfstore', 'max_errors' => 100, 'store_strip_mb_comp_str' => 0);
     $tab_namespaces = array("skos" => "http://www.w3.org/2004/02/skos/core#", "dc" => "http://purl.org/dc/elements/1.1", "dct" => "http://purl.org/dc/terms/", "owl" => "http://www.w3.org/2002/07/owl#", "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdfs" => "http://www.w3.org/2000/01/rdf-schema#", "xsd" => "http://www.w3.org/2001/XMLSchema#", "pmb" => "http://www.pmbservices.fr/ontology#");
     $onto_index = new onto_index();
     $onto_index->load_handler($base_path . "/classes/rdf/skos_pmb.rdf", "arc2", $onto_store_config, "arc2", $data_store_config, $tab_namespaces, 'http://www.w3.org/2004/02/skos/core#prefLabel');
     $onto_index->maj($this->get_id());
     index_concept::update_linked_elements($this->get_id());
 }
function bul_do_form($obj, $bul_id = 0)
{
    // $obj = objet contenant les propriétés de l'exemplaire associé
    global $bul_expl_form;
    global $msg;
    // pour texte du bouton supprimer
    global $dbh;
    global $pmb_type_audit, $select_categ_prop;
    global $pmb_antivol;
    global $option_num_auto;
    global $pmb_rfid_activate, $pmb_rfid_serveur_url, $charset;
    global $pmb_expl_show_dates, $pmb_expl_show_lastempr;
    global $thesaurus_concepts_active;
    if (isset($option_num_auto)) {
        $requete = "DELETE from exemplaires_temp where sess not in (select SESSID from sessions)";
        $res = pmb_mysql_query($requete, $dbh);
        //Appel à la fonction de génération automatique de cb
        $code_exemplaire = init_gen_code_exemplaire(0, $obj->expl_bulletin);
        do {
            $code_exemplaire = gen_code_exemplaire(0, $obj->expl_bulletin, $code_exemplaire);
            $requete = "select expl_cb from exemplaires WHERE expl_cb='{$code_exemplaire}'";
            $res0 = pmb_mysql_query($requete, $dbh);
            $requete = "select cb from exemplaires_temp WHERE cb='{$code_exemplaire}' AND sess <>'" . SESSid . "'";
            $res1 = pmb_mysql_query($requete, $dbh);
        } while (pmb_mysql_num_rows($res0) || pmb_mysql_num_rows($res1));
        //Memorise dans temps le cb et la session pour le cas de multi utilisateur session
        $obj->expl_cb = $code_exemplaire;
        $requete = "INSERT INTO exemplaires_temp (cb ,sess) VALUES ('{$obj->expl_cb}','" . SESSid . "')";
        $res = pmb_mysql_query($requete, $dbh);
    }
    //on compte le nombre de prets pour cet exemplaire
    $req = "select count(arc_expl_id) as nb_prets from pret_archive where arc_expl_id = " . $obj->expl_id;
    $res = pmb_mysql_query($req);
    if (pmb_mysql_num_rows($res)) {
        $arch_pret = pmb_mysql_fetch_object($res);
        $nb_prets = $arch_pret->nb_prets;
    } else {
        $nb_prets = 0;
    }
    if ($nb_prets) {
        //dernière date de pret pour cet exemplaire
        $req = "select date_format(last_loan_date, '" . $msg["format_date"] . "') as date_last from exemplaires where expl_id = " . $obj->expl_id;
        $res = pmb_mysql_query($req);
        if (pmb_mysql_num_rows($res)) {
            $expl_pret = pmb_mysql_fetch_object($res);
            $date_last = $expl_pret->date_last;
            $info_nb_prets = str_replace("!!nb_prets!!", $nb_prets, $msg['expl_nbprets']);
            $query = "select count(pret_idexpl) ";
            $query .= "from pret, empr where pret_idexpl='" . $obj->expl_id . "' and pret_idempr=id_empr ";
            $result = pmb_mysql_query($query, $dbh);
            if ($result && pmb_mysql_result($result, 0, 0)) {
                $info_date_last = str_replace("!!date_last!!", $date_last, $msg['expl_lastpret_encours']);
            } else {
                $info_date_last = str_replace("!!date_last!!", $date_last, $msg['expl_lastpret_retour']);
            }
            print $info_nb_prets . " " . $info_date_last;
        }
    }
    // l'annulation du form renvoit à :
    $annuler = "./catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=" . $obj->expl_bulletin;
    $action = "./catalog.php?categ=serials&sub=bulletinage&action=expl_update";
    $expl_nbparts = $obj->expl_cb;
    if (!$obj->expl_nbparts) {
        $expl_nbparts = 1;
    } else {
        $expl_nbparts = $obj->expl_nbparts;
    }
    // mise à jour des champs de gestion
    $bul_expl_form = str_replace('!!bul_id!!', $obj->expl_bulletin, $bul_expl_form);
    $bul_expl_form = str_replace('!!id_form!!', md5(microtime()), $bul_expl_form);
    $bul_expl_form = str_replace('!!org_cb!!', htmlentities($obj->expl_cb, ENT_QUOTES, $charset), $bul_expl_form);
    $bul_expl_form = str_replace('!!expl_id!!', $obj->expl_id, $bul_expl_form);
    $bul_expl_form = str_replace('!!action!!', $action, $bul_expl_form);
    $bul_expl_form = str_replace('!!id!!', $obj->expl_notice, $bul_expl_form);
    $bul_expl_form = str_replace('!!cb!!', htmlentities($obj->expl_cb, ENT_QUOTES, $charset), $bul_expl_form);
    $bul_expl_form = str_replace('!!nbparts!!', htmlentities($expl_nbparts, ENT_QUOTES, $charset), $bul_expl_form);
    $bul_expl_form = str_replace('!!note!!', $obj->expl_note, $bul_expl_form);
    $bul_expl_form = str_replace('!!comment!!', $obj->expl_comment, $bul_expl_form);
    $bul_expl_form = str_replace('!!cote!!', $obj->expl_cote, $bul_expl_form);
    $bul_expl_form = str_replace('!!prix!!', $obj->expl_prix, $bul_expl_form);
    // select "type document"
    $bul_expl_form = str_replace('!!type_doc!!', do_selector('docs_type', 'expl_typdoc', $obj->expl_typdoc), $bul_expl_form);
    // select "section"
    $bul_expl_form = str_replace('!!section!!', do_selector_bul_section($obj->expl_section, $obj->expl_location), $bul_expl_form);
    // select "statut"
    $bul_expl_form = str_replace('!!statut!!', do_selector('docs_statut', 'expl_statut', $obj->expl_statut), $bul_expl_form);
    // select "localisation"
    //visibilité des exemplaires
    global $explr_visible_mod, $pmb_droits_explr_localises;
    if ($pmb_droits_explr_localises) {
        $where_clause_explr = "idlocation in (" . $explr_visible_mod . ") and";
    } else {
        $where_clause_explr = "";
    }
    $bul_expl_form = str_replace('!!localisation!!', gen_liste("select distinct idlocation, location_libelle from docs_location, docsloc_section where {$where_clause_explr} num_location=idlocation order by 2", "idlocation", "location_libelle", 'expl_location', "calcule_section(this);", $obj->expl_location, "", "", "", "", 0), $bul_expl_form);
    // select "code statistique"
    $bul_expl_form = str_replace('!!codestat!!', do_selector('docs_codestat', 'expl_codestat', $obj->expl_codestat), $bul_expl_form);
    // select "owner"
    $bul_expl_form = str_replace('!!owner!!', do_selector('lenders', 'expl_owner', $obj->expl_owner), $bul_expl_form);
    //dates creation / modification
    if ($obj->expl_id && ($pmb_expl_show_dates == '1' || $pmb_expl_show_dates == '3')) {
        $bul_expl_form = str_replace('<!-- msg_exp_cre_date -->', "<label class='etiquette' >" . htmlentities($msg['exp_cre_date'], ENT_QUOTES, $charset) . "</label>", $bul_expl_form);
        $bul_expl_form = str_replace('<!-- exp_cre_date -->', format_date($obj->create_date), $bul_expl_form);
        $bul_expl_form = str_replace('<!-- msg_exp_upd_date -->', "<label class='etiquette' >" . htmlentities($msg['exp_upd_date'], ENT_QUOTES, $charset) . "</label>", $bul_expl_form);
        $bul_expl_form = str_replace('<!-- exp_upd_date -->', format_date($obj->update_date), $bul_expl_form);
    }
    //dates dépôt / retour
    if ($obj->expl_id && ($pmb_expl_show_dates == '2' || $pmb_expl_show_dates == '3')) {
        $bul_expl_form = str_replace('<!-- msg_exp_filing_date -->', "<label class='etiquette' >" . htmlentities($msg['filing_date'], ENT_QUOTES, $charset) . "</label>", $bul_expl_form);
        $bul_expl_form = str_replace('<!-- exp_filing_date -->', format_date($obj->expl_date_depot), $bul_expl_form);
        $bul_expl_form = str_replace('<!-- msg_exp_return_date -->', "<label class='etiquette' >" . htmlentities($msg['return_date'], ENT_QUOTES, $charset) . "</label>", $bul_expl_form);
        $bul_expl_form = str_replace('<!-- exp_return_date -->', format_date($obj->expl_date_retour), $bul_expl_form);
    }
    // Indexation concept
    if ($thesaurus_concepts_active == 1) {
        $index_concept = new index_concept($obj->expl_id, TYPE_EXPL);
        $bul_expl_form = str_replace('<!-- index_concept_form -->', $index_concept->get_form("expl"), $bul_expl_form);
    }
    // select "type_antivol"
    $selector = "";
    if ($pmb_antivol > 0) {
        global $value_deflt_antivol;
        if ($obj->type_antivol == "") {
            $obj->type_antivol = $value_deflt_antivol;
        }
        // select "type_antivol"
        $selector = "\n\t\t<div class='colonne3'>\n\t\t<!-- code stat -->\n\t\t<label class='etiquette' for='type_antivol'>{$msg['type_antivol']}</label>\n\t\t<div class='row'>\n\t\t<select name='type_antivol' id='type_antivol'>";
        $selector .= "<option value='0'";
        if ($obj->type_antivol == 0) {
            $selector .= ' SELECTED';
        }
        $selector .= '>';
        $selector .= $msg["type_antivol_aucun"] . '</option>';
        $selector .= "<option value='1'";
        if ($obj->type_antivol == 1) {
            $selector .= ' SELECTED';
        }
        $selector .= '>';
        $selector .= $msg["type_antivol_magnetique"] . '</option>';
        $selector .= "<option value='2'";
        if ($obj->type_antivol == 2) {
            $selector .= ' SELECTED';
        }
        $selector .= '>';
        $selector .= $msg["type_antivol_autre"] . '</option>';
        $selector .= '</select></div></div>';
    }
    $bul_expl_form = str_replace('!!type_antivol!!', $selector, $bul_expl_form);
    $p_perso = new parametres_perso("expl");
    if (!$p_perso->no_special_fields) {
        $c = 0;
        $perso = "<hr />";
        global $expl_id_from;
        if ($expl_id_from && !$obj->expl_id) {
            $perso_id_expl = $expl_id_from;
        } elseif ($obj->expl_id) {
            $perso_id_expl = $obj->expl_id;
        } else {
            $perso_id_expl = 0;
        }
        $perso_ = $p_perso->show_editable_fields($perso_id_expl);
        for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
            $p = $perso_["FIELDS"][$i];
            if ($c == 0) {
                $perso .= "<div class='row'>\n";
            }
            $perso .= "<div class='colonne2'><label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . " </label>" . $p["COMMENT_DISPLAY"] . "<div class='row'>" . $p["AFF"] . "</div></div>\n";
            $c++;
            if ($c == 2) {
                $perso .= "</div>\n";
                $c = 0;
            }
        }
        if ($c == 1) {
            $perso .= "<div class='colonne2'>&nbsp;</div>\n</div>\n";
        }
        $perso = $perso_["CHECK_SCRIPTS"] . "\n" . $perso;
        $perso = "<div class='row'>" . $perso . "</div>";
    } else {
        $perso = "";
    }
    $bul_expl_form = str_replace("!!champs_perso!!", $perso, $bul_expl_form);
    // circulation des périodique
    $perio_circ_tpl = "";
    $in_circ = 0;
    if ($obj->expl_id) {
        $req = "select * from serialcirc_expl where num_serialcirc_expl_id=" . $obj->expl_id;
        $res_in_circ = pmb_mysql_query($req);
        if (pmb_mysql_num_rows($res_in_circ)) {
            $in_circ = 1;
            $perio_circ_tpl = "<label class='etiquette'>" . $msg['serialcirc_expl_in_circ'] . "</label>";
        }
    }
    if (!$in_circ) {
        $req = "select * from abts_abts, bulletins, serialcirc where abts_abts.num_notice =bulletin_notice and  bulletin_id=" . $obj->expl_bulletin . " and num_serialcirc_abt=abt_id\n\t\torder by abt_name";
        $res_circ = pmb_mysql_query($req);
        if ($nb = pmb_mysql_num_rows($res_circ)) {
            $perio_circ_tpl = "<input type='checkbox' name='serial_circ_add' value='1'> " . $msg['serialcirc_add_expl'];
            if ($nb > 1) {
                $perio_circ_tpl .= "<select name='abt_id'>";
            }
            while ($circ = pmb_mysql_fetch_object($res_circ)) {
                if ($nb == 1) {
                    $perio_circ_tpl .= "<input type='hidden' name='abt_id' value='" . $circ->abt_id . "' >";
                    break;
                }
                $perio_circ_tpl .= "<option value='" . $circ->abt_id . "'> " . htmlentities($circ->abt_name, ENT_QUOTES, $charset) . "</option>";
            }
            if ($nb > 1) {
                $perio_circ_tpl .= "</select>";
            }
        }
    }
    $bul_expl_form = str_replace("!!perio_circ_tpl!!", $perio_circ_tpl, $bul_expl_form);
    // bouton supprimer si modification
    if ($obj->expl_id) {
        $del_button = "<input type='button' class='bouton' value=' {$msg['63']} ' onClick=\"confirm_expl_delete();\">";
        $bt_dupliquer = "<input type='button' class='bouton' value=\"" . $msg['dupl_expl_bt'] . "\" name='dupl_ex' id='dupl_ex' onClick=\"unload_off();document.location='./catalog.php?categ=serials&sub=bulletinage&action=dupl_expl&bul_id=" . $obj->expl_bulletin . "&expl_id=" . $obj->expl_id . "' ; \" />";
        if ($pmb_type_audit) {
            $link_audit = "<input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=2&object_id={$obj->expl_id}', 'audit_popup', 700, 500, -2, -2, '{$select_categ_prop}')\" title='{$msg['audit_button']}' value='{$msg['audit_button']}' />";
        } else {
            $link_audit = "";
        }
    } else {
        $del_button = "";
        $link_audit = "";
        $bt_dupliquer = "";
    }
    //boutons selon droits
    $nex = new exemplaire($obj->cb, $obj->expl_id, $obj->notice, $obj->bulletin);
    if ($nex->explr_acces_autorise == "MODIF") {
        $bt_modifier = "<input type='submit' class='bouton' value=' {$msg['77']} ' onClick=\"return test_form(this.form)\" />";
    } else {
        $bt_modifier = "";
        $del_button = "";
        $bt_dupliquer = "";
    }
    if ($pmb_rfid_activate == 1 && $pmb_rfid_serveur_url) {
        $script_rfid_encode = "if(script_rfid_encode()==false) return false;";
        $bul_expl_form = str_replace('!!questionrfid!!', $script_rfid_encode, $bul_expl_form);
    } else {
        $bul_expl_form = str_replace('!!questionrfid!!', '', $bul_expl_form);
    }
    $bul_expl_form = str_replace('!!del!!', $del_button, $bul_expl_form);
    $bul_expl_form = str_replace('!!link_audit!!', $link_audit, $bul_expl_form);
    $bul_expl_form = str_replace('!!bt_dupliquer!!', $bt_dupliquer, $bul_expl_form);
    $bul_expl_form = str_replace('!!bt_modifier!!', $bt_modifier, $bul_expl_form);
    $bul_expl_form = str_replace('!!bul_id!!', $bul_id, $bul_expl_form);
    $bul_expl_form = str_replace('!!expl_id!!', $obj->expl_id, $bul_expl_form);
    // action du bouton annuler
    $bul_expl_form = str_replace('!!annuler_action!!', $annuler, $bul_expl_form);
    // rafraichissement de la liste des sections par rapport à la localisation sélectionnée
    //	$bul_expl_form .= "<script> calcule_section(document.forms['expl'].expl_location.options[document.forms['expl'].expl_location.selectedIndex].value); </script>";
    // zone du dernier emrunteur
    $last_pret = "";
    if ($pmb_expl_show_lastempr && $obj->expl_lastempr) {
        $lastempr = new emprunteur($obj->expl_lastempr, '', FALSE, 0);
        $last_pret = "<hr /><div class='row'><b>{$msg['expl_lastempr']} </b>";
        $link = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($lastempr->cb) . "'>";
        $last_pret .= $link . $lastempr->prenom . ' ' . $lastempr->nom . ' (' . $lastempr->cb . ')</a>';
        $last_pret .= "</div>";
    }
    // zone de l'emprunteur
    $query = "select empr_cb, empr_nom, empr_prenom, ";
    $query .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, ";
    $query .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, ";
    $query .= " IF(pret_retour>sysdate(),0,1) as retard ";
    $query .= " from pret, empr where pret_idexpl='" . $obj->expl_id . "' and pret_idempr=id_empr ";
    $result = pmb_mysql_query($query, $dbh);
    if (pmb_mysql_num_rows($result)) {
        $pret = pmb_mysql_fetch_object($result);
        $last_pret .= "<hr /><div class='row'><b>{$msg['380']}</b> ";
        $link = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($pret->empr_cb) . "'>";
        $last_pret .= $link . $pret->empr_prenom . ' ' . $pret->empr_nom . ' (' . $pret->empr_cb . ')</a>';
        $last_pret .= "&nbsp;{$msg[381]}&nbsp;" . $pret->aff_pret_date;
        $last_pret .= ".&nbsp;{$msg[358]}&nbsp;" . $pret->aff_pret_retour . ".";
        $last_pret .= "</div>";
    }
    return $bul_expl_form . $last_pret;
}
 /**
  * Méthode permettant de récupérer les autorités indexées avec un concept utilisant cette autorité
  * @param elements_list_tab $tab
  * @param authority_tabs $authority_tabs
  * @return authority_tab Onglet
  */
 protected static function get_tab_authorities_indexed_with_concept($tab, $authority)
 {
     global $dbh, $msg;
     $types_needed = array(TYPE_AUTHOR, TYPE_CATEGORY, TYPE_PUBLISHER, TYPE_COLLECTION, TYPE_SUBCOLLECTION, TYPE_SERIE, TYPE_TITRE_UNIFORME, TYPE_INDEXINT, TYPE_AUTHPERSO);
     $concepts_ids = $authority->get_concepts_ids();
     $nb_result = 0;
     if (count($concepts_ids)) {
         $query = 'select count(distinct num_object, type_object) from index_concept where num_concept in (' . implode(',', $concepts_ids) . ') and type_object in (' . implode(',', $types_needed) . ')';
         $nb_result = pmb_mysql_result(pmb_mysql_query($query, $dbh), 0, 0);
     }
     $tab->set_nb_results($nb_result);
     if (!$quoi && $nb_result) {
         // Si $quoi n'est pas valorisé et qu'on a des résultats, on valorise $quoi avec cet onglet
         $quoi = $tab->get_name();
     }
     if ($nb_result && $quoi == $tab->get_name()) {
         // On définit les filtres
         $filter = array('name' => 'common_indexed_authorities_by_types', 'label' => $msg['authority_tabs_common_indexed_authorities_by_types']);
         $tab->set_filters(array($filter));
         $groups = array();
         $query = 'select count(distinct num_object) as nb, type_object, id_authperso, authperso_name from index_concept left join authperso_authorities on num_object = id_authperso_authority and type_object = ' . TYPE_AUTHPERSO . ' left join authperso on id_authperso = authperso_authority_authperso_num where num_concept in (' . implode(',', $concepts_ids) . ') and type_object in (' . implode(',', $types_needed) . ') group by type_object, id_authperso';
         $result = pmb_mysql_query($query, $dbh);
         if ($result && pmb_mysql_num_rows($result)) {
             while ($row = pmb_mysql_fetch_object($result)) {
                 if ($row->type_object == TYPE_AUTHPERSO && !isset($groups[1000 + $row->id_authperso])) {
                     $groups[1000 + $row->id_authperso] = array('label' => $row->authperso_name, 'nb_results' => $row->nb);
                 } else {
                     if (!isset($groups[$row->type_object])) {
                         $groups[$row->type_object] = array('label' => authority::get_type_label_from_type_id(index_concept::get_aut_table_type_from_type($row->type_object)), 'nb_results' => $row->nb);
                     }
                 }
             }
         }
         if (count($groups)) {
             // On trie le tableau
             uasort($groups, array('authority_tabs', '_sort_groups_by_label'));
             $tab->add_groups($filter['name'], array('label' => $filter['label'], 'elements' => $groups));
             $filter_values = $tab->get_filter_values($filter['name']);
             $authpersos_needed = array();
             if ($filter_values && count($filter_values)) {
                 $types_needed = array();
                 foreach ($filter_values as $value) {
                     if ($value > 1000) {
                         if (!in_array(TYPE_AUTHPERSO, $types_needed)) {
                             $types_needed[] = TYPE_AUTHPERSO;
                         }
                         $authpersos_needed[] = $value - 1000;
                     } else {
                         $types_needed[] = $value;
                     }
                 }
             }
             $query = 'select SQL_CALC_FOUND_ROWS num_object, type_object, authperso_authority_authperso_num';
             $query .= ' from index_concept left join authperso_authorities on num_object = id_authperso_authority and type_object = ' . TYPE_AUTHPERSO;
             $query .= ' where num_concept in (' . implode(',', $concepts_ids) . ') and type_object in (' . implode(',', $types_needed) . ')';
             // si on a des filtres sur des authorités persos
             if (count($authpersos_needed)) {
                 $query .= ' and (authperso_authority_authperso_num is null or authperso_authority_authperso_num in (' . implode(',', $authpersos_needed) . '))';
             }
             $query .= authority_tabs::get_limit();
             // on lance la requête
             $result = pmb_mysql_query($query, $dbh);
             $records_ids = array();
             if ($result && pmb_mysql_num_rows($result)) {
                 while ($row = pmb_mysql_fetch_object($result)) {
                     $authority = new authority(0, $row->num_object, index_concept::get_aut_table_type_from_type($row->type_object));
                     $records_ids[] = $authority->get_id();
                 }
             }
             $nb_filtered_results = pmb_mysql_result(pmb_mysql_query('select FOUND_ROWS()'), 0, 0);
             $tab->set_nb_filtered_results($nb_filtered_results);
             $tab->set_contents($records_ids);
         }
     }
 }
Beispiel #13
0
 function update($with_print = true)
 {
     global $dbh, $msg;
     global $current_module, $pmb_explnum_statut;
     global $id_rep, $up_place;
     global $mime_vign;
     global $gestion_acces_active, $gestion_acces_empr_docnum;
     global $res_prf, $chk_rights, $prf_rad, $r_rad;
     global $thesaurus_concepts_active;
     $update = false;
     if ($this->explnum_id) {
         $requete = "UPDATE explnum SET ";
         $limiter = " WHERE explnum_id='{$this->explnum_id}' ";
         $update = true;
     } else {
         $requete = "INSERT INTO explnum SET ";
         $limiter = "";
     }
     if ($with_print) {
         print "<div class=\"row\"><h1>{$msg['explnum_doc_associe']}</h1>";
     }
     if (!$this->params["erreur"]) {
         $requete .= " explnum_notice='" . $this->infos_docnum["notice"] . "'";
         $requete .= ", explnum_bulletin='" . $this->infos_docnum["bull"] . "'";
         $requete .= ", explnum_nom='" . $this->infos_docnum["nom"] . "'";
         $requete .= ", explnum_url='" . $this->infos_docnum["url"] . "'";
         if ($this->params["maj_mimetype"]) {
             $requete .= ", explnum_mimetype='" . $this->infos_docnum["mime"] . "' ";
         }
         if ($this->params["maj_data"]) {
             if (!$this->params["is_upload"]) {
                 $requete .= ", explnum_data='" . addslashes($this->infos_docnum["contenu"]) . "'";
             }
             $requete .= ", explnum_nomfichier='" . addslashes($this->infos_docnum["userfile_name"]) . "'";
             $requete .= ", explnum_extfichier='" . addslashes($this->infos_docnum["userfile_ext"]) . "'";
         }
         if ($this->params["maj_vignette"] && !$this->params["conservervignette"]) {
             $requete .= ", explnum_vignette='" . addslashes($this->infos_docnum["contenu_vignette"]) . "'";
         }
         if ($pmb_explnum_statut == '1') {
             $requete .= ", explnum_statut='" . $this->params["statut"] . "'";
         }
         $requete .= ", explnum_repertoire='" . ($up_place ? $id_rep : 0) . "'";
         $requete .= ", explnum_path='" . $this->infos_docnum["path"] . "'";
         $requete .= ", explnum_docnum_statut='" . $this->params["explnum_statut"] . "'";
         $requete .= $limiter;
         pmb_mysql_query($requete, $dbh);
         if (!$update) {
             $this->explnum_id = pmb_mysql_insert_id();
         }
         //traitement des droits acces user_docnum
         if ($gestion_acces_active == 1 && $gestion_acces_empr_docnum == 1) {
             $ac = new acces();
             $dom_3 = $ac->setDomain(3);
             if ($update) {
                 $dom_3->storeUserRights(1, $this->explnum_id, $res_prf, $chk_rights, $prf_rad, $r_rad);
             } else {
                 $dom_3->storeUserRights(0, $this->explnum_id, $res_prf, $chk_rights, $prf_rad, $r_rad);
             }
         }
         //Indexation du document
         global $pmb_indexation_docnum;
         if ($pmb_indexation_docnum) {
             $vign_index = $this->indexer_docnum();
             if (!$mime_vign && !$this->params["conservervignette"] && !$this->infos_docnum["vignette_name"]) {
                 if ($vign_index) {
                     $req_mime = "update explnum set explnum_vignette='" . addslashes($vign_index) . "' where explnum_id='" . $this->explnum_id . "'";
                     pmb_mysql_query($req_mime, $dbh);
                 } else {
                     $contenu_vignette = construire_vignette("", "", $this->infos_docnum["url"]);
                     if ($contenu_vignette) {
                         $req_mime = "update explnum set explnum_vignette='" . addslashes($contenu_vignette) . "' where explnum_id='" . $this->explnum_id . "'";
                         pmb_mysql_query($req_mime, $dbh);
                     }
                 }
             }
         } elseif (!$mime_vign && !$this->params["conservervignette"] && !$this->infos_docnum["vignette_name"] && $this->infos_docnum["url"]) {
             //Si pas d'indexation et que je ne force pas la vignette en fonction du mimetype et si j'ai une url
             $contenu_vignette = construire_vignette("", "", $this->infos_docnum["url"]);
             if ($contenu_vignette) {
                 $req_mime = "update explnum set explnum_vignette='" . addslashes($contenu_vignette) . "' where explnum_id='" . $this->explnum_id . "'";
                 pmb_mysql_query($req_mime, $dbh);
             }
         }
         // Segmentation du document
         global $pmb_diarization_docnum;
         if ($pmb_diarization_docnum) {
             $this->diarization_docnum();
         }
         // Indexation concepts
         if ($thesaurus_concepts_active == 1) {
             $index_concept = new index_concept($this->explnum_id, TYPE_EXPLNUM);
             $index_concept->save();
         }
         //On enregistre la ou les localisations
         global $loc_selector;
         if ($update) {
             $req = "delete from explnum_location where num_explnum='" . $this->explnum_id . "'";
             pmb_mysql_query($req, $dbh);
         }
         if (count($loc_selector) == 1 && $loc_selector[0] == -1) {
             //Ne rien faire
             //$req = "select idlocation from docs_location";
             //$res = pmb_mysql_query($req,$dbh);
             //while($loc=pmb_mysql_fetch_object($res)){
             //	$req = "replace into explnum_location set num_explnum='".$this->explnum_id."', num_location='".$loc->idlocation."'";
             //	pmb_mysql_query($req,$dbh);
             //}
         } else {
             for ($i = 0; $i < count($loc_selector); $i++) {
                 $req = "replace into explnum_location set num_explnum='" . $this->explnum_id . "', num_location='" . $loc_selector[$i] . "'";
                 pmb_mysql_query($req, $dbh);
             }
         }
         // on reaffiche l'ISBD
         if ($with_print) {
             print "<div class='row'><div class='msg-perio'>" . $msg['maj_encours'] . "</div></div>";
         }
         $id_form = md5(microtime());
         if (pmb_mysql_error()) {
             if ($with_print) {
                 echo "MySQL error : " . pmb_mysql_error();
                 print "\n\t\t\t\t\t\t\t<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"" . $this->params["retour"] . "\" >\n\t\t\t\t\t\t\t\t<input type='submit' class='bouton' name=\"id_form\" value=\"Ok\">\n\t\t\t\t\t\t\t\t</form>";
                 print "</div>";
             }
             exit;
         }
         if ($with_print) {
             print "\n\t\t\t\t\t<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"" . $this->params["retour"] . "\" style=\"display:none\">\n\t\t\t\t\t\t<input type=\"hidden\" name=\"id_form\" value=\"{$id_form}\">\n\t\t\t\t\t\t</form>";
             print "<script type=\"text/javascript\">document.dummy.submit();</script>";
         }
     } else {
         eval("\$bid=\"" . $msg['explnum_erreurupload'] . "\";");
         if ($with_print) {
             print "<div class='row'><div class='msg-perio'>" . $bid . "</div></div>";
             print "\n\t\t\t\t\t<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"" . $this->params["retour"] . "\" >\n\t\t\t\t\t\t<input type='submit' class='bouton' name=\"id_form\" value=\"Ok\">\n\t\t\t\t\t</form>";
         }
     }
     if ($with_print) {
         print "</div>";
     }
 }
Beispiel #14
0
     $liaison_tpl = str_replace("<!-- categ_renvoivoiraussi -->", $categ_renvoivoiraussi_content, $liaison_tpl);
     $category_form = str_replace("<!-- liaison -->", $liaison_tpl, $category_form);
 } else {
     $category_form = str_replace("<!-- liaison -->", "", $category_form);
 }
 //Numéro d'autorité
 $form_num_aut = str_replace("!!num_aut!!", $num_aut, $form_num_aut);
 $category_form = str_replace("<!-- numero_autorite -->", $form_num_aut, $category_form);
 // Indexation concepts
 if ($id) {
     $id_categ = $id;
 } else {
     $id_categ = 0;
 }
 if ($thesaurus_concepts_active == 1) {
     $index_concept = new index_concept($id, TYPE_CATEGORY);
     $category_form = str_replace('!!concept_form!!', $index_concept->get_form('categ_form'), $category_form);
 } else {
     $category_form = str_replace('!!concept_form!!', "", $category_form);
 }
 if ($id) {
     // Impression de la branche du thésaurus
     $lien_impression_thesaurus = "<a href='#' onClick=\"openPopUp('./print_thesaurus.php?current_print=2&action=print_prepare&aff_num_thesaurus=" . $id_thes . "&id_noeud_origine={$id}','print', 500, 600, -2, -2, 'scrollbars=yes,menubar=0,resizable=yes'); return false;\">" . $msg[print_branche] . "</a>";
     $category_form = str_replace("<!-- imprimer_thesaurus -->", $lien_impression_thesaurus, $category_form);
 }
 //Remplacement
 $button_remplace = "<input type='button' class='bouton' value='{$msg['158']}' ";
 $button_remplace .= "onclick='unload_off();document.location=\"./autorites.php?categ=categories&sub=categ_replace&id={$id}&parent={$parent}\"'/>";
 $category_form = str_replace("<!-- remplace_categ -->", $button_remplace, $category_form);
 //Suppression
 $category_form = str_replace('<!-- delete_button -->', $delete_button, $category_form);
 function update($value, $force_creation = false)
 {
     global $dbh;
     global $msg, $charset;
     global $include_path;
     global $thesaurus_concepts_active;
     // nettoyage des valeurs en entrée
     $value['name'] = clean_string($value['name']);
     $value['issn'] = clean_string($value['issn']);
     if (!$value['parent']) {
         if ($value['publisher']) {
             //on les a, on crée l'éditeur
             $value['publisher'] = stripslashes_array($value['publisher']);
             //La fonction d'import fait les addslashes contrairement à l'update
             $value['parent'] = editeur::import($value['publisher']);
         }
     }
     if (!$value['name'] || !$value['parent']) {
         return false;
     }
     // construction de la requête
     $requete = 'SET collection_name="' . $value['name'] . '", ';
     $requete .= 'collection_parent="' . $value['parent'] . '", ';
     $requete .= 'collection_issn="' . $value['issn'] . '", ';
     $requete .= 'collection_web="' . $value['collection_web'] . '", ';
     $requete .= 'collection_comment="' . $value['comment'] . '", ';
     $requete .= 'index_coll=" ' . strip_empty_words($value['name']) . ' ' . strip_empty_words($value['issn']) . ' "';
     if ($this->id) {
         // update
         $requete = 'UPDATE collections ' . $requete;
         $requete .= ' WHERE collection_id=' . $this->id . ' ;';
         if (pmb_mysql_query($requete, $dbh)) {
             $requete = "update notices set ed1_id='" . $value[parent] . "' WHERE coll_id='" . $this->id . "' ";
             $res = pmb_mysql_query($requete, $dbh);
             // liens entre autorités
             $aut_link = new aut_link(AUT_TABLE_COLLECTIONS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("collection", $this->id);
             $aut_pperso->save_form();
             audit::insert_modif(AUDIT_COLLECTION, $this->id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[167], htmlentities($msg[169] . " -> " . $this->display, ENT_QUOTES, $charset));
             return FALSE;
         }
     } else {
         if (!$force_creation) {
             // création : s'assurer que la collection n'existe pas déjà
             if ($id_collection_exists = collection::check_if_exists($value)) {
                 $collection_exists = new collection($id_collection_exists);
                 require_once "{$include_path}/user_error.inc.php";
                 warning($msg[167], htmlentities($msg[171] . " -> " . $collection_exists->display, ENT_QUOTES, $charset));
                 return FALSE;
             }
         }
         $requete = 'INSERT INTO collections ' . $requete . ';';
         if (pmb_mysql_query($requete, $dbh)) {
             $this->id = pmb_mysql_insert_id();
             // liens entre autorités
             $aut_link = new aut_link(AUT_TABLE_COLLECTIONS, $this->id);
             $aut_link->save_form();
             audit::insert_creation(AUDIT_COLLECTION, $this->id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[167], htmlentities($msg[170] . " -> " . $requete, ENT_QUOTES, $charset));
             return FALSE;
         }
     }
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->id, TYPE_COLLECTION);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->id, "collection");
     if ($value['subcollections']) {
         for ($i = 0; $i < count($value['subcollections']); $i++) {
             $subcoll = stripslashes_array($value['subcollections'][$i]);
             //La fonction d'import fait les addslashes contrairement à l'update
             $subcoll['coll_parent'] = $this->id;
             subcollection::import($subcoll);
         }
     }
     //update authority informations
     $authority = new authority(0, $this->id, AUT_TABLE_COLLECTIONS);
     $authority->set_num_statut($value['statut']);
     $authority->update();
     collection::update_index($this->id);
     return true;
 }
Beispiel #16
0
 function update($value)
 {
     global $dbh;
     global $msg;
     global $include_path;
     global $pmb_synchro_rdf;
     global $thesaurus_concepts_active;
     if (!$value['name']) {
         return false;
     }
     // nettoyage des valeurs en entree
     $value[name] = clean_string($value[name]);
     $value[adr1] = clean_string($value[adr1]);
     $value[adr2] = clean_string($value[adr2]);
     $value[cp] = clean_string($value[cp]);
     $value[ville] = clean_string($value[ville]);
     $value[pays] = clean_string($value[pays]);
     $value[web] = clean_string($value[web]);
     // construction de la requete
     $requete = "SET ed_name='{$value['name']}', ";
     $requete .= "ed_adr1='{$value['adr1']}', ";
     $requete .= "ed_adr2='{$value['adr2']}', ";
     $requete .= "ed_cp='{$value['cp']}', ";
     $requete .= "ed_ville='{$value['ville']}', ";
     $requete .= "ed_pays='{$value['pays']}', ";
     $requete .= "ed_web='{$value['web']}', ";
     $requete .= "ed_comment='{$value['ed_comment']}', ";
     $requete .= "index_publisher=' " . strip_empty_chars($value[name] . " " . $value[ville] . " " . $value[pays]) . " '";
     if ($this->id) {
         // update
         $requete = 'UPDATE publishers ' . $requete;
         $requete .= ' WHERE ed_id=' . $this->id . ' LIMIT 1;';
         if (pmb_mysql_query($requete, $dbh)) {
             $aut_link = new aut_link(AUT_TABLE_PUBLISHERS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("publisher", $this->id);
             $aut_pperso->save_form();
             editeur::update_index($this->id);
             audit::insert_modif(AUDIT_PUBLISHER, $this->id);
             //mise à jour de l'éditeur dans la base rdf
             if ($pmb_synchro_rdf) {
                 $synchro_rdf = new synchro_rdf();
                 $synchro_rdf->updateAuthority($this->id, 'editeur');
             }
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[145], $msg[150]);
             return FALSE;
         }
     } else {
         // s'assurer que l'editeur n'existe pas deja
         // on teste sur le nom et la ville seulement. voir a l'usage si necessaire de tester plus
         if (editeur::check_if_exists($value)) {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[145], $msg[149] . " ({$value['name']}).");
             return FALSE;
         }
         $requete = 'INSERT INTO publishers ' . $requete . ';';
         if (pmb_mysql_query($requete, $dbh)) {
             $this->id = pmb_mysql_insert_id();
             $aut_link = new aut_link(AUT_TABLE_PUBLISHERS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("publisher", $this->id);
             $aut_pperso->save_form();
             audit::insert_creation(AUDIT_PUBLISHER, $this->id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[145], $msg[151]);
             return FALSE;
         }
     }
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->id, TYPE_PUBLISHER);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->id, "publisher");
     return TRUE;
 }
 function delete($id)
 {
     global $dbh;
     $p_perso = new custom_parametres_perso("authperso", "authperso", $this->id);
     $p_perso->delete_values($id);
     // nettoyage indexation concepts
     $index_concept = new index_concept($id, TYPE_AUTHPERSO);
     $index_concept->delete();
     indexation_authperso::delete_all_index($id, "authorities", "id_authority", AUT_TABLE_AUTHPERSO);
     // effacement de l'identifiant unique d'autorité
     $authority = new authority(0, $id, AUT_TABLE_AUTHPERSO);
     $authority->delete();
     $req = "DELETE FROM authperso_authorities where id_authperso_authority=" . $id;
     $resultat = pmb_mysql_query($req);
     audit::delete_audit($this->id + 1000, $id);
 }
Beispiel #18
0
 function update($value)
 {
     global $dbh;
     global $msg;
     global $include_path;
     global $thesaurus_concepts_active;
     global $authority_statut;
     if (!$value) {
         return false;
     }
     // nettoyage de la chaîne en entrée
     $value = clean_string($value);
     $requete = 'SET serie_name="' . $value . '", ';
     $requete .= 'serie_index=" ' . strip_empty_words($value) . '" ';
     if ($this->s_id) {
         // update
         $requete = 'UPDATE series ' . $requete;
         $requete .= ' WHERE serie_id=' . $this->s_id . ' LIMIT 1;';
         if (pmb_mysql_query($requete, $dbh)) {
             $rqt_notice = "select notice_id,tit1,tit2,tit3,tit4 from notices where tparent_id=" . $this->s_id;
             $r_notice = pmb_mysql_query($rqt_notice);
             while ($r = pmb_mysql_fetch_object($r_notice)) {
                 $rq_serie = "update notices, series set notices.index_serie=serie_index, notices.index_wew=concat(serie_name,' ',tit1,' ',tit2,' ',tit3,' ',tit4),notices.index_sew=concat(' ',serie_index,' ','" . addslashes(strip_empty_words($r->tit1 . " " . $r->tit2 . " " . $r->tit3 . " " . $r->tit4)) . "',' ') where notice_id=" . $r->notice_id . " and serie_id=tparent_id";
                 pmb_mysql_query($rq_serie);
             }
             $aut_link = new aut_link(AUT_TABLE_SERIES, $this->s_id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("serie", $this->s_id);
             $aut_pperso->save_form();
             audit::insert_modif(AUDIT_SERIE, $this->s_id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[337], $msg[341]);
             return FALSE;
         }
     } else {
         // création : s'assurer que le titre n'existe pas déjà
         $dummy = "SELECT * FROM series WHERE serie_name REGEXP '^{$value}\$' LIMIT 1 ";
         $check = pmb_mysql_query($dummy, $dbh);
         if (pmb_mysql_num_rows($check)) {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[336], $msg[340]);
             return FALSE;
         }
         $requete = 'INSERT INTO series ' . $requete . ';';
         if (pmb_mysql_query($requete, $dbh)) {
             $this->s_id = pmb_mysql_insert_id();
             $aut_link = new aut_link(AUT_TABLE_SERIES, $this->s_id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("serie", $this->s_id);
             $aut_pperso->save_form();
             audit::insert_creation(AUDIT_SERIE, $this->s_id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[336], $msg[342]);
             return FALSE;
         }
     }
     //update authority informations
     $authority = new authority(0, $this->s_id, AUT_TABLE_SERIES);
     $authority->set_num_statut($authority_statut);
     $authority->update();
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->s_id, TYPE_SERIE);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->s_id, "serie");
     serie::update_index($this->s_id);
     return TRUE;
 }
Beispiel #19
0
 function do_isbd()
 {
     global $dbh, $base_path;
     global $langue_doc;
     global $msg;
     global $tdoc;
     global $fonction_auteur;
     global $charset;
     global $thesaurus_mode_pmb, $thesaurus_categories_categ_in_line, $pmb_keyword_sep, $thesaurus_categories_affichage_ordre;
     global $load_tablist_js;
     global $lang;
     global $categories_memo, $libelle_thesaurus_memo;
     global $categories_top, $use_opac_url_base, $opac_url_base, $thesaurus_categories_show_only_last;
     global $categ;
     global $id_empr;
     global $pmb_show_notice_id, $pmb_opac_url, $pmb_show_permalink;
     global $sort_children;
     global $pmb_resa_planning;
     global $thesaurus_concepts_active;
     global $pmb_map_activate;
     global $pmb_nomenclature_activate;
     // constitution de la mention de titre
     if ($this->tit_serie) {
         if ($this->print_mode) {
             $this->isbd = $this->tit_serie;
         } else {
             $this->isbd = $this->tit_serie_lien_gestion;
         }
         if ($this->notice->tnvol) {
             $this->isbd .= ',&nbsp;' . $this->notice->tnvol;
         }
     }
     $this->isbd ? $this->isbd .= '.&nbsp;' . $this->notice->tit1 : ($this->isbd = $this->notice->tit1);
     $tit2 = $this->notice->tit2;
     $tit3 = $this->notice->tit3;
     $tit4 = $this->notice->tit4;
     if ($tit3) {
         $this->isbd .= "&nbsp;= {$tit3}";
     }
     if ($tit4) {
         $this->isbd .= "&nbsp;: {$tit4}";
     }
     if ($tit2) {
         $this->isbd .= "&nbsp;; {$tit2}";
     }
     $this->isbd .= ' [' . $tdoc->table[$this->notice->typdoc] . ']';
     $mention_resp = array();
     // constitution de la mention de responsabilité
     //$this->responsabilites
     $as = array_search("0", $this->responsabilites["responsabilites"]);
     if ($as !== FALSE && $as !== NULL) {
         $auteur_0 = $this->responsabilites["auteurs"][$as];
         $auteur = new auteur($auteur_0["id"]);
         if ($this->print_mode) {
             $mention_resp_lib = $auteur->isbd_entry;
         } else {
             $mention_resp_lib = $auteur->isbd_entry_lien_gestion;
         }
         if (!$this->print_mode) {
             $mention_resp_lib .= $auteur->author_web_link;
         }
         if ($auteur_0["fonction"]) {
             $mention_resp_lib .= ", " . $fonction_auteur[$auteur_0["fonction"]];
         }
         $mention_resp[] = $mention_resp_lib;
     }
     $as = array_keys($this->responsabilites["responsabilites"], "1");
     for ($i = 0; $i < count($as); $i++) {
         $indice = $as[$i];
         $auteur_1 = $this->responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_1["id"]);
         if ($this->print_mode) {
             $mention_resp_lib = $auteur->isbd_entry;
         } else {
             $mention_resp_lib = $auteur->isbd_entry_lien_gestion;
         }
         if (!$this->print_mode) {
             $mention_resp_lib .= $auteur->author_web_link;
         }
         if ($auteur_1["fonction"]) {
             $mention_resp_lib .= ", " . $fonction_auteur[$auteur_1["fonction"]];
         }
         $mention_resp[] = $mention_resp_lib;
     }
     $as = array_keys($this->responsabilites["responsabilites"], "2");
     for ($i = 0; $i < count($as); $i++) {
         $indice = $as[$i];
         $auteur_2 = $this->responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_2["id"]);
         if ($this->print_mode) {
             $mention_resp_lib = $auteur->isbd_entry;
         } else {
             $mention_resp_lib = $auteur->isbd_entry_lien_gestion;
         }
         if (!$this->print_mode) {
             $mention_resp_lib .= $auteur->author_web_link;
         }
         if ($auteur_2["fonction"]) {
             $mention_resp_lib .= ", " . $fonction_auteur[$auteur_2["fonction"]];
         }
         $mention_resp[] = $mention_resp_lib;
     }
     $libelle_mention_resp = implode("; ", $mention_resp);
     if ($libelle_mention_resp) {
         $this->isbd .= "&nbsp;/ {$libelle_mention_resp}";
     }
     // mention d'édition
     if ($this->notice->mention_edition) {
         $this->isbd .= ".&nbsp;-&nbsp;" . $this->notice->mention_edition;
     }
     if ($pmb_map_activate) {
         if ($mapisbd = $this->map_info->get_isbd()) {
             $this->isbd .= $mapisbd;
         }
     }
     // zone de l'adresse
     // on récupère la collection au passage, si besoin est
     if ($this->notice->subcoll_id) {
         $collection = new subcollection($this->notice->subcoll_id);
         $ed_obj = new editeur($collection->editeur);
         if ($this->print_mode) {
             $editeurs .= $ed_obj->isbd_entry;
             $collections = $collection->isbd_entry;
         } else {
             $editeurs .= $ed_obj->isbd_entry_lien_gestion;
             $collections = $collection->isbd_entry_lien_gestion;
         }
     } elseif ($this->notice->coll_id) {
         $collection = new collection($this->notice->coll_id);
         $ed_obj = new editeur($collection->parent);
         if ($this->print_mode) {
             $editeurs .= $ed_obj->isbd_entry;
             $collections = $collection->isbd_entry;
         } else {
             $editeurs .= $ed_obj->isbd_entry_lien_gestion;
             $collections = $collection->isbd_entry_lien_gestion;
         }
     } elseif ($this->notice->ed1_id) {
         $editeur = new editeur($this->notice->ed1_id);
         if ($this->print_mode) {
             $editeurs .= $editeur->isbd_entry;
         } else {
             $editeurs .= $editeur->isbd_entry_lien_gestion;
         }
     }
     if ($this->notice->ed2_id) {
         $editeur = new editeur($this->notice->ed2_id);
         if ($this->print_mode) {
             $ed_isbd = $editeur->isbd_entry;
         } else {
             $ed_isbd = $editeur->isbd_entry_lien_gestion;
         }
         $editeurs ? $editeurs .= '&nbsp;; ' . $ed_isbd : ($editeurs = $ed_isbd);
     }
     if ($this->notice->year) {
         $editeurs ? $editeurs .= ', ' . $this->notice->year : ($editeurs = $this->notice->year);
     } elseif ($this->notice->niveau_biblio != 'b') {
         $editeurs ? $editeurs .= ', [s.d.]' : ($editeurs = "[s.d.]");
     }
     if ($editeurs) {
         $this->isbd .= ".&nbsp;-&nbsp;{$editeurs}";
     }
     // zone de la collation (ne concerne que a2)
     if ($this->notice->npages) {
         $collation = $this->notice->npages;
     }
     if ($this->notice->ill) {
         $collation .= ': ' . $this->notice->ill;
     }
     if ($this->notice->size) {
         $collation .= '; ' . $this->notice->size;
     }
     if ($this->notice->accomp) {
         $collation .= '+ ' . $this->notice->accomp;
     }
     if ($collation) {
         $this->isbd .= ".&nbsp;-&nbsp;{$collation}";
     }
     if ($collections) {
         if ($this->notice->nocoll) {
             $collections .= '; ' . $this->notice->nocoll;
         }
         $this->isbd .= ".&nbsp;-&nbsp;({$collections})" . ' ';
     }
     if (substr(trim($this->isbd), -1) != ".") {
         $this->isbd .= '.';
     }
     // note générale
     if ($this->notice->n_gen) {
         $zoneNote = nl2br(htmlentities($this->notice->n_gen, ENT_QUOTES, $charset)) . ' ';
     }
     // ISBN ou NO. commercial
     if ($this->notice->code) {
         if (isISBN($this->notice->code)) {
             if ($zoneNote) {
                 $zoneNote .= '.&nbsp;-&nbsp;ISBN ';
             } else {
                 $zoneNote = 'ISBN ';
             }
         } else {
             if ($zoneNote) {
                 $zoneNote .= '.&nbsp;-&nbsp;';
             }
         }
         $zoneNote .= $this->notice->code;
     }
     if ($this->notice->prix) {
         if ($this->notice->code) {
             $zoneNote .= '&nbsp;: ' . $this->notice->prix;
         } else {
             if ($zoneNote) {
                 $zoneNote .= '&nbsp; ' . $this->notice->prix;
             } else {
                 $zoneNote = $this->notice->prix;
             }
         }
     }
     if ($zoneNote) {
         $this->isbd .= "<br /><br />{$zoneNote}.";
     }
     //In
     //Recherche des notices parentes
     if (!$this->no_link) {
         $requete = "select linked_notice, relation_type, rank, l.niveau_biblio as lnb, l.niveau_hierar as lnh from notices_relations, notices as l where num_notice=" . $this->notice_id . " and linked_notice=l.notice_id order by relation_type,rank";
         $result_linked = pmb_mysql_query($requete) or die(pmb_mysql_error());
         //Si il y en a, on prépare l'affichage
         if (pmb_mysql_num_rows($result_linked)) {
             global $relation_listup;
             if (!$relation_listup) {
                 $relation_listup = new marc_list("relationtypeup");
             }
         }
         $r_type = array();
         $ul_opened = false;
         $r_type_local = "";
         //Pour toutes les notices liées
         while ($r_rel = pmb_mysql_fetch_object($result_linked)) {
             //Pour avoir le lien par défaut
             if (!$this->print_mode && SESSrights & CATALOGAGE_AUTH) {
                 $link_parent = $base_path . '/catalog.php?categ=isbd&id=!!id!!';
             } else {
                 $link_parent = "";
             }
             if ($r_rel->lnb == 's' && $r_rel->lnh == '1') {
                 // c'est une notice chapeau
                 global $link_serial, $link_analysis, $link_bulletin, $link_explnum_serial;
                 $link_serial_sub = $base_path . "/catalog.php?categ=serials&sub=view&serial_id=" . $r_rel->linked_notice;
                 // function serial_display ($id, $level='1', $action_serial='', $action_analysis='', $action_bulletin='', $lien_suppr_cart="", $lien_explnum="", $bouton_explnum=1,$print=0,$show_explnum=1, $show_statut=0, $show_opac_hidden_fields=true, $draggable=0 ) {
                 $serial = new serial_display($r_rel->linked_notice, 0, $link_serial_sub, $link_analysis, $link_bulletin, "", "", 0, $this->print_mode, $this->show_explnum, $this->show_statut, $this->show_opac_hidden_fields, 1, true);
                 $aff = $serial->header;
             } else {
                 if ($r_rel->lnb == 'a' && $r_rel->lnh == '2') {
                     // c'est un dépouillement de bulletin
                     global $link_serial, $link_analysis, $link_bulletin, $link_explnum_serial;
                     if (!$link_analysis) {
                         $link_analysis = $base_path . "/catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=!!bul_id!!&art_to_show=!!id!!";
                     }
                     $serial = new serial_display($r_rel->linked_notice, 0, $link_serial, $link_analysis, $link_bulletin, "", "", 0, $this->print_mode, $this->show_explnum, $this->show_statut, $this->show_opac_hidden_fields, 1, true);
                     $aff = $serial->result;
                 } else {
                     if ($link_parent && $r_rel->lnb == 'b' && $r_rel->lnh == '2') {
                         $requete = "SELECT bulletin_id FROM bulletins WHERE num_notice='" . $r_rel->linked_notice . "'";
                         $res = pmb_mysql_query($requete);
                         if (pmb_mysql_num_rows($res)) {
                             $link_parent = $base_path . "/catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=" . pmb_mysql_result($res, 0, 0);
                         }
                     }
                     // dans les autres cas
                     $parent_notice = new mono_display($r_rel->linked_notice, 0, $link_parent, 1, '', "", '', 0, $this->print_mode, $this->show_explnum, $this->show_statut, '', 1, true, $this->show_opac_hidden_fields, 0);
                     $aff = $parent_notice->header;
                     $this->nb_expl += $parent_notice->nb_expl;
                 }
             }
             //$parent_notice=new mono_display($r_rel->linked_notice,0,$link_parent);
             //Présentation différente si il y en a un ou plusieurs
             if (pmb_mysql_num_rows($result_linked) == 1) {
                 $this->isbd .= "<br /><b>" . $relation_listup->table[$r_rel->relation_type] . "</b> " . $aff . "<br />";
             } else {
                 if ($r_rel->relation_type != $r_type_local) {
                     $r_type_local = $r_rel->relation_type;
                     if ($ul_opened) {
                         $this->isbd .= "</ul>";
                         $this->isbd .= "\n<b>" . $relation_listup->table[$r_rel->relation_type] . "</b>";
                         $this->isbd .= "\n<ul class='notice_rel'>\n";
                         $ul_opened = true;
                     } else {
                         $this->isbd .= "\n<br />";
                         $this->isbd .= "\n<b>" . $relation_listup->table[$r_rel->relation_type] . "</b>";
                         $this->isbd .= "\n<ul class='notice_rel'>\n";
                         $ul_opened = true;
                     }
                 }
                 $this->isbd .= "\n<li>" . $aff . "</li>\n";
             }
         }
         if ($ul_opened) {
             $this->isbd .= "\n</ul>\n";
         }
     }
     if ($pmb_show_notice_id || $pmb_show_permalink) {
         $this->isbd .= "<br />";
     }
     if ($pmb_show_notice_id) {
         $prefixe = explode(",", $pmb_show_notice_id);
         $this->isbd .= "<b>" . $msg['notice_id_libelle'] . "&nbsp;</b>" . ($prefixe[1] ? $prefixe[1] : '') . $this->notice_id . "<br />";
     }
     // Permalink OPAC
     if ($pmb_show_permalink) {
         $this->isbd .= "<b>" . $msg["notice_permalink_opac"] . "&nbsp;</b><a href='" . $pmb_opac_url . "index.php?lvl=notice_display&id=" . $this->notice_id . "' target=\"__LINK__\">" . $pmb_opac_url . "index.php?lvl=notice_display&id=" . $this->notice_id . "</a><br />";
     }
     // niveau 1
     if ($this->level == 1) {
         if (!$this->print_mode) {
             $this->isbd .= "<!-- !!bouton_modif!! -->";
         }
         if ($this->expl) {
             $this->isbd .= "<br /><b>{$msg[285]}</b> (" . $this->nb_expl . ")";
             $this->isbd .= $this->show_expl_per_notice($this->notice->notice_id, $this->link_expl);
         }
         if ($this->show_explnum) {
             $explnum_assoc = show_explnum_per_notice($this->notice->notice_id, 0, $this->link_explnum);
             if ($explnum_assoc) {
                 $this->isbd .= "<b>{$msg['explnum_docs_associes']}</b>" . $explnum_assoc;
             }
         }
         if ($this->show_resa) {
             $aff_resa = resa_list($this->notice_id, 0, 0);
             if ($aff_resa) {
                 $this->isbd .= "<b>{$msg['resas']}</b>" . $aff_resa;
             }
         }
         if ($this->show_planning && $pmb_resa_planning) {
             $aff_resa_planning = planning_list($this->notice_id, 0, 0);
             if ($aff_resa_planning) {
                 $this->isbd .= "<b>{$msg['resas_planning']}</b>" . $aff_resa_planning;
             }
         }
         $this->simple_isbd = $this->isbd;
         $this->do_image($this->isbd);
         return;
     }
     // map
     if ($pmb_map_activate && $this->show_map) {
         $this->isbd .= $this->map->get_map();
     }
     if ($pmb_nomenclature_activate) {
         $nomenclature = new nomenclature_record_ui($this->notice_id);
         $this->isbd .= $nomenclature->get_isbd();
     }
     // résumé
     if ($this->notice->n_resume) {
         // $this->isbd .= "<br /><b>${msg[267]}</b>&nbsp;: ".nl2br(htmlentities($this->notice->n_resume,ENT_QUOTES, $charset));
         $this->isbd .= "<br /><b>{$msg[267]}</b>&nbsp;: " . nl2br($this->notice->n_resume);
     }
     // note de contenu
     if ($this->notice->n_contenu) {
         // $this->isbd .= "<br /><b>${msg[266]}</b>&nbsp;: ".nl2br(htmlentities($this->notice->n_contenu,ENT_QUOTES, $charset));
         $this->isbd .= "<br /><b>{$msg[266]}</b>&nbsp;: " . nl2br($this->notice->n_contenu);
     }
     // catégories
     $categ_repetables = array();
     if (!count($categories_top)) {
         $q = "select num_thesaurus,id_noeud from noeuds where num_parent in(select id_noeud from noeuds where autorite='TOP') ";
         $r = pmb_mysql_query($q, $dbh);
         while ($res = pmb_mysql_fetch_object($r)) {
             $categories_top[] = $res->id_noeud;
         }
     }
     $requete = "select * from (\n\t\tselect libelle_thesaurus, if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie ) as categ_libelle, noeuds.id_noeud , noeuds.num_parent, langue_defaut,id_thesaurus, if(catdef.langue = '" . $lang . "',2, if(catdef.langue= thesaurus.langue_defaut ,1,0)) as p, ordre_vedette, ordre_categorie\n\t\tFROM ((noeuds\n\t\tjoin thesaurus ON thesaurus.id_thesaurus = noeuds.num_thesaurus\n\t\tleft join categories as catdef on noeuds.id_noeud=catdef.num_noeud and catdef.langue = thesaurus.langue_defaut\n\t\tleft join categories as catlg on catdef.num_noeud = catlg.num_noeud and catlg.langue = '" . $lang . "'))\n\t\t,notices_categories\n\t\twhere notices_categories.num_noeud=noeuds.id_noeud and\n\t\tnotices_categories.notcateg_notice=" . $this->notice_id . "\torder by id_thesaurus, noeuds.id_noeud, p desc\n\t\t) as list_categ group by id_noeud";
     if ($thesaurus_categories_affichage_ordre == 1) {
         $requete .= " order by ordre_vedette, ordre_categorie";
     }
     $result_categ = @pmb_mysql_query($requete);
     if (pmb_mysql_num_rows($result_categ)) {
         while ($res_categ = pmb_mysql_fetch_object($result_categ)) {
             $libelle_thesaurus = $res_categ->libelle_thesaurus;
             $categ_id = $res_categ->id_noeud;
             $libelle_categ = $res_categ->categ_libelle;
             $num_parent = $res_categ->num_parent;
             $langue_defaut = $res_categ->langue_defaut;
             $categ_head = 0;
             if (in_array($categ_id, $categories_top)) {
                 $categ_head = 1;
             }
             if ($thesaurus_categories_show_only_last || $categ_head) {
                 if ($use_opac_url_base) {
                     $url_base_lien_aut = $opac_url_base . "index.php?&lvl=categ_see&id=";
                 } else {
                     $url_base_lien_aut = $base_path . "/autorites.php?categ=categories&sub=categ_form&id=";
                 }
                 if ((SESSrights & AUTORITES_AUTH || $use_opac_url_base) && !$this->print_mode) {
                     $libelle_aff_complet = "<a href='" . $url_base_lien_aut . $categ_id . "' class='lien_gestion'>" . $libelle_categ . "</a>";
                 } else {
                     $libelle_aff_complet = $libelle_categ;
                 }
                 if ($thesaurus_mode_pmb) {
                     $categ_repetables[$libelle_thesaurus][] = $libelle_aff_complet;
                 } else {
                     $categ_repetables['MONOTHESAURUS'][] = $libelle_aff_complet;
                 }
             } else {
                 if (!$categories_memo[$categ_id]) {
                     $anti_recurse[$categ_id] = 1;
                     $path_table = '';
                     $requete = "select id_noeud as categ_id, num_noeud, num_parent as categ_parent, libelle_categorie as categ_libelle, num_renvoi_voir as categ_see, note_application as categ_comment, if(langue = '" . $lang . "',2, if(langue= '" . $langue_defaut . "' ,1,0)) as p\n\t\t\t\t\t\tFROM noeuds, categories where id_noeud ='" . $num_parent . "'\n\t\t\t\t\t\tAND noeuds.id_noeud = categories.num_noeud\n\t\t\t\t\t\torder by p desc limit 1";
                     $result = @pmb_mysql_query($requete);
                     if (pmb_mysql_num_rows($result)) {
                         $parent = pmb_mysql_fetch_object($result);
                         $anti_recurse[$parent->categ_id] = 1;
                         $path_table[] = array('id' => $parent->categ_id, 'libelle' => $parent->categ_libelle);
                         // on remonte les ascendants
                         while ($parent->categ_parent && !$anti_recurse[$parent->categ_parent]) {
                             $requete = "select id_noeud as categ_id, num_noeud, num_parent as categ_parent, libelle_categorie as categ_libelle,\tnum_renvoi_voir as categ_see, note_application as categ_comment, if(langue = '" . $lang . "',2, if(langue= '" . $langue_defaut . "' ,1,0)) as p\n\t\t\t\t\t\t\t\tFROM noeuds, categories where id_noeud ='" . $parent->categ_parent . "'\n\t\t\t\t\t\t\t\tAND noeuds.id_noeud = categories.num_noeud\n\t\t\t\t\t\t\t\torder by p desc limit 1";
                             $result = @pmb_mysql_query($requete);
                             if (pmb_mysql_num_rows($result)) {
                                 $parent = pmb_mysql_fetch_object($result);
                                 $anti_recurse[$parent->categ_id] = 1;
                                 $path_table[] = array('id' => $parent->categ_id, 'libelle' => $parent->categ_libelle);
                             } else {
                                 break;
                             }
                         }
                         $anti_recurse = array();
                     } else {
                         $path_table = array();
                     }
                     // ceci remet le tableau dans l'ordre général->particulier
                     $path_table = array_reverse($path_table);
                     if (sizeof($path_table)) {
                         $temp_table = '';
                         while (list($xi, $l) = each($path_table)) {
                             $temp_table[] = $l['libelle'];
                         }
                         $parent_libelle = join(':', $temp_table);
                         $catalog_form = $parent_libelle . ':' . $libelle_categ;
                     } else {
                         $catalog_form = $libelle_categ;
                     }
                     if ($use_opac_url_base) {
                         $url_base_lien_aut = $opac_url_base . "index.php?&lvl=categ_see&id=";
                     } else {
                         $url_base_lien_aut = $base_path . "/autorites.php?categ=categories&sub=categ_form&id=";
                     }
                     if ((SESSrights & AUTORITES_AUTH || $use_opac_url_base) && !$this->print_mode) {
                         $libelle_aff_complet = "<a href='" . $url_base_lien_aut . $categ_id . "' class='lien_gestion'>" . $catalog_form . "</a>";
                     } else {
                         $libelle_aff_complet = $catalog_form;
                     }
                     if ($thesaurus_mode_pmb) {
                         $categ_repetables[$libelle_thesaurus][] = $libelle_aff_complet;
                     } else {
                         $categ_repetables['MONOTHESAURUS'][] = $libelle_aff_complet;
                     }
                     $categories_memo[$categ_id] = $libelle_aff_complet;
                     $libelle_thesaurus_memo[$categ_id] = $libelle_thesaurus;
                 } else {
                     if ($thesaurus_mode_pmb) {
                         $categ_repetables[$libelle_thesaurus_memo[$categ_id]][] = $categories_memo[$categ_id];
                     } else {
                         $categ_repetables['MONOTHESAURUS'][] = $categories_memo[$categ_id];
                     }
                 }
             }
         }
     }
     while (list($nom_tesaurus, $val_lib) = each($categ_repetables)) {
         //c'est un tri par libellé qui est demandé
         if ($thesaurus_categories_affichage_ordre == 0) {
             $tmp = array();
             foreach ($val_lib as $key => $value) {
                 $tmp[$key] = strip_tags($value);
             }
             $tmp = array_map("convert_diacrit", $tmp);
             //On enlève les accents
             $tmp = array_map("strtoupper", $tmp);
             //On met en majuscule
             asort($tmp);
             //Tri sur les valeurs en majuscule sans accent
             foreach ($tmp as $key => $value) {
                 $tmp[$key] = $val_lib[$key];
                 //On reprend les bons couples clé / libellé
             }
             $val_lib = $tmp;
         }
         if ($thesaurus_mode_pmb) {
             if (!$thesaurus_categories_categ_in_line) {
                 $categ_repetables_aff = "[" . $nom_tesaurus . "]" . implode("<br />[" . $nom_tesaurus . "]", $val_lib);
             } else {
                 $categ_repetables_aff = "<b>" . $nom_tesaurus . "</b><br />" . implode(" {$pmb_keyword_sep} ", $val_lib);
             }
         } else {
             if (!$thesaurus_categories_categ_in_line) {
                 $categ_repetables_aff = implode("<br />", $val_lib);
             } else {
                 $categ_repetables_aff = implode(" {$pmb_keyword_sep} ", $val_lib);
             }
         }
         if ($categ_repetables_aff) {
             $tmpcateg_aff .= "<br />{$categ_repetables_aff}";
         }
     }
     if ($tmpcateg_aff) {
         $this->isbd .= "<br />{$tmpcateg_aff}";
     }
     // Concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->notice_id, TYPE_NOTICE);
         $this->isbd .= $index_concept->get_isbd_display();
     }
     // langues
     if (count($this->langues)) {
         $langues = "<b>{$msg[537]}</b>&nbsp;: " . construit_liste_langues($this->langues);
     }
     if (count($this->languesorg)) {
         $langues .= " <b>{$msg[711]}</b>&nbsp;: " . construit_liste_langues($this->languesorg);
     }
     if ($langues) {
         $this->isbd .= "<br />{$langues}";
     }
     // indexation libre
     if ($this->notice->index_l) {
         $this->isbd .= "<br /><b>{$msg[324]}</b>&nbsp;: " . nl2br($this->notice->index_l);
     }
     // indexation interne
     if ($this->notice->indexint) {
         $indexint = new indexint($this->notice->indexint);
         if ($this->print_mode) {
             $indexint_isbd = $indexint->display;
         } else {
             $indexint_isbd = $indexint->isbd_entry_lien_gestion;
         }
         $this->isbd .= "<br /><b>{$msg[indexint_catal_title]}</b>&nbsp;: " . $indexint_isbd;
     }
     $tu = new tu_notice($this->notice_id);
     if ($tu_liste = $tu->get_print_type(1)) {
         $this->isbd .= "<br />" . $tu_liste;
     }
     $authperso = new authperso_notice($this->notice_id);
     $this->isbd .= $authperso->get_notice_display();
     //Champs personalisés
     $perso_aff = "";
     if (!$this->p_perso->no_special_fields) {
         $perso_ = $this->p_perso->show_fields($this->notice_id);
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             // ajout de && ($p['OPAC_SHOW']||$this->show_opac_hidden_fields) afin de masquer les champs masqués de l'OPAC en diff de bannette.
             if ($p["AFF"] && ($p['OPAC_SHOW'] || $this->show_opac_hidden_fields)) {
                 $perso_aff .= "<br />" . $p["TITRE"] . " " . nl2br($p["AFF"]);
             }
         }
     }
     if ($perso_aff) {
         $this->isbd .= $perso_aff;
     }
     //Notices liées
     if (count($this->childs) && !$this->print_mode && !$this->no_link) {
         $link = $base_path . '/catalog.php?categ=isbd&id=!!id!!';
         $link_expl = $base_path . '/catalog.php?categ=edit_expl&id=!!notice_id!!&cb=!!expl_cb!!&expl_id=!!expl_id!!';
         $link_explnum = $base_path . '/catalog.php?categ=edit_explnum&id=!!notice_id!!&explnum_id=!!explnum_id!!';
         global $relation_typedown;
         if (!$relation_typedown) {
             $relation_typedown = new marc_list("relationtypedown");
         }
         reset($this->childs);
         if (!$load_tablist_js) {
             $aff_childs = "<script type='text/javascript' src='" . $base_path . "/javascript/tablist.js'></script>\n";
         }
         $aff_childs .= "<br />";
         $load_tablist_js = 1;
         $anti_loop = $this->anti_loop;
         $anti_loop[] = $this->notice_id;
         $n_childs = 0;
         while ((list($rel_type, $child_notices) = each($this->childs)) && $n_childs < 100) {
             $aff_childs .= "<b>" . $relation_typedown->table[$rel_type] . "</b>";
             $aff_childs .= "<blockquote>";
             if ($pmb_notice_fille_format) {
                 $aff_childs .= "<ul class='notice_rel'>";
             }
             for ($i = 0; $i < count($child_notices); $i++) {
                 $as = array_search($child_notices[$i], $anti_loop);
                 if ($as === false) {
                     global $pmb_notice_fille_format;
                     if ($pmb_notice_fille_format) {
                         $level_fille = 0;
                     } else {
                         $level_fille = 6;
                     }
                     // il faut aller chercher le niveau biblio et niveau hierar de la notice liée
                     $requete_nbnh = "select l.niveau_biblio as lnb, l.niveau_hierar as lnh, rank from notices as l join notices_relations on num_notice=notice_id where notice_id='" . $child_notices[$i] . "' ";
                     $r_rel = pmb_mysql_fetch_object(pmb_mysql_query($requete_nbnh));
                     if ($r_rel->rank != $i) {
                         $req = "update notices_relations set rank='{$i}' where num_notice='" . $child_notices[$i] . "' and relation_type='" . $rel_type . "' and linked_notice='" . $anti_loop[count($serial->anti_loop) - 1] . "'";
                         pmb_mysql_query($req, $dbh);
                     }
                     if ($r_rel->lnb == 's' && $r_rel->lnh == '1') {
                         // c'est une notice de pério
                         global $link_serial, $link_analysis, $link_bulletin, $link_explnum_serial;
                         $link_serial_sub = $base_path . "/catalog.php?categ=serials&sub=view&serial_id=" . $child_notices[$i];
                         $serial = new serial_display($child_notices[$i], $level_fille, $link_serial_sub, $link_analysis, $link_bulletin, "", $link_explnum_serial, 0, $this->print_mode, 1, 1, 1, 0, 0, $anti_loop);
                         if (count($serial->anti_loop) == 1 && $sort_children) {
                             //Drag pour tri des notices filles
                             $id_elt = $serial->notice_id . ($serial->anti_loop ? "_p" . implode("_", $serial->anti_loop) : "");
                             $drag_fille = "<div id=\"drag_" . $id_elt . "\" handler=\"handle_" . $id_elt . "\" dragtype='daughter' draggable='yes' recepttype='daughter' recept='yes'\n\t\t\t\t\t\t\t\t\tdragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($serial->tit1, ENT_QUOTES, $charset) . "\" callback_before=\"is_expandable\"\n\t\t\t\t\t\t\t\t\tcallback_after=\"\" downlight=\"noti_downlight\" highlight=\"noti_highlight\" fille='{$child_notices[$i]}' pere='" . $anti_loop[count($serial->anti_loop) - 1] . "' order='{$i}' type_rel=\"{$rel_type}\" >";
                             $drag_fille .= "<span id=\"handle_" . $id_elt . "\" style=\"float:left; padding-right : 7px\"><img src=\"" . $base_path . "/images/sort.png\" style='width:12px; vertical-align:middle' /></span>";
                             $affichage_result = $serial->result;
                         } else {
                             $drag_fille = "";
                             $affichage_result = $pmb_notice_fille_format ? "<li>" . $serial->result . "</li>" : $serial->result;
                         }
                         $aff = $drag_fille . $affichage_result;
                         if ($drag_fille) {
                             $aff .= "</div>";
                         }
                     } else {
                         if ($r_rel->lnb == 'a' && $r_rel->lnh == '2') {
                             // c'est un dépouillement de bulletin
                             global $link_serial, $link_analysis, $link_bulletin, $link_explnum_analysis;
                             $serial = new serial_display($child_notices[$i], $level_fille, $link_serial, $link_analysis, $link_bulletin, "", $link_explnum_analysis, 0, 0, 1, 1, 1, 0, 0, $anti_loop);
                             if (count($serial->anti_loop) == 1 && $sort_children) {
                                 //Drag pour tri des notices filles
                                 $id_elt = $serial->notice_id . ($serial->anti_loop ? "_p" . implode("_", $serial->anti_loop) : "");
                                 $drag_fille = "<div id=\"drag_" . $id_elt . "\" handler=\"handle_" . $id_elt . "\" dragtype='daughter' draggable='yes' recepttype='daughter' recept='yes'\n\t\t\t\t\t\t\t\t\tdragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($serial->tit1, ENT_QUOTES, $charset) . "\" callback_before=\"is_expandable\"\n\t\t\t\t\t\t\t\t\tcallback_after=\"\" downlight=\"noti_downlight\" highlight=\"noti_highlight\" fille='{$child_notices[$i]}' pere='" . $anti_loop[count($serial->anti_loop) - 1] . "' order='{$i}' type_rel=\"{$rel_type}\">";
                                 $drag_fille .= "<span id=\"handle_" . $id_elt . "\" style=\"float:left; padding-right : 7px\"><img src=\"" . $base_path . "/images/sort.png\" style='width:12px; vertical-align:middle' /></span>";
                                 $affichage_result = $serial->result;
                             } else {
                                 $drag_fille = "";
                                 $affichage_result = $pmb_notice_fille_format ? "<li>" . $serial->result . "</li>" : $serial->result;
                             }
                             $aff = $drag_fille . $affichage_result;
                             if ($drag_fille) {
                                 $aff .= "</div>";
                             }
                         } else {
                             $display = new mono_display($child_notices[$i], $level_fille, $link, 1, $link_expl, '', $link_explnum, 1, 0, 1, 1, $anti_loop, $this->drag, false, true, 0, 1, 0);
                             if (count($display->anti_loop) == 1 && $sort_children) {
                                 //Drag pour tri des notices filles
                                 $id_elt = $display->notice_id . ($display->anti_loop ? "_p" . implode("_", $display->anti_loop) : "");
                                 $drag_fille = "<div id=\"drag_" . $id_elt . "\" handler=\"handle_" . $id_elt . "\" dragtype='daughter' draggable='yes' recepttype='daughter' recept='yes'\n\t\t\t\t\t\t\t\t\tdragicon=\"" . $base_path . "/images/icone_drag_notice.png\" dragtext=\"" . htmlentities($display->tit1, ENT_QUOTES, $charset) . "\" callback_before=\"is_expandable\"\n\t\t\t\t\t\t\t\t\tcallback_after=\"\" downlight=\"noti_downlight\" highlight=\"noti_highlight\" fille='{$child_notices[$i]}' pere='" . $anti_loop[count($display->anti_loop) - 1] . "' order='{$i}' type_rel=\"{$rel_type}\">";
                                 $drag_fille .= "<span id=\"handle_" . $id_elt . "\" style=\"float:left; padding-right : 7px\"><img src=\"" . $base_path . "/images/sort.png\" style='width:12px; vertical-align:middle' /></span>";
                                 $affichage_result = $display->result;
                             } else {
                                 $drag_fille = "";
                                 $affichage_result = $pmb_notice_fille_format ? "<li>" . $display->result . "</li>" : $display->result;
                             }
                             $display->result = str_replace("<!-- !!bouton_modif!! -->", " ", $display->result);
                             $aff = $drag_fille . $affichage_result;
                             $this->nb_expl += $display->nb_expl;
                             if ($drag_fille) {
                                 $aff .= "</div>";
                             }
                         }
                     }
                     $aff_childs .= $aff;
                 }
                 $n_childs++;
             }
             $aff_childs .= ($pmb_notice_fille_format ? "</ul>" : "") . "</blockquote>";
         }
         $this->isbd .= $aff_childs;
     }
     if (!$this->print_mode && !$this->anti_loop) {
         $this->isbd .= "<!-- !!bouton_modif!! -->";
     }
     $this->do_image($this->isbd);
     if (!$this->anti_loop) {
         $this->isbd .= "<!-- !!avis_notice!! -->";
     }
     if ($this->expl) {
         if ($this->notice->niveau_biblio == 'b' && $this->notice->niveau_hierar == 2) {
             // on est face à une notice de bulletin
             $requete = "select bulletin_id from bulletins where num_notice=" . $this->notice->notice_id;
             $result = @pmb_mysql_query($requete);
             if (pmb_mysql_num_rows($result)) {
                 $bull = pmb_mysql_fetch_object($result);
                 $expl_aff = $this->show_expl_per_notice($this->notice->notice_id, $this->link_expl, $bull->bulletin_id);
             }
         } else {
             $expl_aff = $this->show_expl_per_notice($this->notice->notice_id, $this->link_expl);
         }
         if ($expl_aff) {
             $this->isbd .= "<br /><b>{$msg[285]} </b>(" . $this->nb_expl . ")";
             $this->isbd .= $expl_aff;
         }
     }
     if ($this->show_explnum) {
         $explnum_assoc = show_explnum_per_notice($this->notice->notice_id, 0, $this->link_explnum);
         if ($explnum_assoc) {
             $this->isbd .= "<b>{$msg['explnum_docs_associes']}</b> (" . show_explnum_per_notice($this->notice->notice_id, 0, $this->link_explnum, array(), true) . ")" . $explnum_assoc;
         }
     }
     //documents numériques en relation...
     $explnum_in_relation = show_explnum_in_relation($this->notice->notice_id, $this->link_explnum);
     if ($explnum_in_relation) {
         $this->isbd .= "<b>" . $msg["explnum_docs_in_relation"] . "</b>" . $explnum_in_relation;
     }
     //reservations et previsions
     if ($this->show_resa || $this->show_planning && $pmb_resa_planning) {
         $rqt_nt = "select count(*) from exemplaires, notices, docs_statut where exemplaires.expl_statut=docs_statut.idstatut and notices.notice_id=exemplaires.expl_notice and statut_allow_resa=1 and notices.notice_id=" . $this->notice_id;
         $result = pmb_mysql_query($rqt_nt, $dbh) or die($rqt_nt . " " . pmb_mysql_error());
         $nb_expl_reservables = pmb_mysql_result($result, 0, 0);
         if ($this->show_resa) {
             $aff_resa = resa_list($this->notice_id, 0, 0);
             $ouvrir_reserv = "onclick=\"parent.location.href='" . $base_path . "/circ.php?categ=resa_from_catal&id_notice=" . $this->notice_id . "'; return(false) \"";
             if ($aff_resa) {
                 $this->isbd .= "<b>" . $msg['resas'] . "</b><br />";
                 if ($nb_expl_reservables && !($categ == "resa") && !$id_empr) {
                     $this->isbd .= "<input type='button' class='bouton' value='" . $msg['351'] . "' {$ouvrir_reserv}><br /><br />";
                 }
                 $this->isbd .= $aff_resa . "<br />";
             } else {
                 if ($nb_expl_reservables && !($categ == "resa") && !$id_empr) {
                     $this->isbd .= "<b>" . $msg['resas'] . "</b><br /><input type='button' class='bouton' value='" . $msg['351'] . "' {$ouvrir_reserv}><br /><br />";
                 }
             }
         }
         if ($this->show_planning && $pmb_resa_planning) {
             $aff_resa_planning = planning_list($this->notice_id, 0, 0);
             $ouvrir_reserv = "onclick=\"parent.location.href='" . $base_path . "/circ.php?categ=resa_planning_from_catal&id_notice=" . $this->notice_id . "'; return(false) \"";
             if ($aff_resa_planning) {
                 $this->isbd .= "<b>" . $msg['resas_planning'] . "</b><br />";
                 if ($nb_expl_reservables && !($categ == "resa_planning") && !$id_empr) {
                     $this->isbd .= "<input type='button' class='bouton' value='" . $msg['resa_planning_add'] . "' {$ouvrir_reserv}><br /><br />";
                 }
                 $this->isbd .= $aff_resa_planning . "<br />";
             } else {
                 if ($nb_expl_reservables && !($categ == "resa_planning") && !$id_empr) {
                     $this->isbd .= "<b>" . $msg['resas_planning'] . "</b><br /><input type='button' class='bouton' value='" . $msg['resa_planning_add'] . "' {$ouvrir_reserv}><br /><br />";
                 }
             }
         }
     }
     return;
 }
Beispiel #20
0
 function update($value, $force_creation = false)
 {
     global $dbh;
     global $msg, $charset;
     global $include_path;
     global $thesaurus_concepts_active;
     //si on a pas d'id, on peut avoir les infos de la collection
     if (!$value['parent']) {
         if ($value['collection']) {
             //on les a, on crée l'éditeur
             $value['collection'] = stripslashes_array($value['collection']);
             //La fonction d'import fait les addslashes contrairement à l'update
             $value['parent'] = collection::import($value['collection']);
         }
     }
     if (!$value['name'] || !$value['parent']) {
         return false;
     }
     // nettoyage des valeurs en entrée
     $value['name'] = clean_string($value['name']);
     // construction de la requête
     $requete = "SET sub_coll_name='{$value['name']}', ";
     $requete .= "sub_coll_parent='{$value['parent']}', ";
     $requete .= "sub_coll_issn='{$value['issn']}', ";
     $requete .= "subcollection_web='{$value['subcollection_web']}', ";
     $requete .= "subcollection_comment='{$value['comment']}', ";
     $requete .= "index_sub_coll=' " . strip_empty_words($value[name]) . " " . strip_empty_words($value["issn"]) . " '";
     if ($this->id) {
         // update
         $requete = 'UPDATE sub_collections ' . $requete;
         $requete .= ' WHERE sub_coll_id=' . $this->id . ' ';
         if (pmb_mysql_query($requete, $dbh)) {
             $requete = "select collection_parent from collections WHERE collection_id='" . $value[parent] . "' ";
             $res = pmb_mysql_query($requete, $dbh);
             $ed_parent = pmb_mysql_result($res, 0, 0);
             $requete = "update notices set ed1_id='{$ed_parent}', coll_id='" . $value[parent] . "' WHERE subcoll_id='" . $this->id . "' ";
             $res = pmb_mysql_query($requete, $dbh);
             $aut_link = new aut_link(AUT_TABLE_SUB_COLLECTIONS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("subcollection", $this->id);
             $aut_pperso->save_form();
             audit::insert_modif(AUDIT_SUB_COLLECTION, $this->id);
             subcollection::update_index($this->id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[178], htmlentities($msg[182] . " -> " . $this->display, ENT_QUOTES, $charset));
             return FALSE;
         }
     } else {
         if (!$force_creation) {
             // création : s'assurer que la sous-collection n'existe pas déjà
             if ($id_subcollection_exists = subcollection::check_if_exists($value)) {
                 $subcollection_exists = new subcollection($id_subcollection_exists);
                 require_once "{$include_path}/user_error.inc.php";
                 warning($msg[177], htmlentities($msg[219] . " -> " . $subcollection_exists->display, ENT_QUOTES, $charset));
                 return FALSE;
             }
         }
         $requete = 'INSERT INTO sub_collections ' . $requete . ';';
         if (pmb_mysql_query($requete, $dbh)) {
             $this->id = pmb_mysql_insert_id();
             $aut_link = new aut_link(AUT_TABLE_SUB_COLLECTIONS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("subcollection", $this->id);
             $aut_pperso->save_form();
             audit::insert_creation(AUDIT_SUB_COLLECTION, $this->id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[177], htmlentities($msg[182] . " -> " . $requete, ENT_QUOTES, $charset));
             return FALSE;
         }
     }
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->id, TYPE_SUBCOLLECTION);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->id, "subcollection");
     return TRUE;
 }