commentaire) {
$zoom_comment = "
" ;
$java_comment = " onmouseover=\"z=document.getElementById('zoom_comment".$tcateg->id."'); z.style.display=''; \" onmouseout=\"z=document.getElementById('zoom_comment".$tcateg->id."'); z.style.display='none'; \"" ;
} else {
$zoom_comment = "" ;
$java_comment = "" ;
}
if ($thesaurus_mode_pmb && $caller=='notice') $nom_tesaurus='['.$tcateg->thes->getLibelle().'] ' ;
else $nom_tesaurus='' ;
if($tcateg->not_use_in_indexation && ($caller == "notice")){
$link= "
";
}elseif(((!$tcateg->is_under_tilde) || $keep_tilde)){
if($caller == "search_form"){
$lib_final=$tcateg->libelle;
}else{
$lib_final=$nom_tesaurus.$tcateg->catalog_form;
}
$link="id', '".htmlentities(addslashes($lib_final),ENT_QUOTES, $charset)."','$callback','".$tcateg->thes->id_thesaurus."'); return false;\" $java_comment>+$zoom_comment";
}
$visible=true;
$r=array("VISIBLE"=>$visible,"LINK"=>$link);
return $r;
}
class selector_category extends selector_authorities {
protected $thesaurus_id;
public function __construct($user_input = '') {
parent::__construct($user_input);
$this->objects_type = 'categories';
}
public function proceed() {
global $action;
$entity_form = '';
switch ($action) {
case 'hierarchical_search':
case 'terms_search':
case 'autoindex_search':
$entity_form = $this->get_search_form();
break;
case 'hierarchical_results_search':
case 'terms_results_search':
case 'autoindex_results_search':
case 'terms_show_notice':
$entity_form = $this->{$action}();
break;
default:
parent::proceed();
break;
}
if ($entity_form) {
header("Content-Type: text/html; charset=UTF-8");
print encoding_normalize::utf8_normalize($entity_form);
}
}
protected function get_thesaurus_id() {
global $caller, $dyn;
global $id_thes_unique;
global $perso_id, $id_thes;
if(!isset($this->thesaurus_id)) {
if($id_thes_unique>0) {
$this->thesaurus_id=$id_thes_unique;
} else{
//recuperation du thesaurus session en fonction du caller
switch ($caller) {
case 'notice' :
if($id_thes) $this->thesaurus_id = $id_thes;
else $this->thesaurus_id = thesaurus::getNoticeSessionThesaurusId();
if (!$perso_id) thesaurus::setNoticeSessionThesaurusId($this->thesaurus_id);
break;
case 'categ_form' :
if($id_thes) $this->thesaurus_id = $id_thes;
else $this->thesaurus_id = thesaurus::getSessionThesaurusId();
if( $dyn!=2) thesaurus::setSessionThesaurusId($this->thesaurus_id);
break;
default :
if($id_thes) $this->thesaurus_id = $id_thes;
else $this->thesaurus_id = thesaurus::getSessionThesaurusId();
thesaurus::setSessionThesaurusId($this->thesaurus_id);
break;
}
}
}
return $this->thesaurus_id;
}
protected function get_thesaurus_selector() {
global $msg, $charset;
global $caller, $dyn;
global $thesaurus_mode_pmb, $id_thes_unique;
global $search_type;
$id_thes = $this->get_thesaurus_id();
$liste_thesaurus = thesaurus::getThesaurusList();
$sel_thesaurus = '';
if ($thesaurus_mode_pmb != 0 && !$id_thes_unique) { //la liste des thesaurus n'est pas affichée en mode monothesaurus
$sel_thesaurus = " ";
}
return $sel_thesaurus;
}
protected function get_autoindex_form(){
global $autoindex_class;
if(!$autoindex_class) return;
$autoindex=new $autoindex_class();
return $autoindex->get_form();
}
protected function autoindex_results_search() {
global $autoindex_class;
if (empty($autoindex_class)) return '';
$autoindex = new $autoindex_class();
return $autoindex->index_list();
}
protected function get_search_form() {
global $msg, $charset;
global $action;
global $search_type;
$sel_search_form = parent::get_search_form();
$sel_search_form = str_replace("!!sel_thesaurus!!", $this->get_thesaurus_selector(), $sel_search_form);
if ($action == 'autoindex_search') {
$sel_search_form = str_replace("!!sel_index_auto!!", $this->get_autoindex_form(), $sel_search_form);
} else {
$sel_search_form = str_replace("!!sel_index_auto!!", "", $sel_search_form);
}
if ($action == 'terms_search') {
$sel_search_form .= $msg['term_search_info'];
}
return $sel_search_form;
}
protected function get_searcher_instance() {
return searcher_factory::get_searcher('categories', '', $this->user_input);
}
protected function get_sel_search_form_name() {
global $action;
if($this->objects_type) {
return "selector_".$this->objects_type."_".$action."_form";
} else {
return "selector_search_form";
}
}
public function get_sel_search_form_template() {
global $msg, $charset;
global $action;
if($action == 'autoindex_search') {
$sel_search_form ="
";
} else {
$sel_search_form ="
";
}
return $sel_search_form;
}
protected function get_sub_tabs(){
global $autoindex_class;
global $caller;
global $thesaurus_auto_index_notice_fields;
global $bt_ajouter;
$current_url = static::get_base_url();
$current_url = str_replace('select.php?', 'ajax.php?module=selectors&', $current_url);
$searcher_tab = $this->get_searcher_tabs_instance();
$auto_index_notice_fields = str_replace(array("\\n","\\r","\n","\r"), "", $thesaurus_auto_index_notice_fields);
return '
';
}
protected function hierarchical_results_search() {
global $msg, $charset;
global $id2, $parent;
global $lang;
global $page;
global $nb_per_page;
global $keep_tilde;
global $thesaurus_mode_pmb;
global $caller, $callback;
global $bouton_ajouter;
$display = '';
if(!$page) {
$page = 1;
}
if(!$nb_per_page) $nb_per_page = 10;
$debut = ($page-1)*$nb_per_page;
$libelle_partiel=0;
if($caller == 'search_form') {
$libelle_partiel=1;
}
$id_thes = $this->get_thesaurus_id();
$thes = new thesaurus($id_thes);
if(!$this->nbr_lignes){
$query = "SELECT SQL_CALC_FOUND_ROWS noeuds.id_noeud AS categ_id ";
}else{
$query = "SELECT noeuds.id_noeud AS categ_id ";
}
$query.= ",noeuds.num_thesaurus ";
if($this->user_input){
$aq=new analyse_query($this->user_input);
}else{
$aq=new analyse_query("*");
if($id_thes != -1){
if ($id2 == 0) {
//creation, on affiche le thesaurus a partir de la racine
$id_noeud = $thes->num_noeud_racine;
} else {//modification, on affiche a partir du pere de id2
if ($id2 == $parent) {
$id_noeud = $id2;
} else {
if(noeuds::hasChild($id2)){
$id_noeud = $id2;
} else {
$noeud = new noeuds($id2);
$id_noeud = $noeud->num_parent;
}
}
}
}
}
if ($aq->error) {
error_message($msg["searcher_syntax_error"],sprintf($msg["searcher_syntax_error_desc"],$aq->current_car,$aq->input_html,$aq->error_message));
return;
}
if(($id_thes != -1) && ($thes->langue_defaut == $lang)){
$members = $aq->get_query_members("categories", "libelle_categorie", "index_categorie", "num_noeud");
if(!$this->user_input){
$query.= ", categories.libelle_categorie AS index_categorie ";
}else{
$query.= ", categories.index_categorie AS index_categorie ";
$query.= ", ".$members["select"]." AS pert ";
}
$query.= "FROM noeuds JOIN categories ON noeuds.id_noeud = categories.num_noeud AND categories.langue='".$lang."'";
$query.= "WHERE noeuds.num_thesaurus = '".$id_thes."' ";
if(!$this->user_input){
$query.= "AND noeuds.num_parent = '".$id_noeud."' ";
}else{
$query.= "AND (".$members["where"].") ";
}
}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");
if(!$this->user_input){
$query.= ", IF (catlg.num_noeud IS NULL, catdef.libelle_categorie, catlg.libelle_categorie) as index_categorie ";
}else{
$query.= ", IF (catlg.num_noeud IS NULL, catdef.index_categorie, catlg.index_categorie) as index_categorie ";
$query.= ", IF (catlg.num_noeud IS NULL, (".$members_catdef["select"]."), (".$members_catlg["select"].") ) AS pert ";
}
if(($id_thes != -1)){//Je n'ai qu'un thésaurus mais langue du thésaurus != de langue de l'inteface
$query.= "FROM noeuds JOIN categories AS catdef ON noeuds.id_noeud = catdef.num_noeud AND catdef.langue = '".$thes->langue_defaut."' ";
$query.= "LEFT JOIN categories AS catlg ON catdef.num_noeud = catlg.num_noeud AND catlg.langue = '".$lang."' ";
$query.= "WHERE noeuds.num_thesaurus = '".$id_thes."' ";
if(!$this->user_input){
$query.= "AND noeuds.num_parent = '".$id_noeud."' ";
}else{
$query.= "AND ( IF (catlg.num_noeud IS NULL, ".$members_catdef["where"].", ".$members_catlg["where"].") ) ";
}
}else{
//Plusieurs thésaurus
$query.= "FROM noeuds JOIN thesaurus ON thesaurus.id_thesaurus = noeuds.num_thesaurus ";
$query.= "JOIN categories AS catdef ON noeuds.id_noeud = catdef.num_noeud AND catdef.langue = thesaurus.langue_defaut ";
$query.= "LEFT JOIN categories AS catlg on catdef.num_noeud = catlg.num_noeud AND catlg.langue = '".$lang."' ";
$query.= "WHERE 1 ";
$query.= "AND ( IF (catlg.num_noeud IS NULL, ".$members_catdef["where"].", ".$members_catlg["where"].") ) ";
}
}
$query.= "ORDER BY ";
if($this->user_input){
$query.= "pert DESC,";
}
$query.= " num_thesaurus, index_categorie ";
$query.= "LIMIT ".$debut.",".$nb_per_page." ";
$result = pmb_mysql_query($query);
if(!$this->nbr_lignes){
$qry = "SELECT FOUND_ROWS() AS NbRows";
if($resnum = pmb_mysql_query($qry)){
$this->nbr_lignes=pmb_mysql_result($resnum,0,0);
}
}
if($this->nbr_lignes){
$browser_top = "
";
$premier=true;
$browser_header="";
$browser_content="";
while($cat = pmb_mysql_fetch_row($result)) {
$tcateg = new category($cat[0]);
if(!$this->user_input && $premier){
if (!empty($tcateg->path_table) && $id_thes !=-1) {
$nb_path_table = count($tcateg->path_table);
for ($i = 0; $i < $nb_path_table - 1; $i++) {
if ($browser_header) {
$browser_header .= '>';
} else {
$browser_header = '';
}
$browser_header .= "path_table[$i]['id'];
$browser_header .= '&id_thes='.$id_thes;
$browser_header .= "'>";
$browser_header .= $tcateg->path_table[$i]['libelle'];
$browser_header .= "";
}
if ($browser_header) {
$browser_header .= '>