/**
  * creates and returns an instance of a test sequence
  * that corresponds to the current test mode
  * 
  * @param integer $activeId
  * @return ilTestSession|ilTestSessionDynamicQuestionSet
  */
 public function getSession($activeId = null)
 {
     global $ilUser;
     if (self::$testSession === null) {
         switch ($this->testOBJ->getQuestionSetType()) {
             case ilObjTest::QUESTION_SET_TYPE_FIXED:
             case ilObjTest::QUESTION_SET_TYPE_RANDOM:
                 global $ilUser;
                 require_once 'Modules/Test/classes/class.ilTestSession.php';
                 self::$testSession = new ilTestSession();
                 break;
             case ilObjTest::QUESTION_SET_TYPE_DYNAMIC:
                 require_once 'Modules/Test/classes/class.ilTestSessionDynamicQuestionSet.php';
                 self::$testSession = new ilTestSessionDynamicQuestionSet();
                 break;
         }
         self::$testSession->setRefId($this->testOBJ->getRefId());
         self::$testSession->setTestId($this->testOBJ->getTestId());
         if ($activeId) {
             self::$testSession->loadFromDb($activeId);
         } else {
             self::$testSession->loadTestSession($this->testOBJ->getTestId(), $ilUser->getId(), $_SESSION["tst_access_code"][$this->testOBJ->getTestId()]);
         }
     }
     return self::$testSession;
 }
Exemplo n.º 2
0
 /**
  * @todo: Björn, we also need to handle the anonymous user here
  * @param integer $userId
  * @return ilTestSession|ilTestSessionDynamicQuestionSet
  */
 public function getSessionByUserId($userId)
 {
     if (!isset($this->testSession[$this->buildCacheKey($userId)])) {
         $testSession = $this->getNewTestSessionObject();
         $testSession->setRefId($this->testOBJ->getRefId());
         $testSession->setTestId($this->testOBJ->getTestId());
         $testSession->loadTestSession($this->testOBJ->getTestId(), $userId);
         $this->testSession[$this->buildCacheKey($userId)] = $testSession;
     }
     return $this->testSession[$this->buildCacheKey($userId)];
 }
 private function removeStagedQuestions()
 {
     $query = 'SELECT * FROM tst_rnd_cpy WHERE tst_fi = %s';
     $res = $this->db->queryF($query, array('integer'), array($this->testOBJ->getTestId()));
     while ($row = $this->db->fetchAssoc($res)) {
         $question = assQuestion::_instanciateQuestion($row['qst_fi']);
         if ($question instanceof assQuestion) {
             $question->delete($row['qst_fi']);
         } else {
             $GLOBALS['ilLog']->writeWarning("could not delete staged random question (ref={$this->testOBJ->getRefId()} / qst={$row['qst_fi']})");
         }
     }
     $query = "DELETE FROM tst_rnd_cpy WHERE tst_fi = %s";
     $this->db->manipulateF($query, array('integer'), array($this->testOBJ->getTestId()));
 }
 /**
  * Command Execution
  */
 public function executeCommand()
 {
     // allow only write access
     if (!$this->access->checkAccess("write", "", $this->testOBJ->getRefId())) {
         ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
         $this->ctrl->redirectByClass('ilObjTestGUI', "infoScreen");
     }
     // activate corresponding tab (auto activation does not work in ilObjTestGUI-Tabs-Salad)
     $this->tabs->activateTab('assQuestions');
     // process command
     $nextClass = $this->ctrl->getNextClass();
     switch ($nextClass) {
         default:
             $cmd = $this->ctrl->getCmd(self::CMD_SHOW_FORM) . 'Cmd';
             $this->{$cmd}();
     }
 }
 /**
  * removes all question set config related data for cloned/copied test
  *
  * @param ilObjTest $cloneTestOBJ
  */
 public function cloneQuestionSetRelatedData($cloneTestOBJ)
 {
     global $ilLog;
     require_once 'Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
     require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
     $cwo = ilCopyWizardOptions::_getInstance($cloneTestOBJ->getId());
     foreach ($this->questions as $key => $question_id) {
         $question = assQuestion::_instanciateQuestion($question_id);
         $cloneTestOBJ->questions[$key] = $question->duplicate(true, null, null, null, $cloneTestOBJ->getId());
         $original_id = assQuestion::_getOriginalId($question_id);
         $question = assQuestion::_instanciateQuestion($cloneTestOBJ->questions[$key]);
         $question->saveToDb($original_id);
         // Save the mapping of old question id <-> new question id
         // This will be used in class.ilObjCourse::cloneDependencies to copy learning objectives
         $originalKey = $this->testOBJ->getRefId() . '_' . $question_id;
         $mappedKey = $cloneTestOBJ->getRefId() . '_' . $cloneTestOBJ->questions[$key];
         $cwo->appendMapping($originalKey, $mappedKey);
         $ilLog->write(__METHOD__ . ": Added mapping {$originalKey} <-> {$mappedKey}");
     }
 }
 public function executeCommand()
 {
     if (!$this->access->checkAccess("write", "", $this->testOBJ->getRefId())) {
         ilUtil::sendFailure($this->lng->txt("cannot_edit_test"), true);
         $this->ctrl->redirectByClass('ilObjTestGUI', "infoScreen");
     }
     if ($this->isAvoidManipulationRedirectRequired()) {
         ilUtil::sendFailure($this->lng->txt("tst_msg_cannot_modify_random_question_set_conf_due_to_part"), true);
         $this->ctrl->redirect($this);
     }
     $this->handleTabs();
     $nextClass = $this->ctrl->getNextClass();
     switch ($nextClass) {
         case 'ilTestRandomQuestionSetPoolDefinitionFormGUI':
             $formGUI = new ilTestRandomQuestionSetPoolDefinitionFormGUI($this->ctrl, $this->lng, $this->testOBJ, $this, $this->questionSetConfig);
             $this->ctrl->forwardCommand($formGUI);
             break;
         default:
             $cmd = $this->ctrl->getCmd(self::CMD_SHOW_GENERAL_CONFIG_FORM) . 'Cmd';
             $this->{$cmd}();
     }
 }
