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 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 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 ""; }
$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> > ");
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; }
$browser_header .= "<a href='"; $browser_header .= $base_url; $browser_header .= $tcateg->path_table[$i]['id']; $browser_header .= '&id2=' . $tcateg->path_table[$i]['id']; $browser_header .= '&id_thes=' . $id_thes; $browser_header .= "'>"; $browser_header .= $tcateg->path_table[$i]['libelle']; $browser_header .= "</a>"; } $browser_header ? $browser_header .= '><strong>' : ($browser_header = '<strong>'); $browser_header .= $tcateg->path_table[sizeof($tcateg->path_table) - 1]['libelle']; $browser_header .= '</strong>'; $bouton_ajouter = str_replace("!!id_aj!!", $tcateg->path_table[sizeof($tcateg->path_table) - 1]['id'], $bouton_ajouter); } else { $browser_header = ""; $t = thesaurus::getByEltId($cat[0]); $bouton_ajouter = str_replace("!!id_aj!!", $t->num_noeud_racine, $bouton_ajouter); } $premier = false; } if (!$tcateg->is_under_tilde || $tcateg->voir_id || $keep_tilde) { $not_use_in_indexation = $tcateg->not_use_in_indexation; $browser_content .= "<tr><td>"; if ($id_thes == -1 && $thesaurus_mode_pmb) { $display = '[' . htmlentities($tcateg->thes->libelle_thesaurus, ENT_QUOTES, $charset) . ']'; } else { $display = ''; } if ($tcateg->voir_id) { $tcateg_voir = new category($tcateg->voir_id); $display .= "{$tcateg->libelle} -><i>" . $tcateg_voir->catalog_form . "@</i>";
protected function get_human_field($field, $values) { global $msg, $charset; switch ($field["INPUT_TYPE"]) { case "list": $options = $field["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($values); $j++) { $field_aff[$j] = $opt[$values[$j]]; } break; case "query_list": $requete = $field["INPUT_OPTIONS"]["QUERY"][0]["value"]; if ($field["FILTERING"] == "yes") { $requete = str_replace("!!acces_j!!", "", $requete); $requete = str_replace("!!statut_j!!", "", $requete); $requete = str_replace("!!statut_r!!", "", $requete); } if ($field["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]) { $use_global = explode(",", $field["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($values); $j++) { $field_aff[$j] = $opt[$values[$j]]; } break; case "marc_list": $opt = new marc_list($field["INPUT_OPTIONS"]["NAME"][0]["value"]); for ($j = 0; $j < count($values); $j++) { $field_aff[$j] = $opt->table[$values[$j]]; } break; case "date": $field_aff[0] = format_date($values[0]); break; case "authoritie": for ($j = 0; $j < sizeof($values); $j++) { if (is_numeric($values[$j]) && ${$op} == "AUTHORITY") { switch ($field['INPUT_OPTIONS']['SELECTOR']) { case "categorie": $thes = thesaurus::getByEltId($values[$j]); $values[$j] = categories::getlibelle($values[$j], $lang) . " [" . $thes->libelle_thesaurus . "]"; if (isset($fieldvar["id_thesaurus"])) { unset($fieldvar["id_thesaurus"]); } break; case "auteur": $aut = new auteur($values[$j]); if ($aut->rejete) { $values[$j] = $aut->name . ', ' . $aut->rejete; } else { $values[$j] = $aut->name; } if ($aut->date) { $values[$j] .= " ({$aut->date})"; } break; case "editeur": $ed = new editeur($values[$j]); $values[$j] = $ed->name; if ($ed->ville) { if ($ed->pays) { $values[$j] .= " ({$ed->ville} - {$ed->pays})"; } else { $values[$j] .= " ({$ed->ville})"; } } break; case "collection": $coll = new collection($values[$j]); $values[$j] = $coll->name; break; case "subcollection": $coll = new subcollection($values[$j]); $values[$j] = $coll->name; break; case "serie": $serie = new serie($values[$j]); $values[$j] = $serie->name; break; case "indexint": $indexint = new indexint($values[$j]); if ($indexint->comment) { $values[$j] = $indexint->name . " - " . $indexint->comment; } else { $values[$j] = $indexint->name; } if ($thesaurus_classement_mode_pmb != 0) { $values[$j] = "[" . $indexint->name_pclass . "] " . $values[$j]; } break; case "titre_uniforme": $tu = new titre_uniforme($values[$j]); $values[$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)) { $values[$j] = pmb_mysql_result($res, 0, 0); } break; } } } $field_aff = $values; break; default: $field_aff[0] = $values[0]; break; } return '<b>' . get_msg_to_display($field['TITLE']) . '</b> ' . implode(' ', $field_aff); }
function listAncestors($id_noeud = 0) { global $dbh; if (!$id_noeud && is_object($this)) { $id_noeud = $this->id_noeud; $path = $this->path; } else { $q = "select path from noeuds where id_noeud = '" . $id_noeud . "' "; $r = mysql_query($q, $dbh); if ($r && mysql_num_rows($r)) { $path = mysql_result($r, 0, 0); } } if ($path) { $id_list = explode('/', $path); krsort($id_list); return $id_list; } if (!$id_noeud && is_object($this)) { $id_noeud = $this->id_noeud; } $thes = thesaurus::getByEltId($id_noeud); $id_top = $thes->num_noeud_racine; $i = 0; $id_list[$i] = $id_noeud; while ($id_list[$i] != $id_top && $id_list[$i] != 0) { $q = "select num_parent from noeuds where id_noeud = '" . $id_list[$i] . "' limit 1"; $r = mysql_query($q, $dbh); $i++; $id_list[$i] = mysql_result($r, 0, 0); } return $id_list; }
/** * Permet de récupérer les catégories dont le num_renvoi correspond à l'id du noeud courant */ function listSynonyms() { global $dbh, $lang; $thes = thesaurus::getByEltId($this->id); $q = "select id_noeud from noeuds where num_thesaurus = '" . $thes->id_thesaurus . "' and autorite = 'ORPHELINS' "; $r = pmb_mysql_query($q, $dbh); if ($r && pmb_mysql_num_rows($r)) { $num_noeud_orphelins = pmb_mysql_result($r, 0, 0); } else { $num_noeud_orphelins = 0; } $q = "select "; $q .= "catdef.num_noeud, noeuds.autorite, noeuds.num_parent, noeuds.num_renvoi_voir, noeuds.visible, noeuds.num_thesaurus, "; $q .= "if (catlg.num_noeud is null, catdef.langue, catlg.langue ) as langue, "; $q .= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie ) as libelle_categorie, "; $q .= "if (catlg.num_noeud is null, catdef.note_application, catlg.note_application ) as note_application, "; $q .= "if (catlg.num_noeud is null, catdef.comment_public, catlg.comment_public ) as comment_public, "; $q .= "if (catlg.num_noeud is null, catdef.comment_voir, catlg.comment_voir ) as comment_voir, "; $q .= "if (catlg.num_noeud is null, catdef.index_categorie, catlg.index_categorie ) as index_categorie "; $q .= "from noeuds left join categories as catdef on noeuds.id_noeud=catdef.num_noeud and catdef.langue = '" . $thes->langue_defaut . "' "; $q .= "left join categories as catlg on catdef.num_noeud = catlg.num_noeud and catlg.langue = '" . $lang . "' "; $q .= "where "; $q .= "noeuds.num_parent = '{$num_noeud_orphelins}' and noeuds.num_renvoi_voir='" . $this->id . "' "; //if (!$keep_tilde) $q.= "and catdef.libelle_categorie not like '~%' "; //if ($ordered !== 0) $q.= "order by ".$ordered." "; $q .= ""; // A voir pour ajouter un parametre gestion maxddisplay $r = pmb_mysql_query($q, $dbh); while ($cat_see = pmb_mysql_fetch_object($r)) { $this->list_see[] = array('id' => $cat_see->num_noeud, 'name' => $cat_see->comment_public, 'parend_id' => $cat_see->num_parent, 'libelle' => $cat_see->libelle_categorie); } return $this->list_see; }