Пример #1
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;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Пример #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"]) . ".svg"));
     // basic skill selection
     include_once "./Services/Skill/classes/class.ilVirtualSkillTree.php";
     $vtree = new ilVirtualSkillTree();
     $tref_id = 0;
     $skill_id = (int) $_GET["skill_id"];
     if (ilSkillTreeNode::_lookupType((int) $_GET["skill_id"]) == "sktr") {
         include_once "./Services/Skill/classes/class.ilSkillTemplateReference.php";
         $tref_id = $_GET["skill_id"];
         $skill_id = ilSkillTemplateReference::_lookupTemplateId($_GET["skill_id"]);
     }
     $bs = $vtree->getSubTreeForCSkillId($skill_id . ":" . $tref_id, true);
     $options = array();
     foreach ($bs as $b) {
         $options[$b["skill_id"]] = ilSkillTreeNode::_lookupTitle($b["skill_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
 /**
  * Get all usages info of subtree
  *
  * @param array $a_cskill_ids array of common skill ids ("skill_id" => skill_id, "tref_id" => tref_id)
  * @return array usages
  */
 function getAllUsagesInfoOfSubtrees($a_cskill_ids)
 {
     // get nodes
     include_once "./Services/Skill/classes/class.ilVirtualSkillTree.php";
     $vtree = new ilVirtualSkillTree();
     $allnodes = array();
     foreach ($a_cskill_ids as $s) {
         $nodes = $vtree->getSubTreeForCSkillId($s["skill_id"] . ":" . $s["tref_id"]);
         foreach ($nodes as $n) {
             $allnodes[] = $n;
         }
     }
     return $this->getAllUsagesInfo($allnodes);
 }