Exemplo n.º 7
0
 /**
  * adds tabs to tab gui object
  *
  * @param ilTabsGUI $tabs_gui
  */
 function getTabs(&$tabs_gui)
 {
     global $ilAccess, $ilUser, $ilHelp;
     if (preg_match('/^ass(.*?)gui$/i', $this->ctrl->getNextClass($this))) {
         return;
     } else {
         if ($this->ctrl->getNextClass($this) == 'ilassquestionpagegui') {
             return;
         }
     }
     $ilHelp->setScreenIdComponent("tst");
     $hidden_tabs = array();
     $template = $this->object->getTemplate();
     if ($template) {
         include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
         $template = new ilSettingsTemplate($template, ilObjAssessmentFolderGUI::getSettingsTemplateConfig());
         $hidden_tabs = $template->getHiddenTabs();
     }
     // for local use in this f*****g sledge hammer method
     $curUserHasWriteAccess = $ilAccess->checkAccess("write", "", $this->ref_id);
     switch ($this->ctrl->getCmdClass()) {
         // no tabs .. no subtabs .. during test pass
         case 'iltestoutputgui':
             // tab handling happens within GUIs
         // tab handling happens within GUIs
         case 'iltestevaluationgui':
         case 'iltestevalobjectiveorientedgui':
             return;
         case 'ilmarkschemagui':
         case 'ilobjtestsettingsgeneralgui':
         case 'ilobjtestsettingsscoringresultsgui':
             if ($curUserHasWriteAccess) {
                 $this->getSettingsSubTabs($hidden_tabs);
             }
             break;
     }
     if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
         require_once 'Services/Link/classes/class.ilLink.php';
         $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
         $tabs_gui->setBackTarget($this->lng->txt('back_to_objective_container'), $courseLink);
     }
     switch ($this->ctrl->getCmd()) {
         case "resume":
         case "previous":
         case "next":
         case "summary":
         case "directfeedback":
         case "finishTest":
         case "outCorrectSolution":
         case "passDetails":
         case "showAnswersOfUser":
         case "outUserResultsOverview":
         case "backFromSummary":
         case "show_answers":
         case "setsolved":
         case "resetsolved":
         case "confirmFinish":
         case "outTestSummary":
         case "outQuestionSummary":
         case "gotoQuestion":
         case "selectImagemapRegion":
         case "confirmSubmitAnswers":
         case "finalSubmission":
         case "postpone":
         case "redirectQuestion":
         case "outUserPassDetails":
         case "checkPassword":
         case "exportCertificate":
         case "finishListOfAnswers":
         case "backConfirmFinish":
         case "showFinalStatement":
             return;
             break;
             /*case "browseForQuestions":
             		case "filter":
             		case "resetFilter":
             		case "resetTextFilter":
             		case "insertQuestions":
             			// #8497: resetfilter is also used in lp
             			if($this->ctrl->getNextClass($this) != "illearningprogressgui")
             			{
             				return $this->getBrowseForQuestionsTab($tabs_gui);
             			}				
             			break;*/
         /*case "browseForQuestions":
         		case "filter":
         		case "resetFilter":
         		case "resetTextFilter":
         		case "insertQuestions":
         			// #8497: resetfilter is also used in lp
         			if($this->ctrl->getNextClass($this) != "illearningprogressgui")
         			{
         				return $this->getBrowseForQuestionsTab($tabs_gui);
         			}				
         			break;*/
         case "scoring":
         case "certificate":
         case "certificateservice":
         case "certificateImport":
         case "certificateUpload":
         case "certificateEditor":
         case "certificateDelete":
         case "certificateSave":
         case "defaults":
         case "deleteDefaults":
         case "addDefaults":
         case "applyDefaults":
         case "inviteParticipants":
         case "searchParticipants":
             if ($curUserHasWriteAccess && in_array($this->ctrl->getCmdClass(), array('ilobjtestgui', 'ilcertificategui'))) {
                 $this->getSettingsSubTabs($hidden_tabs);
             }
             break;
         case "export":
         case "print":
             break;
         case "statistics":
         case "eval_a":
         case "detailedEvaluation":
         case "outEvaluation":
         case "singleResults":
         case "exportEvaluation":
         case "evalUserDetail":
         case "passDetails":
         case "outStatisticsResultsOverview":
         case "statisticsPassDetails":
             $this->getStatisticsSubTabs();
             break;
     }
     if (strcmp(strtolower(get_class($this->object)), "ilobjtest") == 0) {
         // questions tab
         if ($ilAccess->checkAccess("write", "", $this->ref_id) && !in_array('assQuestions', $hidden_tabs)) {
             $force_active = $_GET["up"] != "" || $_GET["down"] != "" ? true : false;
             if (!$force_active) {
                 if ($_GET["browse"] == 1) {
                     $force_active = true;
                 }
             }
             switch ($this->object->getQuestionSetType()) {
                 case ilObjTest::QUESTION_SET_TYPE_FIXED:
                     $target = $this->ctrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'showPage');
                     break;
                 case ilObjTest::QUESTION_SET_TYPE_RANDOM:
                     $target = $this->ctrl->getLinkTargetByClass('ilTestRandomQuestionSetConfigGUI');
                     break;
                 case ilObjTest::QUESTION_SET_TYPE_DYNAMIC:
                     $target = $this->ctrl->getLinkTargetByClass('ilObjTestDynamicQuestionSetConfigGUI');
                     break;
             }
             $tabs_gui->addTarget("assQuestions", $target, array("questions", "createQuestion", "randomselect", "back", "createRandomSelection", "cancelRandomSelect", "insertRandomSelection", "removeQuestions", "moveQuestions", "insertQuestionsBefore", "insertQuestionsAfter", "confirmRemoveQuestions", "cancelRemoveQuestions", "executeCreateQuestion", "cancelCreateQuestion", "addQuestionpool", "saveRandomQuestions", "saveQuestionSelectionMode", "print", "addsource", "removesource", "randomQuestions"), "", "", $force_active);
         }
         // info tab
         if ($ilAccess->checkAccess("read", "", $this->ref_id) && !in_array('info_short', $hidden_tabs)) {
             $tabs_gui->addTarget("info_short", $this->ctrl->getLinkTarget($this, 'infoScreen'), array("infoScreen", "outIntroductionPage", "showSummary", "setAnonymousId", "outUserListOfAnswerPasses", "redirectToInfoScreen"));
         }
         // settings tab
         if ($ilAccess->checkAccess("write", "", $this->ref_id)) {
             if (!in_array('settings', $hidden_tabs)) {
                 $settingsCommands = array("marks", "showMarkSchema", "addMarkStep", "deleteMarkSteps", "addSimpleMarkSchema", "saveMarks", "certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave", "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport", "scoring", "defaults", "addDefaults", "deleteDefaults", "applyDefaults", "inviteParticipants", "saveFixedParticipantsStatus", "searchParticipants", "addParticipants");
                 require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php';
                 $reflection = new ReflectionClass('ilObjTestSettingsGeneralGUI');
                 foreach ($reflection->getConstants() as $name => $value) {
                     if (substr($name, 0, 4) == 'CMD_') {
                         $settingsCommands[] = $value;
                     }
                 }
                 require_once 'Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php';
                 $reflection = new ReflectionClass('ilObjTestSettingsScoringResultsGUI');
                 foreach ($reflection->getConstants() as $name => $value) {
                     if (substr($name, 0, 4) == 'CMD_') {
                         $settingsCommands[] = $value;
                     }
                 }
                 $settingsCommands[] = "";
                 // DO NOT KNOW WHAT THIS IS DOING, BUT IT'S REQUIRED
                 $tabs_gui->addTarget("settings", $this->ctrl->getLinkTargetByClass('ilObjTestSettingsGeneralGUI'), $settingsCommands, array("ilmarkschemagui", "ilobjtestsettingsgeneralgui", "ilobjtestsettingsscoringresultsgui", "ilobjtestgui", "ilcertificategui"));
             }
             // skill service
             if ($this->object->isSkillServiceEnabled() && ilObjTest::isSkillManagementGloballyActivated()) {
                 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentsGUI.php';
                 $link = $this->ctrl->getLinkTargetByClass(array('ilTestSkillAdministrationGUI', 'ilAssQuestionSkillAssignmentsGUI'), ilAssQuestionSkillAssignmentsGUI::CMD_SHOW_SKILL_QUEST_ASSIGNS);
                 $tabs_gui->addTarget('tst_tab_competences', $link, array(), array());
             }
             if (!in_array('participants', $hidden_tabs)) {
                 // participants
                 $tabs_gui->addTarget("participants", $this->ctrl->getLinkTarget($this, 'participants'), array("participants", "saveClientIP", "removeParticipant", "showParticipantAnswersForAuthor", "deleteAllUserResults", "cancelDeleteAllUserData", "deleteSingleUserResults", "outParticipantsResultsOverview", "outParticipantsPassDetails", "showPassOverview", "showUserAnswers", "participantsAction", "showDetailedResults", 'timing', 'timingOverview', 'npResetFilter', 'npSetFilter', 'showTimingForm'), "");
             }
         }
         include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
         if (ilLearningProgressAccess::checkAccess($this->object->getRefId()) && !in_array('learning_progress', $hidden_tabs)) {
             $tabs_gui->addTarget('learning_progress', $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''), '', array('illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui'));
         }
         if ($ilAccess->checkAccess("write", "", $this->ref_id) && !in_array('manscoring', $hidden_tabs)) {
             include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
             $scoring = ilObjAssessmentFolder::_getManualScoring();
             if (count($scoring)) {
                 // scoring tab
                 $tabs_gui->addTarget("manscoring", $this->ctrl->getLinkTargetByClass('ilTestScoringGUI', 'showManScoringParticipantsTable'), array('showManScoringParticipantsTable', 'applyManScoringParticipantsFilter', 'resetManScoringParticipantsFilter', 'showManScoringParticipantScreen', 'showManScoringByQuestionParticipantsTable', 'applyManScoringByQuestionFilter', 'resetManScoringByQuestionFilter', 'saveManScoringByQuestion'), '');
             }
         }
         // Scoring Adjustment
         $setting = new ilSetting('assessment');
         $scoring_adjust_active = (bool) $setting->get('assessment_adjustments_enabled', false);
         if ($ilAccess->checkAccess("write", "", $this->ref_id) && $scoring_adjust_active && !in_array('scoringadjust', $hidden_tabs)) {
             // scoring tab
             $tabs_gui->addTarget("scoringadjust", $this->ctrl->getLinkTargetByClass('ilScoringAdjustmentGUI', 'showquestionlist'), array('showquestionlist', 'savescoringfortest', 'adjustscoringfortest'), '');
         }
         if (($ilAccess->checkAccess("tst_statistics", "", $this->ref_id) || $ilAccess->checkAccess("write", "", $this->ref_id)) && !in_array('statistics', $hidden_tabs)) {
             // statistics tab
             $tabs_gui->addTarget("statistics", $this->ctrl->getLinkTargetByClass("iltestevaluationgui", "outEvaluation"), array("statistics", "outEvaluation", "exportEvaluation", "detailedEvaluation", "eval_a", "evalUserDetail", "passDetails", "outStatisticsResultsOverview", "statisticsPassDetails", "singleResults"), "");
         }
         if ($ilAccess->checkAccess("write", "", $this->ref_id)) {
             if (!in_array('history', $hidden_tabs)) {
                 // history
                 $tabs_gui->addTarget("history", $this->ctrl->getLinkTarget($this, 'history'), "history", "");
             }
             if (!in_array('meta_data', $hidden_tabs)) {
                 // meta data
                 $tabs_gui->addTarget("meta_data", $this->ctrl->getLinkTargetByClass('ilmdeditorgui', 'listSection'), "", "ilmdeditorgui");
             }
             if (!in_array('export', $hidden_tabs)) {
                 // export tab
                 $tabs_gui->addTarget("export", $this->ctrl->getLinkTargetByClass('iltestexportgui', ''), '', array('iltestexportgui'));
             }
         }
         if ($ilAccess->checkAccess("edit_permission", "", $this->ref_id) && !in_array('permissions', $hidden_tabs)) {
             $tabs_gui->addTarget("perm_settings", $this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilpermissiongui'), "perm"), array("perm", "info", "owner"), 'ilpermissiongui');
         }
     }
     if ($this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken()) {
         $hideTabs = array('settings', 'manscoring', 'scoringadjust', 'statistics', 'history', 'export');
         foreach ($hideTabs as $tabId) {
             $tabs_gui->removeTab($tabId);
         }
     }
 }
 protected function isPrivilegedParticipant()
 {
     return $this->rbacsystem->checkAccess('write', $this->testOBJ->getRefId());
 }
 /**
  * adds tabs to tab gui object
  *
  * @param	object		$tabs_gui		ilTabsGUI object
  */
 function getTabs(&$tabs_gui)
 {
     global $ilAccess, $ilUser, $ilHelp;
     if (preg_match('/^ass(.*?)gui$/i', $this->ctrl->getNextClass($this))) {
         return;
     } else {
         if ($this->ctrl->getNextClass($this) == 'ilpageobjectgui') {
             return;
         }
     }
     $ilHelp->setScreenIdComponent("tst");
     $hidden_tabs = array();
     $template = $this->object->getTemplate();
     if ($template) {
         include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
         $template = new ilSettingsTemplate($template, ilObjAssessmentFolderGUI::getSettingsTemplateConfig());
         $hidden_tabs = $template->getHiddenTabs();
     }
     if ($this->ctrl->getNextClass($this) == 'iltestoutputgui') {
         return;
     }
     switch ($this->ctrl->getCmd()) {
         case "resume":
         case "previous":
         case "next":
         case "summary":
         case "directfeedback":
         case "finishTest":
         case "outCorrectSolution":
         case "passDetails":
         case "showAnswersOfUser":
         case "outUserResultsOverview":
         case "backFromSummary":
         case "show_answers":
         case "setsolved":
         case "resetsolved":
         case "confirmFinish":
         case "outTestSummary":
         case "outQuestionSummary":
         case "gotoQuestion":
         case "selectImagemapRegion":
         case "confirmSubmitAnswers":
         case "finalSubmission":
         case "postpone":
         case "redirectQuestion":
         case "outUserPassDetails":
         case "checkPassword":
         case "exportCertificate":
         case "finishListOfAnswers":
         case "backConfirmFinish":
         case "showFinalStatement":
             return;
             break;
         case "browseForQuestions":
         case "filter":
         case "resetFilter":
         case "resetTextFilter":
         case "insertQuestions":
             // #8497: resetfilter is also used in lp
             if ($this->ctrl->getNextClass($this) != "illearningprogressgui") {
                 return $this->getBrowseForQuestionsTab($tabs_gui);
             }
             break;
         case "scoring":
         case "properties":
         case "marks":
         case "saveMarks":
         case "cancelMarks":
         case "addMarkStep":
         case "deleteMarkSteps":
         case "addSimpleMarkSchema":
         case "certificate":
         case "certificateservice":
         case "certificateImport":
         case "certificateUpload":
         case "certificateEditor":
         case "certificateDelete":
         case "certificateSave":
         case "defaults":
         case "deleteDefaults":
         case "addDefaults":
         case "applyDefaults":
         case "inviteParticipants":
         case "searchParticipants":
         case "":
             if ($ilAccess->checkAccess("write", "", $this->ref_id) && (strcmp($this->ctrl->getCmdClass(), "ilobjtestgui") == 0 || strcmp($this->ctrl->getCmdClass(), "ilcertificategui") == 0 || strlen($this->ctrl->getCmdClass()) == 0)) {
                 $this->getSettingsSubTabs($hidden_tabs);
             }
             break;
         case "export":
         case "print":
             break;
         case "statistics":
         case "eval_a":
         case "detailedEvaluation":
         case "outEvaluation":
         case "singleResults":
         case "exportEvaluation":
         case "evalUserDetail":
         case "passDetails":
         case "outStatisticsResultsOverview":
         case "statisticsPassDetails":
             $this->getStatisticsSubTabs();
             break;
     }
     if (strcmp(strtolower(get_class($this->object)), "ilobjtest") == 0) {
         // questions tab
         if ($ilAccess->checkAccess("write", "", $this->ref_id) && !in_array('assQuestions', $hidden_tabs)) {
             $force_active = $_GET["up"] != "" || $_GET["down"] != "" ? true : false;
             if (!$force_active) {
                 if ($_GET["browse"] == 1) {
                     $force_active = true;
                 }
                 if (preg_match("/deleteqpl_\\d+/", $this->ctrl->getCmd())) {
                     $force_active = true;
                 }
             }
             if ($this->object->isRandomTest()) {
                 $target = $this->ctrl->getLinkTarget($this, 'questions');
             } else {
                 $target = $this->ctrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'showPage');
             }
             $tabs_gui->addTarget("assQuestions", $target, array("questions", "browseForQuestions", "questionBrowser", "createQuestion", "randomselect", "filter", "resetFilter", "insertQuestions", "back", "createRandomSelection", "cancelRandomSelect", "insertRandomSelection", "removeQuestions", "moveQuestions", "insertQuestionsBefore", "insertQuestionsAfter", "confirmRemoveQuestions", "cancelRemoveQuestions", "executeCreateQuestion", "cancelCreateQuestion", "addQuestionpool", "saveRandomQuestions", "saveQuestionSelectionMode", "print", "addsource", "removesource", "randomQuestions"), "", "", $force_active);
         }
         // info tab
         if ($ilAccess->checkAccess("visible", "", $this->ref_id) && !in_array('info_short', $hidden_tabs)) {
             $tabs_gui->addTarget("info_short", $this->ctrl->getLinkTarget($this, 'infoScreen'), array("infoScreen", "outIntroductionPage", "showSummary", "setAnonymousId", "outUserListOfAnswerPasses", "redirectToInfoScreen"));
         }
         // settings tab
         if ($ilAccess->checkAccess("write", "", $this->ref_id)) {
             if (!in_array('settings', $hidden_tabs)) {
                 $tabs_gui->addTarget("settings", $this->ctrl->getLinkTarget($this, 'properties'), array("properties", "saveProperties", "cancelProperties", "marks", "addMarkStep", "deleteMarkSteps", "addSimpleMarkSchema", "saveMarks", "cancelMarks", "certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave", "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport", "scoring", "defaults", "addDefaults", "deleteDefaults", "applyDefaults", "inviteParticipants", "saveFixedParticipantsStatus", "searchParticipants", "addParticipants", ""), array("", "ilobjtestgui", "ilcertificategui"));
             }
             if (!in_array('participants', $hidden_tabs)) {
                 // participants
                 $tabs_gui->addTarget("participants", $this->ctrl->getLinkTarget($this, 'participants'), array("participants", "saveClientIP", "removeParticipant", "showParticipantAnswersForAuthor", "deleteAllUserResults", "cancelDeleteAllUserData", "deleteSingleUserResults", "outParticipantsResultsOverview", "outParticipantsPassDetails", "showPassOverview", "showUserAnswers", "participantsAction", "showDetailedResults"), "");
             }
         }
         include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
         if (ilLearningProgressAccess::checkAccess($this->object->getRefId()) && !in_array('learning_progress', $hidden_tabs)) {
             $tabs_gui->addTarget('learning_progress', $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''), '', array('illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui'));
         }
         if ($ilAccess->checkAccess("write", "", $this->ref_id) && !in_array('manscoring', $hidden_tabs)) {
             include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
             $scoring = ilObjAssessmentFolder::_getManualScoring();
             if (count($scoring)) {
                 // scoring tab
                 $tabs_gui->addTarget("manscoring", $this->ctrl->getLinkTargetByClass('ilTestScoringGUI', 'showManScoringParticipantsTable'), array('showManScoringParticipantsTable', 'applyManScoringParticipantsFilter', 'resetManScoringParticipantsFilter', 'showManScoringParticipantScreen'), '');
             }
         }
         if (($ilAccess->checkAccess("tst_statistics", "", $this->ref_id) || $ilAccess->checkAccess("write", "", $this->ref_id)) && !in_array('statistics', $hidden_tabs)) {
             // statistics tab
             $tabs_gui->addTarget("statistics", $this->ctrl->getLinkTargetByClass("iltestevaluationgui", "outEvaluation"), array("statistics", "outEvaluation", "exportEvaluation", "detailedEvaluation", "eval_a", "evalUserDetail", "passDetails", "outStatisticsResultsOverview", "statisticsPassDetails", "singleResults"), "");
         }
         if ($ilAccess->checkAccess("write", "", $this->ref_id)) {
             if (!in_array('history', $hidden_tabs)) {
                 // history
                 $tabs_gui->addTarget("history", $this->ctrl->getLinkTarget($this, 'history'), "history", "");
             }
             if (!in_array('meta_data', $hidden_tabs)) {
                 // meta data
                 $tabs_gui->addTarget("meta_data", $this->ctrl->getLinkTargetByClass('ilmdeditorgui', 'listSection'), "", "ilmdeditorgui");
             }
             if (!in_array('export', $hidden_tabs)) {
                 // export tab
                 $tabs_gui->addTarget("export", $this->ctrl->getLinkTarget($this, 'export'), array("export", "createExportFile", "confirmDeleteExportFile", "downloadExportFile", "deleteExportFile", "cancelDeleteExportFile"), "");
             }
         }
         if ($ilAccess->checkAccess("edit_permission", "", $this->ref_id) && !in_array('permissions', $hidden_tabs)) {
             $tabs_gui->addTarget("perm_settings", $this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilpermissiongui'), "perm"), array("perm", "info", "owner"), 'ilpermissiongui');
         }
     }
 }
