/**
  * Constructor
  */
 public function __construct($a_parent_obj, $a_parent_cmd, $a_slm)
 {
     global $ilUser;
     $this->slm = $a_slm;
     $tree = new ilTree($this->slm->getId());
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     parent::__construct("scorm_ed_exp", $a_parent_obj, $a_parent_cmd, $tree);
     //$this->setTypeWhiteList(array("du", "chap", "page"));
     $this->setSkipRootNode(false);
     $this->setAjax(false);
 }
 public function parentHasSeqTemplate($a_slm_id)
 {
     require_once "./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004SeqTemplate.php";
     global $ilDB, $ilLog;
     $has_template = false;
     $mtree = new ilTree($a_slm_id);
     $mtree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $mtree->setTreeTablePK("slm_id");
     //get all parents for current node
     $parents = $this->getParentsForNode($a_parents = array(), $this->id);
     for ($i = 0; $i < count($parents); $i++) {
         $template = ilSCORM2004SeqTemplate::templateForChapter($parents[$i]);
         if ($template) {
             $has_template = true;
             break;
         }
     }
     return $has_template;
 }
 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];
 }
 /**
  * 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();
 }
 /**
  * export (sub)structure objects of structure object (see ilias_co.dtd)
  *
  * @param	object		$a_xml_writer	ilXmlWriter object that receives the
  *										xml data
  */
 static function getChapterList($a_lm_id)
 {
     $tree = new ilTree($a_lm_id);
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     $chapters = array();
     $ndata = $tree->getNodeData($tree->readRootId());
     $childs = $tree->getSubtree($ndata);
     foreach ($childs as $child) {
         if ($child["type"] == "st") {
             $chapters[] = $child;
         }
     }
     return $chapters;
 }
