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


PHP ilLMObject::pasteTree方法代码示例

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


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

示例1: pasteTree

 /**
  * Paste item (tree) from clipboard to current lm
  */
 static function pasteTree($a_target_lm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy = false, $a_source_lm = null)
 {
     global $ilUser, $ilias, $ilLog;
     include_once "./Modules/LearningModule/classes/class.ilStructureObject.php";
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     $item_lm_id = ilLMObject::_lookupContObjID($a_item_id);
     $item_type = ilLMObject::_lookupType($a_item_id);
     $lm_obj = $ilias->obj_factory->getInstanceByObjId($item_lm_id);
     if ($item_type == "st") {
         $item = new ilStructureObject($lm_obj, $a_item_id);
     } else {
         if ($item_type == "pg") {
             $item = new ilLMPageObject($lm_obj, $a_item_id);
         }
     }
     $ilLog->write("Getting from clipboard type " . $item_type . ", " . "Item ID: " . $a_item_id . ", of original LM: " . $item_lm_id);
     if ($item_lm_id != $a_target_lm->getId() && !$a_as_copy) {
         // @todo: check whether st is NOT in tree
         // "move" metadata to new lm
         include_once "Services/MetaData/classes/class.ilMD.php";
         $md = new ilMD($item_lm_id, $item->getId(), $item->getType());
         $new_md = $md->cloneMD($a_target_lm->getId(), $item->getId(), $item->getType());
         // update lm object
         $item->setLMId($a_target_lm->getId());
         $item->setContentObject($a_target_lm);
         $item->update();
         // delete old meta data set
         $md->deleteAll();
         if ($item_type == "pg") {
             $page = $item->getPageObject();
             $page->buildDom();
             $page->setParentId($a_target_lm->getId());
             $page->update();
         }
     }
     if ($a_as_copy) {
         $target_item = $item->copy($a_target_lm);
         $a_copied_nodes[$item->getId()] = $target_item->getId();
     } else {
         $target_item = $item;
     }
     $ilLog->write("Putting into tree type " . $target_item->getType() . "Item ID: " . $target_item->getId() . ", Parent: " . $a_parent_id . ", " . "Target: " . $a_target . ", Item LM:" . $target_item->getContentObject()->getId());
     ilLMObject::putInTree($target_item, $a_parent_id, $a_target);
     if ($a_source_lm == null) {
         $childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
     } else {
         $childs = $a_source_lm->lm_tree->getChilds($item->getId());
         foreach ($childs as $k => $child) {
             $childs[$k]["id"] = $childs[$k]["child"];
         }
     }
     foreach ($childs as $child) {
         ilLMObject::pasteTree($a_target_lm, $child["id"], $target_item->getId(), IL_LAST_NODE, $a_insert_time, $a_copied_nodes, $a_as_copy, $a_source_lm);
     }
     return $target_item->getId();
     // @todo: write history (see pastePage)
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:60,代码来源:class.ilLMObject.php

示例2: insertChapterClip

 /**
  * Insert Chapter from clipboard
  */
 function insertChapterClip()
 {
     global $ilUser, $ilCtrl, $ilLog;
     include_once "./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php";
     $node_id = ilChapterHierarchyFormGUI::getPostNodeId();
     $first_child = ilChapterHierarchyFormGUI::getPostFirstChild();
     $ilLog->write("InsertChapterClip, num: {$num}, node_id: {$node_id}, " . " getPostFirstChild " . ilChapterHierarchyFormGUI::getPostFirstChild());
     if (!$first_child) {
         $parent_id = $this->lm_tree->getParentId($node_id);
         $target = $node_id;
     } else {
         $parent_id = $node_id;
         $target = IL_FIRST_NODE;
     }
     // copy and paste
     $chapters = $ilUser->getClipboardObjects("st", true);
     $copied_nodes = array();
     foreach ($chapters as $chap) {
         $ilLog->write("Call pasteTree, Target LM: " . $this->object->getId() . ", Chapter ID: " . $chap["id"] . ", Parent ID: " . $parent_id . ", Target: " . $target);
         $cid = ilLMObject::pasteTree($this->object, $chap["id"], $parent_id, $target, $chap["insert_time"], $copied_nodes, ilEditClipboard::getAction() == "copy");
         $target = $cid;
     }
     ilLMObject::updateInternalLinks($copied_nodes);
     if (ilEditClipboard::getAction() == "cut") {
         $ilUser->clipboardDeleteObjectsOfType("pg");
         $ilUser->clipboardDeleteObjectsOfType("st");
         ilEditClipboard::clear();
     }
     $this->object->checkTree();
     $ilCtrl->redirect($this, "chapters");
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:34,代码来源:class.ilObjContentObjectGUI.php

示例3: copyAllPagesAndChapters

 /**
  * Copy all pages and chapters
  *
  * @param object $a_target_obj target learning module
  */
 function copyAllPagesAndChapters($a_target_obj)
 {
     $parent_id = $a_target_obj->lm_tree->readRootId();
     include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     // get all chapters of root lm
     $chapters = $this->lm_tree->getChildsByType($this->lm_tree->readRootId(), "st");
     $copied_nodes = array();
     //$time = time();
     foreach ($chapters as $chap) {
         $cid = ilLMObject::pasteTree($a_target_obj, $chap["child"], $parent_id, IL_LAST_NODE, $time, $copied_nodes, true, $this);
         $target = $cid;
     }
     // copy free pages
     $pages = ilLMPageObject::getPageList($this->getId());
     foreach ($pages as $p) {
         if (!$this->lm_tree->isInTree($p["obj_id"])) {
             $item = new ilLMPageObject($this, $p["obj_id"]);
             $target_item = $item->copy($a_target_obj);
             $copied_nodes[$item->getId()] = $target_item->getId();
         }
     }
     ilLMObject::updateInternalLinks($copied_nodes);
     $a_target_obj->checkTree();
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:30,代码来源:class.ilObjContentObject.php

示例4: insertPageClip

 /**
  * Insert pages from clipboard
  */
 function insertPageClip()
 {
     global $ilCtrl, $ilUser;
     include_once "./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php";
     $node_id = ilChapterHierarchyFormGUI::getPostNodeId();
     $first_child = ilChapterHierarchyFormGUI::getPostFirstChild();
     if (!$first_child) {
         $parent_id = $this->tree->getParentId($node_id);
         $target = $node_id;
     } else {
         $parent_id = $node_id;
         $target = IL_FIRST_NODE;
     }
     // cut and paste
     $pages = $ilUser->getClipboardObjects("pg");
     $copied_nodes = array();
     foreach ($pages as $pg) {
         $cid = ilLMObject::pasteTree($this->content_object, $pg["id"], $parent_id, $target, $pg["insert_time"], $copied_nodes, ilEditClipboard::getAction() == "copy");
         $target = $cid;
     }
     ilLMObject::updateInternalLinks($copied_nodes);
     if (ilEditClipboard::getAction() == "cut") {
         $ilUser->clipboardDeleteObjectsOfType("pg");
         $ilUser->clipboardDeleteObjectsOfType("st");
         ilEditClipboard::clear();
     }
     $ilCtrl->redirect($this, "view");
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:31,代码来源:class.ilStructureObjectGUI.php

示例5: copyAllPagesAndChapters

 /**
  * Copy all pages and chapters
  *
  * @param object $a_target_obj target learning module
  */
 function copyAllPagesAndChapters($a_target_obj, $a_copy_id = 0)
 {
     $parent_id = $a_target_obj->lm_tree->readRootId();
     include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     // get all chapters of root lm
     $chapters = $this->lm_tree->getChildsByType($this->lm_tree->readRootId(), "st");
     $copied_nodes = array();
     //$time = time();
     foreach ($chapters as $chap) {
         $cid = ilLMObject::pasteTree($a_target_obj, $chap["child"], $parent_id, IL_LAST_NODE, $time, $copied_nodes, true, $this);
         $target = $cid;
     }
     // copy free pages
     $pages = ilLMPageObject::getPageList($this->getId());
     foreach ($pages as $p) {
         if (!$this->lm_tree->isInTree($p["obj_id"])) {
             $item = new ilLMPageObject($this, $p["obj_id"]);
             $target_item = $item->copy($a_target_obj);
             $copied_nodes[$item->getId()] = $target_item->getId();
         }
     }
     // Add mapping for pages and chapters
     include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
     $options = ilCopyWizardOptions::_getInstance($a_copy_id);
     foreach ($copied_nodes as $old_id => $new_id) {
         $options->appendMapping($this->getRefId() . '_' . $old_id, $a_target_obj->getRefId() . '_' . $new_id);
     }
     ilLMObject::updateInternalLinks($copied_nodes);
     $a_target_obj->checkTree();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:36,代码来源:class.ilObjContentObject.php


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