public function getPlayer() { global $ilUser, $lng, $ilias, $ilSetting; // player basic config data $initSuspendData = null; $initAdlactData = null; if ($this->slm->getSequencing() == true) { $initSuspendData = json_decode($this->getSuspendDataInit()); $initAdlactData = json_decode($this->getADLActDataInit()); $initGlobalobjData = $this->readGObjectiveInit(); } $config = $this->getConfigForPlayer(); //session if ($this->slm->getSession()) { // $session_timeout = (int)($ilias->ini->readVariable("session","expire"))/2; $session_timeout = (int) ilSession::getIdleValue() / 2; } else { $session_timeout = 0; } $config['session_ping'] = $session_timeout; //url strings $store_url = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=cmi&ref_id=' . $_GET["ref_id"]; $unload_url = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=scormPlayerUnload&ref_id=' . $_GET["ref_id"]; if ($this->slm->getSessionDeactivated()) { $store_url = 'storeScorm2004.php?package_id=' . $this->packageId . '&ref_id=' . $_GET["ref_id"] . '&client_id=' . $this->ilias->client_id . '&do=store'; $unload_url = 'storeScorm2004.php?package_id=' . $this->packageId . '&ref_id=' . $_GET["ref_id"] . '&client_id=' . $this->ilias->client_id . '&do=unload'; } $config['cp_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=cp&ref_id=' . $_GET["ref_id"]; $config['cmi_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=cmi&ref_id=' . $_GET["ref_id"]; $config['store_url'] = $store_url; $config['get_adldata_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=getSharedData&ref_id=' . $_GET["ref_id"]; $config['set_adldata_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=setSharedData&ref_id=' . $_GET["ref_id"]; $config['adlact_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=adlact&ref_id=' . $_GET["ref_id"]; $config['specialpage_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=specialPage&ref_id=' . $_GET["ref_id"]; $config['suspend_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=suspend&ref_id=' . $_GET["ref_id"]; $config['get_suspend_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=getSuspend&ref_id=' . $_GET["ref_id"]; //next 2 lines could be deleted later $config['gobjective_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=gobjective&ref_id=' . $_GET["ref_id"]; $config['get_gobjective_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=getGobjective&ref_id=' . $_GET["ref_id"]; $config['ping_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=pingSession&ref_id=' . $_GET["ref_id"]; $config['scorm_player_unload_url'] = $unload_url; $config['post_log_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=postLogEntry&ref_id=' . $_GET["ref_id"]; $config['livelog_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=liveLogContent&ref_id=' . $_GET["ref_id"]; $config['package_url'] = $this->getDataDirectory() . "/"; //editor $config['envEditor'] = $this->envEditor; //debug $config['debug'] = $this->slm->getDebug(); $config['debug_fields'] = $this->getDebugValues(); $config['debug_fields_test'] = $this->getDebugValues(true); //language strings $langstrings['btnStart'] = $lng->txt('scplayer_start'); $langstrings['btnExit'] = $lng->txt('scplayer_exit'); $langstrings['btnExitAll'] = $lng->txt('scplayer_exitall'); $langstrings['btnSuspendAll'] = $lng->txt('scplayer_suspendall'); $langstrings['btnPrevious'] = $lng->txt('scplayer_previous'); $langstrings['btnContinue'] = $lng->txt('scplayer_continue'); $langstrings['btnhidetree'] = $lng->txt('scplayer_hidetree'); $langstrings['btnshowtree'] = $lng->txt('scplayer_showtree'); $langstrings['linkexpandTree'] = $lng->txt('scplayer_expandtree'); $langstrings['linkcollapseTree'] = $lng->txt('scplayer_collapsetree'); $config['langstrings'] = $langstrings; //template variables //$this->tpl = new ilTemplate("tpl.scorm2004.player.html", false, false, "Modules/Scorm2004"); $this->tpl = new ilTemplate("tpl.scorm2004.player.html", true, true, "Modules/Scorm2004"); // include ilias rte css, if given $rte_css = $this->slm->getDataDirectory() . "/ilias_css_4_2/css/style.css"; if (is_file($rte_css)) { $this->tpl->setCurrentBlock("rte_css"); $this->tpl->setVariable("RTE_CSS", $rte_css); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable('JSON_LANGSTRINGS', json_encode($langstrings)); include_once "./Services/YUI/classes/class.ilYuiUtil.php"; $this->tpl->setVariable('YUI_PATH', ilYuiUtil::getLocalPath()); $this->tpl->setVariable('TREE_JS', "./Services/UIComponent/NestedList/js/ilNestedList.js"); $this->tpl->setVariable($langstrings); $this->tpl->setVariable('DOC_TITLE', 'ILIAS SCORM 2004 Player'); if ($this->slm->getIe_compatibility()) { $this->tpl->setVariable('IE_COMPATIBILITY', '<meta http-equiv="X-UA-Compatible" content="IE=7" />'); } $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); $this->tpl->setVariable('INIT_CP_DATA', json_encode(json_decode($this->getCPDataInit()))); $this->tpl->setVariable('INIT_CMI_DATA', json_encode($this->getCMIData($this->userId, $this->packageId))); $this->tpl->setVariable('INIT_ADLACT_DATA', json_encode($initAdlactData)); $this->tpl->setVariable('INIT_GLOBALOBJ_DATA', json_encode($initGlobalobjData)); $this->tpl->setVariable('JS_DATA', json_encode($config)); list($tsfrac, $tsint) = explode(' ', microtime()); $this->tpl->setVariable('TIMESTAMP', sprintf('%d%03d', $tsint, 1000 * (double) $tsfrac)); $this->tpl->setVariable('BASE_DIR', './Modules/Scorm2004/'); $this->tpl->setVariable('TXT_COLLAPSE', $lng->txt('scplayer_collapsetree')); if ($this->slm->getDebug()) { $this->tpl->setVariable('TXT_DEBUGGER', $lng->txt('scplayer_debugger')); $this->tpl->setVariable('DEBUG_URL', "PopupCenter('ilias.php?baseClass=ilSAHSPresentationGUI&cmd=debugGUI&ref_id=" . $_GET["ref_id"] . "','Debug',800,600);"); } else { $this->tpl->setVariable('TXT_DEBUGGER', ''); $this->tpl->setVariable('DEBUG_URL', ''); } //set icons path $this->tpl->setVariable('INLINE_CSS', ilSCORM13Player::getInlineCss()); //include scripts if ($this->slm->getCacheDeactivated()) { $this->tpl->setVariable('JS_SCRIPTS', 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=getRTEjs&ref_id=' . $_GET["ref_id"]); } else { $this->tpl->setVariable('JS_SCRIPTS', './Modules/Scorm2004/scripts/buildrte/rte-min.js'); } //disable top menu if ($this->slm->getNoMenu() == "y") { $this->tpl->setVariable("VAL_DISPLAY", "style=\"display:none;\""); } else { $this->tpl->setVariable("VAL_DISPLAY", ""); } //check for max_attempts and raise error if max_attempts is exceeded if ($this->get_max_attempts() != 0) { if ($this->get_actual_attempts() >= $this->get_max_attempts()) { header('Content-Type: text/html; charset=utf-8'); echo $lng->txt("cont_sc_max_attempt_exceed"); exit; } } //count attempt $this->increase_attemptAndsave_module_version(); $this->resetSharedData(); $this->tpl->show("DEFAULT", false); }
function finishTestCmd($requires_confirmation = true) { global $ilUser, $ilAuth; unset($_SESSION["tst_next"]); $active_id = $this->testSession->getActiveId(); $actualpass = $this->object->_getPass($active_id); $allObligationsAnswered = ilObjTest::allObligationsAnswered($this->testSession->getTestId(), $active_id, $actualpass); /* * The following "endgames" are possible prior to actually finishing the test: * - Obligations (Ability to finish the test.) * If not all obligatory questions are answered, the user is presented a list * showing the deficits. * - Examview (Will to finish the test.) * With the examview, the participant can review all answers given in ILIAS or a PDF prior to * commencing to the finished test. * - Last pass allowed (Reassuring the will to finish the test.) * If passes are limited, on the last pass, an additional confirmation is to be displayed. */ // Obligations fulfilled? redirectQuestion : one or the other summary -> no finish if ($this->object->areObligationsEnabled() && !$allObligationsAnswered) { if ($this->object->getListOfQuestions()) { $_GET['activecommand'] = 'summary_obligations'; } else { $_GET['activecommand'] = 'summary_obligations_only'; } $this->redirectQuestionCmd(); return; } // Examview enabled & !reviewed & requires_confirmation? test_submission_overview (review gui) if ($this->object->getEnableExamview() && !isset($_GET['reviewed']) && $requires_confirmation) { $_GET['activecommand'] = 'test_submission_overview'; $this->redirectQuestionCmd(); return; } // Last try in limited tries & !confirmed if ($requires_confirmation && $actualpass == $this->object->getNrOfTries() - 1) { // show confirmation page return $this->confirmFinishTestCmd(); } // Last try in limited tries & confirmed? if ($actualpass == $this->object->getNrOfTries() - 1 && !$requires_confirmation) { $ilAuth->setIdle(ilSession::getIdleValue(), false); $ilAuth->setExpire(0); switch ($this->object->getMailNotification()) { case 1: $this->object->sendSimpleNotification($active_id); break; case 2: $this->object->sendAdvancedNotification($active_id); break; } } // Non-last try finish if (!$_SESSION['tst_pass_finish']) { if (!$_SESSION['tst_pass_finish']) { $_SESSION['tst_pass_finish'] = 1; } if ($this->object->getMailNotificationType() == 1) { switch ($this->object->getMailNotification()) { case 1: $this->object->sendSimpleNotification($active_id); break; case 2: $this->object->sendAdvancedNotification($active_id); break; } } } // no redirect request loops after test pass finished tasks has been performed $this->performTestPassFinishedTasks($actualpass); $this->testSession->setLastFinishedPass($this->testSession->getPass()); $this->testSession->increaseTestPass(); $this->ctrl->redirect($this, 'afterTestPassFinished'); }
/** * @param int $sessionId * @return string */ public function getJsonResponse($sessionId) { /** * @var $ilDB ilDB * @var $ilUser ilObjUser * @var $ilClientIniFile ilIniFile * @var $lng ilLanguage */ global $ilDB, $ilUser, $lng, $ilClientIniFile; include_once 'Services/JSON/classes/class.ilJsonUtil.php'; $response = array('remind' => false); $res = $ilDB->queryF(' SELECT expires, user_id, data FROM usr_session WHERE session_id = %s', array('text'), array($sessionId)); $num = $ilDB->numRows($res); if ($num > 1) { $response['message'] = 'The determined session data is not unique.'; return ilJsonUtil::encode($response); } if ($num == 0) { $response['message'] = 'ILIAS could not determine the session data.'; return ilJsonUtil::encode($response); } $data = $ilDB->fetchAssoc($res); if (!$this->isAuthenticatedUsrSession($data)) { $response['message'] = 'ILIAS could not fetch the session data or the corresponding user is no more authenticated.'; return ilJsonUtil::encode($response); } $session = ilUtil::unserializeSession($data['data']); $idletime = null; foreach ((array) $session as $key => $entry) { if (strpos($key, '_auth__') === 0) { $idletime = $entry['idle']; break; } } if (null === $idletime) { $response['message'] = 'ILIAS could not determine the idle time from the session data.'; return ilJsonUtil::encode($response); } $expiretime = $idletime + ilSession::getIdleValue(); if ($this->isSessionAlreadyExpired($expiretime)) { $response['message'] = 'The session is already expired. The client should have received a remind command before.'; return ilJsonUtil::encode($response); } /** * @var $user ilObjUser */ $ilUser = ilObjectFactory::getInstanceByObjId($data['user_id']); include_once './Services/Authentication/classes/class.ilSessionReminder.php'; $remind_time = $expiretime - max(ilSessionReminder::MIN_LEAD_TIME, (double) $ilUser->getPref('session_reminder_lead_time')) * 60; if ($remind_time > time()) { // session will expire in <lead_time> minutes $response['message'] = 'Lead time not reached, yet. Current time: ' . date('Y-m-d H:i:s', time()) . ', Reminder time: ' . date('Y-m-d H:i:s', $remind_time); return ilJsonUtil::encode($response); } $dateTime = new ilDateTime($expiretime, IL_CAL_UNIX); switch ($ilUser->getTimeFormat()) { case ilCalendarSettings::TIME_FORMAT_12: $formatted_expiration_time = $dateTime->get(IL_CAL_FKT_DATE, 'g:ia', $ilUser->getTimeZone()); break; case ilCalendarSettings::TIME_FORMAT_24: default: $formatted_expiration_time = $dateTime->get(IL_CAL_FKT_DATE, 'H:i', $ilUser->getTimeZone()); break; } $response = array('extend_url' => './ilias.php?baseClass=ilPersonalDesktopGUI', 'txt' => str_replace("\\n", '%0A', sprintf($lng->txt('session_reminder_alert'), ilFormat::_secondsToString($expiretime - time()), $formatted_expiration_time, $ilClientIniFile->readVariable('client', 'name') . ' | ' . ilUtil::_getHttpPath())), 'remind' => true); return ilJsonUtil::encode($response); }
/** * Finish the test * * Finish the test * * @access public */ function finishTest($confirm = true) { global $ilUser; global $ilias; global $ilAuth; unset($_SESSION["tst_next"]); $active_id = $this->object->getTestSession()->getActiveId(); $actualpass = $this->object->_getPass($active_id); $allObligationsAnswered = ilObjTest::allObligationsAnswered($this->object->getTestSession()->getTestId(), $active_id, $actualpass); if ($this->object->areObligationsEnabled() && !$allObligationsAnswered) { if ($this->object->getListOfQuestions()) { $_GET['activecommand'] = 'summary_obligations'; } else { $_GET['activecommand'] = 'summary_obligations_only'; } $this->redirectQuestion(); return; } if ($actualpass == $this->object->getNrOfTries() - 1 && !$confirm) { $this->object->setActiveTestSubmitted($ilUser->getId()); $ilAuth->setIdle(ilSession::getIdleValue(), false); $ilAuth->setExpire(0); switch ($this->object->getMailNotification()) { case 1: $this->object->sendSimpleNotification($active_id); break; case 2: $this->object->sendAdvancedNotification($active_id); break; } } if ($confirm && $actualpass == $this->object->getNrOfTries() - 1) { if ($this->object->canShowSolutionPrintview($ilUser->getId())) { $template = new ilTemplate("tpl.il_as_tst_finish_navigation.html", TRUE, TRUE, "Modules/Test"); $template->setVariable("BUTTON_FINISH", $this->lng->txt("btn_next")); $template->setVariable("BUTTON_CANCEL", $this->lng->txt("btn_previous")); $template_top = new ilTemplate("tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE, "Modules/Test"); $template_top->setCurrentBlock("button_print"); $template_top->setVariable("BUTTON_PRINT", $this->lng->txt("print")); $template_top->parseCurrentBlock(); $this->showListOfAnswers($active_id, NULL, $template_top->get(), $template->get()); return; } else { // show confirmation page return $this->confirmFinishTest(); } } if (!$_SESSION['tst_pass_finish']) { if (!$_SESSION['tst_pass_finish']) { $_SESSION['tst_pass_finish'] = 1; } if ($this->object->getMailNotificationType() == 1) { switch ($this->object->getMailNotification()) { case 1: $this->object->sendSimpleNotification($active_id); break; case 2: $this->object->sendAdvancedNotification($active_id); break; } } $this->object->getTestSession()->increaseTestPass(); } $this->redirectBack(); }
/** * initialises $ilAuth */ function _initAuth() { global $ilAuth, $ilSetting, $ilDB, $ilClientIniFile, $ilBench; $user_auth_mode = false; $ilBench->start('Auth', 'initAuth'); // get default auth mode //$default_auth_mode = $this->getSetting("auth_mode"); define("AUTH_DEFAULT", $ilSetting->get("auth_mode") ? $ilSetting->get("auth_mode") : AUTH_LOCAL); // determine authentication method if no session is found and username & password is posted // does this if statement make any sense? we enter this block nearly everytime. if (empty($_SESSION) || (!isset($_SESSION['_authsession']['registered']) || $_SESSION['_authsession']['registered'] !== true)) { // no sesssion found if (isset($_POST['username']) and $_POST['username'] != '' and $_POST['password'] != '' or isset($_GET['ecs_hash']) or isset($_GET['ecs_hash_url']) or isset($_POST['oid_username']) or isset($_GET['oid_check_status'])) { $user_auth_mode = ilAuthUtils::_getAuthModeOfUser($_POST['username'], $_POST['password'], $ilDB); if ($user_auth_mode == AUTH_CAS && $ilSetting->get("cas_allow_local")) { $user_auth_mode = AUTH_LOCAL; } if ($user_auth_mode == AUTH_SOAP && $ilSetting->get("soap_auth_allow_local")) { $user_auth_mode = AUTH_LOCAL; } if ($user_auth_mode == AUTH_SHIBBOLETH && $ilSetting->get("shib_auth_allow_local")) { $user_auth_mode = AUTH_LOCAL; } } else { if ($_POST['auth_mode'] == AUTH_APACHE) { $user_auth_mode = AUTH_APACHE; } } } // to do: other solution? if (!$ilSetting->get("soap_auth_active") && $user_auth_mode == AUTH_SOAP) { $user_auth_mode = AUTH_LOCAL; } if ($ilSetting->get("cas_active") && $_GET['forceCASLogin']) { ilAuthFactory::setContext(ilAuthFactory::CONTEXT_CAS); $user_auth_mode = AUTH_CAS; } if ($ilSetting->get("apache_active") && $user_auth_mode == AUTH_APACHE) { ilAuthFactory::setContext(ilAuthFactory::CONTEXT_APACHE); $user_auth_mode = AUTH_APACHE; } // BEGIN WebDAV: Share session between browser and WebDAV client. // The realm is needed to support a common session between Auth_HTTP and Auth. // It also helps us to distinguish between parallel sessions run on different clients. // Common session only works if we use a common session name starting with "_authhttp". // We must use the "_authttp" prefix, because it is hardcoded in the session name of // class Auth_HTTP. // Whenever we use Auth_HTTP, we need to explicitly switch off "sessionSharing", because // it interfers with the session mechanism of the other Auth modules. If we would // keep this switched on, then users could steal each others session, which would cause // a major security breach. // Note: The realm and sessionName used here, must be the same as in // class ilBaseAuthentication. Otherwise, Soap clients won't be able to log // in to ILIAS. $realm = CLIENT_ID; //$this->writelog('ilias.php realm='.$realm); // END WebDAV: Share session between browser and WebDAV client. //var_dump($_SESSION); //echo "1-".$ilSetting->get("soap_auth_active")."-"; // if soap authentication activated and soap credentials given if ($ilSetting->get("soap_auth_active") && !empty($_GET["ext_uid"]) && !empty($_GET["soap_pw"]) || $user_auth_mode == AUTH_SOAP) { define('AUTH_CURRENT', AUTH_SOAP); } else { if ($ilSetting->get("shib_active") && $_SERVER[$ilSetting->get("shib_login")]) { define("AUTH_CURRENT", AUTH_SHIBBOLETH); } else { define("AUTH_CURRENT", $user_auth_mode); } } //var_dump($_SESSION); // Determine the authentication method to use if (defined("WebDAV_Authentication") && WebDAV_Authentication == 'HTTP') { // Since WebDAV clients create the login form by // themselves, we can not provide buttons on the form for // choosing an authentication method. // If the user is already logged in, we continue using // the current authentication method. If the user is // not logged in yet, we use the "multiple authentication" // method using a predefined sequence of authentication methods. $authmode = AUTH_CURRENT ? AUTH_CURRENT : AUTH_MULTIPLE; } else { $authmode = AUTH_CURRENT; } //var_dump($authmode); // if no auth mode selected AND default mode is AUTH_APACHE then use it... if ($authmode == null && AUTH_DEFAULT == AUTH_APACHE) { $authmode = AUTH_APACHE; } switch ($authmode) { case AUTH_LDAP: include_once './Services/LDAP/classes/class.ilAuthContainerLDAP.php'; $ilAuth = ilAuthFactory::factory(new ilAuthContainerLDAP()); break; case AUTH_RADIUS: include_once './Services/Radius/classes/class.ilAuthContainerRadius.php'; $ilAuth = ilAuthFactory::factory(new ilAuthContainerRadius()); break; case AUTH_SHIBBOLETH: // build option string for SHIB::Auth $auth_params = array(); $auth_params['sessionName'] = "_authhttp" . md5($realm); $ilAuth = new ShibAuth($auth_params, true); break; case AUTH_CAS: include_once './Services/CAS/classes/class.ilAuthContainerCAS.php'; $ilAuth = ilAuthFactory::factory(new ilAuthContainerCAS()); break; case AUTH_SOAP: include_once './Services/SOAPAuth/classes/class.ilAuthContainerSOAP.php'; $ilAuth = ilAuthFactory::factory(new ilAuthContainerSOAP()); break; case AUTH_MULTIPLE: include_once './Services/Authentication/classes/class.ilAuthContainerMultiple.php'; $ilAuth = ilAuthFactory::factory(new ilAuthContainerMultiple()); break; case AUTH_ECS: include_once './Services/WebServices/ECS/classes/class.ilAuthContainerECS.php'; $ilAuth = ilAuthFactory::factory(new ilAuthContainerECS()); break; case AUTH_OPENID: include_once './Services/OpenId/classes/class.ilAuthContainerOpenId.php'; $ilAuth = ilAuthFactory::factory(new ilAuthContainerOpenId()); break; case AUTH_INACTIVE: require_once './Services/Authentication/classes/class.ilAuthInactive.php'; $ilAuth = new ilAuthInactive(AUTH_MODE_INACTIVE); break; case AUTH_APACHE: include_once './Services/AuthApache/classes/class.ilAuthContainerApache.php'; ilAuthFactory::setContext(ilAuthFactory::CONTEXT_APACHE); $ilAuth = ilAuthFactory::factory(new ilAuthContainerApache()); break; // begin-patch auth_plugin // begin-patch auth_plugin case AUTH_LOCAL: global $ilLog; include_once './Services/Database/classes/class.ilAuthContainerMDB2.php'; $ilAuth = ilAuthFactory::factory(new ilAuthContainerMDB2()); break; default: // check for plugin if ($authmode) { foreach (self::getAuthPlugins() as $pl) { $container = $pl->getContainer($authmode); if ($container instanceof Auth_Container) { $GLOBALS['ilLog']->write(__METHOD__ . ' Using plugin authentication with auth_mode ' . $authmode); $ilAuth = ilAuthFactory::factory($container); break 2; } } } #$GLOBALS['ilLog']->write(__METHOD__.' Using default authentication'); // default for logged in users include_once './Services/Database/classes/class.ilAuthContainerMDB2.php'; $ilAuth = ilAuthFactory::factory(new ilAuthContainerMDB2()); break; // end-patch auth_plugin } // Due to a bug in Pear Auth_HTTP, we can't use idle time // with WebDAV clients. If we used it, users could never log // back into ILIAS once their session idled out. :( if (!defined("WebDAV_Authentication") || WebDAV_Authentication != 'HTTP') { $ilAuth->setIdle(ilSession::getIdleValue(), false); } $ilAuth->setExpire(0); ini_set("session.cookie_lifetime", "0"); //echo "-".get_class($ilAuth)."-"; $GLOBALS['ilAuth'] =& $ilAuth; ilSessionControl::checkExpiredSession(); $ilBench->stop('Auth', 'initAuth'); }
function finishTestCmd($requires_confirmation = true) { global $ilUser, $ilAuth; unset($_SESSION["tst_next"]); $active_id = $this->testSession->getActiveId(); $actualpass = $this->object->_getPass($active_id); $allObligationsAnswered = ilObjTest::allObligationsAnswered($this->testSession->getTestId(), $active_id, $actualpass); /* * The following "endgames" are possible prior to actually finishing the test: * - Obligations (Ability to finish the test.) * If not all obligatory questions are answered, the user is presented a list * showing the deficits. * - Examview (Will to finish the test.) * With the examview, the participant can review all answers given in ILIAS or a PDF prior to * commencing to the finished test. * - Last pass allowed (Reassuring the will to finish the test.) * If passes are limited, on the last pass, an additional confirmation is to be displayed. */ // Obligations fulfilled? redirectQuestion : one or the other summary -> no finish if ($this->object->areObligationsEnabled() && !$allObligationsAnswered) { if ($this->object->getListOfQuestions()) { $_GET['activecommand'] = 'summary_obligations'; } else { $_GET['activecommand'] = 'summary_obligations_only'; } $this->redirectQuestion(); return; } // Examview enabled & !reviewed & requires_confirmation? test_submission_overview (review gui) if ($this->object->getEnableExamview() && !isset($_GET['reviewed']) && $requires_confirmation) { $_GET['activecommand'] = 'test_submission_overview'; $this->redirectQuestionCmd(); return; } // Last try in limited tries & !confirmed if ($requires_confirmation && $actualpass == $this->object->getNrOfTries() - 1) { if ($this->object->canShowSolutionPrintview($ilUser->getId())) { $template = new ilTemplate("tpl.il_as_tst_finish_navigation.html", TRUE, TRUE, "Modules/Test"); $template->setVariable("BUTTON_FINISH", $this->lng->txt("btn_next")); $template->setVariable("BUTTON_CANCEL", $this->lng->txt("btn_previous")); $template_top = new ilTemplate("tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE, "Modules/Test"); $template_top->setCurrentBlock("button_print"); $template_top->setVariable("BUTTON_PRINT", $this->lng->txt("print")); $template_top->parseCurrentBlock(); $this->showListOfAnswers($active_id, NULL, $template_top->get(), $template->get()); return; } else { // show confirmation page return $this->confirmFinishTestCmd(); } } // Last try in limited tries & confirmed? if ($actualpass == $this->object->getNrOfTries() - 1 && !$requires_confirmation) { $this->object->setActiveTestSubmitted($ilUser->getId()); $ilAuth->setIdle(ilSession::getIdleValue(), false); $ilAuth->setExpire(0); switch ($this->object->getMailNotification()) { case 1: $this->object->sendSimpleNotification($active_id); break; case 2: $this->object->sendAdvancedNotification($active_id); break; } } // Non-last try finish if (!$_SESSION['tst_pass_finish']) { if (!$_SESSION['tst_pass_finish']) { $_SESSION['tst_pass_finish'] = 1; } if ($this->object->getMailNotificationType() == 1) { switch ($this->object->getMailNotification()) { case 1: $this->object->sendSimpleNotification($active_id); break; case 2: $this->object->sendAdvancedNotification($active_id); break; } } $this->testSession->increaseTestPass(); ilSession::set('passincreased', $actualpass); } if ($this->object->getEnableArchiving()) { $this->archiveParticipantSubmission($active_id, $actualpass); } /** @var $ilPluginAdmin ilPluginAdmin */ global $ilPluginAdmin, $ilCtrl; if ($this->object->getSignSubmission() && count($ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, 'Test', 'tsig')) != 0) { $key = 'signed_' . $active_id . '_' . $actualpass; if (ilSession::get('passincreased') != null) { $key = 'signed_' . $active_id . '_' . ilSession::get('passincreased'); } $val = ilSession::get($key); if (is_null($val)) { /** @var $ilCtrl ilCtrl */ $ilCtrl->redirectByClass('ilTestSignatureGUI', 'invokeSignaturePlugin'); } } // Redirect after test $redirection_mode = $this->object->getRedirectionMode(); $redirection_url = $this->object->getRedirectionUrl(); if ($redirection_url && $redirection_mode && !$this->object->canViewResults()) { if ($redirection_mode == REDIRECT_KIOSK) { if ($this->object->getKioskMode()) { ilUtil::redirect($redirection_url); } } else { ilUtil::redirect($redirection_url); } } $this->redirectBackCmd(); }