当前位置: 首页>>代码示例>>PHP>>正文


PHP ilTree::getChilds方法代码示例

本文整理汇总了PHP中ilTree::getChilds方法的典型用法代码示例。如果您正苦于以下问题:PHP ilTree::getChilds方法的具体用法?PHP ilTree::getChilds怎么用?PHP ilTree::getChilds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilTree的用法示例。


在下文中一共展示了ilTree::getChilds方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetChild

 public function testGetChild()
 {
     $tree = new ilTree(ROOT_FOLDER_ID);
     $childs = $tree->getChilds(14);
     // Chat settings (contains public chat)
     $this->assertEquals(count($childs), 1);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:7,代码来源:ilTreeTest.php

示例2: getPossibleItems

 public function getPossibleItems($a_ref_id)
 {
     if (!isset(self::$possible_items[$a_ref_id])) {
         $obj_id = ilObject::_lookupObjectId($a_ref_id);
         $items = array();
         // only top-level chapters
         include_once "Services/MetaData/classes/class.ilMDEducational.php";
         $tree = new ilTree($obj_id);
         $tree->setTableNames('lm_tree', 'lm_data');
         $tree->setTreeTablePK("lm_id");
         foreach ($tree->getChilds($tree->readRootId()) as $child) {
             if ($child["type"] == "st") {
                 $child["tlt"] = ilMDEducational::_getTypicalLearningTimeSeconds($obj_id, $child["obj_id"]);
                 $items[$child["obj_id"]] = $child;
             }
         }
         self::$possible_items[$a_ref_id] = $items;
     }
     return self::$possible_items[$a_ref_id];
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:20,代码来源:class.ilLPCollectionOfLMChapters.php

示例3: array

 /**
  * update public access flags in lm_data for all pages of a content object
  * @static
  * @access	public
  * @param	array	page ids
  * @param	integer	content object id
  * @return	of the jedi
  */
 function _writePublicAccessStatus($a_pages, $a_cont_obj_id)
 {
     global $ilDB, $ilLog, $ilErr, $ilTree;
     if (!is_array($a_pages)) {
         $a_pages = array(0);
         /*$message = sprintf('ilLMObject::_writePublicAccessStatus(): Invalid parameter! $a_pages must be an array');
         		$ilLog->write($message,$ilLog->WARNING);
         		$ilErr->raiseError($message,$ilErr->MESSAGE);
         		return false;*/
     }
     if (empty($a_cont_obj_id)) {
         $message = sprintf('ilLMObject::_writePublicAccessStatus(): Invalid parameter! $a_cont_obj_id is empty');
         $ilLog->write($message, $ilLog->WARNING);
         $ilErr->raiseError($message, $ilErr->MESSAGE);
         return false;
     }
     // update structure entries: if at least one page of a chapter is public set chapter to public too
     $lm_tree = new ilTree($a_cont_obj_id);
     $lm_tree->setTableNames('lm_tree', 'lm_data');
     $lm_tree->setTreeTablePK("lm_id");
     $lm_tree->readRootId();
     // get all st entries of cont_obj
     $q = "SELECT obj_id FROM lm_data " . "WHERE lm_id = " . $ilDB->quote($a_cont_obj_id, "integer") . " " . "AND type = 'st'";
     $r = $ilDB->query($q);
     // add chapters with a public page to a_pages
     while ($row = $ilDB->fetchAssoc($r)) {
         $childs = $lm_tree->getChilds($row["obj_id"]);
         foreach ($childs as $page) {
             if ($page["type"] == "pg" and in_array($page["obj_id"], $a_pages)) {
                 array_push($a_pages, $row["obj_id"]);
                 break;
             }
         }
     }
     // update public access status of all pages of cont_obj
     $q = "UPDATE lm_data SET " . "public_access = CASE " . "WHEN " . $ilDB->in("obj_id", $a_pages, false, "integer") . " " . "THEN " . $ilDB->quote("y", "text") . "ELSE " . $ilDB->quote("n", "text") . "END " . "WHERE lm_id = " . $ilDB->quote($a_cont_obj_id, "integer") . " " . "AND " . $ilDB->in("type", array("pg", "st"), false, "text");
     $ilDB->manipulate($q);
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:47,代码来源:class.ilLMObject.php

示例4: executeDragDrop

 /**
  * Execute Drag Drop Action
  *
  * @param	string	$source_id		Source element ID
  * @param	string	$target_id		Target element ID
  * @param	string	$first_child	Insert as first child of target
  * @param	string	$movecopy		Position ("move" | "copy")
  */
 function executeDragDrop($source_id, $target_id, $first_child, $as_subitem = false, $movecopy = "move")
 {
     $lmtree = new ilTree($this->getId());
     $lmtree->setTableNames('lm_tree', 'lm_data');
     $lmtree->setTreeTablePK("lm_id");
     //echo "-".$source_id."-".$target_id."-".$first_child."-".$as_subitem."-";
     $source_obj = ilLMObjectFactory::getInstance($this, $source_id, true);
     $source_obj->setLMId($this->getId());
     if (!$first_child) {
         $target_obj = ilLMObjectFactory::getInstance($this, $target_id, true);
         $target_obj->setLMId($this->getId());
         $target_parent = $lmtree->getParentId($target_id);
     }
     // handle pages
     if ($source_obj->getType() == "pg") {
         //echo "1";
         if ($lmtree->isInTree($source_obj->getId())) {
             $node_data = $lmtree->getNodeData($source_obj->getId());
             // cut on move
             if ($movecopy == "move") {
                 $parent_id = $lmtree->getParentId($source_obj->getId());
                 $lmtree->deleteTree($node_data);
                 // write history entry
                 require_once "./Services/History/classes/class.ilHistory.php";
                 ilHistory::_createEntry($source_obj->getId(), "cut", array(ilLMObject::_lookupTitle($parent_id), $parent_id), $this->getType() . ":pg");
                 ilHistory::_createEntry($parent_id, "cut_page", array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()), $this->getType() . ":st");
             } else {
                 // copy page
                 $new_page =& $source_obj->copy();
                 $source_id = $new_page->getId();
                 $source_obj =& $new_page;
             }
             // paste page
             if (!$lmtree->isInTree($source_obj->getId())) {
                 if ($first_child) {
                     $target_pos = IL_FIRST_NODE;
                     $parent = $target_id;
                 } else {
                     if ($as_subitem) {
                         $parent = $target_id;
                         $target_pos = IL_FIRST_NODE;
                         $pg_childs =& $lmtree->getChildsByType($parent, "pg");
                         if (count($pg_childs) != 0) {
                             $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
                         }
                     } else {
                         $target_pos = $target_id;
                         $parent = $target_parent;
                     }
                 }
                 // insert page into tree
                 $lmtree->insertNode($source_obj->getId(), $parent, $target_pos);
                 // write history entry
                 if ($movecopy == "move") {
                     // write history comments
                     include_once "./Services/History/classes/class.ilHistory.php";
                     ilHistory::_createEntry($source_obj->getId(), "paste", array(ilLMObject::_lookupTitle($parent), $parent), $this->getType() . ":pg");
                     ilHistory::_createEntry($parent, "paste_page", array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()), $this->getType() . ":st");
                 }
             }
         }
     }
     // handle chapters
     if ($source_obj->getType() == "st") {
         //echo "2";
         $source_node = $lmtree->getNodeData($source_id);
         $subnodes = $lmtree->getSubtree($source_node);
         // check, if target is within subtree
         foreach ($subnodes as $subnode) {
             if ($subnode["obj_id"] == $target_id) {
                 return;
             }
         }
         $target_pos = $target_id;
         if ($first_child) {
             $target_pos = IL_FIRST_NODE;
             $target_parent = $target_id;
             $pg_childs =& $lmtree->getChildsByType($target_parent, "pg");
             if (count($pg_childs) != 0) {
                 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
             }
         } else {
             if ($as_subitem) {
                 $target_parent = $target_id;
                 $target_pos = IL_FIRST_NODE;
                 $childs =& $lmtree->getChilds($target_parent);
                 if (count($childs) != 0) {
                     $target_pos = $childs[count($childs) - 1]["obj_id"];
                 }
             }
         }
         // insert into
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.ilObjContentObject.php

示例5: getObjects

 /**
  * static
  */
 function getObjects($a_id)
 {
     $a_tree_id = $_SESSION["AccountId"];
     $tree = new ilTree($a_tree_id);
     $tree->setTableNames('bookmark_tree', 'bookmark_data');
     if (empty($a_id)) {
         $a_id = $tree->getRootId();
     }
     $childs = $tree->getChilds($a_id, "title");
     $objects = array();
     $bookmarks = array();
     foreach ($childs as $key => $child) {
         switch ($child["type"]) {
             case "bmf":
                 $objects[] = $child;
                 break;
             case "bm":
                 $bookmarks[] = $child;
                 break;
         }
     }
     foreach ($bookmarks as $key => $bookmark) {
         $objects[] = $bookmark;
     }
     return $objects;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:29,代码来源:class.ilBookmarkFolder.php

示例6: insertSavedNodes

 /**
  * Recursive method to insert all saved nodes of the clipboard
  */
 private function insertSavedNodes($a_source_id, $a_dest_id, $a_tree_id, &$a_affected_ids)
 {
     global $rbacadmin, $rbacreview, $log, $tree;
     $tree->insertNode($a_source_id, $a_dest_id, IL_LAST_NODE, true);
     $a_affected_ids[$a_source_id] = $a_source_id;
     // write log entry
     $log->write("ilRepUtil::insertSavedNodes(), restored ref_id {$a_source_id} from trash");
     // SET PERMISSIONS
     $parentRoles = $rbacreview->getParentRoleIds($a_dest_id);
     $obj =& ilObjectFactory::getInstanceByRefId($a_source_id);
     foreach ($parentRoles as $parRol) {
         $ops = $rbacreview->getOperationsOfRole($parRol["obj_id"], $obj->getType(), $parRol["parent"]);
         $rbacadmin->grantPermission($parRol["obj_id"], $ops, $a_source_id);
     }
     $saved_tree = new ilTree($a_tree_id);
     $childs = $saved_tree->getChilds($a_source_id);
     foreach ($childs as $child) {
         ilRepUtil::insertSavedNodes($child["child"], $a_source_id, $a_tree_id, $a_affected_ids);
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:23,代码来源:class.ilRepUtil.php


注:本文中的ilTree::getChilds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。