本文整理汇总了PHP中thesaurus::get_child方法的典型用法代码示例。如果您正苦于以下问题:PHP thesaurus::get_child方法的具体用法?PHP thesaurus::get_child怎么用?PHP thesaurus::get_child使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thesaurus
的用法示例。
在下文中一共展示了thesaurus::get_child方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _subtree
function _subtree($id, $termType)
{
global $recordArray;
if (!$retXml) {
$retXml = new simpleXmlElement("<temp/>");
}
$term = thesaurus::get_name($id);
// check if entry allready exists
if (!$recordArray[$term]) {
//------------------------------------------------------------------------------
// extract (BS) from term
// and create new terms from BS clauses
$uses = extract_pattern($term, "/\\(BS[: ](?<use>.*)\\)/");
if ($uses) {
// create common parameters
$newArray['input.name'] = "Thesaurus Redaktion";
$newArray['input.date'] = date("Y-m-d", time());
$newArray['input.time'] = date("h:i:s", time());
$newArray['term.type'] = $termType;
$newArray['term.status'] = "Verweisungsform";
$newArray['use'] = $term;
// $newArray['broader_term'] = thesaurus::get_parent($id);
// loop over uses
foreach ($uses as $entry) {
$newArray['term'] = $entry;
extract_pattern($newArray['term'], "/\\(BS[: ](?<use>.*)\\)/");
// echoall(create_record($newArray,$termType));
xml_insert($retXml->record, create_record($newArray, $termType));
}
}
//------------------------------------------------------------------------------
// insert entry
xml_insert($retXml, record($id, $termType));
// register new record
$recordArray[$term] = $term;
//------------------------------------------------------------------------------
// recursion of children
$children = thesaurus::get_child($id);
if ($children) {
foreach ($children as $entry) {
//echoall($entry);
// subchildren -> recursion
if (count(thesaurus::get_child($entry))) {
$subXml = _subtree($entry, $termType);
if ($subXml) {
xml_insert($retXml, $subXml);
}
}
}
}
return $retXml;
}
}
示例2: action
function action($_arg)
{
//------------------------------------------------------------------------------
// extrace action from coordinate system
while ($entry = each($_arg)) {
$argArray = explode("_", $entry[key]);
if (count($argArray) > 1) {
$indexString = $argArray[0];
$valueString = $argArray[1];
$_arg[$indexString] = $valueString;
if (isset($argArray[2])) {
$_arg['_ID'] = $argArray[2];
}
}
}
//echoalert($_arg);
//echoalert($_SESSION);
//------------------------------------------------------------------------------
// parse reset value
if ($_arg[reset]) {
$_arg = array();
session::destroy(searchshow);
session::destroy(show);
session::destroy(search);
session::destroy(searchtype);
session::destroy(searchcom);
session::destroy(searchorder);
session::destroy(searchString);
session::destroy(searchexact);
session::destroy(searchstart);
session::destroy(searchowner);
session::destroy(searchentrytype);
session::destroy(searchstatus);
}
//------------------------------------------------------------------------------
// parse action parameter
switch ($_arg[action]) {
//------------------------------------------------------------------------------
// login / out
case login:
// login user
user::login($_arg[user], $_arg[password]);
// restore program status if new session
restore_status();
// reset linking
session::destroy("linkaction");
session::destroy("link");
break;
case logout:
// logout user
user::logout();
break;
case changedo:
// change password
if ($password = $_GET[password]) {
database::query("UPDATE user SET password='" . md5($password) . "' WHERE ID='" . session::get("user") . "'");
echojavascript("Passwort erfolgreich geändert");
}
break;
//------------------------------------------------------------------------------
// inherit entrytype to children
//------------------------------------------------------------------------------
// inherit entrytype to children
case inherit:
$childArray = thesaurus::get_child($_arg[id]);
foreach ($childArray as $entry) {
database::query("UPDATE entry SET entrytype={$_arg['entrytype']} WHERE ID={$entry}");
}
break;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
case update:
if ($_arg[orderdefault]) {
session::set(orderdefault, $_arg[id]);
} elseif (isset($_arg[orderdefault])) {
session::destroy(orderdefault);
}
break;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
case edit:
session::set("edit", TRUE);
session::set("show", $_arg[id]);
session::destroy("searchshow");
break;
case noedit:
session::destroy("edit");
break;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
case open:
session::open($_arg[id]);
break;
case close:
session::close($_arg[id]);
break;
case closeall:
session::close_all();
break;
//------------------------------------------------------------------------------
//.........这里部分代码省略.........
示例3: print_tree
function print_tree($descId, $type = "", $depth = "")
{
switch ($type) {
case txt:
$delimitor = "*";
break;
case csv:
$delimitor = ";";
break;
case adlib:
$adlibString = adlib($descId, $type);
return $adlibString;
break;
}
// display id entry
$comment = thesaurus::get_comment($descId);
// remove \r\n
$comment = str_replace("\n", '', $comment);
$comment = str_replace("\r", '', $comment);
$paramArray = explode(";", $comment);
$idArray = explode("=", $paramArray[0]);
$rootArray = explode("=", $paramArray[1]);
$commentArray = explode("=", $paramArray[2]);
$levelCnt = 7;
// insert title
if (!$depth) {
$treeString .= $idArray[0] . $delimitor;
for ($i = 0; $i < $levelCnt; $i++) {
$treeString .= "Level {$i}" . $delimitor;
}
$treeString .= $delimitor . $rootArray[0] . $delimitor . $commentArray[0] . "\r\n";
}
// insert id at beginning
$treeString .= $idArray[1] . $delimitor;
// insert blank tree elements on beginn
$i = 0;
while ($i++ < $depth - 1) {
$treeString .= $delimitor;
}
if ($type == "txt") {
$treeString .= " ";
}
// whitespace in textfile
// display entry
$treeString .= thesaurus::get_name($descId);
// insert blank tree elements at end
while ($i++ < $levelCnt) {
$treeString .= $delimitor;
}
if ($type == "txt") {
$treeString .= " ";
}
// whitespace in textfile
// insert root entry
$treeString .= $delimitor . "{$rootArray['1']}";
// insert comment entry
$treeString .= $delimitor . "{$commentArray['1']}";
// insert crlf
$treeString .= "\r\n";
$childArray = thesaurus::get_child($descId);
// loop all childs recursive
if (is_array($childArray)) {
foreach ($childArray as $entry) {
$treeString .= export::print_tree($entry, $type, $depth + 1);
}
}
return $treeString;
}
示例4: 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);
}
}
//.........这里部分代码省略.........
示例5: child_num
function child_num($descriptorID, $descType = "")
{
$tempArray = thesaurus::get_child($descriptorID, $descType);
if ($tempArray) {
return count($tempArray);
} else {
return FALSE;
}
}
示例6: sub_links
function sub_links($id)
{
$tempArray = thesaurus::get_child($id, 1);
echo "<form method='get' action='index.php' name='ub'>";
echo "<fieldset>";
echo "<legend>Unterbegriffe</legend>";
$x = 0;
$listArray = array();
if ($tempArray) {
foreach ($tempArray as $entry) {
$listArray[$x++] = thesaurus::get_descriptor($entry);
}
}
echo_selection($listArray, "id", "", 3, "lower-field");
// display action line
action::display($id, "");
echo "</fieldset>";
echo "</form>";
}