コード例 #1
0
 /**
  * Is clickable
  *
  * @param
  * @return
  */
 function isNodeClickable($a_node)
 {
     if (in_array($a_node["type"], array("skll", "sktp"))) {
         return true;
     }
     // references that refer directly to a (basic) skill template
     if ($a_node["type"] == "sktr" && ilSkillTreeNode::_lookupType($a_node["skill_id"]) == "sktp") {
         return true;
     }
     return false;
 }
コード例 #2
0
 /**
  * Assign materials to skill levels
  *
  * @param
  * @return
  */
 function selfEvaluation()
 {
     global $ilTabs, $lng, $ilCtrl, $tpl, $ilToolbar;
     $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "listSkills"));
     $ilCtrl->saveParameter($this, "skill_id");
     $ilCtrl->saveParameter($this, "basic_skill_id");
     $ilCtrl->saveParameter($this, "tref_id");
     include_once "./Services/Skill/classes/class.ilSkillTreeNode.php";
     $tpl->setTitle(ilSkillTreeNode::_lookupTitle((int) $_GET["skill_id"]));
     $tpl->setTitleIcon(ilUtil::getImagePath("icon_" . ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]) . "_b.png"));
     // basic skill selection
     // here basic skill id??
     $bs = ilSkillTreeNode::getSkillTreeNodes((int) $_GET["skill_id"], true);
     $options = array();
     foreach ($bs as $b) {
         $options[$b["id"]] = ilSkillTreeNode::_lookupTitle($b["id"]);
     }
     $cur_basic_skill_id = (int) $_POST["basic_skill_id"] > 0 ? (int) $_POST["basic_skill_id"] : ((int) $_GET["basic_skill_id"] > 0 ? (int) $_GET["basic_skill_id"] : key($options));
     $ilCtrl->setParameter($this, "basic_skill_id", $cur_basic_skill_id);
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     $si = new ilSelectInputGUI($lng->txt("skmg_skill"), "basic_skill_id");
     $si->setOptions($options);
     $si->setValue($cur_basic_skill_id);
     $ilToolbar->addInputItem($si, true);
     $ilToolbar->addFormButton($lng->txt("select"), "selfEvaluation");
     $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
     // table
     include_once "./Services/Skill/classes/class.ilSelfEvaluationSimpleTableGUI.php";
     $tab = new ilSelfEvaluationSimpleTableGUI($this, "selfEvaluation", (int) $_GET["skill_id"], (int) $_GET["tref_id"], $cur_basic_skill_id);
     $tpl->setContent($tab->getHTML());
 }
コード例 #3
0
 /**
  * Redirect to parent (identified by current obj_id)
  *
  * @param
  * @return
  */
 function redirectToParent($a_tmp_mode = false)
 {
     global $ilCtrl;
     if ($_GET["tmpmode"]) {
         $a_tmp_mode = true;
     }
     $t = ilSkillTreeNode::_lookupType((int) $_GET["obj_id"]);
     switch ($t) {
         case "skrt":
             $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", (int) $_GET["obj_id"]);
             if ($a_tmp_mode) {
                 $ilCtrl->redirectByClass("ilskillrootgui", "listTemplates");
             } else {
                 $ilCtrl->redirectByClass("ilskillrootgui", "listSkills");
             }
             break;
         case "sctp":
             $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", (int) $_GET["obj_id"]);
             $ilCtrl->redirectByClass("ilskilltemplatecategorygui", "listItems");
             break;
         case "scat":
             $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", (int) $_GET["obj_id"]);
             $ilCtrl->redirectByClass("ilskillcategorygui", "listItems");
             break;
     }
 }
コード例 #4
0
 /**
  * Get node icon
  *
  * @param array 
  * @return
  */
 function getNodeIcon($a_node)
 {
     $a_id_parts = explode(":", $a_node["id"]);
     $a_skl_tree_id = $a_parent_id_parts[0];
     $a_skl_template_tree_id = $a_id_parts[1];
     // root?
     if ($a_node["type"] == "skrt") {
         $icon = ilUtil::getImagePath("icon_scat.svg");
     } else {
         $type = $a_node["type"];
         if ($type == "sktr") {
             include_once "./Services/Skill/classes/class.ilSkillTreeNode.php";
             $type = ilSkillTreeNode::_lookupType($a_skl_template_tree_id);
         }
         if ($type == "sktp") {
             $type = "skll";
         }
         if ($type == "sctp") {
             $type = "scat";
         }
         $icon = ilUtil::getImagePath("icon_" . $type . ".svg");
     }
     return $icon;
 }
