本文整理汇总了PHP中thesaurus::get_hyrarchy方法的典型用法代码示例。如果您正苦于以下问题:PHP thesaurus::get_hyrarchy方法的具体用法?PHP thesaurus::get_hyrarchy怎么用?PHP thesaurus::get_hyrarchy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thesaurus
的用法示例。
在下文中一共展示了thesaurus::get_hyrarchy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
//.........这里部分代码省略.........
break;
}
break;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
case swap:
if ($_arg[id]) {
thesaurus::swap_link($_arg[id], $_arg[_ID]);
}
break;
case change:
if ($_arg[id]) {
// thesaurus::change_link($_arg);
}
break;
case add:
// add new descriptor
session::destroy("show");
session::destroy("searchshow");
// session::set("",1);
break;
// clean database
// clean database
case correct:
thesaurus::validate(true);
echoalert("Datenbank bereinigt");
break;
//------------------------------------------------------------------------------
// open hyrarchy down to selected entry
//------------------------------------------------------------------------------
// open hyrarchy down to selected entry
case showhyrarchy:
if ($_arg[id]) {
$hyrarchyArray = thesaurus::get_hyrarchy($_arg[id]);
// don't open selected entry
// array_pop($hyrarchyArray);
foreach ($hyrarchyArray as $entry) {
// echo $entry . " ";
echo session::open($entry);
}
session::set("hyrarchy", TRUE);
// hide search window
session::destroy("searchshow");
// if nothing selected for display, show ID
if (!session::get(show)) {
session::set("show", $_arg[id]);
}
break;
}
//------------------------------------------------------------------------------
// debug on/off
//------------------------------------------------------------------------------
// debug on/off
case debugon:
system::setval(debug, TRUE);
break;
case debugoff:
system::setval(debug, FALSE);
// legend on/off
// legend on/off
case legendon:
session::set("legend", TRUE);
break;
case legendoff:
session::destroy("legend");
break;
示例2: validate
function validate($action = "")
{
// check entries with undefined links
$sqlRef = database::query("SELECT * FROM parent");
$tempString = "";
// loop over all link entries
while ($entry = mysql_fetch_array($sqlRef)) {
if (!$action) {
$parentName = thesaurus::get_name($entry[parent]);
$childName = thesaurus::get_name($entry[child]);
if (!thesaurus::get_descriptor($entry[parent]) and $entry[parent] != 0) {
$tempString .= "Oberbegriff {$entry['parent']} von <b>'{$childName}'</b> <i>({$entry['child']})</i> existiert nicht<br>";
}
if (!thesaurus::get_descriptor($entry[child])) {
$tempString .= "Unterbegriff {$entry['child']} von <b>'{$parentName}'</b> <i>({$entry['parent']})</i> existiert nicht<br>";
}
} else {
if ((!thesaurus::get_descriptor($entry[parent]) or !thesaurus::get_descriptor($entry[child])) and $entry[parent] != 0) {
database::query("DELETE FROM parent WHERE ID={$entry['ID']}");
}
}
// check crosslinks between thesauri
if (thesaurus::get_thesaurus($entry[parent]) and thesaurus::get_thesaurus($entry[parent]) != thesaurus::get_thesaurus($entry[child])) {
$crossString .= form::link("", $entry[parent], "index.php?action=show&id={$entry['parent']}") . " <=> " . form::link("", $entry[child], "index.php?action=show&id={$entry['child']}") . " link in different thesauri<br>";
}
}
// display error messages
if (right::link() and ($tempString or $crossString)) {
echo "<div id='alert' class='red'>";
if ($tempString) {
echo "<b>OB / UB Fehler</b><br>{$tempString}<br>";
echo "Datenbank bereinigen ";
echo form::link("delete", "Datenbank bereinigen", "index.php?action=correct", "correct", "");
}
// display error message
if ($crossString) {
echo "<b>Crosslink Fehler</b><br>{$crossString}<br>";
// echo "Datenbank bereinigen ";
// echo form::link("delete","Datenbank bereinigen","index.php?action=correct","correct","");
}
echo "</div>";
}
// rewrite thesaurus links
$sqlRef = database::query("SELECT * FROM entry");
while ($entry = mysql_fetch_array($sqlRef)) {
$tempArray = thesaurus::get_hyrarchy($entry[ID]);
if (is_array($tempArray)) {
$thesaurus = $tempArray[0];
} else {
$thesaurus = $tempArray;
}
database::query("UPDATE entry SET thesaurus='{$thesaurus}' WHERE ID='{$entry['ID']}'");
}
}