Exemplo n.º 10
0
 /**
  * Output of the pass overview for a test called by a test participant
  *
  * @param ilTestSession|ilTestSessionDynamicQuestionSet $testSession
  * @param integer $active_id
  * @param integer $pass
  * @param boolean $show_pass_details
  * @param boolean $show_answers
  * @param boolean $show_question_only
  * @param boolean $show_reached_points
  * @access public
  */
 function getResultsOfUserOutput($testSession, $active_id, $pass, $targetGUI, $show_pass_details = TRUE, $show_answers = TRUE, $show_question_only = FALSE, $show_reached_points = FALSE)
 {
     global $ilObjDataCache;
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $template = new ilTemplate("tpl.il_as_tst_results_participant.html", TRUE, TRUE, "Modules/Test");
     if ($this->participantData instanceof ilTestParticipantData) {
         $user_id = $this->participantData->getUserIdByActiveId($active_id);
         $uname = $this->participantData->getConcatedFullnameByActiveId($active_id, false);
     } else {
         $user_id = $this->object->_getUserIdFromActiveId($active_id);
         $uname = $this->object->userLookupFullName($user_id, TRUE);
     }
     if (array_key_exists("pass", $_GET) && strlen($_GET["pass"]) > 0 || !is_null($pass)) {
         if (is_null($pass)) {
             $pass = $_GET["pass"];
         }
     }
     $user_data = $this->getResultsUserdata($testSession, $active_id, TRUE);
     if (!is_null($pass)) {
         require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
         $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache);
         $objectivesList = null;
         if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
             $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
             $testSequence->loadFromDb();
             $testSequence->loadQuestions();
             require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
             $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
             $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
             $objectivesList->loadObjectivesTitles();
             $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
             $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
             $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
             $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
             $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
         }
         $result_array = $this->object->getTestResult($active_id, $pass, false, !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired());
         $command_solution_details = "";
         if ($show_pass_details) {
             $detailsoverview = $this->getPassDetailsOverview($result_array, $active_id, $pass, $targetGUI, "getResultsOfUserOutput", $command_solution_details, $show_answers, $objectivesList);
         }
         $user_id = $this->object->_getUserIdFromActiveId($active_id);
         $showAllAnswers = TRUE;
         if ($this->object->isExecutable($testSession, $user_id)) {
             $showAllAnswers = FALSE;
         }
         if ($show_answers) {
             $list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, $_SESSION['tst_results_show_best_solutions'], $showAllAnswers, $show_question_only, $show_reached_points, $show_pass_details, $objectivesList, $testResultHeaderLabelBuilder);
         }
         $template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
         //$template->setVariable("PASS_RESULTS_OVERVIEW", sprintf($this->lng->txt("tst_results_overview_pass"), $pass + 1));
         $template->setVariable("PASS_DETAILS", $detailsoverview);
         $signature = $this->getResultsSignature();
         $template->setVariable("SIGNATURE", $signature);
         if ($this->object->isShowExamIdInTestResultsEnabled()) {
             $template->setCurrentBlock('exam_id_footer');
             $template->setVariable('EXAM_ID_VAL', $this->object->lookupExamId($testSession->getActiveId(), $pass));
             $template->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
             $template->parseCurrentBlock();
         }
     }
     $template->setCurrentBlock('participant_back_anchor');
     $template->setVariable("HREF_PARTICIPANT_BACK_ANCHOR", "#tst_results_toolbar");
     $template->setVariable("TXT_PARTICIPANT_BACK_ANCHOR", $this->lng->txt('tst_back_to_top'));
     $template->parseCurrentBlock();
     $template->setCurrentBlock('participant_block_id');
     $template->setVariable("PARTICIPANT_BLOCK_ID", "participant_active_{$active_id}");
     $template->parseCurrentBlock();
     if ($this->isGradingMessageRequired()) {
         $template->setCurrentBlock('grading_message');
         $template->setVariable('GRADING_MESSAGE', $this->getGradingMessage($active_id));
         $template->parseCurrentBlock();
     }
     $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
     $template->setVariable("USER_DATA", $testResultHeaderLabelBuilder->getPassDetailsHeaderLabel($pass + 1));
     return $template->get();
 }
 private function invokeSkillLevelTrigger($userId, $skillBaseId, $skillTrefId, $skillLevelId)
 {
     ilBasicSkill::writeUserSkillLevelStatus($skillLevelId, $userId, $this->testOBJ->getRefId(), $skillTrefId, ilBasicSkill::ACHIEVED, true);
     //mail('*****@*****.**', "trigger skill $skillBaseId:$skillTrefId level $skillLevelId for user $userId", '');
 }