コード例 #5
0
 /**
  * Show Editing Tree
  */
 function showTree($a_templates, $a_gui = "", $a_gui_cmd = "")
 {
     global $ilUser, $tpl, $ilCtrl, $lng;
     if ($a_templates) {
         if ($_GET["obj_id"] == "" || $_GET["obj_id"] == 1) {
             return;
         }
         if ($_GET["obj_id"] > 1) {
             $path = $this->skill_tree->getPathId($_GET["obj_id"]);
             include_once "./Services/Skill/classes/class.ilSkillTreeNode.php";
             if (ilSkillTreeNode::_lookupType($path[1]) == "sktp") {
                 return;
             }
         }
     }
     include_once "./Services/Skill/classes/class.ilSkillTreeExplorerGUI.php";
     $ilCtrl->setParameter($this, "templates_tree", $a_templates);
     $exp = new ilSkillTreeExplorerGUI($this, "showTree", $a_templates);
     if (!$exp->handleCommand()) {
         $tpl->setLeftNavContent($exp->getHTML());
     }
 }
コード例 #6
0
 /**
  * List items
  */
 function listItems()
 {
     global $tpl;
     $this->setTabs("content");
     $sk_id = $this->node_object->getSkillTemplateId();
     $obj_type = ilSkillTreeNode::_lookupType($sk_id);
     if ($obj_type == "sctp") {
         include_once "./Services/Skill/classes/class.ilSkillCatTableGUI.php";
         $table = new ilSkillCatTableGUI($this, "listItems", (int) $sk_id, ilSkillCatTableGUI::MODE_SCTP, $this->node_object->getId());
         $tpl->setContent($table->getHTML());
     } else {
         if ($obj_type == "sktp") {
             include_once "./Services/Skill/classes/class.ilSkillLevelTableGUI.php";
             $table = new ilSkillLevelTableGUI((int) $sk_id, $this, "edit", $this->node_object->getId());
             $tpl->setContent($table->getHTML());
         }
     }
 }
コード例 #7
0
 /**
  * Get icon path
  *
  * @param
  * @return
  */
 function getIconPath($a_obj_id, $a_type, $a_size = "", $a_draft = false)
 {
     $off = $a_draft ? "_off" : "";
     $a_name = "icon_" . $a_type . $a_size . $off . ".png";
     if ($a_type == "sktr") {
         include_once "./Services/Skill/classes/class.ilSkillTemplateReference.php";
         $tid = ilSkillTemplateReference::_lookupTemplateId($a_obj_id);
         $type = ilSkillTreeNode::_lookupType($tid);
         if ($type == "sctp") {
             $a_name = "icon_sctr" . $a_size . $off . ".png";
         }
     }
     $vers = "vers=" . str_replace(array(".", " "), "-", ILIAS_VERSION);
     return ilUtil::getImagePath($a_name) . "?" . $vers;
 }
