get_parms( "bid" , "piv" , "tid" , "field" ); ?> <?php echo p4string::MakeString(_('thesaurus:: Lier la branche de thesaurus')) ?>
get_databox((int) $parm['bid']); $domstruct = $databox->get_dom_structure(); $domth = $databox->get_dom_thesaurus(); if ($domstruct && $domth) { $xpathth = new DOMXPath($domth); $xpathstruct = new DOMXPath($domstruct); ?>
"> "> ">


query("/record/description/*"); for ($i = 0; $i < $nodes->length; $i ++ ) { $fieldname = $nodes->item($i)->nodeName; $tbranch = $nodes->item($i)->getAttribute("tbranch"); $ck = false; $tids = array(); // les ids de branches liees e ce champ if ($tbranch) { // ce champ a deje un tbranch, on balaye les branches auxquelles il est lie $thnodes = $xpathth->query($tbranch); for ($j = 0; $j < $thnodes->length; $j ++ ) { if ($thnodes->item($j)->getAttribute("id") == $parm["tid"]) { // il etait deje lie e la branche selectionnee $tids[$thnodes->item($j)->getAttribute("id")] = $thnodes->item($j); $ck = true; } else { // il etait lie e une autre branche $tids[$thnodes->item($j)->getAttribute("id")] = $thnodes->item($j); } } } // printf("'%s' avant:%s apres:%s
\n", $fieldname, $ck, array_key_exists($fieldname, $parm["field"])); if (array_key_exists($fieldname, $parm["field"]) != $ck) { print("\t\t
"); echo "" . $fieldname . "" . p4string::MakeString(sprintf(_('thesaurus:: Ce champ a ete modifie ; ancienne branche : %s '), $tbranch)); print("
\n"); if ($ck) { // print("il etait lie a la branche, il ne l'est plus
\n"); unset($tids[$parm["tid"]]); } else { // print("il n'etait pas lie a la branche, il l'est maintenant
\n"); $tids[$parm["tid"]] = $xpathth->query("/thesaurus//te[@id='" . thesaurus::xquery_escape($parm["tid"]) . "']")->item(0); } $newtbranch = ""; foreach ($tids as $kitd => $node) { if ($kitd === "") $newtbranch .= ( $newtbranch ? " | " : "") . "/thesaurus"; else { // $newtbranch .= ($newtbranch?" | ":"") . "/thesaurus//te[@id='" . $kitd . "']"; $neb = ""; while ($node && $node->nodeName == "te") { $neb = "/te[@id='" . $node->getAttribute("id") . "']" . $neb; $node = $node->parentNode; } $newtbranch .= ( $newtbranch ? " | " : "") . "/thesaurus" . $neb; } } echo p4string::MakeString(_('thesaurus:: nouvelle branche')) . $newtbranch; print("
\n"); if ($tbranch != "" && $newtbranch == "") { echo "" . $fieldname . "" . p4string::MakeString(_('thesaurus:: ce champ n\'est plus lie au thesaurus, les termes indexes et candidats seront supprimes')); print("
\n"); printf("\t\t\n", $fieldname); } if ($newtbranch != "") { if ($tbranch == "") { echo "" . $fieldname . "" . p4string::MakeString(_('thesaurus:: ce champ doit etre lie au thesaurus. La reindexation de la base est necessaire')); } else { echo "" . $fieldname . "" . p4string::MakeString(_('thesaurus:: le lien au thesaurus doit etre modifie, la reindexation de la base est necessaire')); } print("
\n"); $needreindex = true; printf("\t\t\n", $fieldname . "<" . $newtbranch); } } } ?>
\n"); print("
" . p4string::MakeString(_('thesaurus:: reindexation necessaire')) /* Reindexation necessaire ! */ . "
"); } else { print("
" . p4string::MakeString(_('thesaurus:: pas de reindexation')) /* Pas de reindexation necessaire ! */ . "
"); } ?>