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


PHP ilTree::getRootId方法代码示例

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


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

示例1: putInTree

 /**
  * put chapter into tree
  */
 function putInTree()
 {
     //echo "st:putInTree";
     // chapters should be behind pages in the tree
     // so if target is first node, the target is substituted with
     // the last child of type pg
     if ($_GET["target"] == IL_FIRST_NODE) {
         $tree = new ilTree($this->content_object->getId());
         $tree->setTableNames('lm_tree', 'lm_data');
         $tree->setTreeTablePK("lm_id");
         // determine parent node id
         $parent_id = !empty($_GET["obj_id"]) ? $_GET["obj_id"] : $tree->getRootId();
         // determine last child of type pg
         $childs =& $tree->getChildsByType($parent_id, "pg");
         if (count($childs) != 0) {
             $_GET["target"] = $childs[count($childs) - 1]["obj_id"];
         }
     }
     if (empty($_GET["target"])) {
         $_GET["target"] = IL_LAST_NODE;
     }
     parent::putInTree();
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:26,代码来源:class.ilStructureObjectGUI.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: exportHTMLScoObjects

 function exportHTMLScoObjects($a_inst, $a_target_dir, &$expLog, $a_one_file = "")
 {
     global $ilBench;
     $tree = new ilTree($this->getId());
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     // copy all necessary files now
     if ($a_one_file != "") {
         $this->prepareHTMLExporter($a_target_dir);
         // put header into file
         $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
         include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
         $sco_tpl = ilCOPageHTMLExport::getPreparedMainTemplate($sco_tpl);
         $sco_tpl->setCurrentBlock("js_file");
         $sco_tpl->setVariable("JS_FILE", "./js/pure.js");
         $sco_tpl->parseCurrentBlock();
         $sco_tpl->setCurrentBlock("js_file");
         $sco_tpl->setVariable("JS_FILE", "./js/question_handling.js");
         $sco_tpl->parseCurrentBlock();
         $sco_tpl->setCurrentBlock("head");
         $sco_tpl->parseCurrentBlock();
         fputs($a_one_file, $sco_tpl->get("head"));
         // toc
         include_once "./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php";
         $manifestBuilder = new ilContObjectManifestBuilder($this);
         $manifestBuilder->buildManifest('12');
         $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
         $xml = simplexml_load_string($manifestBuilder->writer->xmlDumpMem());
         $args = array('/_xml' => $xml->organizations->organization->asXml(), '/_xsl' => $xsl);
         $xh = xslt_create();
         $params = array("one_page" => "y");
         $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
         xslt_free($xh);
         fputs($a_one_file, $output);
     }
     foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
         include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php";
         $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
         ilUtil::makeDir($sco_folder);
         $node = new ilSCORM2004Sco($this, $sco['obj_id']);
         if ($a_one_file == "") {
             $node->exportHTML($a_inst, $sco_folder, $expLog, $a_one_file);
         } else {
             $node->exportHTMLPageObjects($a_inst, $a_target_dir, $expLog, 'full', "sco", $a_one_file, $sco_tpl);
         }
         if ($this->getAssignedGlossary() != 0) {
             include_once "./Modules/Glossary/classes/class.ilObjGlossary.php";
             $glos = new ilObjGlossary($this->getAssignedGlossary(), false);
             //$glos->exportHTML($sco_folder."/glossary", $expLog);
         }
     }
     // copy all necessary files now
     if ($a_one_file != "") {
         // put tail into file
         fputs($a_one_file, $sco_tpl->get("tail"));
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:57,代码来源:class.ilObjSCORM2004LearningModule.php

示例4: getRootFolder

 function getRootFolder()
 {
     $a_tree_id = $_SESSION["AccountId"];
     $tree = new ilTree($a_tree_id);
     $tree->setTableNames('bookmark_tree', 'bookmark_data');
     return $tree->getRootId();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:7,代码来源:class.ilBookmarkFolder.php

示例5: ilTree

 function updateQuickEdit_scorm_propagate($request, $type)
 {
     $module_id = $this->md_obj->obj_id;
     if ($this->md_obj->obj_type == 'sco') {
         $module_id = $this->md_obj->rbac_id;
     }
     $tree = new ilTree($module_id);
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
         $sco_md = new ilMD($module_id, $sco['obj_id'], 'sco');
         if ($_POST[$request] != "") {
             $sco_md_section;
             if (!is_object($sco_md_section = $sco_md->getLifecycle())) {
                 $sco_md_section = $sco_md->addLifecycle();
                 $sco_md_section->save();
             }
             // determine all entered authors
             $auth_arr = explode(",", $_POST[$request]);
             for ($i = 0; $i < count($auth_arr); $i++) {
                 $auth_arr[$i] = trim($auth_arr[$i]);
             }
             $md_con_author = "";
             // update existing author entries (delete if not entered)
             foreach ($ids = $sco_md_section->getContributeIds() as $con_id) {
                 $md_con = $sco_md_section->getContribute($con_id);
                 if ($md_con->getRole() == $type) {
                     foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
                         $md_ent = $md_con->getEntity($ent_id);
                         // entered author already exists
                         if (in_array($md_ent->getEntity(), $auth_arr)) {
                             unset($auth_arr[array_search($md_ent->getEntity(), $auth_arr)]);
                         } else {
                             $md_ent->delete();
                         }
                     }
                     $md_con_author = $md_con;
                 }
             }
             // insert enterd, but not existing authors
             if (count($auth_arr) > 0) {
                 if (!is_object($md_con_author)) {
                     $md_con_author = $sco_md_section->addContribute();
                     $md_con_author->setRole($type);
                     $md_con_author->save();
                 }
                 foreach ($auth_arr as $auth) {
                     $md_ent = $md_con_author->addEntity();
                     $md_ent->setEntity(ilUtil::stripSlashes($auth));
                     $md_ent->save();
                 }
             }
         } else {
             if (is_object($sco_md_section = $sco_md->getLifecycle())) {
                 foreach ($ids = $sco_md_section->getContributeIds() as $con_id) {
                     $md_con = $sco_md_section->getContribute($con_id);
                     if ($md_con->getRole() == $type) {
                         $md_con->delete();
                     }
                 }
             }
         }
         $sco_md->update();
     }
     $this->updateQuickEdit_scorm();
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:66,代码来源:class.ilMDEditorGUI.php

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

示例7: getAllSubObjects

 /**
  * get all subobject (structure and page objects) of a lm 
  *
  * @access protected
  * @return
  */
 protected function getAllSubObjects($a_ref_id)
 {
     $tree = new ilTree(ilObject::_lookupObjId($a_ref_id));
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId())) as $node) {
         if ($node['type'] == 'st' or $node['type'] == 'pg') {
             $depth = $node['depth'] - 1;
             $child = $node['child'];
             $chapter[$child]['depth'] = $depth;
             $chapter[$child]['type'] = $node['type'];
         }
     }
     return $chapter ? $chapter : array();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:21,代码来源:class.ilCourseObjectiveMaterialAssignmentTableGUI.php


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