コード例 #8
0
 /**
  * Collect page elements (that need to be exported separately)
  *
  * @param string $a_pg_type page type
  * @param int $a_pg_id page id
  */
 function collectPageElements($a_type, $a_id)
 {
     // collect media objects
     $pg_mobs = ilObjMediaObject::_getMobsOfObject($a_type, $a_id);
     foreach ($pg_mobs as $pg_mob) {
         $this->mobs[$pg_mob] = $pg_mob;
     }
     // collect all files
     include_once "./Modules/File/classes/class.ilObjFile.php";
     $files = ilObjFile::_getFilesOfObject($a_type, $a_id);
     foreach ($files as $f) {
         $this->files[$f] = $f;
     }
     $skill_tree = $ws_tree = null;
     $pcs = ilPageContentUsage::getUsagesOfPage($a_id, $a_type);
     foreach ($pcs as $pc) {
         // skils
         if ($pc["type"] == "skmg") {
             $skill_id = $pc["id"];
             // trying to find user id
             $user_id = null;
             switch ($a_type) {
                 case "prtf:pg":
                     include_once "Modules/Portfolio/classes/class.ilPortfolioPage.php";
                     $page = new ilPortfolioPage($a_id);
                     $user_id = $page->create_user;
                     break;
                 default:
                     // :TODO:
                     break;
             }
             if ($user_id) {
                 // we only need 1 instance each
                 if (!$skill_tree) {
                     include_once "Services/Skill/classes/class.ilSkillTree.php";
                     $skill_tree = new ilSkillTree();
                     include_once "Services/Skill/classes/class.ilPersonalSkill.php";
                     include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
                     $ws_tree = new ilWorkspaceTree($user_id);
                 }
                 // walk skill tree
                 include_once "./Services/Skill/classes/class.ilVirtualSkillTree.php";
                 $vtree = new ilVirtualSkillTree();
                 $tref_id = 0;
                 $skill_id = (int) $skill_id;
                 include_once "./Services/Skill/classes/class.ilSkillTreeNode.php";
                 if (ilSkillTreeNode::_lookupType($skill_id) == "sktr") {
                     include_once "./Services/Skill/classes/class.ilSkillTemplateReference.php";
                     $tref_id = $skill_id;
                     $skill_id = ilSkillTemplateReference::_lookupTemplateId($skill_id);
                 }
                 $b_skills = $vtree->getSubTreeForCSkillId($skill_id . ":" . $tref_id, true);
                 foreach ($b_skills as $bs) {
                     $skill = ilSkillTreeNodeFactory::getInstance($bs["skill_id"]);
                     $level_data = $skill->getLevelData();
                     foreach ($level_data as $k => $v) {
                         // get assigned materials from personal skill
                         $mat = ilPersonalSkill::getAssignedMaterial($user_id, $bs["tref_id"], $v["id"]);
                         if (sizeof($mat)) {
                             foreach ($mat as $item) {
                                 $wsp_id = $item["wsp_id"];
                                 $obj_id = $ws_tree->lookupObjectId($wsp_id);
                                 // all possible material types for now
                                 switch (ilObject::_lookupType($obj_id)) {
                                     case "file":
                                         $this->files[$obj_id] = $obj_id;
                                         break;
                                     case "tstv":
                                         include_once "Modules/Test/classes/class.ilObjTestVerification.php";
                                         $obj = new ilObjTestVerification($obj_id, false);
                                         $this->files_direct[$obj_id] = array($obj->getFilePath(), $obj->getOfflineFilename());
                                         break;
                                     case "excv":
                                         include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php";
                                         $obj = new ilObjExerciseVerification($obj_id, false);
                                         $this->files_direct[$obj_id] = array($obj->getFilePath(), $obj->getOfflineFilename());
                                         break;
                                     case "crsv":
                                         include_once "Modules/Course/classes/Verification/class.ilObjCourseVerification.php";
                                         $obj = new ilObjCourseVerification($obj_id, false);
                                         $this->files_direct[$obj_id] = array($obj->getFilePath(), $obj->getOfflineFilename());
                                         break;
                                     case "scov":
                                         include_once "Modules/ScormAicc/classes/Verification/class.ilObjSCORMVerification.php";
                                         $obj = new ilObjSCORMVerification($obj_id, false);
                                         $this->files_direct[$obj_id] = array($obj->getFilePath(), $obj->getOfflineFilename());
                                         break;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #9
0
 /**
  * Get subtree, internal
  *
  * @param string $id vtree id
  * @param array $result node array (called by reference)
  * @param bool $a_only_basic return only basic skills (and basic skill templates)
  */
 private function __getSubTreeRec($id, &$result, $a_only_basic)
 {
     $childs = $this->getChildsOfNode($id);
     foreach ($childs as $c) {
         if (!$a_only_basic || in_array($c["type"], array("skll", "sktp")) || $c["type"] == "sktr" && ilSkillTreeNode::_lookupType($c["skill_id"]) == "sktp") {
             $result[] = $c;
         }
         $this->__getSubTreeRec($c["id"], $result, $a_only_basic);
     }
 }
コード例 #10
0
 /**
  * Get icon path
  *
  * @param int $a_obj_id node id
  * @param string $a_type node type
  * @param string $a_size size
  * @param int $a_status status
  * @return string icon path
  */
 static function getIconPath($a_obj_id, $a_type, $a_size = "", $a_status = 0)
 {
     if ($a_status == self::STATUS_DRAFT && $a_type == "sctp") {
         $a_type = "scat";
     }
     if ($a_status == self::STATUS_DRAFT && $a_type == "sktp") {
         $a_type = "skll";
     }
     $off = $a_status == self::STATUS_DRAFT ? "_off" : "";
     $a_name = "icon_" . $a_type . $a_size . $off . ".svg";
     if ($a_type == "sktr") {
         include_once "./Services/Skill/classes/class.ilSkillTemplateReference.php";
         $tid = ilSkillTemplateReference::_lookupTemplateId($a_obj_id);
         $type = ilSkillTreeNode::_lookupType($tid);
         if ($type == "sctp") {
             $a_name = "icon_sctr" . $a_size . $off . ".svg";
         }
     }
     $vers = "vers=" . str_replace(array(".", " "), "-", ILIAS_VERSION);
     return ilUtil::getImagePath($a_name) . "?" . $vers;
 }
コード例 #11
0
 /**
  * Redirect to parent (identified by current obj_id)
  */
 function redirectToParent()
 {
     global $ilCtrl;
     $t = ilSkillTreeNode::_lookupType((int) $_GET["obj_id"]);
     switch ($t) {
         case "skrt":
             $ilCtrl->setParameterByClass("ilskillrootgui", "obj_id", (int) $_GET["obj_id"]);
             $ilCtrl->redirectByClass("ilskillrootgui", "listSkills");
             break;
     }
     parent::redirectToParent();
 }
コード例 #12
0
 /**
  * Get childs of node
  *
  * @param int $a_parent_id parent id
  * @return array childs
  */
 function getChildsOfNode($a_parent_id)
 {
     switch (ilSkillTreeNode::_lookupType($a_parent_id)) {
         /*
               'id' => string '1' (length=1)
               'skill_id' => string '4' (length=1)
               'nr' => string '1' (length=1)
               'title' => string 'Ungenügend' (length=11)
               'description' => null
               'trigger_ref_id' => string '0' (length=1)
               'trigger_obj_id' => string '0' (length=1)
         */
         default:
             $childs = parent::getChildsOfNode($a_parent_id);
             //var_dump($childs);
             return $childs;
     }
 }