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


PHP ilTree::insertNode方法代码示例

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


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

示例1: array

<#2745>
<?php 
// media object and media pool settings
// register new object type 'mobs' for media pool and media object settings
$id = $ilDB->nextId("object_data");
$ilDB->manipulateF("INSERT INTO object_data (obj_id, type, title, description, owner, create_date, last_update) " . "VALUES (%s, %s, %s, %s, %s, %s, %s)", array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"), array($id, "typ", "mobs", "Media Object/Pool settings", -1, ilUtil::now(), ilUtil::now()));
$typ_id = $id;
// create object data entry
$id = $ilDB->nextId("object_data");
$ilDB->manipulateF("INSERT INTO object_data (obj_id, type, title, description, owner, create_date, last_update) " . "VALUES (%s, %s, %s, %s, %s, %s, %s)", array("integer", "text", "text", "text", "integer", "timestamp", "timestamp"), array($id, "mobs", "__MediaObjectSettings", "Media Object/Pool Settings", -1, ilUtil::now(), ilUtil::now()));
// create object reference entry
$ref_id = $ilDB->nextId('object_reference');
$res = $ilDB->manipulateF("INSERT INTO object_reference (ref_id, obj_id) VALUES (%s, %s)", array("integer", "integer"), array($ref_id, $id));
// put in tree
$tree = new ilTree(ROOT_FOLDER_ID);
$tree->insertNode($ref_id, SYSTEM_FOLDER_ID);
// add rbac operations
// 1: edit_permissions, 2: visible, 3: read, 4:write
$ilDB->manipulateF("INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", array("integer", "integer"), array($typ_id, 1));
$ilDB->manipulateF("INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", array("integer", "integer"), array($typ_id, 2));
$ilDB->manipulateF("INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", array("integer", "integer"), array($typ_id, 3));
$ilDB->manipulateF("INSERT INTO rbac_ta (typ_id, ops_id) VALUES (%s, %s)", array("integer", "integer"), array($typ_id, 4));
?>
<#2746>
<?php 
$ilCtrlStructureReader->getStructure();
?>
<#2747>
<?php 
$ilDB->createTable("mep_item", array('id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 'type' => array('type' => 'text', 'length' => 10, 'notnull' => false), 'title' => array('type' => 'text', 'length' => 128, 'notnull' => false), 'foreign_id' => array('type' => 'integer', 'length' => 4, 'notnull' => false)));
?>
开发者ID:arlendotcn,项目名称:ilias,代码行数:31,代码来源:dbupdate_02.php

示例2: putInTree

 /**
  * put this object into content object tree
  */
 static function putInTree($a_obj, $a_parent_id = "", $a_target_node_id = "")
 {
     global $ilLog;
     $tree = new ilTree($a_obj->getContentObject()->getId());
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     // determine parent
     $parent_id = $a_parent_id != "" ? $a_parent_id : $tree->getRootId();
     // determine target
     if ($a_target_node_id != "") {
         $target = $a_target_node_id;
     } else {
         // determine last child that serves as predecessor
         if ($a_obj->getType() == "st") {
             $s_types = array("st", "pg");
             $childs =& $tree->getChildsByTypeFilter($parent_id, $s_types);
         } else {
             $s_types = "pg";
             $childs =& $tree->getChildsByType($parent_id, $s_types);
         }
         if (count($childs) == 0) {
             $target = IL_FIRST_NODE;
         } else {
             $target = $childs[count($childs) - 1]["obj_id"];
         }
     }
     if ($tree->isInTree($parent_id) && !$tree->isInTree($a_obj->getId())) {
         $ilLog->write("LMObject::putInTree: insertNode, ID: " . $a_obj->getId() . "Parent ID: " . $parent_id . ", Target: " . $target);
         $tree->insertNode($a_obj->getId(), $parent_id, $target);
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:34,代码来源:class.ilLMObject.php

示例3: switch

 /**
  * split page at hierarchical id
  *
  * the main reason for this method being static is that a lm page
  * object is not available within ilPageContentGUI where this method
  * is called
  */
 function _splitPage($a_page_id, $a_pg_parent_type, $a_hier_id)
 {
     // get content object (learning module / digilib book)
     $lm_id = ilLMObject::_lookupContObjID($a_page_id);
     $type = ilObject::_lookupType($lm_id, false);
     switch ($type) {
         case "lm":
             include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
             $cont_obj = new ilObjLearningModule($lm_id, false);
             break;
         case "dbk":
             include_once "./Modules/LearningModule/classes/class.ilObjDlBook.php";
             $cont_obj = new ilObjDlBook($lm_id, false);
             break;
     }
     $source_lm_page = new ilLMPageObject($cont_obj, $a_page_id);
     // create new page
     $lm_page = new ilLMPageObject($cont_obj);
     $lm_page->setTitle($source_lm_page->getTitle());
     $lm_page->setLMId($source_lm_page->getLMId());
     $lm_page->setType($source_lm_page->getType());
     $lm_page->setDescription($source_lm_page->getDescription());
     $lm_page->create(true);
     // copy complete content of source page to new page
     $source_page = $source_lm_page->getPageObject();
     $page = $lm_page->getPageObject();
     $page->setXMLContent($source_page->copyXMLContent());
     //echo htmlentities($source_page->copyXMLContent());
     $page->buildDom(true);
     $page->update();
     //		echo "-".$page->getId()."-".$page->getParentType()."-";
     // copy meta data
     include_once "Services/MetaData/classes/class.ilMD.php";
     $md = new ilMD($source_lm_page->getLMId(), $a_page_id, $source_lm_page->getType());
     $md->cloneMD($source_lm_page->getLMId(), $lm_page->getId(), $source_lm_page->getType());
     // insert new page in tree (after original page)
     $tree = new ilTree($cont_obj->getId());
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     if ($tree->isInTree($source_lm_page->getId())) {
         $parent_node = $tree->getParentNodeData($source_lm_page->getId());
         $tree->insertNode($lm_page->getId(), $parent_node["child"], $source_lm_page->getId());
     }
     // remove all nodes < hierarchical id from new page (incl. update)
     $page->addHierIds();
     $page->deleteContentBeforeHierId($a_hier_id);
     //		$page->update();
     // remove all nodes >= hierarchical id from source page
     $source_page->buildDom();
     $source_page->addHierIds();
     $source_page->deleteContentFromHierId($a_hier_id);
     return $lm_page;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:60,代码来源:class.ilLMPageObject.php

示例4: addAdminNode

 /**
  * Create new admin object node
  * 
  * @param string $a_id
  * @param string $a_title
  */
 public static function addAdminNode($a_obj_type, $a_title)
 {
     global $ilDB, $tree;
     if (self::getObjectTypeId($a_obj_type)) {
         return;
     }
     $obj_type_id = self::addNewType($a_obj_type, $a_title);
     $obj_id = $ilDB->nextId('object_data');
     $ilDB->manipulate("INSERT INTO object_data " . "(obj_id, type, title, description, owner, create_date, last_update) VALUES (" . $ilDB->quote($obj_id, "integer") . "," . $ilDB->quote($a_obj_type, "text") . "," . $ilDB->quote($a_title, "text") . "," . $ilDB->quote($a_title, "text") . "," . $ilDB->quote(-1, "integer") . "," . $ilDB->now() . "," . $ilDB->now() . ")");
     $ref_id = $ilDB->nextId('object_reference');
     $ilDB->manipulate("INSERT INTO object_reference " . "(obj_id, ref_id) VALUES (" . $ilDB->quote($obj_id, "integer") . "," . $ilDB->quote($ref_id, "integer") . ")");
     // put in tree
     $tree = new ilTree(ROOT_FOLDER_ID);
     $tree->insertNode($ref_id, SYSTEM_FOLDER_ID);
     $rbac_ops = array(self::RBAC_OP_EDIT_PERMISSIONS, self::RBAC_OP_VISIBLE, self::RBAC_OP_READ, self::RBAC_OP_WRITE);
     self::addRBACOperations($obj_type_id, $rbac_ops);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:23,代码来源:class.ilDBUpdateNewObjectType.php

示例5: 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

示例6: registerAdminObject

 /**
  * Registgers admin chat object by inserting it into object_data.
  * @global ilDBMySQL $ilDB
  */
 public static function registerAdminObject()
 {
     /**
      * @var $ilDB ilDB
      */
     global $ilDB;
     $query = 'SELECT * FROM object_data WHERE type = ' . $ilDB->quote('chta', 'text');
     if (!$ilDB->fetchAssoc($ilDB->query($query))) {
         $obj_id = $ilDB->nextId('object_data');
         $ilDB->insert('object_data', array('obj_id' => array('integer', $obj_id), 'type' => array('text', 'chta'), 'title' => array('text', 'Chatroom Admin'), 'description' => array('text', 'Chatroom General Settings'), 'owner' => array('integer', -1), 'create_date' => array('timestamp', date('Y-m-d H:i:s')), 'last_update' => array('timestamp', date('Y-m-d H:i:s'))));
         $ref_id = $ilDB->nextId('object_reference');
         $query = "INSERT INTO object_reference (ref_id, obj_id) VALUES(" . $ilDB->quote($ref_id, 'integer') . ", " . $ilDB->quote($obj_id, 'integer') . ")";
         $ilDB->manipulate($query);
         $tree = new ilTree(ROOT_FOLDER_ID);
         $tree->insertNode($ref_id, SYSTEM_FOLDER_ID);
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:21,代码来源:class.ilChatroomInstaller.php

示例7: putInTree

 /**
  * put this object into content object tree
  *
  * @todo: move to application class
  */
 function putInTree($a_parent_id, $a_target)
 {
     $tree = new ilTree($this->slm_object->getId());
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     /*$parent_id = (!empty($_GET["obj_id"]))
     		? $_GET["obj_id"]
     		: $tree->getRootId();*/
     /*		if (!empty($_GET["target"]))
     		{
     			$target = $_GET["target"];
     		}
     		else
     		{
     			// determine last child of current type
     			$childs =& $tree->getChildsByType($parent_id, $this->obj->getType());
     			if (count($childs) == 0)
     			{
     				$target = IL_FIRST_NODE;
     			}
     			else
     			{
     				$target = $childs[count($childs) - 1]["obj_id"];
     			}
     		}*/
     if (!$tree->isInTree($this->node_obj->getId())) {
         $tree->insertNode($this->node_obj->getId(), $parent_id, $target);
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:34,代码来源:class.ilSCORM2004NodeGUI.php

示例8: putInTree

 /**
  * put this object into content object tree
  */
 function putInTree()
 {
     $tree = new ilTree($this->content_object->getId());
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     $parent_id = !empty($_GET["obj_id"]) ? $_GET["obj_id"] : $tree->getRootId();
     if (!empty($_GET["target"])) {
         $target = $_GET["target"];
     } else {
         // determine last child of current type
         $childs =& $tree->getChildsByType($parent_id, $this->obj->getType());
         if (count($childs) == 0) {
             $target = IL_FIRST_NODE;
         } else {
             $target = $childs[count($childs) - 1]["obj_id"];
         }
     }
     if (!$tree->isInTree($this->obj->getId())) {
         $tree->insertNode($this->obj->getId(), $parent_id, $target);
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:24,代码来源:class.ilLMObjectGUI.php

示例9: pastePage

 /**
  * paste page
  */
 function pastePage()
 {
     global $ilUser;
     if (!$ilUser->clipboardHasObjectsOfType("pg")) {
         $this->ilias->raiseError($this->lng->txt("no_page_in_clipboard"), $this->ilias->error_obj->MESSAGE);
     }
     return $this->insertPageClip();
     return;
     $tree = new ilTree($this->content_object->getId());
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     // paste selected object
     $id = ilEditClipboard::getContentObjectId();
     // copy page, if action is copy
     if (ilEditClipboard::getAction() == "copy") {
         // check wether page belongs to lm
         if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId()) == $this->content_object->getID()) {
             $lm_page = new ilLMPageObject($this->content_object, $id);
             $new_page =& $lm_page->copy();
             $id = $new_page->getId();
         } else {
             // get page from other content object into current content object
             $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
             $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
             $lm_page = new ilLMPageObject($lm_obj, $id);
             $copied_nodes = array();
             $new_page =& $lm_page->copyToOtherContObject($this->content_object, $copied_nodes);
             $id = $new_page->getId();
             ilLMObject::updateInternalLinks($copied_nodes);
         }
     }
     if (ilEditClipboard::getAction() == "cut") {
         // check wether page belongs not to lm
         if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId()) != $this->content_object->getID()) {
             $lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
             $lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
             $lm_page = new ilLMPageObject($lm_obj, $id);
             $lm_page->setLMId($this->content_object->getID());
             $lm_page->update();
             $page =& $lm_page->getPageObject();
             $page->buildDom();
             $page->setParentId($this->content_object->getID());
             $page->update();
         }
     }
     if (!$tree->isInTree($id)) {
         if (!isset($_POST["id"])) {
             $target = IL_FIRST_NODE;
         } else {
             $target = $_POST["id"][0];
         }
         $tree->insertNode($id, $this->obj->getId(), $target);
         ilEditClipboard::clear();
     }
     // write history comments
     include_once "./Services/History/classes/class.ilHistory.php";
     $parent_id = $tree->getParentId($id);
     ilHistory::_createEntry($id, "paste", array(ilLMObject::_lookupTitle($this->obj->getId()), $this->obj->getId()), $this->content_object->getType() . ":pg");
     ilHistory::_createEntry($parent_id, "paste_page", array(ilLMObject::_lookupTitle($id), $id), $this->content_object->getType() . ":st");
     // check the tree
     $this->checkTree();
     $this->ctrl->redirect($this, "view");
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:66,代码来源:class.ilStructureObjectGUI.php


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