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


PHP ilTree::getSubTree方法代码示例

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


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

示例1: testGetSubTree

 /**
  * get childs by type filter
  * @group IL_Init
  * @static
  */
 public function testGetSubTree()
 {
     $tree = new ilTree(ROOT_FOLDER_ID);
     $root = $tree->getNodeData(1);
     $childs = $tree->getSubTree($root, false, 'cals');
     // only calendar settings
     $this->assertEquals(count($childs), 1);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:13,代码来源:ilTreeTest.php

示例2: showTree

 /**
  * Show Editing Tree
  */
 function showTree()
 {
     global $ilUser, $ilias, $ilCtrl, $lng;
     $mtree = new ilTree($this->object->getId());
     $mtree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $mtree->setTreeTablePK("slm_id");
     if ($_POST["expandAll"] != "") {
         $_GET["scexpand"] = "";
         $stree = $mtree->getSubTree($mtree->getNodeData($mtree->readRootId()));
         $n_arr = array();
         foreach ($stree as $n) {
             $n_arr[] = $n["child"];
         }
         $_SESSION["scexpand"] = $n_arr;
     }
     if ($_POST["collapseAll"] != "") {
         $_GET["scexpand"] = "";
         $_SESSION["scexpand"] = array($mtree->readRootId());
     }
     $this->tpl = new ilTemplate("tpl.main.html", true, true);
     $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     $ilCtrl->setParameter($this, "active_node", $_GET["active_node"]);
     $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
     $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
     $this->tpl->setCurrentBlock("exp2_button");
     $this->tpl->setVariable("CMD_EXP2_BTN", "expandAll");
     $this->tpl->setVariable("TXT_EXP2_BTN", $lng->txt("expand_all"));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setCurrentBlock("exp2_button");
     $this->tpl->setVariable("CMD_EXP2_BTN", "collapseAll");
     $this->tpl->setVariable("TXT_EXP2_BTN", $lng->txt("collapse_all"));
     $this->tpl->parseCurrentBlock();
     require_once "./Modules/Scorm2004/classes/class.ilSCORM2004EditorExplorer.php";
     $exp = new ilSCORM2004EditorExplorer($this->ctrl->getLinkTarget($this, "edit"), $this->object);
     $exp->setFrameUpdater("content", "ilHierarchyFormUpdater");
     $exp->setTargetGet("obj_id");
     $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "showTree"));
     if ($_GET["scexpand"] == "") {
         $expanded = $mtree->readRootId();
     } else {
         $expanded = $_GET["scexpand"];
     }
     //echo "-".$_GET["active_node"]."-";
     if ($_GET["active_node"] != "") {
         $path = $mtree->getPathId($_GET["active_node"]);
         $exp->setForceOpenPath($path);
         $exp->highlightNode($_GET["active_node"]);
     }
     $exp->setExpand($expanded);
     // build html-output
     $exp->setOutput(0);
     $output = $exp->getOutput();
     // asynchronous output
     if ($ilCtrl->isAsynch()) {
         echo $output;
         exit;
     }
     $this->tpl->setCurrentBlock("content");
     $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("sahs_organization"));
     $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
     $this->tpl->setVariable("EXPLORER", $output);
     $this->ctrl->setParameter($this, "scexpand", $_GET["scexpand"]);
     $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "showTree"));
     $this->tpl->parseCurrentBlock();
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     iljQueryUtil::initjQuery($this->tpl);
     $this->tpl->show(false);
     exit;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:72,代码来源:class.ilObjSCORM2004LearningModuleGUI.php

