function printSubordinateSynsets($db, $inner_db, $id, $top_id) { $open_ids = array(); array_push($open_ids, $top_id); if (array_key_exists('id', $_GET)) { foreach (getSuperordinateSynsets($inner_db, $_GET['id']) as $tmp_id) { array_push($open_ids, $tmp_id); } } print "\t<ul class=\"tree\">\n"; $sub_ids = getSubordinateSynsets($db, $id); $i = 0; $openall = 0; if (array_key_exists('openall', $_GET) && $_GET['openall'] == 1) { $openall = 1; } foreach ($sub_ids as $sub_id) { $open = 0; if ($openall == 1) { $open = 1; } $has_sub_synsets = 1; if (sizeof(getSubordinateSynsets($db, $sub_id)) == 0) { $has_sub_synsets = 0; } $anchor = ""; if (array_key_exists('id', $_GET) && $_GET['id'] == $sub_id) { $open = 1; $anchor = '<a name="position"></a>'; } else { if (array_search($sub_id, $open_ids)) { $open = 1; } } print "\t<li>{$anchor}"; if (!$has_sub_synsets) { print "<tt>[ ]</tt> "; } else { if ($open) { print "<a class=\"openplus\" href=\"tree.php?id={$id}#position\"><tt>[-]</tt></a> "; } else { print "<a class=\"openplus\" href=\"tree.php?id={$sub_id}#position\" " . "title=\"" . T_("Show subordinate meanings") . "\"><tt>[+]</tt></a> "; } } print "<a href=\"synset.php?id={$sub_id}\">"; if ($open) { print "<b>" . getJoinedSynset($sub_id) . "</b>"; } else { print getJoinedSynset($sub_id); } print "</a>\n"; if ($open) { printSubordinateSynsets($db, $inner_db, $sub_id, $top_id); } print "\t</li>\n"; $i++; } if ($i == 0 && $openall == 0) { // shouldn't happen - there's no such link print "\t<li>" . T_("No subordinate meanings defined yet") . "</li>\n"; } print "\t</ul>\n"; }
} } # Antonyme: $antonym_line = ""; if ($antonym_term != "") { $antonym_array = getAntonym($db2, $db->f('wmid')); if (is_array($antonym_array)) { list($antonym_mid, $antonym_word) = $antonym_array; $antonym_line = $antonym_word . $antonym_term; #print "Anto: ".$w.": ".$antonym_word." -- ".$antonym_line."<br>"; } } if ($sub_term != "") { #subordinate concepts: $sub_line = ""; $sub = getSubordinateSynsets($db2, $db->f('meaning_id')); foreach ($sub as $sub_id) { $sub_synset = getSynsetWithUsage($sub_id); if (sizeof($sub_synset) > 0) { $sub_line = getLine($sub_synset, $w, $sub_term); $sub_line = substr($sub_line, 1); # cut off "-" $syn_line = $syn_line . $sub_line; } } } $syn_line = $syn_line . $generic_line; if ($antonym_line != "") { $syn_line .= "|" . $antonym_line; } if (strtolower($prev_word) == strtolower($w)) {