Esempio n. 6
0
 /**
  * split page to next 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 _splitPageNext($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;
     }
     $tree = new ilTree($cont_obj->getId());
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     $source_lm_page =& new ilLMPageObject($cont_obj, $a_page_id);
     $source_page =& $source_lm_page->getPageObject();
     // get next page
     $succ = $tree->fetchSuccessorNode($a_page_id, "pg");
     if ($succ["child"] > 0) {
         $target_lm_page =& new ilLMPageObject($cont_obj, $succ["child"]);
         $target_page =& $target_lm_page->getPageObject();
         $target_page->buildDom();
         $target_page->addHierIds();
         // move nodes to target page
         $source_page->buildDom();
         $source_page->addHierIds();
         ilLMPage::_moveContentAfterHierId($source_page, $target_page, $a_hier_id);
         //$source_page->deleteContentFromHierId($a_hier_id);
         return $succ["child"];
     }
 }
 /**
  * Delete chapters/scos/pages
  */
 function confirmedDelete($a_redirect = true)
 {
     global $ilCtrl;
     $tree = new ilTree($this->object->getId());
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     // delete all selected objects
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php";
     foreach ($_POST["id"] as $id) {
         if ($id != IL_FIRST_NODE) {
             $obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
             $node_data = $tree->getNodeData($id);
             if (is_object($obj)) {
                 $obj->setSLMId($this->object->getId());
                 /*include_once("./Services/History/classes/class.ilHistory.php");
                 	 ilHistory::_createEntry($this->object->getId(), "delete_".$obj->getType(),
                 		array(ilLMObject::_lookupTitle($id), $id),
                 		$this->object->getType());*/
                 $obj->delete();
             }
             if ($tree->isInTree($id)) {
                 $tree->deleteTree($node_data);
             }
         }
     }
     // check the tree
     //		$this->object->checkTree();
     // feedback
     ilUtil::sendInfo($this->lng->txt("info_deleted"), true);
     if ($a_redirect) {
         $ilCtrl->redirect($this, "showOrganization");
     }
 }
 /**
  * presentation title doesn't have to be page title, it may be
  * chapter title + page title or chapter title only, depending on settings
  *
  * @param	string	$a_mode		IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER
  */
 function _getPresentationTitle($a_pg_id, $a_mode = IL_CHAPTER_TITLE, $a_include_numbers = false, $a_time_scheduled_activation = false, $a_force_content = false)
 {
     global $ilDB;
     // select
     $query = "SELECT * FROM lm_data WHERE obj_id = " . $ilDB->quote($a_pg_id, "integer");
     $pg_set = $ilDB->query($query);
     $pg_rec = $ilDB->fetchAssoc($pg_set);
     if ($a_mode == IL_NO_HEADER && !$a_force_content) {
         return "";
     }
     $tree = new ilTree($pg_rec["lm_id"]);
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     if ($a_mode == IL_PAGE_TITLE) {
         $nr = "";
         return $nr . $pg_rec["title"];
     }
     if ($tree->isInTree($pg_rec["obj_id"])) {
         $pred_node = $tree->fetchPredecessorNode($pg_rec["obj_id"], "st");
         $childs = $tree->getChildsByType($pred_node["obj_id"], "pg");
         $cnt_str = "";
         if (count($childs) > 1) {
             $cnt = 0;
             foreach ($childs as $child) {
                 include_once "./Services/COPage/classes/class.ilPageObject.php";
                 $active = ilPageObject::_lookupActive($child["obj_id"], ilObject::_lookupType($pg_rec["lm_id"]), $a_time_scheduled_activation);
                 if (!$active) {
                     $act_data = ilPageObject::_lookupActivationData((int) $child["obj_id"], ilObject::_lookupType($pg_rec["lm_id"]));
                     if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) {
                         $active = true;
                     }
                 }
                 if ($child["type"] != "pg" || $active) {
                     $cnt++;
                 }
                 if ($child["obj_id"] == $pg_rec["obj_id"]) {
                     $cur_cnt = $cnt;
                 }
             }
             if ($cnt > 1) {
                 $cnt_str = " (" . $cur_cnt . "/" . $cnt . ")";
             }
         }
         require_once "./Modules/LearningModule/classes/class.ilStructureObject.php";
         //$struct_obj =& new ilStructureObject($pred_node["obj_id"]);
         //return $struct_obj->getTitle();
         return ilStructureObject::_getPresentationTitle($pred_node["obj_id"], $a_include_numbers) . $cnt_str;
         //return $pred_node["title"].$cnt_str;
     } else {
         return $pg_rec["title"];
     }
 }
 /**
  * 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");
 }
Esempio n. 10
0
 /**
  * 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);
     }
 }
 /**
  * get last accessed page
  *
  * @param	int		$a_obj_id	content object id
  * @param	int		$a_user_id	user object id
  */
 function _getLastAccessedPage($a_ref_id, $a_user_id = "")
 {
     global $ilDB, $ilUser;
     if ($a_user_id == "") {
         $a_user_id = $ilUser->getId();
     }
     if (isset(self::$lo_access[$a_ref_id])) {
         $acc_rec["obj_id"] = self::$lo_access[$a_ref_id];
     } else {
         $q = "SELECT * FROM lo_access WHERE " . "usr_id = " . $ilDB->quote($a_user_id, "integer") . " AND " . "lm_id = " . $ilDB->quote($a_ref_id, "integer");
         $acc_set = $ilDB->query($q);
         $acc_rec = $ilDB->fetchAssoc($acc_set);
     }
     if ($acc_rec["obj_id"] > 0) {
         $lm_id = ilObject::_lookupObjId($a_ref_id);
         $mtree = new ilTree($lm_id);
         $mtree->setTableNames('lm_tree', 'lm_data');
         $mtree->setTreeTablePK("lm_id");
         if ($mtree->isInTree($acc_rec["obj_id"])) {
             return $acc_rec["obj_id"];
         }
     }
     return 0;
 }
Esempio n. 12
0
 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;
 }
 /**
  * Get Pool Tree
  *
  * @param	int		Media pool ID
  *
  * @return	object	Tree object of media pool
  */
 static function getPoolTree($a_obj_id)
 {
     $tree = new ilTree($a_obj_id);
     $tree->setTreeTablePK("mep_id");
     $tree->setTableNames("mep_tree", "mep_item");
     return $tree;
 }
 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"));
     }
 }
Esempio n. 15
0
 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();
 }