示例3: getExportResources

 function getExportResources()
 {
     $export_files = array();
     require_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     include_once "./Modules/File/classes/class.ilObjFile.php";
     $tree = new ilTree($this->slm_object->getId());
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()), true, 'page') as $page) {
         $page_obj = new ilSCORM2004Page($page["obj_id"]);
         $page_obj->buildDom();
         $mob_ids = $page_obj->collectMediaObjects(false);
         foreach ($mob_ids as $mob_id) {
             if ($mob_id > 0 && ilObject::_exists($mob_id)) {
                 $path = ilObjMediaObject::_lookupStandardItemPath($mob_id, false, false);
                 $media_obj = new ilObjMediaObject($mob_id);
                 $export_files[$i]["date"] = $media_obj->getCreateDate();
                 $export_files[$i]["size"] = @filesize($path);
                 // could be remote, e.g. youtube video
                 $export_files[$i]["file"] = $media_obj->getTitle();
                 $export_files[$i]["type"] = $media_obj->getDescription();
                 $export_files[$i]["path"] = $path;
                 $this->ctrl->setParameter($this, "resource", rawurlencode(ilObjMediaObject::_lookupStandardItemPath($mob_id, false, false)));
                 $export_files[$i]["link"] = $this->ctrl->getLinkTarget($this, "downloadResource");
                 $i++;
             }
         }
         include_once "./Services/COPage/classes/class.ilPCFileList.php";
         $file_ids = ilPCFileList::collectFileItems($page_obj, $page_obj->getDomDoc());
         foreach ($file_ids as $file_id) {
             $file_obj = new ilObjFile($file_id, false);
             $export_files[$i]["date"] = $file_obj->getCreateDate();
             $export_files[$i]["size"] = $file_obj->getFileSize();
             $export_files[$i]["file"] = $file_obj->getFileName();
             $export_files[$i]["type"] = $file_obj->getFileType();
             $export_files[$i]["file_id"] = $file_id;
             $this->ctrl->setParameter($this, "file_id", $file_id);
             $export_files[$i]["link"] = $this->ctrl->getLinkTarget($this, "downloadFile", "");
             $i++;
         }
         unset($page_obj);
     }
     return $export_files;
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:45,代码来源:class.ilSCORM2004ScoGUI.php

