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 = " ";
$button_voir = " ";
// on récupère les données de la catégorie
$cat = new category($id);
$c_form = '
'.$cat->catalog_form.'
';
$p_value = $cat->parent_id;
$p_libelle = $cat->parent_libelle;
$v_value = $cat->voir_id;
if($v_value) {
$voir = new category($v_value);
$v_libelle = $voir->catalog_form;
} else {
$v_libelle = "";
}
//renvois voir aussi
$see_also=$cat->associated_terms;
//Non utilisisable en indexation
$not_use_in_indexation=$cat->not_use_in_indexation;
//numero autorite
$n=new noeuds($id);
$num_aut=$n->autorite;
$authority_statut=$n->num_statut;
//import bloqué
$import_denied = $n->authority_import_denied;
if (noeuds::isProtected($id)) {
$aff_node_info=false;
} else {
$aff_node_info=true;
}
} else {
$action = "./autorites.php?categ=categories&sub=update&id=$id&parent=$parent";
$delete_button = '';
$button_voir = '';
$title = $msg[319];
$libelle = '';
$c_form = '';
if($parent) {
$pr = new category($parent);
$p_value = $pr->id;
$p_libelle = $pr->catalog_form;
} else {
$p_value = 0;
$p_libelle = '';
}
$v_value = 0;
$v_libelle = '';
$not_use_in_indexation = 0;
$num_aut=0;
$authority_statut=0;
$aff_node_info=true;
$import_denied = 0;
}
if ($thesaurus_mode_pmb != 0) $title.= ' ('.htmlentities($thes->libelle_thesaurus, ENT_QUOTES, $charset).')';
//Traductions
$tab_traductions = array();
//Affichage des boutons de traduction
$bt_lib_trad = '';
$bt_cm_trad = '';
$bt_na_trad = '';
if ( count($lg1) > 0 ) {
$bt_lib_trad = " ";
$bt_cm_trad = " ";
$bt_na_trad = " ";
}
$category_form = str_replace('', $bt_lib_trad, $category_form);
$category_form = str_replace('', $bt_cm_trad, $category_form);
$category_form = str_replace('', $bt_na_trad, $category_form);
//On lit d'abord dans la langue par défaut du thesaurus
if (categories::exists($id, $thes->langue_defaut)) {
$c = new categories($id, $thes->langue_defaut);
$libelle_categorie = $c->libelle_categorie;
$note_application = $c->note_application;
$commentaire = $c->comment_public;
} else {
$libelle_categorie = '';
$note_application = '';
$commentaire = '';
}
$tab_traductions [$thes->langue_defaut][0] = $lg[$thes->langue_defaut];
$tab_traductions [$thes->langue_defaut][1] = $libelle_categorie;
$tab_traductions [$thes->langue_defaut][2] = $note_application;
$tab_traductions [$thes->langue_defaut][3] = $commentaire;
//Ensuite, on regarde si les categories existent pour les langues de traduction des thesaurus
foreach($lg1 as $key=>$value){
if (categories::exists($id, $key)) {
$c = new categories($id, $key);
$libelle_categorie = $c->libelle_categorie;
$note_application = $c->note_application;
$commentaire = $c->comment_public;
} else {
$libelle_categorie = '';
$note_application = '';
$commentaire = '';
}
$tab_traductions[$key][0] = $value;
$tab_traductions[$key][1] = $libelle_categorie;
$tab_traductions[$key][2] = $note_application;
$tab_traductions[$key][3] = $commentaire;
}
//categories langue par defaut thesaurus
$category_form = str_replace('!!lang_def_cle!!', htmlentities('['.$thes->langue_defaut.']', ENT_QUOTES, $charset), $category_form);
$category_form = str_replace('!!lang_def!!', htmlentities(' ('.$tab_traductions[$thes->langue_defaut][0].') ', ENT_QUOTES, $charset), $category_form);
$category_form = str_replace('!!lang_def_js!!', ' ('.$tab_traductions[$thes->langue_defaut][0].') ', $category_form);
$category_form = str_replace('!!lang_def_libelle!!', htmlentities($tab_traductions[$thes->langue_defaut][1], ENT_QUOTES, $charset), $category_form);
$label1 = "\t(";
$label2 = ")
\n";
$input1 = "\t
\n";
//categories langue interface (si dans la liste des langues pour les thesaurus)
if ( ($lang != $thes->langue_defaut) && ($lg1[$lang] != '') ) {
$c_libelle_trad = $label1.htmlentities($tab_traductions[$lang][0], ENT_QUOTES, $charset).$label2;
$c_libelle_trad.= $input1.$lang.$input2.htmlentities($tab_traductions[$lang][1], ENT_QUOTES, $charset).$input3;
} else {
$c_libelle_trad = '';
}
//categories autres langues
foreach($tab_traductions as $key=>$value) {
if ($key != $thes->langue_defaut && $key != $lang) {
$c_libelle_trad.= $label1.htmlentities($tab_traductions[$key][0], ENT_QUOTES, $charset).$label2;
$c_libelle_trad.= $input1.$key.$input2.htmlentities($tab_traductions[$key][1], ENT_QUOTES, $charset).$input3;
}
}
$category_form = str_replace('!!c_libelle_trad!!', $c_libelle_trad, $category_form);
//Non utilisisable en indexation
if($not_use_in_indexation == 1){
$not_use_checked = "checked='checked'";
}else{
$not_use_checked = "";
}
$category_form = str_replace('!!not_use_in_indexation!!',$not_use_checked,$category_form);
//note d'application langue par defaut thesaurus
$category_form = str_replace('!!lang_def_na!!', htmlentities($tab_traductions[$thes->langue_defaut][2], ENT_QUOTES, $charset), $category_form);
//commentaire langue par defaut thesaurus
$category_form = str_replace('!!lang_def_cm!!', htmlentities($tab_traductions[$thes->langue_defaut][3], ENT_QUOTES, $charset), $category_form);
$na_trad = "";
$cm_trad = "";
//note d'application et commentaire en langue de l'interface
if ($lang != $thes->langue_defaut) {
$na_trad = $traduction_na_tpl;
$na_trad = str_replace('!!lang_value!!', htmlentities($tab_traductions[$lang][0], ENT_QUOTES, $charset), $na_trad);
$na_trad = str_replace('!!lang!!', $lang, $na_trad);
$na_trad = str_replace('!!note_application!!', htmlentities($tab_traductions[$lang][2], ENT_QUOTES, $charset), $na_trad);
$cm_trad = $traduction_cm_tpl;
$cm_trad = str_replace('!!lang_value!!', htmlentities($tab_traductions[$lang][0], ENT_QUOTES, $charset), $cm_trad);
$cm_trad = str_replace('!!lang!!', $lang, $cm_trad);
$cm_trad = str_replace('!!commentaire!!', htmlentities($tab_traductions[$lang][3], ENT_QUOTES, $charset), $cm_trad);
}
//note d'application et commentaire autres langues
foreach($tab_traductions as $key=>$value) {
if ($key != $thes->langue_defaut && $key != $lang) {
$temp_na_trad = $traduction_na_tpl;
$temp_na_trad = str_replace('!!lang_value!!', htmlentities($tab_traductions[$key][0], ENT_QUOTES, $charset), $temp_na_trad);
$temp_na_trad = str_replace('!!lang!!', $key, $temp_na_trad);
$temp_na_trad = str_replace('!!note_application!!', htmlentities($tab_traductions[$key][2], ENT_QUOTES, $charset), $temp_na_trad);
$na_trad .= $temp_na_trad;
$temp_cm_trad = $traduction_cm_tpl;
$temp_cm_trad = str_replace('!!lang_value!!', htmlentities($tab_traductions[$key][0], ENT_QUOTES, $charset), $temp_cm_trad);
$temp_cm_trad = str_replace('!!lang!!', $key, $temp_cm_trad);
$temp_cm_trad = str_replace('!!commentaire!!', htmlentities($tab_traductions[$key][3], ENT_QUOTES, $charset), $temp_cm_trad);
$cm_trad .= $temp_cm_trad;
}
}
$category_form = str_replace('!!na_trad!!', $na_trad, $category_form);
$category_form = str_replace('!!cm_trad!!', $cm_trad, $category_form);
$category_form = str_replace('!!id!!', $id, $category_form);
$category_form = str_replace('!!parent!!', $parent, $category_form);
$category_form = str_replace('!!action!!', $action, $category_form);
$category_form = str_replace('!!id_parent!!', $parent, $category_form);
$category_form = str_replace('!!form_title!!', $title, $category_form);
$category_form = str_replace('!!category_comment!!', htmlentities($commentaire,ENT_QUOTES, $charset), $category_form);
/**
* Gestion du selecteur de statut d'autorité
*/
$category_form = str_replace('!!auth_statut_selector!!', authorities_statuts::get_form_for(AUT_TABLE_CATEG, $authority_statut), $category_form);
if ($aff_node_info) {
$form_categ_parent = str_replace('!!parent_value!!', $p_value, $form_categ_parent);
$form_categ_parent = str_replace('!!parent_libelle!!', htmlentities($p_libelle,ENT_QUOTES, $charset), $form_categ_parent);
$category_form = str_replace('', $form_categ_parent, $category_form);
$form_renvoivoir = str_replace('!!voir_value!!', $v_value, $form_renvoivoir);
$form_renvoivoir = str_replace('!!voir_libelle!!', htmlentities($v_libelle,ENT_QUOTES, $charset), $form_renvoivoir);
$category_form = str_replace('', $form_renvoivoir , $category_form);
if (count($see_also)==0) {
$max_categ=1;
$categ0_id=0;
$categ0_lib="";
$categ0_rec="unchecked='unchecked'";
} else {
$max_categ=count($see_also);
$csa=new category($see_also[0]['id']);
$categ0_id=$see_also[0]['id'];
$categ0_lib=$csa->catalog_form;
if ( $see_also[0]['rec'] )$categ0_rec="checked='checked'"; else $categ0_rec="unchecked='unchecked'";
}
$see_also_form=$add_see_also;
$see_also_form.=" \n";
$categ0=str_replace("!!categ_libelle!!",$categ0_lib,$categ0);
$categ0=str_replace("!!categ_id!!",$categ0_id,$categ0);
$categ0=str_replace("!!icateg!!","0",$categ0);
$categ0=str_replace("!!parent!!", $parent, $categ0);
$categ0=str_replace("!!chk!!", $categ0_rec, $categ0);
$see_also_form.=$categ0."\n";
$see_also_form.="\n";
for ($i=1; $icatalog_form,$categ_);
$categ_=str_replace("!!categ_id!!",$see_also[$i]['id'],$categ_);
$categ_=str_replace("!!icateg!!",$i,$categ_);
if ( $see_also[$i]['rec'] )$categ_rec="checked='checked'"; else $categ_rec="unchecked='unchecked'";
$categ_=str_replace("!!chk!!", $categ_rec, $categ_);
$see_also_form.=$categ_."\n";
}
$see_also_form.="
";
$form_renvoivoiraussi=str_replace("!!renvoi_voir_aussi!!",$see_also_form,$form_renvoivoiraussi);
$category_form=str_replace("",$form_renvoivoiraussi,$category_form);
//liaisons
$has_link = false;
$categ_child_content="";
if (noeuds::hasChild($id)) {
$has_link = true;
$odd_even=1;
if ($res = noeuds::listChilds($id, 0)) {
$categ_child_content .= "
$msg[categ_childs]
";
$categs = array();
while ($row = pmb_mysql_fetch_object($res)) {
$categs[] = new category($row->id_noeud);
}
usort($categs, "usort_categs_array_by_libelle");
foreach ($categs as $tcateg) {
if ($odd_even==0) {
$categ_child_content .= " ";
$odd_even=1;
} else if ($odd_even==1) {
$categ_child_content .= " ";
$odd_even=0;
}
$notice_count = $tcateg->notice_count(false);
$categ_child_content .= "";
if($tcateg->has_child) {
$categ_child_content .= "";
$categ_child_content .= " ";
} else {
$categ_child_content .= " ";
}
if ($tcateg->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 = "" ;
}
$categ_child_content .= "";
$categ_child_content .= $tcateg->libelle;
$categ_child_content .= ' ';
$categ_child_content .= $zoom_comment.' ';
if($notice_count && $notice_count!=0)
$categ_child_content .= "id'\">".$notice_count." ";
else $categ_child_content .= " ";
$categ_child_content .=' ';
}
$categ_child_content .= "
";
}
}
$categ_renvoivoir_content="";
if (noeuds::isTarget($id)){
$has_link = true;
$odd_even=1;
if ($res = noeuds::listTargets($id)) {
$categ_renvoivoir_content .= "
$msg[categ_renvoivoir]
";
$categs = array();
while ($row = pmb_mysql_fetch_object($res)) {
$categs[] = new category($row->id_noeud);
}
usort($categs, "usort_categs_array_by_libelle");
foreach ($categs as $tcateg) {
$categ_renvoivoir_content .= " ";
if ($odd_even==0) {
$categ_renvoivoir_content .= " ";
$odd_even=1;
} else if ($odd_even==1) {
$categ_renvoivoir_content .= " ";
$odd_even=0;
}
$notice_count = $tcateg->notice_count(false);
$categ_renvoivoir_content .= "";
if($tcateg->has_child) {
$categ_renvoivoir_content .= "";
$categ_renvoivoir_content .= " ";
} else {
$categ_renvoivoir_content .= " ";
}
if ($tcateg->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 = "" ;
}
$categ_renvoivoir_content .= "";
$categ_renvoivoir_content .= $tcateg->libelle;
$categ_renvoivoir_content .= ' ';
$categ_renvoivoir_content .= $zoom_comment.' ';
if($notice_count && $notice_count!=0)
$categ_renvoivoir_content .= "id'\">".$notice_count." ";
else $categ_renvoivoir_content .= " ";
$categ_renvoivoir_content .=' ';
}
$categ_renvoivoir_content .= "
";
}
}
$categ_renvoivoiraussi_content="";
//Voir aussi
$requete="SELECT distinct num_noeud_orig AS id_noeud FROM voir_aussi WHERE num_noeud_dest='".$id."'";
$res=pmb_mysql_query($requete);
if (pmb_mysql_num_rows($res)) {
$has_link = true;
$odd_even=1;
$categ_renvoivoiraussi_content .= "
$msg[categ_renvoivoiraussi]
";
$categs = array();
while ($row = pmb_mysql_fetch_object($res)) {
$categs[] = new category($row->id_noeud);
}
usort($categs, "usort_categs_array_by_libelle");
foreach ($categs as $tcateg) {
$categ_renvoivoiraussi_content .= " ";
if ($odd_even==0) {
$categ_renvoivoiraussi_content .= " ";
$odd_even=1;
} else if ($odd_even==1) {
$categ_renvoivoiraussi_content .= " ";
$odd_even=0;
}
$notice_count = $tcateg->notice_count(false);
$categ_renvoivoiraussi_content .= "";
if($tcateg->has_child) {
$categ_renvoivoiraussi_content .= "";
$categ_renvoivoiraussi_content .= " ";
} else {
$categ_renvoivoiraussi_content .= " ";
}
if ($tcateg->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 = "" ;
}
$categ_renvoivoiraussi_content .= "";
$categ_renvoivoiraussi_content .= $tcateg->libelle;
$categ_renvoivoiraussi_content .= ' ';
$categ_renvoivoiraussi_content .= $zoom_comment.' ';
if($notice_count && $notice_count!=0)
$categ_renvoivoiraussi_content .= "id'\">".$notice_count." ";
else $categ_renvoivoiraussi_content .= " ";
$categ_renvoivoiraussi_content .=' ';
}
$categ_renvoivoiraussi_content .= "
";
}
if ($has_link) {
$categories_liaison_tpl=str_replace("",$categ_child_content,$categories_liaison_tpl);
$categories_liaison_tpl=str_replace("",$categ_renvoivoir_content,$categories_liaison_tpl);
$categories_liaison_tpl=str_replace("",$categ_renvoivoiraussi_content,$categories_liaison_tpl);
$category_form=str_replace("",$categories_liaison_tpl,$category_form);
} else {
$category_form=str_replace("","",$category_form);
}
//Numéro d'autorité
$form_num_aut=str_replace("!!num_aut!!",$num_aut,$form_num_aut);
$category_form=str_replace("",$form_num_aut,$category_form);
// Indexation concepts
if ($id) $id_categ = $id;
else $id_categ = 0;
if($thesaurus_concepts_active == 1 ){
$index_concept = new index_concept($id, TYPE_CATEGORY);
$category_form = str_replace('!!concept_form!!', $index_concept->get_form('categ_form'), $category_form);
}else{
$category_form = str_replace('!!concept_form!!', "", $category_form);
}
if ($tab_traductions[$thes->langue_defaut][1]) {
$category_form = str_replace('!!document_title!!', addslashes($tab_traductions[$thes->langue_defaut][1].' - '.$title), $category_form);
} else {
$category_form = str_replace('!!document_title!!', addslashes($title), $category_form);
}
if ($id) {
// Impression de la branche du thésaurus
$lien_impression_thesaurus="".$msg['print_branche']." ";
$category_form=str_replace("",$lien_impression_thesaurus,$category_form);
}
//Remplacement
$button_remplace = " ";
$category_form = str_replace("", $button_remplace, $category_form);
//Suppression
$category_form = str_replace('', $delete_button, $category_form);
} else {
$category_form=str_replace("",$num_aut,$category_form);
$category_form = str_replace('!!concept_form!!', "", $category_form);
}
$authority = new authority(0, $id, AUT_TABLE_CATEG);
$category_form = str_replace('!!thumbnail_url_form!!', thumbnail::get_form('authority', $authority->get_thumbnail_url()), $category_form);
if($import_denied == 1 || !$id){
$import_denied_checked = "checked='checked'";
}else{
$import_denied_checked = "";
}
$category_form = str_replace('!!authority_import_denied!!',$import_denied_checked,$category_form);
require_once("$class_path/aut_link.class.php");
$aut_link= new aut_link(AUT_TABLE_CATEG,$id);
$category_form = str_replace('', $aut_link->get_form('categ_form') , $category_form);
global $pmb_map_activate;
if($pmb_map_activate){
$map_edition=new map_edition_controler(AUT_TABLE_CATEG,$id);
$map_form=$map_edition->get_form();
$category_form = str_replace('', $map_form , $category_form);
}
$aut_pperso= new aut_pperso("categ",$id);
$category_form = str_replace('!!aut_pperso!!', $aut_pperso->get_form(), $category_form);
$category_form = str_replace('!!voir_notices!!', $button_voir, $category_form);
if($pmb_type_audit && $id) {
$bouton_audit= " ";
} else {
$bouton_audit= "";
}
$category_form = str_replace('!!audit_bt!!', $bouton_audit, $category_form);
$category_form = str_replace('!!user_input!!', htmlentities($user_input,ENT_QUOTES, $charset), $category_form);
$category_form = str_replace('!!nbr_lignes!!', $nbr_lignes, $category_form);
$category_form = str_replace('!!page!!', $page, $category_form);
$category_form = str_replace('!!nb_per_page!!', $nb_per_page_gestion, $category_form);
print $category_form;