/** * get commands * * this method returns an array of all possible commands/permission combinations * * example: * $commands = array * ( * array("permission" => "read", "cmd" => "view", "lang_var" => "show"), * array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), * ); */ function _getCommands($a_obj_id) { $commands = array(array("permission" => "read", "cmd" => "view", "lang_var" => "show", "default" => true), array("permission" => "write", "cmd" => "editContent", "lang_var" => "edit_content"), array("permission" => "write", "cmd" => "edit", "lang_var" => "settings")); if (ilObjSAHSLearningModuleAccess::_lookupOfflineModeAvailable($a_obj_id)) { $offlineMode = ilObjSAHSLearningModuleAccess::_lookupUserIsOfflineMode($a_obj_id); if ($offlineMode == false) { $commands[] = array("permission" => "read", "cmd" => "offlineModeStart", "lang_var" => "offline_mode"); } else { $commands[] = array("permission" => "read", "cmd" => "offlineModeStop", "lang_var" => "offline_mode"); $commands[0] = array("permission" => "read", "cmd" => "offlineModeView", "lang_var" => "show", "default" => true); } } return $commands; }
/** * inititialize new item (is called by getItemHTML()) * * @param int $a_ref_id reference id * @param int $a_obj_id object id * @param string $a_title title * @param string $a_description description * @param int $a_context tree/workspace */ function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "", $a_context = self::CONTEXT_REPOSITORY) { $this->offline_mode = false; include_once 'Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php'; if ($this->type == "sahs") { $this->offline_mode = ilObjSAHSLearningModuleAccess::_lookupUserIsOfflineMode($a_obj_id); } $this->access_cache = array(); $this->ref_id = $a_ref_id; $this->obj_id = $a_obj_id; $this->context = $a_context; $this->setTitle($a_title); $this->setDescription($a_description); #$this->description = $a_description; // checks, whether any admin commands are included in the output $this->adm_commands_included = false; $this->prevent_access_caching = false; }
/** * execute command */ function &executeCommand() { global $lng, $ilAccess, $ilNavigationHistory, $ilCtrl, $ilLocator, $ilObjDataCache; include_once "./Services/Object/classes/class.ilObjectGUI.php"; include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $lng->loadLanguageModule("content"); $obj_id = ilObject::_lookupObjectId($_GET['ref_id']); // add entry to navigation history if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) { include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php"; $this->offline_mode = ilObjSAHSLearningModuleAccess::_lookupUserIsOfflineMode($obj_id); if (!ilObjSAHSLearningModuleAccess::_lookupEditable($obj_id)) { $ilNavigationHistory->addItem($_GET["ref_id"], "ilias.php?cmd=infoScreen&baseClass=ilSAHSPresentationGUI&ref_id=" . $_GET["ref_id"], "lm"); } } include_once 'Services/Payment/classes/class.ilPaymentObject.php'; if (ilPaymentObject::_requiresPurchaseToAccess($_GET['ref_id'], $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) { $ilLocator->addRepositoryItems(); $ilLocator->addItem($ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($_GET['ref_id'])), 'ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=' . $_GET['ref_id'], '', $_GET['ref_id'], 'sahs'); $this->tpl->setLocator(); $this->tpl->getStandardTemplate(); include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php'; $this->ctrl->setReturn($this, ''); $pp_gui = new ilShopPurchaseGUI($_GET['ref_id']); $this->ctrl->forwardCommand($pp_gui); $this->tpl->show(); exit; } $next_class = $this->ctrl->getNextClass($this); $cmd = $this->ctrl->getCmd(); $type = ilObjSAHSLearningModule::_lookupSubType($obj_id); if ($cmd == "downloadCertificate") { require_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMPresentationGUI.php"; $scorm_gui = new ilSCORMPresentationGUI(); $ret =& $this->ctrl->forwardCommand($scorm_gui); } if (substr($cmd, 0, 11) == "offlineMode" || $this->offline_mode) { $next_class = "ilscormofflinemodegui"; } switch ($type) { case "scorm2004": include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php"; $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false); break; case "scorm": include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php"; $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false); break; case "aicc": include_once "./Modules/ScormAicc/classes/class.ilObjAICCLearningModuleGUI.php"; $this->slm_gui = new ilObjAICCLearningModuleGUI("", $_GET["ref_id"], true, false); break; case "hacp": include_once "./Modules/ScormAicc/classes/class.ilObjHACPLearningModuleGUI.php"; $this->slm_gui = new ilObjHACPLearningModuleGUI("", $_GET["ref_id"], true, false); break; } if ($next_class != "ilinfoscreengui" && $cmd != "infoScreen" && $next_class != "ilscormofflinemodegui" && $next_class != "illearningprogressgui") { include_once "./Services/License/classes/class.ilLicense.php"; ilLicense::_noteAccess($obj_id, "sahs", $_GET["ref_id"]); switch ($type) { case "scorm2004": $this->ctrl->setCmdClass("ilscorm13player"); $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false); break; case "scorm": $this->ctrl->setCmdClass("ilscormpresentationgui"); $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false); break; case "aicc": $this->ctrl->setCmdClass("ilaiccpresentationgui"); break; case "hacp": $this->ctrl->setCmdClass("ilhacppresentationgui"); break; } $next_class = $this->ctrl->getNextClass($this); } switch ($next_class) { case "ilinfoscreengui": $ret =& $this->outputInfoScreen(); break; case "ilscorm13player": require_once "./Modules/Scorm2004/classes/ilSCORM13Player.php"; $scorm_gui = new ilSCORM13Player(); $ret =& $this->ctrl->forwardCommand($scorm_gui); break; case "ilscormpresentationgui": require_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMPresentationGUI.php"; $scorm_gui = new ilSCORMPresentationGUI(); $ret =& $this->ctrl->forwardCommand($scorm_gui); break; case "ilaiccpresentationgui": require_once "./Modules/ScormAicc/classes/AICC/class.ilAICCPresentationGUI.php"; $aicc_gui = new ilAICCPresentationGUI(); $ret =& $this->ctrl->forwardCommand($aicc_gui); break; case "ilhacppresentationgui": require_once "./Modules/ScormAicc/classes/HACP/class.ilHACPPresentationGUI.php"; $hacp_gui = new ilHACPPresentationGUI(); $ret =& $this->ctrl->forwardCommand($hacp_gui); break; case "illearningprogressgui": $this->setInfoTabs("learning_progress"); include_once "./Services/Tracking/classes/class.ilLearningProgressGUI.php"; $new_gui =& new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $_GET['ref_id']); $this->ctrl->forwardCommand($new_gui); $this->tpl->show(); break; case "ilscormofflinemodegui": include_once "./Modules/ScormAicc/classes/class.ilSCORMOfflineModeGUI.php"; $new_gui =& new ilSCORMOfflineModeGUI($type); $this->ctrl->forwardCommand($new_gui); break; default: $this->{$cmd}(); } }