get_parms( "bid" , "id" , "lng" , "sortsy" // trier la liste des sy (="1") ou pas , "debug" ); if(isset($session->usr_id) && isset($session->ses_id)) { $ses_id = $session->ses_id; $usr_id = $session->usr_id; if(!($ph_session = phrasea_open_session((int)$ses_id, $usr_id))) { header("Location: /login/?err=no-session"); exit(); } } else { header("Location: /login/"); exit(); } header("Content-Type: text/html; charset=UTF-8"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0 ?> \n"); $nodes = $xpath->query($q); if($nodes->length > 0) { $nts = 0; $tts = array(); // on dresse la liste des termes specifiques avec comme cle le synonyme dans la langue pivot for($n=$nodes->item(0)->firstChild; $n; $n=$n->nextSibling) { if($n->nodeName=="te") { $nts++; $allsy = ""; $tsy = array(); $firstksy = null; $ksy = $realksy = null; // on liste les sy pour fabriquer la cle for($n2=$n->firstChild; $n2; $n2=$n2->nextSibling) { if($n2->nodeName=="sy") { $lng = $n2->getAttribute("lng"); $t = $n2->getAttribute("v"); $ksy = $n2->getAttribute("w"); if($k = $n2->getAttribute("k")) { // $t .= " ($k)"; $ksy .= " ($k)"; } if(!$firstksy) $firstksy = $ksy; if(!$realksy && $parm["lng"] && $lng==$parm["lng"]) { $realksy = $ksy; // $allsy = "" . $t . "" . ($allsy ? " ; ":"") . $allsy; $allsy = $t . ($allsy ? " ; ":"") . $allsy; array_push($tsy, array("id"=>$n2->getAttribute("id"), "sy"=>$t)); } else { $allsy .= ($allsy?" ; ":"") . $t; array_push($tsy, array("id"=>$n2->getAttribute("id"), "sy"=>$t)); } } } if(!$realksy) $realksy = $firstksy; if($parm["sortsy"] && $parm["lng"]) { for($uniq=0; $uniq<9999; $uniq++) { if(!isset($tts[$realksy . "_" . $uniq])) break; } $tts[$realksy . "_" . $uniq] = array("id"=>$n->getAttribute("id"), "allsy"=>$allsy, "nchild"=>$xpath->query("te", $n)->length, "tsy"=>$tsy); } else { $tts[] = array("id"=>$n->getAttribute("id"), "allsy"=>$allsy, "nchild"=>$xpath->query("te", $n)->length, "tsy"=>$tsy); } } elseif($n->nodeName=="sy") { } } if($parm["sortsy"] && $parm["lng"]) ksort($tts, SORT_STRING); if($parm["debug"]) printf("tts :
%s

\n", var_export($tts, true)); $zhtml = ""; $bid = $parm["bid"]; foreach($tts as $ts) { $tid = $ts["id"]; $t = $ts["allsy"]; $lt = ""; foreach($ts["tsy"] as $sy) { $lt .= ($lt?" ; ":""); $lt .= ""; $lt .= $sy["sy"]; $lt .= ""; } $zhtml .= "

"; if($ts["nchild"] > 0) { $zhtml .= "+"; $zhtml .= $lt; $zhtml .= "

"; $zhtml .= "
"; $zhtml .= "loading"; $zhtml .= "
"; } else { $zhtml .= " "; $zhtml .= $lt; $zhtml .= "

"; } } } } } if($parm["debug"]) print("
" . htmlentities($zhtml) . "
"); else print($zhtml); ?>