public function testXquery_escape() { $string = 'Eléphant '; $this->assertEquals($string, thesaurus::xquery_escape($string)); $string = '&é"\'(-è_ çà)=ù*!:;,?./§%µ+°0987654321'; $this->assertEquals('&é"'(-è_ çà)=ù*!:;,?./§%µ+°0987654321', thesaurus::xquery_escape($string)); }
function categ_browser($parent = 0, $folder_link = '', $document_link = '', $id_thes = 0) { global $PHP_SELF; $this->parent = $parent; $this->folder_link = $folder_link; $this->document_link = $document_link; //recuperation du thesaurus session if (!$id_thes) { $id_thes = thesaurus::getSessionThesaurusId(); } else { thesaurus::setSessionThesaurusId($id_thes); } if ($id_thes != -1) { $this->thes = new thesaurus($id_thes); } $this->id_thes = $id_thes; if ($this->id_thes != -1) { // 1 seul thesaurus if (!$this->parent) { $this->parent = $this->thes->num_noeud_racine; } $this->parents_tab = array(); $this->children_tab = array(); $caller = preg_replace('/\\/.*\\//', './', $PHP_SELF); if (!$this->folder_link) { $this->folder_link = "<a href='" . $caller . "?parent=!!id!!'>"; } if (!$this->document_link) { $this->document_link = "<a href='" . $caller . "?id=!!id!!'>"; } $this->get_children(); $this->get_parents(); } return TRUE; }
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 category($id = 0) { if ($id) { // on cherche à atteindre une notice existante $this->id = $id; $this->is_under_tilde = 0; $this->thes = thesaurus::getByEltId($id); $this->getData(); } else { // la notice n'existe pas $this->id = 0; $this->is_under_tilde = 0; $this->getData(); } }
function get_data() { global $dbh; global $categorie_separator; global $lang; // on récupère les infos de la catégorie $this->thes = thesaurus::getByEltId($this->id); if (categories::exists($this->id, $lang)) { $lg = $lang; } else { $lg = $this->thes->langue_defaut; } $query = "select "; $query .= "categories.libelle_categorie,categories.note_application, categories.comment_public, "; $query .= "noeuds.num_parent, noeuds.num_renvoi_voir "; $query .= "from noeuds, categories "; $query .= "where categories.langue = '" . $lg . "' "; $query .= "and noeuds.id_noeud = '" . $this->id . "' "; $query .= "and noeuds.id_noeud = categories.num_noeud "; $query .= "limit 1"; $result = pmb_mysql_query($query, $dbh); $current = pmb_mysql_fetch_object($result); $this->libelle = $current->libelle_categorie; $this->parent = $current->num_parent; $this->voir = $current->num_renvoi_voir; $this->note = $current->note_application; $this->comment = $current->comment_public; // on regarde si la catégorie à des enfants $query = "select count(1) from noeuds where num_parent = '" . $this->id . "' "; $result = pmb_mysql_query($query, $dbh); $this->has_child = pmb_mysql_result($result, 0, 0); // on regarde si la catégorie à des associées $query = "select count(1) from voir_aussi where num_noeud_orig = '" . $this->id . "' or num_noeud_dest = '" . $this->id . "' "; $result = pmb_mysql_query($query, $dbh); $this->has_child = $this->has_child + pmb_mysql_result($result, 0, 0); // on regarde si la catégorie est utilisée dans des notices $query = "select count(1) from notices_categories where num_noeud = '" . $this->id . "' "; $result = pmb_mysql_query($query, $dbh); $this->has_notices = pmb_mysql_result($result, 0, 0); }
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; }
<?php // +-------------------------------------------------+ // � 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: main.inc.php,v 1.2 2007-03-10 09:03:17 touraine37 Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } // page de switch recherche sujets require_once $class_path . "/searcher.class.php"; require_once "{$class_path}/thesaurus.class.php"; //recuperation du thesaurus session if (!$id_thes) { $id_thes = thesaurus::getSessionThesaurusId(); } else { thesaurus::setSessionThesaurusId($id_thes); } $link = "./circ.php?categ=resa_planning&resa_action=add_resa&id_empr={$id_empr}&groupID={$groupID}&id_notice=!!id!!"; $link_serial = ''; $link_analysis = ''; $link_bulletin = ''; $unq = md5(microtime()); $browser_url = './circ/resa_planning/subjects/categ_browser.php?id_thes=' . $id_thes . '&id_empr=' . $id_empr . '&groupID=' . $groupID . '&unq=' . $unq; $sh = new searcher_subject("./circ.php?categ=resa_planning&resa_action=search_resa&mode=1&id_empr={$id_empr}&groupID={$groupID}&unq={$unq}");
function getRdfThesaurus($idThes) { $arrayTriples = array(); $uriThes = $this->baseUriThesaurus . $idThes; $thes = new thesaurus($idThes); //Type $triple = array(); $triple[0] = '<' . $uriThes . '>'; $triple[1] = "rdf:type"; $triple[2] = "skos:ConceptScheme"; $arrayTriples[] = $triple; //Label $triple = array(); $triple[0] = '<' . $uriThes . '>'; $triple[1] = "skos:prefLabel"; $triple[2] = '"' . addslashes($thes->getLibelle()) . '"'; $arrayTriples[] = $triple; //topConcepts $resBis = mysql_query("SELECT id_noeud FROM noeuds WHERE num_parent='" . $thes->num_noeud_racine . "' AND num_renvoi_voir='0' AND autorite != 'ORPHELINS' AND num_thesaurus='" . $idThes . "'"); while ($rowBis = mysql_fetch_object($resBis)) { $triple = array(); $triple[0] = '<' . $uriThes . '>'; $triple[1] = "skos:hasTopConcept"; $triple[2] = '<' . $this->baseUriConcept . $rowBis->id_noeud . '>'; $arrayTriples[] = $triple; } return $arrayTriples; }
function list_id($type, $idArray) { $retXml = new simpleXmlElement("<{$type} />"); if (is_array($idArray)) { foreach ($idArray as $entry) { if (is_numeric($entry)) { $xmlString = thesaurus::get_name($entry); extract_pattern($xmlString, "/\\(BS[: ](?<use>.*)\\)/"); } else { $xmlString = $entry; } xml_insert($retXml, new simpleXmlElement("<{$type}>" . trim($xmlString) . "</{$type}>")); } } return $retXml; }
break; case 'search_form': $libelle_partiel = 1; if (!$id_thes) { $id_thes = thesaurus::getSessionThesaurusId(); } thesaurus::setSessionThesaurusId($id_thes); break; default: if (!$id_thes) { $id_thes = thesaurus::getSessionThesaurusId(); } thesaurus::setSessionThesaurusId($id_thes); break; } $thes = new thesaurus($id_thes); if ($aj == 'add' && SESSrights & THESAURUS_AUTH) { // on arrive du formulaire d'ajout à la volée if (!strlen($category_parent)) { $category_parent_id = $thes->num_noeud_racine; } $category_voir_id = 0; $noeud = new noeuds(); $noeud->num_parent = $category_parent_id; $noeud->num_thesaurus = $thes->id_thesaurus; $noeud->save(); $cat = new categories($noeud->id_noeud, $thes->langue_defaut); $cat->libelle_categorie = stripslashes($category_libelle); $cat->note_application = stripslashes($category_comment); $cat->index_categorie = " " . strip_empty_words($cat->libelle_categorie) . " "; $cat->save();
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; }
private function doSearchCandidate(Application $app, $bid, $pid, $t, $k, $piv) { $ret = new \DOMDocument("1.0", "UTF-8"); $ret->standalone = true; $ret->preserveWhiteSpace = false; $root = $ret->appendChild($ret->createElement("result")); $root->appendChild($ret->createCDATASection(var_export(["bid" => $bid, "pid" => $pid, "t" => $t, "k" => $k, "piv" => $piv], true))); $ctlist = $root->appendChild($ret->createElement("candidates_list")); try { $databox = $app['phraseanet.appbox']->get_databox((int) $bid); $domstruct = $databox->get_dom_structure(); $domth = $databox->get_dom_thesaurus(); $domct = $databox->get_dom_cterms(); if ($domstruct && $domth && $domct) { $xpathth = new \DOMXPath($domth); $xpathct = new \DOMXPath($domct); // on cherche les champs d'ou peut provenir un candidat, en fct de l'endroit oe on veut inserer le nouveau terme $fields = array(); $xpathstruct = new \DOMXPath($domstruct); $nodes = $xpathstruct->query("/record/description/*[@tbranch]"); for ($i = 0; $i < $nodes->length; $i++) { $fieldname = $nodes->item($i)->nodeName; $tbranch = $nodes->item($i)->getAttribute("tbranch"); if ($pid != "") { $q = "(" . $tbranch . ")/descendant-or-self::te[@id='" . $pid . "']"; } else { $q = "(" . $tbranch . ")/descendant-or-self::te[not(@id)]"; } $fields[$fieldname] = ["name" => $fieldname, "tbranch" => $tbranch, "cid" => null, "sourceok" => false]; if (!$tbranch) { continue; } $l = $xpathth->query($q)->length; if ($l > 0) { // le pt d'insertion du nvo terme se trouve dans la tbranch du champ, // donc ce champ peut etre source de candidats $fields[$fieldname]["sourceok"] = true; } else { // le pt d'insertion du nvo terme ne se trouve PAS dans la tbranch du champ, // donc ce champ ne peut pas etre source de candidats } } // on considere que la source 'deleted' est toujours valide $fields["[deleted]"] = ["name" => $app->trans('thesaurus:: corbeille'), "tbranch" => null, "cid" => null, "sourceok" => true]; if (count($fields) > 0) { $q = "@w='" . \thesaurus::xquery_escape($app['unicode']->remove_indexer_chars($t)) . "'"; if ($k) { if ($k != "*") { $q .= " and @k='" . \thesaurus::xquery_escape($app['unicode']->remove_indexer_chars($k)) . "'"; } } else { $q .= " and not(@k)"; } $q = "/cterms//te[./sy[{$q}]]"; $nodes = $xpathct->query($q); // le terme peut etre present dans plusieurs candidats for ($i = 0; $i < $nodes->length; $i++) { // on a trouve le terme dans les candidats, mais en provenance de quel champ ?.. on remonte au champ candidat for ($n = $nodes->item($i)->parentNode; $n && $n->parentNode && $n->parentNode->nodeName != "cterms"; $n = $n->parentNode) { } if ($n && array_key_exists($f = $n->getAttribute("field"), $fields)) { $fields[$f]["cid"] = $nodes->item($i)->getAttribute("id"); } } } foreach ($fields as $kfield => $field) { if ($field["cid"] === null) { continue; } $ct = $ctlist->appendChild($ret->createElement("ct")); $ct->setAttribute("field", $field["name"]); $ct->setAttribute("sourceok", $field["sourceok"] ? "1" : "0"); if ($field["cid"] !== null) { $ct->setAttribute("id", $field["cid"]); } } } } catch (\Exception $e) { } return $ret; }
function do_query($mode, $param = "") { global $lang; $select = "SELECT DISTINCT noeuds.id_noeud AS categ_id, "; $from = "FROM noeuds "; $join = " JOIN categories AS catdef ON noeuds.id_noeud = catdef.num_noeud AND catdef.langue = '" . addslashes($this->thes->langue_defaut) . "' "; $where = "WHERE 1 "; $order = "ORDER BY categ_libelle "; $limit = ""; if ($lang == $this->thes->langue_defaut || in_array($lang, thesaurus::getTranslationsList()) === false) { $simple = true; } else { $simple = false; } //$select.= "noeuds.num_parent AS categ_parent, "; if ($simple) { $select .= "catdef.libelle_categorie AS categ_libelle, "; //$select.= "catdef.note_application as categ_comment, "; //$select.= "catdef.index_categorie as index_categorie "; } else { $select .= "IF (catlg.num_noeud IS NULL, catdef.libelle_categorie, catlg.libelle_categorie) AS categ_libelle, "; $join .= "LEFT JOIN categories AS catlg ON catdef.num_noeud = catlg.num_noeud AND catlg.langue = '" . $lang . "' "; //$select.= "if (catlg.num_noeud is null, catdef.note_application, catlg.note_application) as categ_comment, "; //$select.= "if (catlg.num_noeud is null, catdef.index_categorie, catlg.index_categorie) as index_categorie "; } if ($mode == 1) { $where .= "AND noeuds.num_thesaurus = '" . $this->id_thes . "' "; if ($simple) { $where .= "AND catdef.libelle_categorie = '" . addslashes($this->term) . "' "; } else { $where .= "AND (IF (catlg.num_noeud IS NULL, catdef.libelle_categorie = '" . addslashes($this->term) . "', catlg.libelle_categorie = '" . addslashes($this->term) . "') ) "; } } elseif ($mode == 2) { $from = "FROM voir_aussi JOIN noeuds ON noeuds.id_noeud=voir_aussi.num_noeud_dest "; //On écrase l'ancien from car ce n'est pas ce que l'on veut $where .= "AND voir_aussi.num_noeud_orig = '" . $param . "' "; } elseif ($mode == 3) { $select .= "noeuds.num_thesaurus as thes_id, "; $select .= "thesaurus.libelle_thesaurus as thes_libelle, "; $join .= "JOIN thesaurus ON noeuds.num_thesaurus=thesaurus.id_thesaurus "; $where .= "AND noeuds.id_noeud = '" . $param . "' "; } elseif ($mode == 4) { $where .= "AND noeuds.num_parent = '" . $param . "' "; $limit .= "LIMIT 400"; } $select .= "noeuds.num_renvoi_voir AS categ_see "; $requete = $select . $from . $join . $where . $order . $limit; return pmb_mysql_query($requete); }
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 show_list_of_terms() { global $charset; global $msg; global $lang; global $dbh; global $opac_thesaurus; global $nbresultterme; //Si il y a eu erreur lors de la première analyse... if ($this->error_message) { return $this->error_message; } //Recherche des termes correspondants à la requête $where_term = $this->get_where_term(); if ($where_term) { $members_catdef = $this->aq->get_query_members("catdef", "catdef.libelle_categorie", "catdef.index_categorie", "catdef.num_noeud"); $members_catlg = $this->aq->get_query_members("catlg", "catlg.libelle_categorie", "catlg.index_categorie", "catlg.num_noeud"); } else { echo $msg["term_search_info"]; return; } if ($nbresultterme) { $this->n_total = $nbresultterme; $requete = "select count(catdef.num_noeud) as nb, "; } else { $requete = "select SQL_CALC_FOUND_ROWS count(catdef.num_noeud) as nb, "; } if ($this->id_thes != -1) { //1 seul thesaurus if ($lang == $this->thes->langue_defaut || in_array($lang, thesaurus::getTranslationsList()) === false) { //Recherche dans la langue par défaut du thesaurus $requete .= "num_thesaurus, "; $requete .= "num_noeud as categ_id, "; $requete .= "libelle_categorie as categ_libelle, "; $requete .= "catdef.index_categorie as indexcat "; if ($where_term) { $requete .= ", " . $members_catdef["select"] . " as pert "; } $requete .= "from categories as catdef "; $requete .= "where 1 "; if ($where_term) { $requete .= "and " . $members_catdef["where"] . " "; } $requete .= "and num_thesaurus = '" . $this->id_thes . "' "; $requete .= "and catdef.langue = '" . $this->thes->langue_defaut . "' "; $requete .= "and catdef.libelle_categorie not like '~%' "; $requete .= "group by categ_libelle "; $requete .= "order by "; if ($where_term) { $requete .= "pert desc, "; } $requete .= "indexcat asc "; $requete .= "limit " . $this->offset . "," . $this->n_per_page; } else { //Recherche dans la langue de l'interface ou dans la langue par défaut du thesaurus $requete .= "catdef.num_thesaurus, "; $requete .= "catdef.num_noeud as categ_id, "; $requete .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie ) as categ_libelle, "; $requete .= "if (catlg.num_noeud is null, catdef.index_categorie , catlg.index_categorie ) as indexcat "; if ($where_term) { $requete .= ", if (catlg.num_noeud is null, " . $members_catdef["select"] . ", " . $members_catlg["select"] . ") as pert "; } $requete .= "from categories as catdef "; $requete .= "left join categories as catlg on catdef.num_noeud = catlg.num_noeud and catlg.langue = '" . $lang . "' "; $requete .= "where 1 "; if ($where_term) { $requete .= "and (if(catlg.num_noeud is null, " . $members_catdef["where"] . ", " . $members_catlg["where"] . ") ) "; } $requete .= "and catdef.num_thesaurus = '" . $this->id_thes . "' "; $requete .= "and catdef.langue = '" . $this->thes->langue_defaut . "' "; $requete .= "and catdef.libelle_categorie not like '~%' "; $requete .= "group by categ_libelle "; $requete .= "order by "; if ($where_term) { $requete .= "pert desc, "; } $requete .= "indexcat asc "; $requete .= "limit " . $this->offset . "," . $this->n_per_page; } } else { //tous les thesaurus //on recherche dans la langue de l'interface ou dans la langue par défaut du thesaurus $requete .= "catdef.num_thesaurus, "; $requete .= "catdef.num_noeud as categ_id, "; $requete .= "if (catlg.num_noeud is null, catdef.libelle_categorie , catlg.libelle_categorie ) as categ_libelle, "; $requete .= "if (catlg.num_noeud is null, catdef.index_categorie , catlg.index_categorie ) as indexcat "; if ($where_term) { $requete .= ", if (catlg.num_noeud is null, " . $members_catdef["select"] . ", " . $members_catlg["select"] . ") as pert "; } $requete .= "from thesaurus "; $requete .= "left join categories as catdef on id_thesaurus=catdef.num_thesaurus and catdef.langue=thesaurus.langue_defaut "; $requete .= "left join categories as catlg on catdef.num_noeud=catlg.num_noeud and catlg.langue = '" . $lang . "' "; if ($where_term) { $requete .= "where if(catlg.num_noeud is null, " . $members_catdef["where"] . ", " . $members_catlg["where"] . ") "; } $requete .= "group by categ_libelle, catdef.num_thesaurus "; $requete .= "order by "; if ($where_term) { $requete .= "pert desc, "; } $requete .= "catdef.num_thesaurus, indexcat asc "; $requete .= "limit " . $this->offset . "," . $this->n_per_page; } $resultat = pmb_mysql_query($requete, $dbh); //On récupère le nombre de résultat if (!$this->n_total) { $qry = "SELECT FOUND_ROWS() AS NbRows"; if ($resnum = pmb_mysql_query($qry)) { $this->n_total = pmb_mysql_result($resnum, 0, 0); } } $res = "<b>"; if ($this->search_term != "") { $res .= $msg["term_search_found_term"] . "<i>" . htmlentities($this->search_term_origin, ENT_QUOTES, $charset); } else { $res .= "<i>" . $msg["term_search_all_terms"]; } $res .= "</i></b>\n"; //Navigateur de page if ($this->n_total) { $res .= "<br /><span style='text-align:right;'>" . $this->page_navigator() . "</span><br /><br />"; } else { $res .= "<br /><br /><span style='text-align:right;'><i>" . $msg['term_no_results'] . "</span><br /><br />"; } //Affichage des termes trouvés $class = "colonne2"; while ($r = pmb_mysql_fetch_object($resultat)) { $show = 1; //S'il n'y a qu'un seul résultat, vérification que ce n'est pas un terme masqué if ($r->nb == 1 && !$this->keep_tilde) { $t_test = new category($resultat->categ_id); if ($t_test->is_under_tilde && !$t_test->voir_id) { $show = 0; } } if ($show) { $res .= "<div class='" . $class . "'>"; if ($r->nb > 1) { $nbre_termes = '(' . $r->nb . ') '; } else { $nbre_termes = ''; } $res .= $nbre_termes . "<a href=\"" . $this->url_for_term_show . '?term=' . rawurlencode($r->categ_libelle) . '&id_thes=' . $r->num_thesaurus . '&' . $this->base_query . "\" target=\"term_show\">"; if ($this->id_thes == -1) { //le nom du thesaurus n'est pas affiché si 1 seul thesaurus $res .= '[' . htmlentities(addslashes(thesaurus::getLibelle($r->num_thesaurus)), ENT_QUOTES, $charset) . '] '; } $res .= htmlentities($r->categ_libelle, ENT_QUOTES, $charset) . "</a><br />\n"; $res .= "</div>"; if ($class == "colonne2") { $class = "colonne_suite"; } else { $class = "colonne2"; } } } if ($class = "colonne_suite") { $res .= "<div class=\"colonne_suite\"></div>\n"; } return $res; }
<?php // Time query $time_pre = microtime(true); // Get the Query from User input $q = strtolower($_SESSION['query']); if ($_SESSION['queryEx'] == 'on') { // Query Preprocess $thesaurus1 = new thesaurus(); $thesaurus1->loadThesaurusFile($_SESSION['thesaurus']); $qX = new query(); if ($_SESSION['stemmer'] == 'off') { $qX->tokeniseQuery($q); } else { if ($_SESSION['stemmer'] == 'on') { $qX->tokeniseQuery(implode(" ", $qX->stem_list($q))); } } $q = $qX->expandQuery($q, $thesaurus1->returnThesaurus()); } // Process the Query $q1 = new query(); $query1 = $q1->complexQueryGoogle($q); $query2 = $q1->complexQueryBing($q); $query3 = $q1->complexQueryBlekko($q); // AGG if ($_SESSION['result_op'] == 'agg') { // Instantiate a new API $api1 = new api(); // Instantiate a new formatter with the 3 result sets as properties $formatter1 = new formatter(new resultSet(), new resultSet(), new resultSet());
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; }
public function SearchTermJson(Application $app, Request $request) { if (null === ($lng = $request->get('lng'))) { $data = explode('_', $app['locale']); if (count($data) > 0) { $lng = $data[0]; } } $html = ''; $sbid = (int) $request->get('sbid'); try { $databox = $app['phraseanet.appbox']->get_databox($sbid); $html = "" . '<LI id="TX_P.' . $sbid . '.T" class="expandable">' . "\n"; $html .= "\t" . '<div class="hitarea expandable-hitarea"></div>' . "\n"; $html .= "\t" . '<span>' . \phrasea::sbas_labels($sbid, $app) . '</span>' . "\n"; if ($request->get('t')) { if ($request->get('field') != '') { $domth = $databox->get_dom_thesaurus(); $dom_struct = $databox->get_dom_structure(); } else { $domth = $databox->get_dom_thesaurus(); } $q = null; if ($request->get('field') != '') { // search only in the branch(es) linked to this field if ($dom_struct) { $xpath = new \DOMXPath($dom_struct); if ($znode = $xpath->query('/record/description/' . $request->get('field'))->item(0)) { $q = '(' . $znode->getAttribute('tbranch') . ')'; } } } else { // search in the whole thesaurus $q = '/thesaurus'; } if ($q !== null && $domth) { $xpath = new \DOMXPath($domth); $t = $this->splitTermAndContext($request->get('t')); $q2 = 'starts-with(@w, \'' . \thesaurus::xquery_escape($app['unicode']->remove_indexer_chars($t[0])) . '\')'; if ($t[1]) { $q2 .= ' and starts-with(@k, \'' . \thesaurus::xquery_escape($app['unicode']->remove_indexer_chars($t[1])) . '\')'; } $q2 = '//sy[' . $q2 . ' and @lng=\'' . $lng . '\']'; $q .= $q2; $nodes = $xpath->query($q); for ($i = 0; $i < $nodes->length; $i++) { $nodes->item($i)->setAttribute('bold', '1'); for ($n = $nodes->item($i)->parentNode; $n && $n->nodeType == XML_ELEMENT_NODE && $n->nodeName == 'te'; $n = $n->parentNode) { $n->setAttribute('open', '1'); } } $this->getHTMLTerm($sbid, $lng, $domth->documentElement, $html); } } else { $html .= "\t" . '<ul style="display: none;">loading</ul>' . "\n"; } $html .= "" . '</LI>' . "\n"; } catch (\Exception $e) { } return $app->json(['parm' => ['sbid' => $request->get('sbid'), 't' => $request->get('t'), 'field' => $request->get('field'), 'lng' => $request->get('lng'), 'debug' => $request->get('debug')], 'html' => $html]); }
function make_human_query() { global $search; global $msg; global $charset; global $include_path; global $pmb_multi_search_operator; global $lang; global $thesaurus_classement_mode_pmb; $r = ""; for ($i = 0; $i < count($search); $i++) { $s = explode("_", $search[$i]); if ($s[0] == "f") { $title = $this->fixedfields[$s[1]]["TITLE"]; } elseif (array_key_exists($s[0], $this->pp)) { $title = $this->pp[$s[0]]->t_fields[$s[1]]["TITRE"]; } elseif ($s[0] == "s") { $title = $this->specialfields[$s[1]]["TITLE"]; } elseif ($s[0] == "authperso") { $title = $this->authpersos[$s[1]]['name']; } $op = "op_" . $i . "_" . $search[$i]; global ${$op}; //faire un test de classe et getop() $operator = $this->operators[${$op}]; $field_ = "field_" . $i . "_" . $search[$i]; global ${$field_}; $field = ${$field_}; //Recuperation des variables auxiliaires $fieldvar_ = "fieldvar_" . $i . "_" . $search[$i]; global ${$fieldvar_}; $fieldvar = ${$fieldvar_}; if (!is_array($fieldvar)) { $fieldvar = array(); } $field_aff = array(); $fieldvar_aff = array(); $operator_multi = $pmb_multi_search_operator ? $pmb_multi_search_operator : "or"; if (array_key_exists($s[0], $this->pp)) { $datatype = $this->pp[$s[0]]->t_fields[$s[1]]["DATATYPE"]; $df = $this->dynamicfields[$s[0]]["FIELD"][$this->get_id_from_datatype($datatype, $s[0])]; $q_index = $df["QUERIES_INDEX"]; $q = $df["QUERIES"][$q_index[${$op}]]; if ($q["DEFAULT_OPERATOR"]) { $operator_multi = $q["DEFAULT_OPERATOR"]; } for ($j = 0; $j < count($field); $j++) { $field_aff[$j] = $this->pp[$s[0]]->get_formatted_output(array(0 => $field[$j]), $s[1]); } } elseif ($s[0] == "f") { $ff = $this->fixedfields[$s[1]]; $q_index = $ff["QUERIES_INDEX"]; $q = $ff["QUERIES"][$q_index[${$op}]]; if ($fieldvar["operator_between_multiple_authorities"]) { $operator_multi = $fieldvar["operator_between_multiple_authorities"][0]; } else { if ($q["DEFAULT_OPERATOR"]) { $operator_multi = $q["DEFAULT_OPERATOR"]; } } switch ($this->fixedfields[$s[1]]["INPUT_TYPE"]) { case "list": $options = $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["OPTIONS"][0]; $opt = array(); for ($j = 0; $j < count($options["OPTION"]); $j++) { if (substr($options["OPTION"][$j]["value"], 0, 4) == "msg:") { $opt[$options["OPTION"][$j]["VALUE"]] = $msg[substr($options["OPTION"][$j]["value"], 4, strlen($options["OPTION"][$j]["value"]) - 4)]; } else { $opt[$options["OPTION"][$j]["VALUE"]] = $options["OPTION"][$j]["value"]; } } for ($j = 0; $j < count($field); $j++) { $field_aff[$j] = $opt[$field[$j]]; } break; case "query_list": $requete = $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["value"]; if ($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["FILTERING"] == "yes") { $requete = str_replace("!!acces_j!!", "", $requete); $requete = str_replace("!!statut_j!!", "", $requete); $requete = str_replace("!!statut_r!!", "", $requete); } if ($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]) { $use_global = explode(",", $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]); for ($j = 0; $j < count($use_global); $j++) { $var_global = $use_global[$j]; global ${$var_global}; $requete = str_replace("!!" . $var_global . "!!", ${$var_global}, $requete); } } $resultat = pmb_mysql_query($requete); $opt = array(); while ($r_ = @pmb_mysql_fetch_row($resultat)) { $opt[$r_[0]] = $r_[1]; } for ($j = 0; $j < count($field); $j++) { $field_aff[$j] = $opt[$field[$j]]; } break; case "marc_list": $opt = new marc_list($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["NAME"][0]["value"]); for ($j = 0; $j < count($field); $j++) { $field_aff[$j] = $opt->table[$field[$j]]; } break; case "date": $field_aff[0] = format_date($field[0]); break; case "authoritie": for ($j = 0; $j < sizeof($field); $j++) { if (is_numeric($field[$j]) && ${$op} == "AUTHORITY") { switch ($ff['INPUT_OPTIONS']['SELECTOR']) { case "categorie": $thes = thesaurus::getByEltId($field[$j]); $field[$j] = categories::getlibelle($field[$j], $lang) . " [" . $thes->libelle_thesaurus . "]"; if (isset($fieldvar["id_thesaurus"])) { unset($fieldvar["id_thesaurus"]); } break; case "auteur": $aut = new auteur($field[$j]); if ($aut->rejete) { $field[$j] = $aut->name . ', ' . $aut->rejete; } else { $field[$j] = $aut->name; } if ($aut->date) { $field[$j] .= " ({$aut->date})"; } break; case "editeur": $ed = new editeur($field[$j]); $field[$j] = $ed->name; if ($ed->ville) { if ($ed->pays) { $field[$j] .= " ({$ed->ville} - {$ed->pays})"; } else { $field[$j] .= " ({$ed->ville})"; } } break; case "collection": $coll = new collection($field[$j]); $field[$j] = $coll->name; break; case "subcollection": $coll = new subcollection($field[$j]); $field[$j] = $coll->name; break; case "serie": $serie = new serie($field[$j]); $field[$j] = $serie->name; break; case "indexint": $indexint = new indexint($field[$j]); if ($indexint->comment) { $field[$j] = $indexint->name . " - " . $indexint->comment; } else { $field[$j] = $indexint->name; } if ($thesaurus_classement_mode_pmb != 0) { $field[$j] = "[" . $indexint->name_pclass . "] " . $field[$j]; } break; case "titre_uniforme": $tu = new titre_uniforme($field[$j]); $field[$j] = $tu->name; break; case "notice": $requete = "select if(serie_name is not null,if(tnvol is not null,concat(serie_name,', ',tnvol,'. ',tit1),concat(serie_name,'. ',tit1)),tit1) AS tit from notices left join series on serie_id=tparent_id where notice_id='" . $field[$j] . "' "; $res = pmb_mysql_query($requete); if ($res && pmb_mysql_num_rows($res)) { $field[$j] = pmb_mysql_result($res, 0, 0); } break; } } } $field_aff = $field; break; default: $field_aff = $field; break; } //Ajout des variables si necessaire reset($fieldvar); $fieldvar_aff = array(); while (list($var_name, $var_value) = each($fieldvar)) { //Recherche de la variable par son nom $vvar = $this->fixedfields[$s[1]]["VAR"]; for ($j = 0; $j < count($vvar); $j++) { if ($vvar[$j]["TYPE"] == "input" && $vvar[$j]["NAME"] == $var_name) { //Calcul de la visibilite $varname = $vvar[$j]["NAME"]; $visibility = 1; $vis = $vvar[$j]["OPTIONS"]["VAR"][0]; if ($vis["NAME"]) { $vis_name = $vis["NAME"]; global ${$vis_name}; if ($vis["VISIBILITY"] == "no") { $visibility = 0; } for ($k = 0; $k < count($vis["VALUE"]); $k++) { if ($vis["VALUE"][$k]["value"] == ${$vis_name}) { if ($vis["VALUE"][$k]["VISIBILITY"] == "no") { $sub_vis = 0; } else { $sub_vis = 1; } if ($vis["VISIBILITY"] == "no") { $visibility |= $sub_vis; } else { $visibility &= $sub_vis; } break; } } } $var_list_aff = array(); $flag_aff = false; if ($visibility) { switch ($vvar[$j]["OPTIONS"]["INPUT"][0]["TYPE"]) { case "query_list": $query_list = $vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["value"]; $r_list = pmb_mysql_query($query_list); while ($line = pmb_mysql_fetch_array($r_list)) { $as = array_search($line[0], $var_value); if ($as !== false && $as !== NULL) { $var_list_aff[] = $line[1]; } } if ($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["ALLCHOICE"] == "yes" && count($var_list_aff) == 0) { $var_list_aff[] = $msg[substr($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["TITLEALLCHOICE"], 4, strlen($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["TITLEALLCHOICE"]) - 4)]; } $fieldvar_aff[] = implode(" " . $msg["search_or"] . " ", $var_list_aff); $flag_aff = true; break; case "checkbox": $value = $var_value[0]; $label_list = $vvar[$j]["OPTIONS"]["INPUT"][0]["COMMENTS"][0]["LABEL"]; for ($indice = 0; $indice < count($label_list); $indice++) { if ($value == $label_list[$indice]["VALUE"]) { $libelle = $label_list[$indice]["value"]; break; } } $fieldvar_aff[] = $libelle; $flag_aff = true; break; } if ($flag_aff) { $fieldvar_aff[count($fieldvar_aff) - 1] = $vvar[$j]["COMMENT"] . " : " . $fieldvar_aff[count($fieldvar_aff) - 1]; } } } } } } elseif ($s[0] == "s") { //appel de la fonction make_human_query de la classe du champ special //Recherche du type $type = $this->specialfields[$s[1]]["TYPE"]; for ($is = 0; $is < count($this->tableau_speciaux["TYPE"]); $is++) { if ($this->tableau_speciaux["TYPE"][$is]["NAME"] == $type) { $sf = $this->specialfields[$s[1]]; require_once $include_path . "/search_queries/specials/" . $this->tableau_speciaux["TYPE"][$is]["PATH"] . "/search.class.php"; $specialclass = new $this->tableau_speciaux["TYPE"][$is]["CLASS"]($s[1], $i, $sf, $this); $field_aff = $specialclass->make_human_query(); $field_aff[0] = html_entity_decode(strip_tags($field_aff[0]), ENT_QUOTES, $charset); break; } } } elseif ($s[0] == "authperso") { $field_aff[0] = $field[0]; } switch ($operator_multi) { case "and": $op_list = $msg["search_and"]; break; case "or": $op_list = $msg["search_or"]; break; default: $op_list = $msg["search_or"]; break; } if (is_array($field_aff)) { $texte = implode(" " . $op_list . " ", $field_aff); } if (count($fieldvar_aff)) { $texte .= " [" . implode(" ; ", $fieldvar_aff) . "]"; } $inter = "inter_" . $i . "_" . $search[$i]; global ${$inter}; switch (${$inter}) { case "and": $inter_op = $msg["search_and"]; break; case "or": $inter_op = $msg["search_or"]; break; case "ex": $inter_op = $msg["search_exept"]; break; default: $inter_op = ""; break; } if ($inter_op) { $inter_op = "<strong>" . htmlentities($inter_op, ENT_QUOTES, $charset) . "</strong>"; } $r .= $inter_op . " <i><strong>" . htmlentities($title, ENT_QUOTES, $charset) . "</strong> " . htmlentities($operator, ENT_QUOTES, $charset) . " (" . htmlentities($texte, ENT_QUOTES, $charset) . ")</i> "; } return $r; }
function getlibelle($num_noeud = 0, $langue = "") { global $dbh; $lib = ""; if (!$num_noeud) { $num_noeud = $this->num_noeud; $langue = $this->langue; } $thes = thesaurus::getByEltId($num_noeud); if (categories::exists($num_noeud, $langue)) { $lg = $langue; } else { $lg = $thes->langue_defaut; } $q = "select libelle_categorie from categories where num_noeud = '" . $num_noeud . "' "; $q .= "and langue = '" . $lg . "' limit 1"; $r = pmb_mysql_query($q, $dbh); if (pmb_mysql_num_rows($r)) { $lib = pmb_mysql_result($r, 0, 0); } return $lib; }
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) {
if ($form_nb_per_page_select >= 1) { $names[] = 'nb_per_page_select'; $values[] = "'{$form_nb_per_page_select}'"; } if ($form_nb_per_page_gestion >= 1) { $names[] = 'nb_per_page_gestion'; $values[] = "'{$form_nb_per_page_gestion}'"; } if (strcmp($form_style, $stylesheet)) { $names[] .= 'deflt_styles'; $values[] .= "'{$form_style}'"; } /* insérer ici la maj des param et deflt */ //maj thesaurus par defaut en session if ($form_deflt_thesaurus) { thesaurus::setSessionThesaurusId($form_deflt_thesaurus); } $requete_param = "SELECT * FROM users WHERE userid='{$PMBuserid}' LIMIT 1 "; $res_param = mysql_query($requete_param, $dbh); $field_values = mysql_fetch_row($res_param); $i = 0; while ($i < mysql_num_fields($res_param)) { $field = mysql_field_name($res_param, $i); $field_deb = substr($field, 0, 6); switch ($field_deb) { case "deflt_": if ($field == "deflt_styles") { $dummy[$i + 8] = $field . "='" . $form_style . "'"; } elseif ($field == "deflt_docs_section") { $formlocid = "f_ex_section" . $form_deflt_docs_location; $dummy[$i + 8] = $field . "='" . ${$formlocid} . "'";
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> " . $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> " . $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();\"> "; $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=¶m1=f_bull_new_date¶m2=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; }
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; }
//recuperation du thesaurus session if (!$id_thes) { $id_thes = thesaurus::getSessionThesaurusId(); } if ($id_thes == '-1') { $id_thes = $thesaurus_defaut; } thesaurus::setSessionThesaurusId($id_thes); $thes = new thesaurus($id_thes); //Récuperation de la liste des langues définies pour l'interface $langages = new XMLlist("{$include_path}/messages/languages.xml", 1); $langages->analyser(); $lg = $langages->table; //Récuperation de la liste des langues définies pour les thésaurus //autre que la langue par defaut du thesaurus $thes_liste_trad = thesaurus::getTranslationsList(); $lg1 = array(); foreach ($thes_liste_trad as $dummykey => $item) { if ($item != $thes->langue_defaut && $lg[$item] != '') { $lg1[$item] = $lg[$item]; } } // dessin du form $see_also = array(); if ($id) { $title = $msg[318]; $action = "./autorites.php?categ=categories&sub=update&id={$id}&parent={$parent}"; $delete_button = "<input type='button' class='bouton' value='{$msg['63']}' onClick=\"confirm_delete();\">"; $button_voir = "<input type='button' class='bouton' value='{$msg['voir_notices_assoc']}' "; $button_voir .= "onclick='unload_off();document.location=\"./catalog.php?categ=search&mode=1&etat=aut_search&aut_type=categ&aut_id={$id}\"'>"; // on récupère les données de la catégorie
function display($searchResult) { if ($searchResult) { echo "<div id='result' class='search'>"; echo "<b>Suchergebnis - </b>"; echo " <i class='normal'>" . count($searchResult) . " Treffer</i>"; echo form::link("delete", "x", "index.php?action=hidesearch", "close-search"); action::listit("search", $searchResult); foreach ($searchResult as $entry) { $nameArray = thesaurus::get_descriptor($entry[ID]); export::descriptor($nameArray[ID], session::get("search"), "SHOW"); echo "<hr>"; } // set parent if (session::get(show) != 0) { $parent = session::get(show); } else { $parent = system::getval("val_orderdefault"); } // sugest new entry if orderdefault is set or OB is displayed if ($parent) { form::insert_entry(array('parent' => $parent, 'action' => 'add', ""), array(), session::get(search)); } else { echo "<p>Kein Oberbegriff für neuen Begriff gesetzt.</p>"; } echo "</div>"; } else { echo "<div id='result' class='search'>"; echo "<span class='red'>Kein Eintrag gefunden</span>"; echo form::link("delete", "x", "index.php?action=hidesearch", "close-search"); // set parent if (session::get(show) != 0) { $parent = session::get(show); } else { $parent = system::getval("val_orderdefault"); } // sugest new entry if orderdefault is set or OB is displayed if ($parent) { form::insert_entry(array('parent' => $parent, 'action' => 'add', ""), array(), session::get(search)); } else { echo "<p>Kein Oberbegriff für neuen Begriff gesetzt.</p>"; } echo "</div>"; } }
function action($_arg) { //------------------------------------------------------------------------------ // extrace action from coordinate system while ($entry = each($_arg)) { $argArray = explode("_", $entry[key]); if (count($argArray) > 1) { $indexString = $argArray[0]; $valueString = $argArray[1]; $_arg[$indexString] = $valueString; if (isset($argArray[2])) { $_arg['_ID'] = $argArray[2]; } } } //echoalert($_arg); //echoalert($_SESSION); //------------------------------------------------------------------------------ // parse reset value if ($_arg[reset]) { $_arg = array(); session::destroy(searchshow); session::destroy(show); session::destroy(search); session::destroy(searchtype); session::destroy(searchcom); session::destroy(searchorder); session::destroy(searchString); session::destroy(searchexact); session::destroy(searchstart); session::destroy(searchowner); session::destroy(searchentrytype); session::destroy(searchstatus); } //------------------------------------------------------------------------------ // parse action parameter switch ($_arg[action]) { //------------------------------------------------------------------------------ // login / out case login: // login user user::login($_arg[user], $_arg[password]); // restore program status if new session restore_status(); // reset linking session::destroy("linkaction"); session::destroy("link"); break; case logout: // logout user user::logout(); break; case changedo: // change password if ($password = $_GET[password]) { database::query("UPDATE user SET password='******' WHERE ID='" . session::get("user") . "'"); echojavascript("Passwort erfolgreich geändert"); } break; //------------------------------------------------------------------------------ // inherit entrytype to children //------------------------------------------------------------------------------ // inherit entrytype to children case inherit: $childArray = thesaurus::get_child($_arg[id]); foreach ($childArray as $entry) { database::query("UPDATE entry SET entrytype={$_arg['entrytype']} WHERE ID={$entry}"); } break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case update: if ($_arg[orderdefault]) { session::set(orderdefault, $_arg[id]); } elseif (isset($_arg[orderdefault])) { session::destroy(orderdefault); } break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case edit: session::set("edit", TRUE); session::set("show", $_arg[id]); session::destroy("searchshow"); break; case noedit: session::destroy("edit"); break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case open: session::open($_arg[id]); break; case close: session::close($_arg[id]); break; case closeall: session::close_all(); break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case deleteid: end_link(); hide(); database::delete($_arg[id]); break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case suchen: if (!$_arg[searchString] and ($_arg[searchowner] or $_arg[searchtype] or $_arg[searchstatus])) { $_arg[searchString] = "%"; } if ($_arg[searchString]) { session::set("searchshow", true); } // show search result session::set("search", $_arg[searchString]); session::set("searchcom", $_arg[searchcom]); session::set("searchorder", $_arg[searchorder]); session::set("searchentrytype", $_arg[searchentrytype]); session::set("searchstatus", $_arg[searchstatus]); if ($_arg[searchowner]) { session::set("searchowner", $_arg[searchowner]); } else { session::destroy("searchowner"); } switch ($_arg[searchtype]) { case 0: session::destroy("searchexact"); session::destroy("searchstart"); break; case 1: session::destroy("searchexact"); session::set("searchstart", TRUE); break; case 2: session::destroy("searchstart"); session::set("searchexact", TRUE); break; } break; case hidesearch: session::destroy(searchshow); break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case show: session::destroy("searchshow"); $_arg[linkaction] = ""; if ($_arg[id] == NULL) { break; } elseif ($_arg[id] > 0) { session::set("show", $_arg[id]); break; } else { session::delete("show"); break; } break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case swap: if ($_arg[id]) { thesaurus::swap_link($_arg[id], $_arg[_ID]); } break; case change: if ($_arg[id]) { // thesaurus::change_link($_arg); } break; case add: // add new descriptor session::destroy("show"); session::destroy("searchshow"); // session::set("",1); break; // clean database // clean database case correct: thesaurus::validate(true); echoalert("Datenbank bereinigt"); break; //------------------------------------------------------------------------------ // open hyrarchy down to selected entry //------------------------------------------------------------------------------ // open hyrarchy down to selected entry case showhyrarchy: if ($_arg[id]) { $hyrarchyArray = thesaurus::get_hyrarchy($_arg[id]); // don't open selected entry // array_pop($hyrarchyArray); foreach ($hyrarchyArray as $entry) { // echo $entry . " "; echo session::open($entry); } session::set("hyrarchy", TRUE); // hide search window session::destroy("searchshow"); // if nothing selected for display, show ID if (!session::get(show)) { session::set("show", $_arg[id]); } break; } //------------------------------------------------------------------------------ // debug on/off //------------------------------------------------------------------------------ // debug on/off case debugon: system::setval(debug, TRUE); break; case debugoff: system::setval(debug, FALSE); // legend on/off // legend on/off case legendon: session::set("legend", TRUE); break; case legendoff: session::destroy("legend"); break; // display / hide non descriptors // display / hide non descriptors case toggleND: if (session::get("descriptor")) { session::destroy("descriptor"); } else { session::set("descriptor", TRUE); } break; // display / hide orders // display / hide orders case toggleVI: if (session::get("visible")) { session::destroy("visible"); } else { session::set("visible", TRUE); } break; // toggle tooltips on/off // toggle tooltips on/off case off: session::set("tooltips", TRUE); break; case on: session::destroy("tooltips"); break; // toggle hyrarchy // toggle hyrarchy case hyrarchyon: session::set("hyrarchy", TRUE); break; case hyrarchyoff: session::set("hyrarchy", FALSE); break; } //------------------------------------------------------------------------------ // parse linkaction parameter switch ($_arg[linkaction]) { // link case link: session::set("link", $_arg[id]); session::set("linkaction", $_arg[linkaction]); session::set("linktype", $_arg[linktype]); break; // execute linking // execute linking case linkdo: switch (session::get('linkaction')) { case link: database::parent_insert(session::get("link"), $_arg[id], session::get("linktype")); session::set("show", session::get("link")); // set display to linked objects // with BS set linked descriptor to "no descriptor" if (session::get("linktype") == 2) { database::set_desc($_arg[id], 0); } // session::destroy("link"); // end linking break; case change: database::link_change(session::get('linkparent'), session::get('link'), $_arg['id']); // parent,oldlink,newlink break; } break; case linkend: end_link(); break; // unlink // unlink case unlink: if ($_arg[id]) { database::parent_delete(session::get("show"), $_arg[id]); } break; // change OB // change OB case change: if ($_arg[id]) { session::set("link", $_arg[id]); session::set("linkaction", $_arg[linkaction]); session::set("linkparent", $_arg[_ID]); session::set("linktype", $_arg[linktype]); } break; } // TEMP SETTINGS // if not link rights, set descriptor and visible to true if (!right::link()) { session::set(descriptor, FALSE); } //if (!right::link()) session::set(visible,TRUE); // save program status save_status($_SESSION); }
$q .= "and " . $first_clause . " "; $q .= "and ( if (catlg.num_noeud is null, " . $members_catdef['where'] . ", " . $members_catlg['where'] . ") ) "; } $r = mysql_query($q, $dbh); $q = "INSERT INTO catjoin SELECT "; } $q = 'select distinct catjoin.num_noeud, catjoin.* from catjoin ' . $clause . ' ORDER BY pert desc, catjoin.index_categorie ' . $limiter; $found = mysql_query($q, $dbh); while ($mesCategories_trouvees = mysql_fetch_object($found)) { print "<li class='categ_colonne'>"; if ($mesCategories_trouvees->num_renvoi_voir) { // Affichage des renvois_voir if (categories::exists($mesCategories_trouvees->num_renvoi_voir, $lang)) { $lg = $lang; } else { $thes = thesaurus::getByEltId($mesCategories_trouvees->num_noeud); $lg = $thes->langue_defaut; } $q = "select * from noeuds, categories where num_noeud='" . $mesCategories_trouvees->num_renvoi_voir . "' and langue = '" . $lg . "' and noeuds.id_noeud = categories.num_noeud limit 1"; $found_see = mysql_query($q, $dbh); $mesCategories = @mysql_fetch_object($found_see); print pmb_bidi("<b>" . $mesCategories_trouvees->libelle_categorie . "</b> " . $msg['term_show_see'] . " "); } else { $mesCategories = $mesCategories_trouvees; } // Affichage de l'arborescence des renvois voir if ($mesCategories->num_parent) { $bar = categories::listAncestors($mesCategories->num_noeud, $lang); $bar = array_reverse($bar); if ($bar[3]) { print pmb_bidi("<a href=./index.php?lvl=categ_see&id=" . $bar[3]['num_noeud'] . "><img src='./images/folder.gif' border='0' align='middle'>...</a> > ");
<?php // +-------------------------------------------------+ // � 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: thes_delete.inc.php,v 1.4 2009-12-18 11:18:25 mbertin Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } // si tout est OK, on a les variables suivantes � exploiter : // $id_thes identifiant de thesaurus (0 si nouveau) // $libelle_thesaurus libelle du thesaurus // $langue_defaut langue par d�faut du thesaurus (rien si inchang�e) require_once "{$class_path}/thesaurus.class.php"; if (thesaurus::hasNotices($id_thes)) { //le thesaurus est utilis� dans les notices. error_form_message($msg["thes_suppr_impossible"]); exit; } else { if ($opac_thesaurus_defaut === $id_thes or $thesaurus_defaut === $id_thes or $deflt_thesaurus === $id_thes) { error_form_message($msg["thes_suppr_categ_utilisee"]); } else { thesaurus::delete($id_thes); thesaurus::setSessionThesaurusId(-1); } } include './autorites/subjects/thesaurus.inc.php';
function replace($by = 0, $link_save = 0) { global $msg, $dbh; global $pmb_synchro_rdf; if ($this->id_noeud == $by || !$this->id_noeud || !$by) { return $msg["categ_imposible_remplace_elle_meme"]; } $aut_link = new aut_link(AUT_TABLE_CATEG, $this->id_noeud); // "Conserver les liens entre autorités" est demandé if ($link_save) { // liens entre autorités $aut_link->add_link_to(AUT_TABLE_CATEG, $by); } $aut_link->delete(); //synchro_rdf : on empile les noeuds impactés pour les traiter plus loin if ($pmb_synchro_rdf) { $arrayIdImpactes = array(); $arrayThesImpactes = array(); $thes = thesaurus::getByEltId($this->id_noeud); $arrayThesImpactes[] = $thes->id_thesaurus; //parent if ($this->num_parent != $thes->num_noeud_racine) { $arrayIdImpactes[] = $this->num_parent; } //enfants $res = noeuds::listChilds($this->id_noeud, 1); if (pmb_mysql_num_rows($res)) { while ($row = pmb_mysql_fetch_array($res)) { $arrayIdImpactes[] = $row[0]; } } //renvoi_voir if ($this->num_renvoi_voir) { $arrayIdImpactes[] = $this->num_renvoi_voir; } } $noeuds_a_garder = new noeuds($by); //Si les noeuds sont du même thésaurus if ($noeuds_a_garder->num_thesaurus == $this->num_thesaurus) { //On déplace les catégories qui renvoi vers l'ancien noeuds pour qu'elle renvoie vers le nouveau if (noeuds::isTarget($this->id_noeud)) { $requete = "UPDATE noeuds SET num_renvoi_voir='" . $by . "' WHERE num_renvoi_voir='" . $this->id_noeud . "' and id_noeud!='" . $by . "' "; @pmb_mysql_query($requete, $dbh); } //On garde les liens voir_aussi $requete = "UPDATE ignore voir_aussi SET num_noeud_orig='" . $by . "' WHERE num_noeud_orig='" . $this->id_noeud . "' and num_noeud_dest!='" . $by . "' "; @pmb_mysql_query($requete, $dbh); $requete = "UPDATE ignore voir_aussi SET num_noeud_dest='" . $by . "' WHERE num_noeud_dest='" . $this->id_noeud . "' and num_noeud_orig!='" . $by . "'"; @pmb_mysql_query($requete, $dbh); } if (noeuds::isTarget($this->id_noeud)) { //Si le noeuds à supprimé est utilisé pour des renvois et qu'il reste des liens on les supprime //On supprime les renvoies $requete = "UPDATE noeuds SET num_renvoi_voir='0' WHERE num_renvoi_voir='" . $this->id_noeud . "'"; @pmb_mysql_query($requete, $dbh); } //On déplace les notices liées $requete = "UPDATE ignore notices_categories SET num_noeud='" . $by . "' where num_noeud = '" . $this->id_noeud . "' "; @pmb_mysql_query($requete, $dbh); //nettoyage d'autorities_sources $query = "select * from authorities_sources where num_authority = " . $this->id_noeud . " and authority_type = 'category'"; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { if ($row->authority_favorite == 1) { //on suprime les références si l'autorité a été importée... $query = "delete from notices_authorities_sources where num_authority_source = " . $row->id_authority_source; pmb_mysql_result($query); $query = "delete from authorities_sources where id_authority_source = " . $row->id_authority_source; pmb_mysql_result($query); } else { //on fait suivre le reste $query = "update authorities_sources set num_authority = " . $by . " where num_authority_source = " . $row->id_authority_source; pmb_mysql_query($query); } } } //On supprime le noeuds $this->delete(); // effacement de l'identifiant unique d'autorité $authority = new authority(0, $this->id_noeud, AUT_TABLE_CATEG); $authority->delete(); //synchro_rdf if ($pmb_synchro_rdf) { //on ajoute les noeuds impactés par le $by $thesBy = thesaurus::getByEltId($by); if (!in_array($thesBy->id_thesaurus, $arrayThesImpactes)) { $arrayThesImpactes[] = $thesBy->id_thesaurus; } $arrayIdImpactes[] = $by; //parent if ($noeuds_a_garder->num_parent != $thesBy->num_noeud_racine) { $arrayIdImpactes[] = $noeuds_a_garder->num_parent; } //enfants $res = noeuds::listChilds($noeuds_a_garder->id_noeud, 1); if (pmb_mysql_num_rows($res)) { while ($row = pmb_mysql_fetch_array($res)) { $arrayIdImpactes[] = $row[0]; } } //renvoi_voir if ($noeuds_a_garder->num_renvoi_voir) { $arrayIdImpactes[] = $noeuds_a_garder->num_renvoi_voir; } //On met le tout à jour $synchro_rdf = new synchro_rdf(); $synchro_rdf->delConcept($this->id_noeud); if (count($arrayIdImpactes)) { foreach ($arrayIdImpactes as $idNoeud) { $synchro_rdf->delConcept($idNoeud); $synchro_rdf->storeConcept($idNoeud); } } if (count($arrayThesImpactes)) { foreach ($arrayThesImpactes as $idThes) { $synchro_rdf->updateAuthority($idThes, 'thesaurus'); } } } return ""; }