/**
  * 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());
 }
 /**
  * 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"];
             // get user id from portfolio page
             include_once "Services/Portfolio/classes/class.ilPortfolioPage.php";
             $page = new ilPortfolioPage(0, $a_id);
             $user_id = $page->create_user;
             // 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
             $b_skills = ilSkillTreeNode::getSkillTreeNodes($skill_id, true);
             foreach ($b_skills as $bs) {
                 $skill = ilSkillTreeNodeFactory::getInstance($bs["id"]);
                 $level_data = $skill->getLevelData();
                 foreach ($level_data as $k => $v) {
                     // get assigned materials from personal skill
                     $mat = ilPersonalSkill::getAssignedMaterial($user_id, $bs["tref"], $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;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 /**
  * List items
  */
 function listItems()
 {
     global $tpl;
     $this->setTabs("content");
     include_once "./Services/Skill/classes/class.ilSkillTreeNode.php";
     $bs = ilSkillTreeNode::getSkillTreeNodes((int) $_GET["obj_id"], false);
     include_once "./Services/UIComponent/NestedList/classes/class.ilNestedList.php";
     $ns = new ilNestedList();
     $ns->setListClass("il_Explorer");
     foreach ($bs as $b) {
         $par = $b["id"] == (int) $_GET["obj_id"] ? 0 : $b["parent"];
         $ns->addListNode(ilSkillTreeNode::_lookupTitle($b["id"]), $b["id"], $par);
     }
     $tpl->setContent($ns->getHTML());
 }