示例4: exportXMLPageObjects

 function exportXMLPageObjects($a_target_dir, &$a_xml_writer, $a_inst, &$expLog)
 {
     global $ilBench;
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
     $tree = new ilTree($this->slm_id);
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     $pages = $tree->getSubTree($tree->getNodeData($this->getId()), true, 'page');
     foreach ($pages as $page) {
         $expLog->write(date("[y-m-d H:i:s] ") . "Page Object " . $page["obj_id"]);
         // export xml to writer object
         $page_obj = new ilSCORM2004Page($page["obj_id"]);
         $page_obj->exportXML($a_xml_writer, "normal", $a_inst);
         //collect media objects
         $mob_ids = $page_obj->getMediaObjectIds();
         foreach ($mob_ids as $mob_id) {
             $this->mob_ids[$mob_id] = $mob_id;
         }
         // collect all file items
         $file_ids = $page_obj->getFileItemIds();
         foreach ($file_ids as $file_id) {
             $this->file_ids[$file_id] = $file_id;
         }
         include_once "./Services/COPage/classes/class.ilPCQuestion.php";
         $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
         if (count($q_ids) > 0) {
             include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
             foreach ($q_ids as $q_id) {
                 $q_obj =& assQuestion::_instanciateQuestion($q_id);
                 $qti_file = fopen($a_target_dir . "/qti_" . $q_id . ".xml", "w");
                 fwrite($qti_file, $q_obj->toXML());
                 fclose($qti_file);
             }
         }
         unset($page_obj);
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:38,代码来源:class.ilSCORM2004Asset.php

示例5: ilTree

 /**
  * Get number of folders and bookmarks for current user.
  */
 function _getNumberOfObjects()
 {
     $a_tree_id = $_SESSION["AccountId"];
     $tree = new ilTree($a_tree_id);
     $tree->setTableNames('bookmark_tree', 'bookmark_data');
     $root_node = $tree->getNodeData($tree->getRootId());
     if ($root_node["lft"] != "") {
         $bmf = $tree->getSubTree($root_node, false, "bmf");
         $bm = $tree->getSubTree($root_node, false, "bm");
     } else {
         $bmf = array("dummy");
         $bm = array();
     }
     return array("folders" => (int) count($bmf) - 1, "bookmarks" => (int) count($bm));
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:18,代码来源:class.ilBookmarkFolder.php

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

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

示例8: removeDeletedNodes

 /**
  * Remove already deleted objects within the objects in trash
  */
 private function removeDeletedNodes($a_node_id, $a_checked, $a_delete_objects, &$a_affected_ids)
 {
     global $log, $ilDB, $tree;
     $q = "SELECT tree FROM tree WHERE parent= " . $ilDB->quote($a_node_id, "integer") . " AND tree < 0";
     $r = $ilDB->query($q);
     while ($row = $ilDB->fetchObject($r)) {
         // only continue recursion if fetched node wasn't touched already!
         if (!in_array($row->tree, $a_checked)) {
             $deleted_tree = new ilTree($row->tree);
             $a_checked[] = $row->tree;
             $row->tree = $row->tree * -1;
             $del_node_data = $deleted_tree->getNodeData($row->tree);
             $del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
             ilRepUtil::removeDeletedNodes($row->tree, $a_checked, $a_delete_objects, $a_affected_ids);
             if ($a_delete_objects) {
                 foreach ($del_subtree_nodes as $node) {
                     $node_obj =& ilObjectFactory::getInstanceByRefId($node["ref_id"]);
                     // write log entry
                     $log->write("ilObjectGUI::removeDeletedNodes(), delete obj_id: " . $node_obj->getId() . ", ref_id: " . $node_obj->getRefId() . ", type: " . $node_obj->getType() . ", " . "title: " . $node_obj->getTitle());
                     $a_affected_ids[$node["ref_id"]] = array("ref_id" => $node["ref_id"], "obj_id" => $node_obj->getId(), "type" => $node_obj->getType());
                     $node_obj->delete();
                 }
             }
             $tree->deleteTree($del_node_data);
             // write log entry
             $log->write("ilObjectGUI::removeDeletedNodes(), deleted tree, tree_id: " . $del_node_data["tree"] . ", child: " . $del_node_data["child"]);
         }
     }
     return true;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:33,代码来源:class.ilRepUtil.php

示例9: mapCurrentPageId

 function mapCurrentPageId($current_page_id)
 {
     $subtree = $this->lm_tree->getSubTree($this->lm_tree->getNodeData(1));
     $node = $this->lm_tree->getNodeData($current_page_id);
     $pos = array_search($node, $subtree);
     $this->tr_obj =& $this->ilias->obj_factory->getInstanceByRefId($_SESSION["tr_id"]);
     $lmtree = new ilTree($this->tr_obj->getId());
     $lmtree->setTableNames('lm_tree', 'lm_data');
     $lmtree->setTreeTablePK("lm_id");
     $subtree = $lmtree->getSubTree($lmtree->getNodeData(1));
     return $subtree[$pos]["child"];
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:12,代码来源:class.ilLMPresentationGUI.php

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

示例11: removeDeletedNodes

 /**
  * remove already deleted objects within the objects in trash
  * recursive function
  *
  * @access	public
  * @param	integer ref_id of source object
  * @param    boolean 
  */
 function removeDeletedNodes($a_node_id, $a_checked, $a_delete_objects = true)
 {
     global $ilDB, $log, $ilias, $tree;
     $query = "SELECT tree FROM tree WHERE parent = ? AND tree < 0 ";
     $sta = $ilDB->prepare($query, array('integer', 'integer'));
     $res = $ilDB->execute($sta, array($a_node_id, 0));
     while ($row = $ilDB->fetchObject($res)) {
         // only continue recursion if fetched node wasn't touched already!
         if (!in_array($row->tree, $a_checked)) {
             $deleted_tree = new ilTree($row->tree);
             $a_checked[] = $row->tree;
             $row->tree = $row->tree * -1;
             $del_node_data = $deleted_tree->getNodeData($row->tree);
             $del_subtree_nodes = $deleted_tree->getSubTree($del_node_data);
             $this->removeDeletedNodes($row->tree, $a_checked);
             if ($a_delete_objects) {
                 foreach ($del_subtree_nodes as $node) {
                     $node_obj =& $ilias->obj_factory->getInstanceByRefId($node["ref_id"]);
                     // write log entry
                     /*$this->writelog("removeDeletedNodes(), delete obj_id: ".$node_obj->getId().
                     			", ref_id: ".$node_obj->getRefId().", type: ".$node_obj->getType().", ".
                     			"title: ".$node_obj->getTitle());
                     		*/
                     $node_obj->delete();
                 }
             }
             $tree->deleteTree($del_node_data);
             // write log entry
             //$this->writelog("removeDeletedNodes(), deleted tree, tree_id: ".$del_node_data["tree"].", child: ".$del_node_data["child"]);
         }
     }
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:41,代码来源:class.ilObjectDAV.php


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