$categ_child_content .= "<a href='./autorites.php?categ=categories&sub=categ_form&parent=" . $parent . "&id=" . $tcateg->id . "' {$java_comment} >"; $categ_child_content .= $tcateg->libelle; $categ_child_content .= '</a>'; $categ_child_content .= $zoom_comment . '</td>'; if ($notice_count && $notice_count != 0) { $categ_child_content .= "<td style='cursor: pointer; width:20%; text-align:center;' onmousedown=\"document.location='./catalog.php?categ=search&mode=1&etat=aut_search&aut_type=categ&aut_id={$tcateg->id}'\">" . $notice_count . "</td>"; } else { $categ_child_content .= "<td> </td>"; } $categ_child_content .= '</tr>'; } $categ_child_content .= "</table>\n\t\t\t\t</div>"; } } $categ_renvoivoir_content = ""; if (noeuds::isTarget($id)) { $has_link = true; $odd_even = 1; if ($res = noeuds::listTargets($id)) { $categ_renvoivoir_content .= "\n\t\t\t\t<div class='row'>\n\t \t\t<label for='' class='etiquette'>{$msg['categ_renvoivoir']}</label>\n\t \t</div>\n\t \t<div class='row'>\n\t \t\t<table>"; while ($row = mysql_fetch_object($res)) { $tcateg = new category($row->id_noeud); $categ_renvoivoir_content .= "\t<tr class='even'>"; if ($odd_even == 0) { $categ_renvoivoir_content .= "\t<tr class='odd'>"; $odd_even = 1; } else { if ($odd_even == 1) { $categ_renvoivoir_content .= "\t<tr class='even'>"; $odd_even = 0; }
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 ""; }