本文整理汇总了PHP中thesaurus::child_num方法的典型用法代码示例。如果您正苦于以下问题:PHP thesaurus::child_num方法的具体用法?PHP thesaurus::child_num怎么用?PHP thesaurus::child_num使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thesaurus
的用法示例。
在下文中一共展示了thesaurus::child_num方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($parent, $depth, $pos, $errorArray)
{
// V2.0
// starting on thesaurus level
if ($parent == 0) {
$elementArray = thesaurus::get_thesaurus_list();
// get thesauri
} else {
$elementArray = thesaurus::get_child($parent);
}
// get children
// entries found
if (is_array($elementArray)) {
$cntElements = count($elementArray);
// start new line
if (!isset($pos)) {
$pos = 0;
}
// set position to 0
$line = new line();
// ****************************************************************
// start array
$lineCnt = 0;
foreach ($elementArray as $id) {
// don't display if
// non descriptor
// or not visible
// if ((thesaurus::is_descriptor($id) or session::get("descriptor"))
// and (thesaurus::is_visible($id) or session::get("visible"))
// )
if (thesaurus::is_visible($id) or session::get("visible")) {
$cntParents = thesaurus::parent_num($id);
$equivArray = thesaurus::get_equiv($id, "BS");
if (is_array($equivArray)) {
$cntEquiv = count($equivArray);
} else {
$cntEquiv = 0;
}
// get count and list of subentries
$childrenArray = thesaurus::get_child($id);
$cntChildren = thesaurus::child_num($id, session::get(descriptor));
// get entry details
$entry = thesaurus::get_descriptor($id);
// ECHO ENTRY
// space in front
$x = 0;
while ($x < $pos - 1) {
$line->insert(grafik::disp("line", "|", 20), 20);
// insert line-grafik
$x++;
}
// search elements in next level enabled
if ($depth > $pos or $depth == -1) {
// display tree grafik
if ($pos > 0) {
if ($lineCnt++ < $cntElements - 1) {
$line->insert(grafik::disp("subtree", "|", 20), 20);
} else {
$line->insert(grafik::disp("subend", "|", 20), 20);
}
// insert sub end icon
}
// display open / close icon if subobjects
if ($cntChildren != 0) {
// subobjects found -> display icon to open / close
if (thesaurus::is_open($id)) {
if ($pos > 0) {
$tempString = form::link("minus", "[+]", "index.php?id={$id}&action=close", "close");
} else {
$tempString = form::link("thesaurus-open", "[+]", "index.php?id={$id}&action=close", "close");
}
} else {
if ($pos > 0) {
$tempString = form::link("plus", "[+]", "index.php?id={$id}&action=open", "open");
} else {
$tempString = form::link("thesaurus", "[T]", "index.php?id={$id}&action=open", "open");
}
}
} else {
$tempString = grafik::disp("space", " ", 20);
}
$line->insert($tempString, 20);
// insert navigation symbols
$tempString = "";
// Display parent and child link icon
if (session::get("show")) {
// display parent arrow
if (thesaurus::is_child_of(session::get("show"), $id) and session::get("show")) {
$line->insert(grafik::arrow("right", "blue", 15), 20);
// display parent arrow
}
// display link-arrow
if (thesaurus::is_parent_of(session::get("show"), $id)) {
$line->insert(grafik::arrow("right", "orange", 15), 20);
}
// display associate links
if (thesaurus::is_assoc_of(session::get("show"), $id)) {
$line->insert(grafik::disp("assoc", "=", 20), 20);
}
}
//.........这里部分代码省略.........
示例2: descriptor
function descriptor($id, $name, $error)
{
echo "<fieldset><legend>";
//-----------------
if (!thesaurus::is_descriptor($id)) {
$checkString = "";
echo "kein ";
} else {
$checkString = " checked";
}
echo "Begriff";
if (!thesaurus::is_visible($id)) {
echo " <span class='red'>(versteckt)</span>";
}
echo "</legend>";
// descriptor value
echo form::field("text", "name", $name, 30, "class='{$error}'", "", "", $help = "name-field");
// display ID
echo "<span class='small'>ID = {$id}</span>";
// open tree
echo form::link("opentree", "[+]", "index.php?action=showhyrarchy&id={$id}", "opentree");
// exit edit mode
if (right::write()) {
action::edit();
}
// delete entry
if (thesaurus::child_num($id, 1) == 0) {
$javaText = "Wollen Sie " . $name . " wirklich löschen? Es werden auch alle Links zu diesem Eintrag gelöscht";
echo form::link("delete", "x", "javascript:get_confirm("{$javaText}","index.php?action=deleteid&id={$id}");", "delete");
}
echo "<br>";
// type of descriptor
/* $typeArray = thesaurus::get_type_list();
$entryType = thesaurus::get_entrytype($id);
$entryTypeName = thesaurus::get_entrytype_name($entryType);
$javaText = "Wollen Sie wirklich allen Unterbegriffen von " . $name . " den Begriffstyp " . $entryTypeName . " zuweisen?";
echo form::selector("entrytype",$typeArray,1,"",$entryType,"<span class='small'>Begriffstype</span><br>","","entrytype");
// herite to all childs
echo form::link("inheritance"," Begriffstyp vererben","javascript:get_confirm("$javaText","index.php?id=$id&entrytype=$entryType&action=inherit");","inheritance");
*/
echo "<span class='normal'><i>" . thesaurus::get_name(thesaurus::get_thesaurus($id)) . "</i></span>";
echo "<br>";
// status of descriptor
$statusArray = thesaurus::get_status_list();
echo form::selector("status", $statusArray, 1, "", thesaurus::get_status($id), "<span class='small'>Status</span><br>", "", "statustype");
echo "<br>";
// descriptor is default value for ordered entries
// default place for kandidates defined
$orderDefault = system::getval("val_orderdefault");
if ($orderDefault) {
if (intval($orderDefault) == $id) {
$checkedString = "checked='checked'";
} else {
$defaultString = "<br>(derzeit: <i>'";
$defaultString .= "<a href='index.php?id={$orderDefault}&action=show'>";
$defaultString .= thesaurus::get_name($orderDefault);
$defaultString .= "</a>";
$defaultString .= "'</i>)";
}
} else {
$defaultString = "<br>(Kein Ort für Kandidaten festgelegt)";
}
echo form::field("checkbox", "orderdefault", $id, "", $checkedString, "", "als Standard für Kandidaten festlegen {$defaultString}", "orderdefault");
echo "</fieldset>";
}