Esempio n. 16
0
    $ilDB->manipulate("INSERT INTO rbac_ta " . "(typ_id, ops_id) VALUES (" . $ilDB->quote($typ_id, "integer") . "," . $ilDB->quote(1, "integer") . ")");
    $ilDB->manipulate("INSERT INTO rbac_ta " . "(typ_id, ops_id) VALUES (" . $ilDB->quote($typ_id, "integer") . "," . $ilDB->quote(2, "integer") . ")");
    $ilDB->manipulate("INSERT INTO rbac_ta " . "(typ_id, ops_id) VALUES (" . $ilDB->quote($typ_id, "integer") . "," . $ilDB->quote(3, "integer") . ")");
    $ilDB->manipulate("INSERT INTO rbac_ta " . "(typ_id, ops_id) VALUES (" . $ilDB->quote($typ_id, "integer") . "," . $ilDB->quote(4, "integer") . ")");
}
?>
<#3379>
<?php 
$setting = new ilSetting();
$sk_step = (int) $setting->get('sk_db');
if ($sk_step <= 4) {
    // add skill tree and root node
    $nid = $ilDB->nextId("skl_tree_node");
    $ilDB->manipulate("INSERT INTO skl_tree_node " . "(obj_id, type, title, create_date) VALUES (" . $ilDB->quote($nid, "integer") . "," . $ilDB->quote("skrt", "text") . "," . $ilDB->quote("Skill Tree Root Node", "text") . "," . $ilDB->now() . ")");
    $skill_tree = new ilTree(1);
    $skill_tree->setTreeTablePK("skl_tree_id");
    $skill_tree->setTableNames('skl_tree', 'skl_tree_node');
    $skill_tree->addTree(1, $nid);
}
?>
<#3380>
<?php 
$setting = new ilSetting();
$sk_step = (int) $setting->get('sk_db');
if ($sk_step <= 6) {
    $fields = array('id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 'skill_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 'nr' => array('type' => 'integer', 'length' => 2, 'notnull' => true), 'title' => array('type' => 'text', 'length' => 200, 'notnull' => false), 'description' => array('type' => 'clob'));
    $ilDB->createTable('skl_level', $fields);
    $ilDB->createSequence('skl_level');
    $ilDB->addPrimaryKey("skl_level", array("id"));
}
?>
 /**
  * Set Locator Items
  */
 function setLocator()
 {
     global $ilLocator, $tpl, $ilCtrl;
     $ilLocator->addRepositoryItems($_GET["ref_id"]);
     $this->getParentGUI()->addLocatorItems();
     if ($_GET["obj_id"] > 0) {
         $tree = new ilTree($this->slm_object->getId());
         $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
         $tree->setTreeTablePK("slm_id");
         $path = $tree->getPathFull($_GET["obj_id"]);
         for ($i = 1; $i < count($path); $i++) {
             //var_dump($path[$i]);
             switch ($path[$i]["type"]) {
                 case "chap":
                     $ilCtrl->setParameterByClass("ilscorm2004chaptergui", "obj_id", $path[$i]["child"]);
                     $ilLocator->addItem($path[$i]["title"], $ilCtrl->getLinkTargetByClass("ilscorm2004chaptergui", "showOrganization"), "", 0, $path[$i]["type"], ilUtil::getImagePath("icon_chap_s.png"));
                     break;
                 case "seqc":
                     $ilCtrl->setParameterByClass("ilscorm2004seqchaptergui", "obj_id", $path[$i]["child"]);
                     $ilLocator->addItem($path[$i]["title"], $ilCtrl->getLinkTargetByClass("ilscorm2004seqchaptergui", "showOrganization"), "", 0, $path[$i]["type"], ilUtil::getImagePath("icon_chap_s.png"));
                     break;
                 case "sco":
                     $ilCtrl->setParameterByClass("ilscorm2004scogui", "obj_id", $path[$i]["child"]);
                     $ilLocator->addItem($path[$i]["title"], $ilCtrl->getLinkTargetByClass("ilscorm2004scogui", "showOrganization"), "", 0, $path[$i]["type"], ilUtil::getImagePath("icon_sco_s.png"));
                     break;
                 case "ass":
                     $ilCtrl->setParameterByClass("ilscorm2004assetgui", "obj_id", $path[$i]["child"]);
                     $ilLocator->addItem($path[$i]["title"], $ilCtrl->getLinkTargetByClass("ilscorm2004assetgui", "showOrganization"), "", 0, $path[$i]["type"], ilUtil::getImagePath("icon_sca_s.png"));
                     break;
                 case "page":
                     $ilCtrl->setParameterByClass("ilscorm2004pagegui", "obj_id", $path[$i]["child"]);
                     $ilLocator->addItem($path[$i]["title"], $ilCtrl->getLinkTargetByClass("ilscorm2004pagegui", "edit"), "", 0, $path[$i]["type"], ilUtil::getImagePath("icon_pg_s.png"));
                     break;
             }
         }
     }
     $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
     $tpl->setLocator();
 }
 /**
  * Get scorm module editing tree
  *
  * @param	int		scorm module object id
  *
  * @return	object		tree object
  */
 static function getTree($a_slm_obj_id)
 {
     $tree = new ilTree($a_slm_obj_id);
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     $tree->readRootId();
     return $tree;
 }
 /**
  * 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
         /*
         			if ($position == "into")
         			{
         				$target_parent = $target_id;
         				$target_pos = IL_FIRST_NODE;
         
         				// if target_pos is still first node we must skip all pages
         				if ($target_pos == IL_FIRST_NODE)
         				{
         					$pg_childs =& $lmtree->getChildsByType($target_parent, "pg");
         					if (count($pg_childs) != 0)
         					{
         						$target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
         					}
         				}
         			}
         */
         // delete source tree
         if ($movecopy == "move") {
             $lmtree->deleteTree($source_node);
         } else {
             // copy chapter (incl. subcontents)
             $new_chapter =& $source_obj->copy($lmtree, $target_parent, $target_pos);
         }
         if (!$lmtree->isInTree($source_id)) {
             $lmtree->insertNode($source_id, $target_parent, $target_pos);
             // insert moved tree
             if ($movecopy == "move") {
                 foreach ($subnodes as $node) {
                     if ($node["obj_id"] != $source_id) {
                         $lmtree->insertNode($node["obj_id"], $node["parent"]);
                     }
                 }
             }
         }
         // check the tree
         $this->checkTree();
     }
     $this->checkTree();
 }
 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"];
 }
 /**
  * delete page object or structure objects
  *
  * @param	int		$a_parent_subobj_id		id of parent object (structure object)
  *											of the objects, that should be deleted
  *											(or no parent object id for top level)
  */
 function confirmedDelete($a_parent_subobj_id = 0)
 {
     $tree = new ilTree($this->object->getId());
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     // check number of objects
     if (!$_POST["id"]) {
         $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
     }
     // delete all selected objects
     foreach ($_POST["id"] as $id) {
         if ($id != IL_FIRST_NODE) {
             $obj =& ilLMObjectFactory::getInstance($this->object, $id, false);
             $node_data = $tree->getNodeData($id);
             if (is_object($obj)) {
                 $obj->setLMId($this->object->getId());
                 include_once "./Services/History/classes/class.ilHistory.php";
                 ilHistory::_createEntry($this->object->getId(), "delete_" . $obj->getType(), array(ilLMObject::_lookupTitle($id), $id), $this->object->getType());
                 $obj->delete();
             }
             if ($tree->isInTree($id)) {
                 $tree->deleteTree($node_data);
             }
         }
     }
     // check the tree
     $this->object->checkTree();
     // feedback
     ilUtil::sendSuccess($this->lng->txt("info_deleted"), true);
     if ($a_parent_subobj_id == 0) {
         $this->ctrl->redirect($this, $_GET["backcmd"]);
     }
 }
Esempio n. 22
0
 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);
     }
 }
Esempio n. 23
0
 /**
  * Get pages of chapter
  *
  * @param
  * @return
  */
 static function getPagesOfChapter($a_lm_id, $a_chap_id)
 {
     // update structure entries: if at least one page of a chapter is public set chapter to public too
     $lm_tree = new ilTree($a_lm_id);
     $lm_tree->setTableNames('lm_tree', 'lm_data');
     $lm_tree->setTreeTablePK("lm_id");
     $lm_tree->readRootId();
     $childs = $lm_tree->getChildsByType($a_chap_id, "pg");
     return $childs;
 }
 /**
  * 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();
 }