/** * create new instance and save it */ public function save() { global $ilUser; $exercise_id = $_REQUEST["exc_id"]; if ($exercise_id) { include_once "Modules/Exercise/classes/class.ilObjExercise.php"; $exercise = new ilObjExercise($exercise_id, false); include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php"; $newObj = ilObjExerciseVerification::createFromExercise($exercise, $ilUser->getId()); if ($newObj) { $parent_id = $this->node_id; $this->node_id = null; $this->putObjectInTree($newObj, $parent_id); $this->afterSave($newObj); } else { ilUtil::sendFailure($this->lng->txt("msg_failed")); } } else { ilUtil::sendFailure($this->lng->txt("select_one")); } $this->create(); }
/** * 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; } } } } } } } }
/** * Get material file name and goto url * * @param int $a_wsp_id * @return array caption, url */ function getMaterialInfo($a_wsp_id) { global $ilUser; if (!$this->ws_tree) { include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php"; $this->ws_tree = new ilWorkspaceTree($ilUser->getId()); $this->ws_access = new ilWorkspaceAccessHandler($caption); } $obj_id = $this->ws_tree->lookupObjectId($a_wsp_id); $caption = ilObject::_lookupTitle($obj_id); if (!$this->offline_mode) { $url = $this->ws_access->getGotoLink($a_wsp_id, $obj_id); } else { $url = $this->offline_mode . "file_" . $obj_id . "/"; // all possible material types for now switch (ilObject::_lookupType($obj_id)) { case "tstv": include_once "Modules/Test/classes/class.ilObjTestVerification.php"; $obj = new ilObjTestVerification($obj_id, false); $url .= $obj->getOfflineFilename(); break; case "excv": include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php"; $obj = new ilObjExerciseVerification($obj_id, false); $url .= $obj->getOfflineFilename(); break; case "file": $file = new ilObjFile($obj_id, false); $url .= $file->getFilename(); break; } } return array($caption, $url); }