function list_thesauri($OPACUserId = -1) { $thesauri = thesaurus::getThesaurusList(); $results = array(); global $opac_thesaurus, $opac_thesaurus_defaut; foreach ($thesauri as $id => $caption) { if ($OPACUserId != -1 && $opac_thesaurus == 0 && $opac_thesaurus_defaut != $id) { continue; } $athesaurus = new thesaurus($id); $results[] = array('thesaurus_id' => $id, 'thesaurus_caption' => utf8_normalize($caption), 'thesaurus_num_root_node' => $athesaurus->num_noeud_racine, 'thesaurus_num_unclassed_node' => $athesaurus->num_noeud_nonclasses, 'thesaurus_num_orphans_node' => $athesaurus->num_noeud_orphelins); } return $results; }
function cleanCategoriesPath() { global $msg, $charset, $PMBusername; if (SESSrights & ADMINISTRATION_AUTH) { // Pour tous les thésaurus, on parcours les childs $list_thesaurus = thesaurus::getThesaurusList(); foreach ($list_thesaurus as $id_thesaurus => $libelle_thesaurus) { $thes = new thesaurus($id_thesaurus); $noeud_rac = $thes->num_noeud_racine; $r = noeuds::listChilds($noeud_rac, 0); while ($row = mysql_fetch_object($r)) { noeuds::process_categ_path($row->id_noeud); } } if ($thesaurus_auto_postage_search) { categories::process_categ_index(); } $result .= htmlentities($msg["clean_categories_path_end"], ENT_QUOTES, $charset); } else { $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername); } return $result; }
if (!$parent) { $parent = 0; } if (!$id) { $id = 0; } //recuperation du thesaurus session if (!$id_thes) { $id_thes = thesaurus::getSessionThesaurusId(); } else { thesaurus::setSessionThesaurusId($id_thes); } $liste_thesaurus = ''; $browser_top = ''; //affichage du selectionneur de thesaurus et du lien vers les thésaurus $liste_thesaurus = thesaurus::getThesaurusList(); $sel_thesaurus = ''; $lien_thesaurus = ''; if ($thesaurus_mode_pmb != 0) { //la liste des thesaurus n'est pas affichée en mode monothesaurus $sel_thesaurus = "<select class='saisie-30em' id='id_thes' name='id_thes' "; $sel_thesaurus .= "onchange = \"document.location = '" . $base_url . "&id_thes='+document.getElementById('id_thes').value; \">"; foreach ($liste_thesaurus as $id_thesaurus => $libelle_thesaurus) { $sel_thesaurus .= "<option value='" . $id_thesaurus . "' "; if ($id_thesaurus == $id_thes) { $sel_thesaurus .= " selected"; } $sel_thesaurus .= ">" . htmlentities($libelle_thesaurus, ENT_QUOTES, $charset) . "</option>"; } $sel_thesaurus .= "<option value=-1 "; if ($id_thes == -1) {
function cleanCategories() { global $msg, $dbh, $charset, $PMBusername; if ($deleted == "") { $deleted = 0; } if (SESSrights & ADMINISTRATION_AUTH) { $result .= "<h3>" . htmlentities($msg["nettoyage_suppr_categories"], ENT_QUOTES, $charset) . "</h3>"; $list_thesaurus = thesaurus::getThesaurusList(); foreach ($list_thesaurus as $id_thesaurus => $libelle_thesaurus) { $thes = new thesaurus($id_thesaurus); $noeud_rac = $thes->num_noeud_racine; $r = noeuds::listChilds($noeud_rac, 0); while ($row = mysql_fetch_object($r)) { noeuds::process_categ($row->id_noeud); } } //TODO non repris >> Utilité ??? // $delete = mysql_query("delete from categories where categ_libelle='#deleted#'"); $result .= $deleted . " " . htmlentities($msg["nettoyage_res_suppr_categories"], ENT_QUOTES, $charset); $optn = noeuds::optimize(); $optc = categories::optimize(); } else { $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername); } return $result; }
} print "</b></font>"; print activation_surlignage(); print "</h3></span>"; if (!$opac_allow_affiliate_search) { print "\n\t\t\t\t</div>"; } print "\n\t\t\t\t<div id=\"resultatrech_liste\">\n\t\t\t\t<ul>"; $first_clause .= "catdef.libelle_categorie not like '~%' "; $aq = new analyse_query(stripslashes($user_query), 0, 0, 1, 0, $opac_stemming_active); $members_catdef = $aq->get_query_members('catdef', 'catdef.libelle_categorie', 'catdef.index_categorie', 'catdef.num_noeud'); $members_catlg = $aq->get_query_members('catlg', 'catlg.libelle_categorie', 'catlg.index_categorie', 'catlg.num_noeud'); $list_thes = array(); if ($id_thes == -1) { //recherche dans tous les thesaurus $list_thes = thesaurus::getThesaurusList(); } else { //recherche dans le thesaurus transmis $thes = new thesaurus($id_thes); $list_thes[$id_thes] = $thes->libelle_thesaurus; } $q = "drop table if exists catjoin "; $r = mysql_query($q, $dbh); $q = "create temporary table catjoin ENGINE=MyISAM as select "; foreach ($list_thes as $id_thesaurus => $libelle_thesaurus) { $thes = new thesaurus($id_thesaurus); if ($lang == $thes->langue_defaut || in_array($lang, thesaurus::getTranslationsList()) === false) { $q .= "noeuds.num_thesaurus, "; $q .= "noeuds.id_noeud as num_noeud, "; $q .= "catdef.note_application as note_application, "; $q .= "catdef.comment_public as comment_public, ";
function make_first_search() { global $search_subject; global $search_indexint, $search_indexint_id, $aut_type; global $msg; global $charset; global $browser, $search_form_categ, $browser_url; global $lang; global $dbh; global $id_thes; global $thesaurus_mode_pmb; if ($search_indexint_id) { $this->id = $search_indexint_id; $aut_type = "indexint"; return AUT_SEARCH; } $this->nbresults = 0; if ($search_subject) { $aq = new analyse_query(stripslashes($search_subject)); if (!$aq->error) { if ($id_thes != -1) { $thes = new thesaurus($id_thes); } $requete = "SELECT SQL_CALC_FOUND_ROWS noeuds.id_noeud AS categ_id, "; if ($id_thes != -1 && $thes->langue_defaut == $lang) { $members = $aq->get_query_members("categories", "libelle_categorie", "index_categorie", "num_noeud"); $requete .= $members["select"] . " AS pert "; $requete .= "FROM noeuds JOIN categories ON noeuds.id_noeud = categories.num_noeud AND categories.langue='" . addslashes($lang) . "' "; $requete .= "WHERE noeuds.num_thesaurus = '" . $id_thes . "' "; $requete .= "AND (" . $members["where"] . ") "; $requete .= "AND categories.libelle_categorie NOT LIKE '~%' "; $requete .= "ORDER BY pert DESC,categories.index_categorie"; } else { $members_catdef = $aq->get_query_members("catdef", "catdef.libelle_categorie", "catdef.index_categorie", "catdef.num_noeud"); $members_catlg = $aq->get_query_members("catlg", "catlg.libelle_categorie", "catlg.index_categorie", "catlg.num_noeud"); $requete .= "IF (catlg.num_noeud IS NULL, catdef.index_categorie, catlg.index_categorie) as index_categorie, "; $requete .= "IF (catlg.num_noeud IS NULL, " . $members_catdef["select"] . ", " . $members_catlg["select"] . ") as pert "; if ($id_thes != -1) { $requete .= "FROM noeuds JOIN categories AS catdef ON noeuds.id_noeud = catdef.num_noeud AND catdef.langue = '" . $thes->langue_defaut . "' "; $requete .= "LEFT JOIN categories AS catlg ON catdef.num_noeud = catlg.num_noeud AND catlg.langue = '" . $lang . "' "; $requete .= "WHERE noeuds.num_thesaurus = '" . $id_thes . "' "; } else { //Plusieurs thésaurus $requete .= "FROM noeuds JOIN thesaurus ON thesaurus.id_thesaurus = noeuds.num_thesaurus "; $requete .= "JOIN categories AS catdef ON noeuds.id_noeud = catdef.num_noeud AND catdef.langue = thesaurus.langue_defaut "; $requete .= "LEFT JOIN categories AS catlg on catdef.num_noeud = catlg.num_noeud AND catlg.langue = '" . $lang . "' "; $requete .= "WHERE 1 "; } $requete .= "AND catdef.libelle_categorie NOT LIKE '~%' "; $requete .= "AND (IF (catlg.num_noeud IS NULL, " . $members_catdef["where"] . ", " . $members_catlg["where"] . ") ) ORDER BY pert DESC,index_categorie"; } $this->s_query = pmb_mysql_query($requete, $dbh); $qry = "SELECT FOUND_ROWS() AS NbRows"; if ($resnum = pmb_mysql_query($qry)) { $this->nb_s = pmb_mysql_result($resnum, 0, 0); } } else { $this->show_error($aq->current_car, $aq->input_html, $aq->error_message); return; } } if ($search_indexint) { $aq = new analyse_query(stripslashes($search_indexint)); if (!$aq->error) { $this->nb_id = @pmb_mysql_result(@pmb_mysql_query("select count(distinct indexint_id) from indexint where indexint_name like '" . str_replace("*", "%", $search_indexint) . "'"), 0, 0); if ($this->nb_id) { $this->id_query = @pmb_mysql_query("select indexint_id from indexint where indexint_name like '" . str_replace("*", "%", $search_indexint) . "' order by indexint_name*1, indexint_name"); if ($this->nb_id == 1) { $id = @pmb_mysql_fetch_object($this->id_query); $this->id = $id->indexint_id; $aut_type = "indexint"; return AUT_SEARCH; } } $this->nb_i = @pmb_mysql_result(@pmb_mysql_query($aq->get_query_count("indexint", "indexint_comment", "index_indexint", "indexint_id")), 0, 0); if ($this->nb_i) { $this->i_query = @pmb_mysql_query($aq->get_query("indexint", "indexint_comment", "index_indexint", "indexint_id")); } } else { $this->show_error($aq->current_car, $aq->input_html, $aq->error_message); return; } } if ($this->nb_s + $this->nb_i + $this->nb_id == 0) { //affichage du selectionneur de thesaurus et du lien vers les thésaurus $liste_thesaurus = thesaurus::getThesaurusList(); $sel_thesaurus = ''; $lien_thesaurus = ''; if ($thesaurus_mode_pmb != 0) { //la liste des thesaurus n'est pas affichée en mode monothesaurus $sel_thesaurus = "<select class='saisie-30em' id='id_thes' name='id_thes' "; $sel_thesaurus .= "onchange = \"document.location = '" . $this->base_url . "&id_thes='+document.getElementById('id_thes').value; \">"; foreach ($liste_thesaurus as $id_thesaurus => $libelle_thesaurus) { $sel_thesaurus .= "<option value='" . $id_thesaurus . "' "; if ($id_thesaurus == $id_thes) { $sel_thesaurus .= " selected"; } $sel_thesaurus .= ">" . htmlentities($libelle_thesaurus, ENT_QUOTES, $charset) . "</option>"; } $sel_thesaurus .= "<option value=-1 "; if ($id_thes == -1) { $sel_thesaurus .= "selected "; } $sel_thesaurus .= ">" . htmlentities($msg['thes_all'], ENT_QUOTES, $charset) . "</option>"; $sel_thesaurus .= "</select> "; } $search_form_categ = str_replace("<!-- sel_thesaurus -->", $sel_thesaurus, $search_form_categ); //affichage du choix de langue pour la recherche // $sel_langue = ''; // $sel_langue = "<div class='row'>"; // $sel_langue.= "<input type='checkbox' name='lg_search' id='lg_search' value='1' /> ".htmlentities($msg['thes_sel_langue'],ENT_QUOTES, $charset); // $sel_langue.= "</div><br />"; // $search_form_categ=str_replace("<!-- sel_langue -->",$sel_langue,$search_form_categ); $search_form_categ = str_replace("!!base_url!!", $this->base_url, $search_form_categ); print pmb_bidi($search_form_categ); error_message($msg["searcher_no_result"], $msg["searcher_no_result_desc"]); $browser = str_replace("!!browser_url!!", $browser_url, $browser); print pmb_bidi($browser); return; } return AUT_LIST; }
function get_config_form() { global $charset, $msg, $dbh; global $thesaurus_default; global $base_path; if (!$this->config['used_thesaurus']) { $this->config['used_thesaurus'] = $thesaurus_default; } if (!$this->config['base_uri']) { $this->config['base_uri'] = "/"; } if (!$this->config['tree']) { $this->config['tree'] = array(); } if (!$this->config['restricted_empr_write_permission']) { $this->config['restricted_empr_write_permission'] = array(); } if (!$this->config['restricted_user_write_permission']) { $this->config['restricted_user_write_permission'] = array(); } if (!$this->config['metasMapper_class']) { $this->config['metasMapper_class'] = ""; } if (!$this->config['upload_rep']) { global $PMBuserid; $query = "select deflt_upload_repertoire from users where userid = " . $PMBuserid; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $this->config['upload_rep'] = pmb_mysql_result($result, 0, 0); } else { $this->config['upload_rep'] = 0; } } $result = parent::get_config_form(); //Included sets $result .= "\n\t\t\t<div class='row'>\n\t\t\t\t<label for='base_uri'>" . htmlentities($this->msg['webdav_base_uri'], ENT_QUOTES, $charset) . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t<input type='text' name='base_uri' value='" . htmlentities($this->config['base_uri'], ENT_QUOTES, $charset) . "'/>\n\t\t\t</div>\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>\n\t\t\t\t<label for='base_uri'>" . htmlentities($this->msg['webdav_allow_web'], ENT_QUOTES, $charset) . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t" . htmlentities($this->msg['webdav_yes'], ENT_QUOTES, $charset) . " <input type='radio' name='allow_web' value='1' " . ($this->config['allow_web'] == 1 ? "checked='checked'" : "") . "/> \n\t\t\t\t" . htmlentities($this->msg['webdav_no'], ENT_QUOTES, $charset) . " <input type='radio' name='allow_web' value='0' " . ($this->config['allow_web'] == 0 ? "checked='checked'" : "") . "/>\n\t\t\t\t\t\t</div>\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>\n\t\t\t\t<label for='authentication'>" . htmlentities($this->msg['webdav_authentication'], ENT_QUOTES, $charset) . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t<select name='authentication'>\n\t\t\t\t\t<option value='anonymous' " . ($this->config['authentication'] == "anonymous" ? "selected='selected'" : "") . ">" . htmlentities($this->msg['webdav_anonymous'], ENT_QUOTES, $charset) . "</option>\n\t\t\t\t\t<option value='gestion' " . ($this->config['authentication'] == "gestion" ? "selected='selected'" : "") . ">" . htmlentities($this->msg['webdav_authenticate_gest'], ENT_QUOTES, $charset) . "</option>\n\t\t\t\t\t<option value='opac' " . ($this->config['authentication'] == "opac" ? "selected='selected'" : "") . ">" . htmlentities($this->msg['webdav_authenticate_opac'], ENT_QUOTES, $charset) . "</option>\n\t\t\t\t</select>\n\t\t\t</div>\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>\n\t\t\t\t<label for='write_permission'>" . htmlentities($this->msg['webdav_write_permission'], ENT_QUOTES, $charset) . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t" . htmlentities($this->msg['webdav_yes'], ENT_QUOTES, $charset) . " <input type='radio' name='write_permission' value='1' " . ($this->config['write_permission'] == 1 ? "checked='checked'" : "") . "/> \n\t\t\t\t" . htmlentities($this->msg['webdav_no'], ENT_QUOTES, $charset) . " <input type='radio' name='write_permission' value='0' " . ($this->config['write_permission'] == 0 ? "checked='checked'" : "") . "/>\n\t\t\t</div>\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>\n\t\t\t\t<label for='restricted_write_permission'>" . htmlentities($this->msg['webdav_restricted_write_permission'], ENT_QUOTES, $charset) . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>"; //groupes d'utilisateurs $result .= "\n\t\t\t\t<div class='colonne2'>\n\t\t\t\t\t<label for='restricted_write_permission'>" . htmlentities($this->msg['webdav_restricted_user_write_permission'], ENT_QUOTES, $charset) . "</label><br />"; $query = "SELECT grp_id, grp_name FROM users_groups ORDER BY grp_name "; $res = pmb_mysql_query($query); if (pmb_mysql_num_rows($res) > 0) { $result .= "\n\t\t\t\t<select id='restricted_user_write_permission' name='restricted_user_write_permission[]' multiple>"; while ($obj = pmb_mysql_fetch_object($res)) { $result .= "\n\t\t\t\t\t<option value='" . $obj->grp_id . "' " . (in_array($obj->grp_id, $this->config['restricted_user_write_permission']) ? "selected=selected" : "") . ">" . htmlentities($obj->grp_name, ENT_QUOTES, $charset) . "</option>"; } $result .= " or id_noeud in (select id_noeud from noeuds where num_parent=" . $this->categ->id . "))\n\t\t\t\t\t</select>"; } $result .= "\n\t\t\t\t</div>"; $result .= "\n\t\t\t\t<div class='colonne-suite'>\n\t\t\t\t\t<label for='restricted_write_permission'>" . htmlentities($this->msg['webdav_restricted_empr_write_permission'], ENT_QUOTES, $charset) . "</label><br />"; //catégories de lecteurs $requete = "SELECT id_categ_empr, libelle FROM empr_categ ORDER BY libelle "; $res = pmb_mysql_query($requete); if (pmb_mysql_num_rows($res) > 0) { $result .= "\n\t\t\t\t<select id='restricted_empr_write_permission' name='restricted_empr_write_permission[]' multiple>"; while ($obj = pmb_mysql_fetch_object($res)) { $result .= "\n\t\t\t\t\t<option value='" . $obj->id_categ_empr . "' " . (in_array($obj->id_categ_empr, $this->config['restricted_empr_write_permission']) ? "selected=selected" : "") . ">" . htmlentities($obj->libelle, ENT_QUOTES, $charset) . "</option>"; } $result .= "\n\t\t\t\t\t</select>"; } $result .= "\t\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>\n\t\t\t\t<label for='included_sets'>" . htmlentities($this->msg['webdav_restricted_sets'], ENT_QUOTES, $charset) . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t<select MULTIPLE name='included_sets[]'>"; $sets = new connector_out_sets(); foreach ($sets->sets as &$aset) { $result .= "\n\t\t\t\t\t<option " . (in_array($aset->id, $this->included_sets) ? "selected" : "") . " value='" . $aset->id . "'>" . htmlentities($aset->caption, ENT_QUOTES, $charset) . "</option>"; } $result .= "\n\t\t\t\t</select>\n\t\t\t</div>\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>\n\t\t\t\t<label for='used_thesaurus'>" . htmlentities($this->msg['webdav_user_thesaurus'], ENT_QUOTES, $charset) . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t<select name='used_thesaurus'>"; $liste_thesaurus = thesaurus::getThesaurusList(); foreach ($liste_thesaurus as $id_thesaurus => $libelle_thesaurus) { $result .= "\n\t\t\t\t\t<option value='" . $id_thesaurus . "' " . ($id_thesaurus == $this->config['used_thesaurus'] ? "selected='selected'" : "") . ">" . htmlentities($libelle_thesaurus, ENT_QUOTES, $charset) . "</option>"; } $result .= "\n\t\t\t\t</select>\n\t\t\t</div>\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>\n\t\t\t\t<label for='only_with_notices'>" . htmlentities($this->msg['webdav_only_with_notices'], ENT_QUOTES, $charset) . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t" . $this->msg['webdav_yes'] . " <input type='radio' value='1' name='only_with_notices' " . ($this->config['only_with_notices'] ? "checked='checked'" : "") . "/>\n\t\t\t\t" . $this->msg['webdav_no'] . " <input type='radio' value='0' name='only_with_notices' " . ($this->config['only_with_notices'] ? "" : "checked='checked'") . "/> \n\t\t\t</div>"; $result .= "\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>\n\t\t\t\t<label for='tree'>" . htmlentities($this->msg['webdav_tree'], ENT_QUOTES, $charset) . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t<select name='tree_elem' id='select_tree_elem' onchange='load_tree_elem(this.value)'>\n\t\t\t\t\t<option value='0'>" . htmlentities($this->msg['webdav_select_tree_elem'], ENT_QUOTES, $charset) . "</option>\n\t\t\t\t\t<option value='typdoc'>typdoc</option>\n\t\t\t\t\t<option value='statut'>statut</option>\n\t\t\t\t\t<option value='categorie'>categorie</option>\n\t\t\t\t\t<option value='indexint'>indexint</option>\n\t\t\t\t</select><br />\n\t\t\t\t<table id='tree'>"; foreach ($this->config['tree'] as $pos => $elem) { $result .= "\n\t\t\t\t\t<tr id='tree_elem_tr" . $pos . "'>\n\t\t\t\t\t\t<td recept='yes' recepttype='tree_elem' highlight='tree_elem_show_recept' downlight='tree_elem_hide_recept' id='tree_elem_td" . $pos . "' draggable='yes' callback_after='move_tree_elem' dragtype='tree_elem' dragicon='{$base_path}/images/icone_drag_notice.png' dragtext='" . $elem . "'>\n\t\t\t\t\t\t\t<input type='hidden' name='tree[]' value='" . $elem . "' />\n\t\t\t\t\t\t\t<img src='{$base_path}/images/sort.png' style='width:12px; vertical-align:middle'/>" . $elem . "</td>\n\t\t\t\t\t\t<td onclick='tree_elem_delete(\"tree_elem_tr" . $pos . "\");'><img src=\"{$base_path}/images/trash.png\" /></td>\n\t\t\t\t\t</tr>"; } $result .= "\n\t\t\t\t</table>\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\tvar nb_tree_elems = " . count($this->config['tree']) . ";\n\t\t\t\t\tfunction load_tree_elem(elem){\n\t\t\t\t\t\tif(elem){\n\t\t\t\t\t\t\tvar tr = document.createElement('tr');\n\t\t\t\t\t\t\tdocument.getElementById('tree').appendChild(tr);\n\t\t\t\t\t\t\ttr.setAttribute('id','tree_elem_tr'+nb_tree_elems);\n\t\t\t\t\t\t\tvar td = document.createElement('td');\t\n\t\t\t\t\t\t\ttd.setAttribute('recept','yes');\n\t\t\t\t\t\t\ttd.setAttribute('recepttype','tree_elem');\n\t\t\t\t\t\t\ttd.setAttribute('highlight','tree_elem_show_recept');\n\t\t\t\t\t\t\ttd.setAttribute('downlight','tree_elem_hide_recept');\n\t\t\t\t\t\t\ttd.setAttribute('id','tree_elem_td'+nb_tree_elems);\n\t\t\t\t\t\t\ttd.setAttribute('draggable','yes');\n\t\t\t\t\t\t\ttd.setAttribute('callback_after','move_tree_elem');\n\t\t\t\t\t\t\ttd.setAttribute('dragtype','tree_elem');\n\t\t\t\t\t\t\ttd.setAttribute('dragicon','{$base_path}/images/icone_drag_notice.png');\n\t\t\t\t\t\t\ttd.setAttribute('dragtext',elem);\n\t\t\t\t\t\t\ttd.innerHTML = '<input type=\"hidden\" name=\"tree[]\" value=\"'+elem+'\" /> <img src=\"{$base_path}/images/sort.png\" style=\"width:12px; vertical-align:middle\"/>'+elem;\n\t\t\t\t\t\t\ttr.appendChild(td);\n\t\t\t\t\t\t\tvar td = document.createElement('td');\t\n\t\t\t\t\t\t\ttd.setAttribute('onclick','tree_elem_delete(\"tree_elem_tr'+nb_tree_elems+'\")');\n\t\t\t\t\t\t\ttd.innerHTML = '<img src=\"{$base_path}/images/trash.png\" />';\n\t\t\t\t\t\t\ttr.appendChild(td);\n\t\t\t\t\t\t\tnb_tree_elems++;\n\t\t\t\t\t\t\tinit_drag();\n\t\t\t\t\t\t\tdocument.getElementById('select_tree_elem').selectedIndex=0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfunction move_tree_elem(elem,evt,target){\n\t\t\t\t\t\n\t\t\t\t\t\tif(target != 'false' || target != 'null'){\n\t\t\t\t\t\t\telem = elem.parentNode;\n\t\t\t\t\t\t\ttarget = document.getElementById(target).parentNode;\n\t\t\t\t\t\t\tparent = target.parentNode;\n\t\t\t\t\t\t\tparent.insertBefore(elem,target);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfunction tree_elem_show_recept(obj){\n\t\t\t\t\t\tobj.style.background='#DDD';\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfunction tree_elem_hide_recept(obj){\n\t\t\t\t\t\tobj.style.background='';\n\t\t\t\t\t} \n\t\t\t\t\t\n\t\t\t\t\tfunction tree_elem_delete(id){\n\t\t\t\t\t\tdocument.getElementById(id).parentNode.removeChild(document.getElementById(id));\n\t\t\t\t\t}\n\t\t\t\t</script>\n\t\t\t</div>\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>\n\t\t\t\t<label for='default_statut'>" . htmlentities($this->msg['webdav_metasMapper_class'], ENT_QUOTES, $charset) . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'>\t\t\n\t\t\t\t<input type='text' name='metasMapper_class' value='" . htmlentities($this->config['metasMapper_class'], ENT_QUOTES, $charset) . "'/>\n\t\t\t</div>\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>\n\t\t\t\t<label for='default_statut'>" . htmlentities($this->msg['webdav_default_statut'], ENT_QUOTES, $charset) . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'>"; $query = "select id_notice_statut, gestion_libelle from notice_statut order by gestion_libelle"; $res = pmb_mysql_query($query); if (pmb_mysql_num_rows($res)) { $result .= "\n\t\t\t\t<select name='default_statut'>"; while ($row = pmb_mysql_fetch_object($res)) { $result .= "\n\t\t\t\t\t<option value='" . $row->id_notice_statut . "'" . ($row->id_notice_statut == $this->config['default_statut'] ? "selected='selected'" : "") . ">" . htmlentities($row->gestion_libelle, ENT_QUOTES, $charset) . "</option>"; } $result .= "\n\t\t\t\t</select>"; } $result .= "\t\t\t\t\n\t\t\t</div>\n\t\t\t<div class='row'> </div>\n\t\t\t<script src=\"./javascript/select.js\" type='text/javascript'></script>\n\t\t\t<script src=\"./javascript/upload.js\" type='text/javascript'></script>"; //Intégration de la gestion de l'interface de l'upload //statut docunum $result .= "\n\t\t\t<div class='row'>\n\t\t\t\t<label for='default_docnum_statut'>" . htmlentities($this->msg['webdav_default_docnum_statut'], ENT_QUOTES, $charset) . "</label>\n\t\t\t</div>\n\t\t\t<div class='row'>"; $query = "select id_explnum_statut, gestion_libelle from explnum_statut order by gestion_libelle"; $res = pmb_mysql_query($query); if (pmb_mysql_num_rows($res)) { $result .= "\n\t\t\t\t<select name='default_docnum_statut'>"; while ($row = pmb_mysql_fetch_object($res)) { $result .= "\n\t\t\t\t\t<option value='" . $row->id_explnum_statut . "'" . ($row->id_explnum_statut == $this->config['default_docnum_statut'] ? "selected='selected'" : "") . ">" . htmlentities($row->gestion_libelle, ENT_QUOTES, $charset) . "</option>"; } $result .= "\n\t\t\t\t</select>"; } $result .= "\n\t\t\t</div>"; global $pmb_docnum_in_database_allow, $pmb_docnum_in_directory_allow; $result .= "<div class='row'>"; if ($pmb_docnum_in_database_allow) { $result .= "<input type='radio' name='up_place' id='base' value='0' !!check_base!! /> <label for='base'>" . $msg['upload_repertoire_sql'] . "</label>"; } if ($pmb_docnum_in_directory_allow) { $result .= "<input type='radio' name='up_place' id='upload' value='1' !!check_up!! /> <label for='upload'>" . $msg['upload_repertoire_server'] . "</label>"; $req = "select repertoire_id, repertoire_nom from upload_repertoire order by repertoire_nom"; $res = pmb_mysql_query($req); if (pmb_mysql_num_rows($res)) { $result .= " \n\t\t\t\t\t\t<select name='id_rep'>"; while ($row = pmb_mysql_fetch_object($res)) { $result .= "\n\t\t\t\t\t\t\t<option value='" . $row->repertoire_id . "' " . ($row->repertoire_id == $this->config['upload_rep'] ? "selected='selected'" : "") . ">" . htmlentities($row->repertoire_nom, ENT_QUOTES, $charset) . "</option>"; } $result .= " \n\t\t\t\t\t\t</select>"; } } if ($pmb_docnum_in_directory_allow && $this->config['up_place']) { $result = str_replace('!!check_base!!', '', $result); $result = str_replace('!!check_up!!', "checked='checked'", $result); } else { if ($pmb_docnum_in_database_allow) { $result = str_replace('!!check_up!!', '', $result); $result = str_replace('!!check_base!!', "checked='checked'", $result); } } $result .= "</div>"; return $result; }
function extrait_info_notice($sql = "", $entete = 1, $flag = "") { global $dbh; global $dest; global $worksheet; global $myCart; global $entete_bloc; global $msg; global $debligne_excel; global $etat_table; // permet de savoir si les tag table sont ouverts ou fermés global $max_aut; // le nombre max de colonnes d'auteurs global $thesaurus_mode_pmb; global $thesaurus_defaut; global $lang; global $pmb_keyword_sep; global $max_perso; global $res_compte3; if (!$debligne_excel) { $debligne_excel = 0; } $res = @mysql_query($sql, $dbh); $nbr_lignes = @mysql_num_rows($res); $nbr_champs = @mysql_num_fields($res); if ($nbr_lignes) { // Pour les champs personnalisés $caddie_type = $myCart->type; switch ($caddie_type) { case 'EXPL': $libelle_caddie_type = "expl"; break; case 'NOTI': default: $libelle_caddie_type = "notices"; break; } switch ($dest) { case "TABLEAU": if ($entete) { $worksheet->write_string(1 + $debligne_excel, 0, $msg["caddie_mess_edition_" . $entete_bloc]); $debligne_excel++; $worksheet->write_string(1 + $debligne_excel, 0, $msg['caddie_action_marque']); for ($i = 0; $i < $nbr_champs; $i++) { // entête de colonnes $fieldname = mysql_field_name($res, $i); $worksheet->write_string(1 + $debligne_excel, $i + 1, $fieldname); } for ($i = 0; $i < $max_aut; $i++) { $worksheet->write_string(1 + $debligne_excel, $i * 6 + 1 + $nbr_champs, "aut_entree_{$i}"); $worksheet->write_string(1 + $debligne_excel, $i * 6 + 2 + $nbr_champs, "aut_rejete_{$i}"); $worksheet->write_string(1 + $debligne_excel, $i * 6 + 3 + $nbr_champs, "aut_dates_{$i}"); $worksheet->write_string(1 + $debligne_excel, $i * 6 + 4 + $nbr_champs, "aut_fonction_{$i}"); $worksheet->write_string(1 + $debligne_excel, $i * 6 + 5 + $nbr_champs, "aut_type_{$i}"); $worksheet->write_string(1 + $debligne_excel, $i * 6 + 6 + $nbr_champs, "aut_resp_type_{$i}"); } $worksheet->write_string(1 + $debligne_excel, $max_aut * 6 + $nbr_champs + 1, "DESCR"); for ($i = 0; $i < $max_perso; $i++) { $perso = mysql_fetch_object($res_compte3); $worksheet->write_string(1 + $debligne_excel, $max_aut * 6 + $nbr_champs + 2 + $i, $perso->titre); } $debligne_excel++; } //Fonctions d'auteurs $codes_auteurs = get_functions_authors(); for ($i = 0; $i < $nbr_lignes; $i++) { $debligne_excel++; $row = mysql_fetch_row($res); switch ($caddie_type) { case 'EXPL': $id_notice = $row[2]; break; case 'NOTI': default: $id_notice = $row[0]; break; } if ($flag) { $worksheet->write_string($debligne_excel, 0, "X"); } $j = 0; foreach ($row as $dummykey => $col) { if (!$col) { $col = " "; } $worksheet->write_string($debligne_excel, $j + 1, $col); $j++; } $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type "; $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id "; $rqt_aut .= "WHERE responsability_notice={$id_notice} "; $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC"; $res_aut = @mysql_query($rqt_aut); for ($iaut = 0; $iaut < $max_aut; $iaut++) { $aut = @mysql_fetch_row($res_aut); $worksheet->write_string($debligne_excel, $iaut * 6 + 1 + $nbr_champs, $aut[0]); $worksheet->write_string($debligne_excel, $iaut * 6 + 2 + $nbr_champs, $aut[1]); $worksheet->write_string($debligne_excel, $iaut * 6 + 3 + $nbr_champs, $aut[2]); $worksheet->write_string($debligne_excel, $iaut * 6 + 4 + $nbr_champs, $codes_auteurs[$aut[3]]); if ($aut[4] == "70") { $lib_type_aut = $msg[203]; } else { if ($aut[4] == "71") { $lib_type_aut = $msg[204]; } else { if ($aut[4] == "72") { $lib_type_aut = $msg["congres_libelle"]; } else { $lib_type_aut = $aut[4]; } } } $worksheet->write_string($debligne_excel, $iaut * 6 + 5 + $nbr_champs, $lib_type_aut); $lib_resp_type = ""; if ($aut[0]) { if ($aut[5] == 0) { $lib_resp_type = $msg["export_main_author"]; } else { if ($aut[5] == 1) { $lib_resp_type = $msg["export_other_author"]; } else { if ($aut[5] == 2) { $lib_resp_type = $msg["export_secondary_author"]; } } } } $worksheet->write_string($debligne_excel, $iaut * 6 + 6 + $nbr_champs, $lib_resp_type); } $q = "drop table if exists catlg "; $r = mysql_query($q, $dbh); $q = "CREATE TEMPORARY TABLE catlg ENGINE=MyISAM as "; $q .= "SELECT categories.num_noeud, categories.libelle_categorie "; $q .= "FROM noeuds, categories, notices_categories "; $q .= "WHERE notices_categories.notcateg_notice = '" . $id_notice . "' "; $q .= "AND categories.langue = '" . $lang . "' "; $q .= "AND categories.num_noeud = notices_categories.num_noeud "; $q .= "AND categories.num_noeud = noeuds.id_noeud "; $q .= "ORDER BY ordre_categorie"; $r = mysql_query($q, $dbh); $q = "DROP TABLE IF EXISTS catdef "; $r = mysql_query($q, $dbh); $q = "CREATE TEMPORARY TABLE catdef ( "; $q .= "num_noeud int(9) unsigned not null default '0', "; $q .= "num_thesaurus int(3) unsigned not null default '0', "; $q .= "libelle_categorie text not null ) ENGINE=MyISAM "; $r = mysql_query($q, $dbh); $thes_list = thesaurus::getThesaurusList(); $q = ''; foreach ($thes_list as $id_thesaurus => $libelle_thesaurus) { $thes = new thesaurus($id_thesaurus); $q = "INSERT INTO catdef "; $q .= "SELECT categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie "; $q .= "FROM noeuds, categories, notices_categories "; $q .= "WHERE noeuds.num_thesaurus={$id_thesaurus} and notices_categories.notcateg_notice = '" . $id_notice . "' "; $q .= "AND categories.langue = '" . $thes->langue_defaut . "' "; $q .= "AND categories.num_noeud = notices_categories.num_noeud "; $q .= "AND categories.num_noeud = noeuds.id_noeud "; $q .= "ORDER BY ordre_categorie"; $r = mysql_query($q, $dbh); } $q = "select catdef.num_thesaurus as num_thesaurus, "; $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie "; $q .= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud "; if (!$thesaurus_mode_pmb) { $q .= "where catdef.num_thesaurus = '" . $thesaurus_defaut . "' "; } $res_desc = mysql_query($q, $dbh); $lib_desc = ""; while ($desc = mysql_fetch_object($res_desc)) { $lib_desc .= $lib_desc ? $pmb_keyword_sep : ""; if ($thesaurus_mode_pmb) { $lib_desc .= '[' . thesaurus::getLibelle($desc->num_thesaurus) . '] '; } $lib_desc .= $desc->libelle_categorie; } $worksheet->write_string($debligne_excel, $max_aut * 6 + $nbr_champs + 1, "{$lib_desc}"); $p_perso = new parametres_perso($libelle_caddie_type); //Champs personalisés if (!$p_perso->no_special_fields) { $perso_ = $p_perso->show_fields($id_notice); for ($i = 0; $i < count($perso_["FIELDS"]); $i++) { $p = $perso_["FIELDS"][$i]; $worksheet->write_string($debligne_excel, $max_aut * 6 + $nbr_champs + 2 + $i, html_entity_decode($p["AFF"], ENT_QUOTES | ENT_COMPAT, "iso-8859-15")); } } } break; case "TABLEAUHTML": if ($entete) { if ($etat_table) { echo "\n</table>"; } echo "<h3>" . $msg["caddie_mess_edition_" . $entete_bloc] . "</h3>"; echo "\n<table><th align='left'>" . $msg['caddie_action_marque'] . "</th>"; for ($i = 0; $i < $nbr_champs; $i++) { $fieldname = mysql_field_name($res, $i); print "<th align='left'>{$fieldname}</th>"; } for ($i = 0; $i < $max_aut; $i++) { print pmb_bidi("<th align='left'>aut_entree_{$i}</th>"); print pmb_bidi("<th align='left'>aut_rejete_{$i}</th>"); print pmb_bidi("<th align='left'>aut_dates_{$i}</th>"); print pmb_bidi("<th align='left'>aut_fonction_{$i}</th>"); print pmb_bidi("<th align='left'>aut_type_{$i}</th>"); print pmb_bidi("<th align='left'>aut_resp_type_{$i}</th>"); } print "<th align='left'>DESCR</th>"; for ($i = 0; $i < $max_perso; $i++) { $perso = mysql_fetch_object($res_compte3); print "<th align='left'>" . $perso->titre . "</th>"; } $etat_table = 1; } //Fonctions d'auteurs $codes_auteurs = get_functions_authors(); for ($i = 0; $i < $nbr_lignes; $i++) { $row = mysql_fetch_row($res); switch ($caddie_type) { case 'EXPL': $id_notice = $row[2]; break; case 'NOTI': default: $id_notice = $row[0]; break; } echo "<tr>"; if ($flag) { print "<td>X</td>"; } else { print "<td> </td>"; } foreach ($row as $dummykey => $col) { if (is_numeric($col)) { $col = "'" . $col; } if (!$col) { $col = " "; } print pmb_bidi("<td>{$col}</td>"); } $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type "; $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id "; $rqt_aut .= "WHERE responsability_notice={$id_notice} "; $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC"; $res_aut = @mysql_query($rqt_aut, $dbh); for ($i = 0; $i < $max_aut; $i++) { $aut = @mysql_fetch_row($res_aut); print pmb_bidi("<td>{$aut['0']}</td>"); print pmb_bidi("<td>{$aut['1']}</td>"); print pmb_bidi("<td>{$aut['2']}</td>"); print pmb_bidi("<td>" . $codes_auteurs[$aut[3]] . "</td>"); if ($aut[4] == "70") { $lib_type_aut = $msg[203]; } else { if ($aut[4] == "71") { $lib_type_aut = $msg[204]; } else { if ($aut[4] == "72") { $lib_type_aut = $msg["congres_libelle"]; } else { $lib_type_aut = $aut[4]; } } } print pmb_bidi("<td>{$lib_type_aut}</td>"); $lib_resp_type = ""; if ($aut[0]) { if ($aut[5] == 0) { $lib_resp_type = $msg["export_main_author"]; } else { if ($aut[5] == 1) { $lib_resp_type = $msg["export_other_author"]; } else { if ($aut[5] == 2) { $lib_resp_type = $msg["export_secondary_author"]; } } } } print pmb_bidi("<td>{$lib_resp_type}</td>"); } $q = "drop table if exists catlg "; $r = mysql_query($q, $dbh); $q = "create temporary table catlg ENGINE=MyISAM as "; $q .= "select categories.num_noeud, categories.libelle_categorie "; $q .= "from noeuds, categories, notices_categories "; $q .= "where notices_categories.notcateg_notice = '" . $id_notice . "' "; $q .= "and categories.langue = '" . $lang . "' "; $q .= "and categories.num_noeud = notices_categories.num_noeud "; $q .= "and categories.num_noeud = noeuds.id_noeud "; $q .= "ORDER BY ordre_categorie"; $r = mysql_query($q, $dbh); $q = "drop table if exists catdef "; $r = mysql_query($q, $dbh); $q = "create temporary table catdef ( "; $q .= "num_noeud int(9) unsigned not null default '0', "; $q .= "num_thesaurus int(3) unsigned not null default '0', "; $q .= "libelle_categorie text not null "; $q .= ") ENGINE=MyISAM "; $r = mysql_query($q, $dbh); $thes_list = thesaurus::getThesaurusList(); $q = ''; foreach ($thes_list as $id_thesaurus => $libelle_thesaurus) { $thes = new thesaurus($id_thesaurus); $q = "insert into catdef "; $q .= "select categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie "; $q .= "from noeuds, categories, notices_categories "; $q .= "where noeuds.num_thesaurus={$id_thesaurus} and notices_categories.notcateg_notice = '" . $id_notice . "' "; $q .= "and categories.langue = '" . $thes->langue_defaut . "' "; $q .= "and categories.num_noeud = notices_categories.num_noeud "; $q .= "and categories.num_noeud = noeuds.id_noeud "; $q .= "ORDER BY ordre_categorie"; $r = mysql_query($q, $dbh); } $q = "select catdef.num_thesaurus as num_thesaurus, "; $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie "; $q .= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud "; if (!$thesaurus_mode_pmb) { $q .= "where catdef.num_thesaurus = '" . $thesaurus_defaut . "' "; } $res_desc = mysql_query($q, $dbh); $lib_desc = ""; while ($desc = mysql_fetch_object($res_desc)) { $lib_desc .= $lib_desc ? $pmb_keyword_sep : ""; if ($thesaurus_mode_pmb) { $lib_desc .= '[' . thesaurus::getLibelle($desc->num_thesaurus) . '] '; } $lib_desc .= $desc->libelle_categorie; } print pmb_bidi("<td>{$lib_desc}</td>"); $p_perso = new parametres_perso($libelle_caddie_type); //Champs personalisés if (!$p_perso->no_special_fields) { $perso_ = $p_perso->show_fields($id_notice); for ($i = 0; $i < count($perso_["FIELDS"]); $i++) { $p = $perso_["FIELDS"][$i]; print "<td>" . $p["AFF"] . "</td>"; } } echo "</tr>"; } break; default: if ($entete) { if ($etat_table) { echo "\n</table>"; } echo "<h3>" . $msg["caddie_mess_edition_" . $entete_bloc] . "</h3>"; echo "\n<table><th align='left'>" . $msg['caddie_action_marque'] . "</th>"; for ($i = 0; $i < $nbr_champs; $i++) { $fieldname = mysql_field_name($res, $i); print "<th align='left'>{$fieldname}</th>"; } for ($i = 0; $i < $max_aut; $i++) { print pmb_bidi("<th align='left'>aut_entree_{$i}</th>"); print pmb_bidi("<th align='left'>aut_rejete_{$i}</th>"); print pmb_bidi("<th align='left'>aut_dates_{$i}</th>"); print pmb_bidi("<th align='left'>aut_fonction_{$i}</th>"); print pmb_bidi("<th align='left'>aut_type_{$i}</th>"); print pmb_bidi("<th align='left'>aut_resp_type_{$i}</th>"); } print "<th align='left'>DESCR</th>"; for ($i = 0; $i < $max_perso; $i++) { $perso = mysql_fetch_object($res_compte3); print "<th align='left'>" . $perso->titre . "</th>"; } $etat_table = 1; } //Fonctions d'auteurs $codes_auteurs = get_functions_authors(); $odd_even = 0; for ($i = 0; $i < $nbr_lignes; $i++) { $row = mysql_fetch_row($res); switch ($caddie_type) { case 'EXPL': $id_notice = $row[2]; break; case 'NOTI': default: $id_notice = $row[0]; break; } if ($odd_even == 0) { echo "\t<tr class='odd'>"; $odd_even = 1; } else { if ($odd_even == 1) { echo "\t<tr class='even'>"; $odd_even = 0; } } if ($flag) { print "<td>X</td>"; } else { print "<td> </td>"; } foreach ($row as $dummykey => $col) { if (!$col) { $col = " "; } print pmb_bidi("<td>{$col}</td>"); } $rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type "; $rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id "; $rqt_aut .= "WHERE responsability_notice={$id_notice} "; $rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC"; $res_aut = @mysql_query($rqt_aut, $dbh); for ($i = 0; $i < $max_aut; $i++) { $aut = @mysql_fetch_row($res_aut); print pmb_bidi("<td>{$aut['0']}</td>"); print pmb_bidi("<td>{$aut['1']}</td>"); print pmb_bidi("<td>{$aut['2']}</td>"); print pmb_bidi("<td>" . $codes_auteurs[$aut[3]] . "</td>"); if ($aut[4] == "70") { $lib_type_aut = $msg[203]; } else { if ($aut[4] == "71") { $lib_type_aut = $msg[204]; } else { if ($aut[4] == "72") { $lib_type_aut = $msg["congres_libelle"]; } else { $lib_type_aut = $aut[4]; } } } print pmb_bidi("<td>{$lib_type_aut}</td>"); $lib_resp_type = ""; if ($aut[0]) { if ($aut[5] == 0) { $lib_resp_type = $msg["export_main_author"]; } else { if ($aut[5] == 1) { $lib_resp_type = $msg["export_other_author"]; } else { if ($aut[5] == 2) { $lib_resp_type = $msg["export_secondary_author"]; } } } } print pmb_bidi("<td>{$lib_resp_type}</td>"); } $q = "drop table if exists catlg "; $r = mysql_query($q, $dbh); $q = "create temporary table catlg ENGINE=MyISAM as "; $q .= "select categories.num_noeud, categories.libelle_categorie "; $q .= "from noeuds, categories, notices_categories "; $q .= "where notices_categories.notcateg_notice = '" . $id_notice . "' "; $q .= "and categories.langue = '" . $lang . "' "; $q .= "and categories.num_noeud = notices_categories.num_noeud "; $q .= "and categories.num_noeud = noeuds.id_noeud "; $q .= "ORDER BY ordre_categorie"; $r = mysql_query($q, $dbh); $q = "drop table if exists catdef "; $r = mysql_query($q, $dbh); $q = "create temporary table catdef ( "; $q .= "num_noeud int(9) unsigned not null default '0', "; $q .= "num_thesaurus int(3) unsigned not null default '0', "; $q .= "libelle_categorie text not null "; $q .= ") ENGINE=MyISAM "; $r = mysql_query($q, $dbh); $thes_list = thesaurus::getThesaurusList(); $q = ''; foreach ($thes_list as $id_thesaurus => $libelle_thesaurus) { $thes = new thesaurus($id_thesaurus); $q = "insert into catdef "; $q .= "select categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie "; $q .= "from noeuds, categories, notices_categories "; $q .= "where noeuds.num_thesaurus={$id_thesaurus} and notices_categories.notcateg_notice = '" . $id_notice . "' "; $q .= "and categories.langue = '" . $thes->langue_defaut . "' "; $q .= "and categories.num_noeud = notices_categories.num_noeud "; $q .= "and categories.num_noeud = noeuds.id_noeud "; $q .= "ORDER BY ordre_categorie"; $r = mysql_query($q, $dbh); } $q = "select catdef.num_thesaurus as num_thesaurus, "; $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie "; $q .= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud "; if (!$thesaurus_mode_pmb) { $q .= "where catdef.num_thesaurus = '" . $thesaurus_defaut . "' "; } $res_desc = mysql_query($q, $dbh); $lib_desc = ""; while ($desc = mysql_fetch_object($res_desc)) { $lib_desc .= $lib_desc ? $pmb_keyword_sep : ""; if ($thesaurus_mode_pmb) { $lib_desc .= '[' . thesaurus::getLibelle($desc->num_thesaurus) . '] '; } $lib_desc .= $desc->libelle_categorie; } print pmb_bidi("<td>{$lib_desc}</td>"); $p_perso = new parametres_perso($libelle_caddie_type); //Champs personalisés if (!$p_perso->no_special_fields) { $perso_ = $p_perso->show_fields($id_notice); for ($i = 0; $i < count($perso_["FIELDS"]); $i++) { $p = $perso_["FIELDS"][$i]; print "<td>" . $p["AFF"] . "</td>"; } } echo "</tr>"; } break; } // fin switch } // fin if nbr_lignes }
function search_categories() { global $opac_search_other_function, $typdoc, $dbh, $charset, $opac_thesaurus_defaut, $lang, $opac_thesaurus; global $opac_stemming_active; $first_clause .= "categories.libelle_categorie not like '~%' "; $q = 'drop table if exists catjoin '; $r = pmb_mysql_query($q, $dbh); $q = 'create temporary table catjoin ( '; $q .= "num_thesaurus int(3) unsigned not null default '0', "; $q .= "num_noeud int(9) unsigned not null default '0', "; $q .= 'key (num_noeud,num_thesaurus) '; $q .= ") ENGINE=MyISAM "; $r = pmb_mysql_query($q, $dbh); $list_thes = array(); if ($opac_thesaurus) { //mode multithesaurus $list_thes = thesaurus::getThesaurusList(); $id_thes_for_link = -1; } else { //mode monothesaurus $thes = new thesaurus($opac_thesaurus_defaut); $list_thes[$opac_thesaurus_defaut] = $thes->libelle_thesaurus; $id_thes_for_link = $opac_thesaurus_defaut; } $aq = new analyse_query(stripslashes($this->user_query), 0, 0, 1, 0, $opac_stemming_active); $members_catdef = $aq->get_query_members('catdef', 'catdef.libelle_categorie', 'catdef.index_categorie', 'catdef.num_noeud'); $members_catlg = $aq->get_query_members('catlg', 'catlg.libelle_categorie', 'catlg.index_categorie', 'catlg.num_noeud'); foreach ($list_thes as $id_thesaurus => $libelle_thesaurus) { $thes = new thesaurus($id_thesaurus); $q = "INSERT INTO catjoin SELECT noeuds.num_thesaurus, noeuds.id_noeud FROM "; if ($lang == $thes->langue_defaut || in_array($lang, thesaurus::getTranslationsList()) === false) { $q .= "noeuds JOIN categories as catdef on noeuds.id_noeud = catdef.num_noeud AND catdef.langue = '" . $thes->langue_defaut . "'"; //$q.=" WHERE noeuds.num_thesaurus='".$id_thesaurus."' AND not_use_in_indexation='0' AND catdef.libelle_categorie not like '~%' and ".$members_catdef["where"]; $q .= " WHERE noeuds.num_thesaurus='" . $id_thesaurus . "' AND catdef.libelle_categorie not like '~%' and " . $members_catdef["where"]; } else { $q .= "noeuds JOIN categories as catdef on noeuds.id_noeud = catdef.num_noeud AND catdef.langue='" . $thes->langue_defaut . "' JOIN categories as catlg on catdef.num_noeud=catlg.num_noeud and catlg.langue = '" . $lang . "'"; //$q.=" WHERE noeuds.num_thesaurus='".$id_thesaurus."' AND not_use_in_indexation='0' AND if(catlg.num_noeud is null, ".$members_catdef["where"].", ".$members_catlg["where"].") AND if(catlg.num_noeud is null,catdef.libelle_categorie not like '~%',catlg.libelle_categorie not like '~%')"; $q .= " WHERE noeuds.num_thesaurus='" . $id_thesaurus . "' AND if(catlg.num_noeud is null, " . $members_catdef["where"] . ", " . $members_catlg["where"] . ") AND if(catlg.num_noeud is null,catdef.libelle_categorie not like '~%',catlg.libelle_categorie not like '~%')"; } $r = pmb_mysql_query($q, $dbh); } $clause = ''; $add_notice = ''; if ($opac_search_other_function) { $add_notice = search_other_function_clause(); } if ($typdoc || $add_notice) { $clause .= ' JOIN notices_categories ON notices_categories.num_noeud=catjoin.num_noeud JOIN notices ON notices_categories.notcateg_notice=notices.notice_id WHERE 1 '; } else { $clause .= ' WHERE 1 '; } if ($typdoc) { $clause .= " and typdoc='" . $typdoc . "' "; } if ($add_notice) { $clause .= ' and notice_id in (' . $add_notice . ')'; } $q = 'select count(distinct catjoin.num_noeud) from catjoin ' . $clause; $r = pmb_mysql_query($q); $nb_result_categories = pmb_mysql_result($r, 0, 0); if ($nb_result_categories) { $form = "<form name=\"search_categorie\" action=\"./index.php?lvl=more_results\" method=\"post\">"; $form .= "<input type=\"hidden\" name=\"user_query\" value=\"" . htmlentities(stripslashes($this->user_query), ENT_QUOTES, $charset) . "\">\n"; if (function_exists("search_other_function_post_values")) { $form .= search_other_function_post_values(); } $form .= "<input type=\"hidden\" name=\"mode\" value=\"categorie\">\n"; $form .= "<input type=\"hidden\" name=\"search_type_asked\" value=\"simple_search\">\n"; $form .= "<input type=\"hidden\" id=\"count\" name=\"count\" value=\"" . $nb_result_categories . "\">\n"; $form .= "<input type=\"hidden\" name=\"clause\" value=\"" . htmlentities($clause, ENT_QUOTES, $charset) . "\">\n"; $form .= "<input type=\"hidden\" id=\"id_thes\" name=\"id_thes\" value=\"" . $id_thes_for_link . "\"></form>\n"; $_SESSION["level1"]["category"]["form"] = $form; $_SESSION["level1"]["category"]["count"] = $nb_result_categories; } return $nb_result_categories; }
function simple_search_content($value = '', $css) { global $dbh; global $msg; global $charset; global $lang; global $css; global $search_type; global $class_path; global $es; global $lvl; global $include_path; global $opac_allow_extended_search, $opac_allow_term_search, $opac_allow_external_search; global $typdoc; global $opac_search_other_function, $opac_search_show_typdoc; global $opac_thesaurus; global $id_thes; global $base_path; global $opac_allow_tags_search; global $opac_show_onglet_empr; global $external_env; global $user_query; global $source; global $opac_recherches_pliables; global $opac_show_help; global $onglet_persopac, $opac_allow_personal_search; global $search_form_perso, $search_form, $search_form_perso_limitsearch, $limitsearch; global $opac_show_onglet_help; global $search_in_perio; global $get_query; global $opac_show_onglet_perio_a2z, $opac_autolevel2; global $opac_simple_search_suggestions; include $include_path . "/templates/simple_search.tpl.php"; if ($opac_search_other_function) { require_once $include_path . "/" . $opac_search_other_function; } // pour la DSI global $opac_allow_bannette_priv; // bannettes privees autorisees ? global $bt_cree_bannette_priv; if ($opac_allow_bannette_priv && ($bt_cree_bannette_priv || $_SESSION['abon_cree_bannette_priv'] == 1)) { $_SESSION['abon_cree_bannette_priv'] = 1; } else { $_SESSION['abon_cree_bannette_priv'] = 0; } global $script_test_form; switch ($opac_show_onglet_empr) { case 1: $empr_link_onglet = "./index.php?search_type_asked=connect_empr"; break; case 2: $empr_link_onglet = "./empr.php"; break; } $search_p = new search_persopac(); $onglets_search_perso = $search_p->directlink_user; $onglets_search_perso_form = $search_p->directlink_user_form; switch ($search_type) { case "simple_search": // les tests de formulaire $result = $script_test_form; $tests = test_field("search_input", "query", "recherche"); $result = str_replace("!!tests!!", $tests, $result); // les typ_doc if ($opac_search_show_typdoc) { $query = "SELECT typdoc FROM notices where typdoc!='' GROUP BY typdoc"; $result2 = mysql_query($query, $dbh); $toprint_typdocfield = " <select name='typdoc'>"; $toprint_typdocfield .= " <option "; $toprint_typdocfield .= " value=''"; if ($typdoc == '') { $toprint_typdocfield .= " selected"; } $toprint_typdocfield .= ">" . $msg["simple_search_all_doc_type"] . "</option>\n"; $doctype = new marc_list('doctype'); while ($rt = mysql_fetch_row($result2)) { $obj[$rt[0]] = 1; } foreach ($doctype->table as $key => $libelle) { if ($obj[$key] == 1) { $toprint_typdocfield .= " <option "; $toprint_typdocfield .= " value='{$key}'"; if ($typdoc == $key) { $toprint_typdocfield .= " selected"; } $toprint_typdocfield .= ">" . htmlentities($libelle, ENT_QUOTES, $charset) . "</option>\n"; } } $toprint_typdocfield .= "</select>"; } else { $toprint_typdocfield = ""; } if ($opac_search_other_function) { $toprint_typdocfield .= search_other_function_filters(); } $toprint_typdocfield .= "<br />"; // le contenu $result .= $search_input; // on met la valeur a jour $result = str_replace("!!user_query!!", htmlentities($value, ENT_QUOTES, $charset), $result); $result = str_replace("<!--!!typdoc_field!!-->", $toprint_typdocfield, $result); if ($opac_autolevel2) { $result = str_replace("!!action_simple_search!!", "./index.php?lvl=more_results&autolevel1=1", $result); } else { $result = str_replace("!!action_simple_search!!", "./index.php?lvl=search_result", $result); } if (!$opac_recherches_pliables) { $ou_chercher = "<div id='simple_search_zone'>" . do_ou_chercher() . "</div>"; } elseif ($opac_recherches_pliables == 1) { $ou_chercher = "<div id='simple_search_zone'>" . gen_plus_form("zsimples", $msg["rechercher_dans"], do_ou_chercher(), false) . "</div>"; } elseif ($opac_recherches_pliables == 2) { $ou_chercher = "<div id='simple_search_zone'>" . gen_plus_form("zsimples", $msg["rechercher_dans"], do_ou_chercher(), true) . "</div>"; } elseif ($opac_recherches_pliables == 3) { // les options de recherches sont invisibles, pas dépliables. $ou_chercher = "\n" . do_ou_chercher_hidden() . "\n"; } $result = str_replace("<!--!!ou_chercher!!-->", $ou_chercher, $result); // on se place dans le bon champ // $result .= form_focus("search_input", "query"); $others = ""; if ($opac_allow_personal_search) { $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>"; } $others .= $onglets_search_perso; if ($opac_allow_extended_search) { $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>"; } if ($opac_allow_term_search) { $others .= "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>"; } if ($opac_allow_tags_search) { $others .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>"; } if ($opac_show_onglet_perio_a2z) { $others .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>"; } if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) { if (!$_SESSION["user_code"]) { $others .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>"; } else { $others .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>"; } } if ($opac_allow_external_search) { $others .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>"; } $result = str_replace("!!others!!", $others, $result); $result .= $onglets_search_perso_form; break; //Recherche avancee //Recherche avancee case "extended_search": global $mode_aff; if ($mode_aff) { if ($mode_aff == "aff_module") { //ajout de la recherche dans l'historique $_SESSION["nb_queries"] = $_SESSION["nb_queries"] + 1; $n = $_SESSION["nb_queries"]; $_SESSION["notice_view" . $n] = $_SESSION["last_module_search"]; switch ($_SESSION["last_module_search"]["search_mod"]) { case 'etagere_see': //appel de la fonction tableau_etagere du fichier etagere_func.inc.php $r1 = $msg["etagere_query"]; $t = array(); $t = tableau_etagere($_SESSION["last_module_search"]["search_id"]); $r = $r1 . " '" . $t[0]["nometagere"] . "'"; break; case 'categ_see': // instanciation de la categorie $ourCateg = new categorie($_SESSION["last_module_search"]["search_id"]); $r1 = $msg["category"]; $r = $r1 . " '" . $ourCateg->libelle . "'"; break; case 'indexint_see': // instanciation de la classe indexation $r1 = $msg["indexint_search"]; $ourIndexint = new indexint($_SESSION["last_module_search"]["search_id"]); $r = $r1 . " '" . $ourIndexint->name . " " . $ourIndexint->comment . "'"; break; case 'section_see': $resultat = mysql_query("select location_libelle from docs_location where idlocation='" . addslashes($_SESSION["last_module_search"]["search_location"]) . "'"); $j = mysql_fetch_array($resultat); $localisation_ = $j["location_libelle"]; mysql_free_result($resultat); $resultat = mysql_query("select section_libelle from docs_section where idsection='" . addslashes($_SESSION["last_module_search"]["search_id"]) . "'"); $j = mysql_fetch_array($resultat); $section_ = $j["section_libelle"]; mysql_free_result($resultat); $r1 = $localisation_ . " => " . $msg["section"]; $r = $r1 . " '" . $section_ . "'"; break; } $_SESSION["human_query" . $n] = $r; $_SESSION["search_type" . $n] = "module"; } else { if ($_SESSION["last_query"]) { $n = $_SESSION["last_query"]; if ($_SESSION["lq_facette"]) { $facette = true; } } else { $n = $_SESSION["nb_queries"]; } } //générer les critères de la multi_critères //Attention ! si on est déjà dans une facette ! if ($facette) { search::unserialize_search($_SESSION["lq_facette_search"]["lq_search"]); } else { global $search; $search[0] = "s_1"; $op_ = "EQ"; //operateur $op = "op_0_" . $search[0]; global ${$op}; ${$op} = $op_; //contenu de la recherche $field = "field_0_" . $search[0]; $field_ = array(); $field_[0] = $n; global ${$field}; ${$field} = $field_; //opérateur inter-champ $inter = "inter_0_" . $search[0]; global ${$inter}; ${$inter} = ""; //variables auxiliaires $fieldvar_ = "fieldvar_0_" . $search[0]; global ${$fieldvar_}; ${$fieldvar_} = ""; $fieldvar = ${$fieldvar_}; } } if ($search_in_perio) { global $search; $search[0] = "f_34"; //opérateur $op = "op_0_" . $search[0]; global ${$op}; $op_ = "EQ"; ${$op} = $op_; //contenu de la recherche $field = "field_0_" . $search[0]; $field_ = array(); $field_[0] = $search_in_perio; global ${$field}; ${$field} = $field_; $search[1] = "f_42"; //opérateur $op = "op_1_" . $search[0]; global ${$op}; $op_ = "BOOLEAN"; ${$op} = $op_; } else { if ($get_query) { if ($_SESSION["last_query"] == $get_query && $_SESSION["lq_facette_test"]) { search::unserialize_search($_SESSION["lq_facette_search"]["lq_search"]); } else { get_history($get_query); } } } $es = new search(); if ($onglet_persopac) { $search_form = $search_form_perso; global $search; if (!$search) { $search_p_direct = new search_persopac($onglet_persopac); $es->unserialize_search($search_p_direct->query); } } if ($limitsearch) { $search_form = $search_form_perso_limitsearch; } if ($onglet_persopac && $lvl == "search_result") { $es->reduct_search(); } $result = $es->show_form("./index.php?lvl={$lvl}&search_type_asked=extended_search", "./index.php?lvl=search_result&search_type_asked=extended_search"); $others = "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>\n"; if ($opac_allow_personal_search) { $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>"; } $others .= $onglets_search_perso; if ($opac_allow_term_search) { $others2 = "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>\n"; } else { $others2 = ""; } if ($opac_allow_tags_search) { $others2 .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>"; } if ($opac_show_onglet_perio_a2z) { $others2 .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>"; } if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) { if (!$_SESSION["user_code"]) { $others2 .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>"; } else { $others2 .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>"; } } if ($opac_allow_external_search) { $others2 .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>"; } $result = str_replace("!!others!!", $others, $result); $result = str_replace("!!others2!!", $others2, $result); $result = "<div id='search'>" . $result . "</div>"; $result .= $onglets_search_perso_form; break; //Recherche avancee //Recherche avancee case "external_search": //Si c'est une multi-critere, on l'affiche telle quelle global $external_type; if ($external_type) { $_SESSION["ext_type"] = $external_type; } global $mode_aff; //Affinage if ($mode_aff) { if ($mode_aff == "aff_module") { //ajout de la recherche dans l'historique $_SESSION["nb_queries"] = $_SESSION["nb_queries"] + 1; $n = $_SESSION["nb_queries"]; $_SESSION["notice_view" . $n] = $_SESSION["last_module_search"]; switch ($_SESSION["last_module_search"]["search_mod"]) { case 'etagere_see': //appel de la fonction tableau_etagere du fichier etagere_func.inc.php $r1 = $msg["etagere_query"]; $t = array(); $t = tableau_etagere($_SESSION["last_module_search"]["search_id"]); $r = $r1 . " '" . $t[0]["nometagere"] . "'"; break; case 'categ_see': // instanciation de la catégorie $ourCateg = new categorie($_SESSION["last_module_search"]["search_id"]); $r1 = $msg["category"]; $r = $r1 . " '" . $ourCateg->libelle . "'"; break; case 'indexint_see': // instanciation de la classe indexation $r1 = $msg["indexint_search"]; $ourIndexint = new indexint($_SESSION["last_module_search"]["search_id"]); $r = $r1 . " '" . $ourIndexint->name . " " . $ourIndexint->comment . "'"; break; case 'section_see': $resultat = mysql_query("select location_libelle from docs_location where idlocation='" . addslashes($_SESSION["last_module_search"]["search_location"]) . "'"); $j = mysql_fetch_array($resultat); $localisation_ = $j["location_libelle"]; mysql_free_result($resultat); $resultat = mysql_query("select section_libelle from docs_section where idsection='" . addslashes($_SESSION["last_module_search"]["search_id"]) . "'"); $j = mysql_fetch_array($resultat); $section_ = $j["section_libelle"]; mysql_free_result($resultat); $r1 = $localisation_ . " => " . $msg["section"]; $r = $r1 . " '" . $section_ . "'"; break; } $_SESSION["human_query" . $n] = $r; $_SESSION["search_type" . $n] = "module"; } else { if ($_SESSION["last_query"]) { $n = $_SESSION["last_query"]; } else { $n = $_SESSION["nb_queries"]; } } } if ($_SESSION["ext_type"] == "multi") { global $search; if (!$search) { $search[0] = "s_2"; $op_0_s_2 = "EQ"; $field_0_s_2 = array(); } else { //Recherche du champp source, s'il n'est pas present, on decale tout et on l'ajoute $flag_found = false; for ($i = 0; $i < count($search); $i++) { if ($search[$i] == "s_2") { $flag_found = true; break; } } if (!$flag_found) { //Pas trouve, on decale tout !! for ($i = count($search) - 1; $i >= 0; $i--) { $search[$i + 1] = $search[$i]; decale("field_" . $i . "_" . $search[$i], "field_" . ($i + 1) . "_" . $search[$i]); decale("op_" . $i . "_" . $search[$i], "op_" . ($i + 1) . "_" . $search[$i]); decale("inter_" . $i . "_" . $search[$i], "inter_" . ($i + 1) . "_" . $search[$i]); decale("fieldvar_" . $i . "_" . $search[$i], "fieldvar_" . ($i + 1) . "_" . $search[$i]); } $search[0] = "s_2"; $op_0_s_2 = "EQ"; $field_0_s_2 = array(); } } if ($mode_aff) { //générer les critères de la multi_critères $search[1] = "s_1"; $op_ = "EQ"; //opérateur $op = "op_1_" . $search[1]; global ${$op}; ${$op} = $op_; //contenu de la recherche $field = "field_1_" . $search[1]; $field_ = array(); $field_[0] = $n; global ${$field}; ${$field} = $field_; //opérateur inter-champ $inter = "inter_1_" . $search[1]; global ${$inter}; ${$inter} = "and"; //variables auxiliaires $fieldvar_ = "fieldvar_1_" . $search[1]; global ${$fieldvar_}; ${$fieldvar_} = ""; $fieldvar = ${$fieldvar_}; } $es = new search("search_fields_unimarc"); $result = $es->show_form("./index.php?lvl={$lvl}&search_type_asked=external_search", "./index.php?lvl=search_result&search_type_asked=external_search"); } else { global $mode_aff; //Si il y a une mode d'affichage demandé, on construit l'écran correspondant if ($mode_aff) { $f = get_field_text($n); $user_query = $f[0]; $look = $f[1]; global ${$look}; ${$look} = 1; global $look_FIRSTACCESS; $look_FIRSTACCESS = 1; } else { if ($external_env) { $external_env = unserialize(stripslashes($external_env)); foreach ($external_env as $varname => $varvalue) { global ${$varname}; ${$varname} = $varvalue; } } } $result = $search_input; $result = str_replace("!!user_query!!", htmlentities(stripslashes($user_query), ENT_QUOTES, $charset), $result); $result = str_replace("<!--!!ou_chercher!!-->", do_ou_chercher(), $result); $result = str_replace("<!--!!sources!!-->", do_sources(), $result); } $others = "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>\n"; if ($opac_allow_personal_search) { $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>"; } $others .= $onglets_search_perso; if ($opac_allow_extended_search) { $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>"; } if ($opac_allow_term_search) { $others .= "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>\n"; } if ($opac_allow_tags_search) { $others .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>"; } if ($opac_show_onglet_perio_a2z) { $others .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>"; } if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) { if (!$_SESSION["user_code"]) { $others .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>"; } else { $others .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>"; } } $others2 = ""; $result = str_replace("!!others!!", $others, $result); $result = str_replace("!!others2!!", $others2, $result); $result = "<div id='search'>" . $result . "</div>"; $result .= $onglets_search_perso_form; break; //Recherche par termes //Recherche par termes case "term_search": global $search_term; global $term_click; global $page_search; global $opac_term_search_height; global $opac_show_help; if (!$opac_term_search_height) { $height = 300; } else { $height = $opac_term_search_height; } $search_form_term = "\n\t\t\t<div id='search'>\n\t\t\t<ul class='search_tabs'>!!others!!" . ($opac_show_onglet_help ? "<li><a href=\"./index.php?lvl=infopages&pagesid={$opac_show_onglet_help}\">" . $msg["search_help"] . "</a></li>" : '') . "\n\t\t\t</ul>\n\t\t\t<div id='search_crl'></div>\n\t\t\t<form class='form-{$current_module}' name='term_search_form' method='post' action='./index.php?lvl={$lvl}&search_type_asked=term_search'>\n\t\t\t\t<div class='form-contenu'>\n\t\t\t\t<!-- sel_thesaurus -->\n\t\t\t\t\t\t\t<span class='libSearchTermes'>" . $msg["term_search_search_for"] . "</span><input type='text' class='saisie-50em' name='search_term' value='" . htmlentities(stripslashes($search_term), ENT_QUOTES, $charset) . "'>\n\t\t\t\t\t<!--\tBouton Rechercher -->\n\t\t\t\t\t\t<input type='submit' class='boutonrechercher' value='{$msg['142']}' onClick=\"this.form.page_search.value=''; this.form.term_click.value='';\"/>\n"; if ($opac_show_help) { $search_form_term .= "<input type='submit' class='bouton' value='{$msg['search_help']}' onClick='window.open(\"help.php?whatis=search_terms\", \"search_help\", \"scrollbars=yes, toolbar=no, dependent=yes, width=400, height=400, resizable=yes\"); return false' />\n"; } $search_form_term .= "<input type='hidden' name='term_click' value='" . htmlentities(stripslashes($term_click), ENT_QUOTES, $charset) . "'/>\n\t\t\t\t<input type='hidden' name='page_search' value='" . $page_search . "'/>\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t\t<script type='text/javascript'>\n\t\t\t\tdocument.forms['term_search_form'].elements['search_term'].focus();\n\t\t\t\t</script>\n\t\t\t</div>\n\t\t\t"; //recuperation du thesaurus session if (!$id_thes) { $id_thes = thesaurus::getSessionThesaurusId(); } else { thesaurus::setSessionThesaurusId($id_thes); } //affichage du selectionneur de thesaurus et du lien vers les thesaurus $liste_thesaurus = thesaurus::getThesaurusList(); $sel_thesaurus = ''; $lien_thesaurus = ''; if ($opac_thesaurus != 0) { //la liste des thesaurus n'est pas affichée en mode monothesaurus $sel_thesaurus = "<select class='saisie-30em' id='id_thes' name='id_thes' "; $sel_thesaurus .= "onchange = \"document.location = './index.php?lvl=index&search_type_asked=term_search&id_thes='+document.getElementById('id_thes').value; \">"; foreach ($liste_thesaurus as $id_thesaurus => $libelle_thesaurus) { $sel_thesaurus .= "<option value='" . $id_thesaurus . "' "; if ($id_thesaurus == $id_thes) { $sel_thesaurus .= " selected"; } $sel_thesaurus .= ">" . htmlentities($libelle_thesaurus, ENT_QUOTES, $charset) . "</option>"; } $sel_thesaurus .= "<option value=-1 "; if ($id_thes == -1) { $sel_thesaurus .= "selected "; } $sel_thesaurus .= ">" . htmlentities($msg['thes_all'], ENT_QUOTES, $charset) . "</option>"; $sel_thesaurus .= "</select> "; $lien_thesaurus = "<a href='./autorites.php?categ=categories&sub=thes'>" . $msg[thes_lien] . "</a>"; } $search_form_term = str_replace("<!-- sel_thesaurus -->", $sel_thesaurus, $search_form_term); $search_form_term = str_replace("<!-- lien_thesaurus -->", $lien_thesaurus, $search_form_term); $result = $search_form_term; $others = ""; $others .= "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>"; if ($opac_allow_personal_search) { $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>"; } $others .= $onglets_search_perso; if ($opac_allow_extended_search) { $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>"; } $others .= "<li id='current'>" . $msg["search_by_terms"] . "</li>"; if ($opac_allow_tags_search) { $others .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>"; } if ($opac_show_onglet_perio_a2z) { $others .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>"; } if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) { if (!$_SESSION["user_code"]) { $others .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>"; } else { $others .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>"; } } if ($opac_allow_external_search) { $others .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>"; } $result = str_replace("!!others!!", $others, $result); $result .= "\n\t\t\t<a name='search_frame'/>\n\t\t\t<iframe style='border: solid 1px black;' name='term_search' class='frame_term_search' src='" . $base_path . "/term_browse.php?search_term=" . rawurlencode(stripslashes($search_term)) . "&term_click=" . rawurlencode(stripslashes($term_click)) . "&page_search={$page_search}&id_thes={$id_thes}' width='100%' height='" . $height . "'></iframe>\n\t\t\t<br /><br />"; $result .= $onglets_search_perso_form; break; case "tags_search": // les tests de formulaire $result = $script_test_form; $tests = test_field("search_input", "query", "recherche"); $result = str_replace("!!tests!!", $tests, $result); if ($opac_search_other_function) { $toprint_typdocfield .= search_other_function_filters(); } // le contenu $result .= $search_input; // on met la valeur a jour $result = str_replace("!!user_query!!", htmlentities($value, ENT_QUOTES, $charset), $result); $result = str_replace("<!--!!typdoc_field!!-->", "", $result); $result = str_replace("<!--!!ou_chercher!!-->", "", $result); // on se place dans le bon champ // $result .= form_focus("search_input", "query"); $others = ""; $others = "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>\n"; if ($opac_allow_personal_search) { $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>"; } $others .= $onglets_search_perso; if ($opac_allow_extended_search) { $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>"; } if ($opac_allow_term_search) { $others .= "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>"; } if ($opac_allow_tags_search) { $others .= "<li id='current'>" . $msg["tags_search"] . "</li>"; } if ($opac_show_onglet_perio_a2z) { $others .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>"; } if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) { if (!$_SESSION["user_code"]) { $others .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>"; } else { $others .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>"; } } if ($opac_allow_external_search) { $others .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>"; } $result = str_replace("!!others!!", $others, $result); // Ajout de la liste des tags if ($user_query == "") { $result .= "<h3><span>{$msg['search_result_for']}<b>" . htmlentities(stripslashes($user_query), ENT_QUOTES, $charset) . "</b></span></h3>"; $tag = new tags(); $result .= $tag->listeAlphabetique(); } $result .= $onglets_search_perso_form; break; // ***************** // Pour affichage compte emprunteur en onglet // ***************** // Pour affichage compte emprunteur en onglet case "connect_empr": // les tests de formulaire $result = $search_input; $others = ""; $others = "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>\n"; if ($opac_allow_personal_search) { $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>"; } $others .= $onglets_search_perso; if ($opac_allow_extended_search) { $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>"; } if ($opac_allow_term_search) { $others .= "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>"; } if ($opac_allow_tags_search) { $others .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>"; } if ($opac_show_onglet_perio_a2z) { $others .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>"; } if ($opac_show_onglet_empr) { if (!$_SESSION["user_code"]) { $others .= "<li id='current'>" . $msg["onglet_empr_connect"] . "</li>"; } else { $others .= "<li id='current'>" . $msg["onglet_empr_compte"] . "</li>"; } } if ($opac_allow_external_search) { $others .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>"; } $result = str_replace("!!account_or_form_empr_connect!!", affichage_onglet_compte_empr(), $result); $result = str_replace("!!others!!", $others, $result); $result .= $onglets_search_perso_form; break; case "search_perso": // les tests de formulaire $result = $search_input; $others = ""; $others = "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>\n"; if ($opac_allow_personal_search) { $others .= "<li id='current'>" . $msg["search_perso_menu"] . "</li>"; } $others .= $onglets_search_perso; if ($opac_allow_extended_search) { $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>"; } if ($opac_allow_term_search) { $others .= "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>"; } if ($opac_allow_tags_search) { $others .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>"; } if ($opac_show_onglet_perio_a2z) { $others .= "<li><a href=\"./index.php?search_type_asked=perio_a2z\">" . $msg["a2z_onglet"] . "</a></li>"; } if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) { if (!$_SESSION["user_code"]) { $others .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>"; } else { $others .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>"; } } if ($opac_allow_external_search) { $others .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>"; } $search_p = new search_persopac(); $result = str_replace("!!contenu!!", $search_p->do_list(), $result); $result = str_replace("!!others!!", $others, $result); break; case "perio_a2z": global $opac_perio_a2z_abc_search; global $opac_perio_a2z_max_per_onglet; $result = $search_input; $others .= "<li><a href=\"./index.php?search_type_asked=simple_search\">" . $msg["simple_search"] . "</a></li>\n"; if ($opac_allow_personal_search) { $others .= "<li><a href=\"./index.php?search_type_asked=search_perso\">" . $msg["search_perso_menu"] . "</a></li>"; } $others .= $onglets_search_perso; if ($opac_allow_extended_search) { $others .= "<li><a href=\"./index.php?search_type_asked=extended_search\">" . $msg["extended_search"] . "</a></li>"; } if ($opac_allow_term_search) { $others .= "<li><a href=\"./index.php?search_type_asked=term_search\">" . $msg["term_search"] . "</a></li>"; } if ($opac_allow_tags_search) { $others .= "<li><a href=\"./index.php?search_type_asked=tags_search\">" . $msg["tags_search"] . "</a></li>"; } if ($opac_show_onglet_perio_a2z) { $others .= "<li id='current'>" . $msg["a2z_onglet"] . "</li>"; } if ($opac_show_onglet_empr == 1 || $opac_show_onglet_empr == 2 && $_SESSION["user_code"]) { if (!$_SESSION["user_code"]) { $others .= "<li><a href=\"./index.php?search_type_asked=connect_empr\">" . $msg["onglet_empr_connect"] . "</a></li>"; } else { $others .= "<li><a href=\"{$empr_link_onglet}\">" . $msg["onglet_empr_compte"] . "</a></li>"; } } if ($opac_allow_external_search) { $others .= "<li><a href=\"./index.php?search_type_asked=external_search&external_type=simple\">" . $msg["connecteurs_external_search"] . "</a></li>"; } $result = str_replace("!!others!!", $others, $result); // affichage des _perio_a2z $a2z = new perio_a2z(0, $opac_perio_a2z_abc_search, $opac_perio_a2z_max_per_onglet); $a2z_form = $a2z->get_form(); $a2z_form .= $onglets_search_perso_form; $result = str_replace("!!contenu!!", $a2z_form, $result); break; } return $result; }
while ($sub_categ = pmb_mysql_fetch_object($result_bis)) { if (!$sub_categ->num_renvoi_voir) { $id = $sub_categ->num_noeud; $link = $sub_categ->libelle_categorie; } else { $id = $sub_categ->num_renvoi_voir; $link = '<i>' . $sub_categ->libelle_categorie . '@</i>'; } // Si il y a présence d'un commentaire affichage du layer $result_com = categorie::zoom_categ($id, $sub_categ->comment_public); $child[] = "<a href='./index.php?lvl=categ_see&id={$id}&main=1&id_thes=" . $sub_categ->num_thesaurus . "'" . $result_com['java_com'] . ">" . $link . "</a>" . $result_com['zoom']; } $categ_array[] = array(categ => $categ, child => $child); } //affichage des liens vers les autres thésaurus $liste_thesaurus = thesaurus::getThesaurusList($opac_show_categ_browser_home_id_thes); if ($opac_show_categ_browser_home_id_thes_tab) { $liste_thesaurus_tmp = array(); foreach ($opac_show_categ_browser_home_id_thes_tab as $value) { if ($liste_thesaurus[$value]) { $liste_thesaurus_tmp[$value] = $liste_thesaurus[$value]; unset($liste_thesaurus[$value]); } } foreach ($liste_thesaurus as $key => $value) { $liste_thesaurus_tmp[$key] = $value; } $liste_thesaurus = $liste_thesaurus_tmp; } $liens_thesaurus = ''; if ($opac_thesaurus != 0) {