コード例 #1
0
 private function showCmd()
 {
     $selectedSkillProfile = ilTestSkillEvaluationToolbarGUI::fetchSkillProfileParam($_POST);
     $testSession = $this->testSessionFactory->getSession();
     $this->skillEvaluation->init()->evaluate($testSession->getActiveId(), $testSession->getLastFinishedPass(), $testSession->getUserId());
     $evaluationToolbarGUI = $this->buildEvaluationToolbarGUI($testSession->getUserId(), $selectedSkillProfile);
     $personalSkillsGUI = $this->buildPersonalSkillsGUI($testSession->getUserId(), $selectedSkillProfile);
     $this->tpl->setContent($this->ctrl->getHTML($evaluationToolbarGUI) . $this->ctrl->getHTML($personalSkillsGUI));
 }
コード例 #2
0
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilDB, $lng, $ilPluginAdmin, $ilTabs, $tree;
     $ilTabs->clearTargets();
     $this->ctrl->saveParameter($this, "sequence");
     $this->ctrl->saveParameter($this, "active_id");
     $this->initAssessmentSettings();
     require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
     $this->dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this->object);
     $this->dynamicQuestionSetConfig->loadFromDb();
     $testSessionFactory = new ilTestSessionFactory($this->object);
     $this->testSession = $testSessionFactory->getSession($_GET['active_id']);
     $this->ensureExistingTestSession($this->testSession);
     $this->initProcessLocker($this->testSession->getActiveId());
     $testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object);
     $this->testSequence = $testSequenceFactory->getSequenceByTestSession($this->testSession);
     $this->testSequence->loadFromDb();
     include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
     iljQueryUtil::initjQuery();
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initConnectionWithAnimation();
     if ($this->object->getKioskMode()) {
         include_once 'Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php';
         ilOverlayGUI::initJavascript();
     }
     $this->handlePasswordProtectionRedirect();
     $cmd = $this->ctrl->getCmd();
     $nextClass = $this->ctrl->getNextClass($this);
     switch ($nextClass) {
         case 'ilassquestionpagegui':
             $questionId = $this->testSequence->getQuestionForSequence($this->calculateSequence());
             require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
             $page_gui = new ilAssQuestionPageGUI($questionId);
             $ret = $this->ctrl->forwardCommand($page_gui);
             break;
         case 'ilassquestionhintrequestgui':
             $questionGUI = $this->object->createQuestionGUI("", $this->testSequenceFactory->getSequenceByTestSession()->getQuestionForSequence($this->calculateSequence()));
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
             $gui = new ilAssQuestionHintRequestGUI($this, self::CMD_SHOW_QUESTION, $this->testSession, $questionGUI);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ildynamicquestionsetstatistictablegui':
             $this->ctrl->forwardCommand($this->buildQuestionSetFilteredStatisticTableGUI());
             break;
         case 'iltestpasswordprotectiongui':
             require_once 'Modules/Test/classes/class.ilTestPasswordProtectionGUI.php';
             $gui = new ilTestPasswordProtectionGUI($this->ctrl, $this->tpl, $this->lng, $this, $this->passwordChecker);
             $ret = $this->ctrl->forwardCommand($gui);
             break;
         default:
             $cmd .= 'Cmd';
             $ret =& $this->{$cmd}();
             break;
     }
     return $ret;
 }
コード例 #3
0
 /**
  * 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;
 }
コード例 #4
0
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilDB, $lng, $ilPluginAdmin, $ilTabs, $tree;
     $ilTabs->clearTargets();
     $this->ctrl->saveParameter($this, "sequence");
     $this->ctrl->saveParameter($this, "active_id");
     require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
     $this->dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this->object);
     $this->dynamicQuestionSetConfig->loadFromDb();
     $testSessionFactory = new ilTestSessionFactory($this->object);
     $this->testSession = $testSessionFactory->getSession($_GET['active_id']);
     $testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object);
     $this->testSequence = $testSequenceFactory->getSequence($this->testSession);
     $this->testSequence->loadFromDb();
     include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
     iljQueryUtil::initjQuery();
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initConnectionWithAnimation();
     if ($this->object->getKioskMode()) {
         include_once 'Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php';
         ilOverlayGUI::initJavascript();
     }
     $cmd = $this->ctrl->getCmd();
     $nextClass = $this->ctrl->getNextClass($this);
     switch ($nextClass) {
         case 'ilassquestionhintrequestgui':
             $questionGUI = $this->object->createQuestionGUI("", $this->testSequenceFactory->getSequence()->getQuestionForSequence($this->calculateSequence()));
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
             $gui = new ilAssQuestionHintRequestGUI($this, $this->testSession, $questionGUI);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilfilteredquestionstablegui':
             $this->ctrl->forwardCommand($this->buildFilteredQuestionsTableGUI());
             break;
         default:
             $cmd .= 'Cmd';
             $ret =& $this->{$cmd}();
             break;
     }
     return $ret;
 }
コード例 #5
0
 /**
  * Creates an output of the solution of an answer compared to the correct solution
  *
  * @access public
  */
 protected function outCorrectSolution()
 {
     if (!$this->object->getShowSolutionDetails()) {
         ilUtil::sendInfo($this->lng->txt("no_permission"), true);
         $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
     }
     $testSession = $this->testSessionFactory->getSession();
     $activeId = $testSession->getActiveId();
     if (!($activeId > 0)) {
         $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
     }
     $this->ctrl->saveParameter($this, "pass");
     $pass = (int) $_GET['pass'];
     $questionId = (int) $_GET['evaluation'];
     if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
         $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $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();
     } else {
         $objectivesList = null;
     }
     global $ilTabs;
     if ($this instanceof ilTestEvalObjectiveOrientedGUI) {
         $ilTabs->setBackTarget($this->lng->txt("tst_back_to_virtual_pass"), $this->ctrl->getLinkTarget($this, 'showVirtualPass'));
     } else {
         $ilTabs->setBackTarget($this->lng->txt("tst_back_to_pass_details"), $this->ctrl->getLinkTarget($this, 'outUserPassDetails'));
     }
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $this->tpl->setCurrentBlock("ContentStyle");
     $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setCurrentBlock("SyntaxStyle");
     $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
     $this->tpl->parseCurrentBlock();
     $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
     if ($this->object->getShowSolutionAnswersOnly()) {
         $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
     }
     $solution = $this->getCorrectSolutionOutput($questionId, $activeId, $pass, $objectivesList);
     $this->tpl->setContent($solution);
 }
コード例 #6
0
ファイル: class.ilObjTest.php プロジェクト: bheyser/qplskl
 public static function isParticipantsLastPassActive($testRefId, $userId)
 {
     global $ilDB, $lng, $ilPluginAdmin;
     /* @var ilObjTest $testOBJ */
     $testOBJ = ilObjectFactory::getInstanceByRefId($testRefId, false);
     $activeId = $testOBJ->getActiveIdOfUser($userId);
     require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
     $testSessionFactory = new ilTestSessionFactory($testOBJ);
     // Added temporarily bugfix smeyer
     $testSessionFactory->reset();
     require_once 'Modules/Test/classes/class.ilTestSequenceFactory.php';
     $testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $testOBJ);
     $testSession = $testSessionFactory->getSession($activeId);
     $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $testSession->getPass());
     $testSequence->loadFromDb();
     return $testSequence->hasSequence();
 }
コード例 #7
0
ファイル: class.ilObjTestGUI.php プロジェクト: bheyser/qplskl
 /**
  * Questions per page
  *
  * @param
  * @return
  */
 function buildPageViewToolbar($qid = 0)
 {
     if ($this->create_question_mode) {
         return;
     }
     global $ilToolbar, $ilCtrl, $lng;
     require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
     $this->getQuestionsSubTabs();
     $ilCtrl->saveParameter($this, 'q_mode');
     $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'test_express_mode', 1);
     $ilCtrl->setParameter($this, 'test_express_mode', 1);
     $ilCtrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', $_REQUEST['q_id']);
     $ilCtrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
     $ilToolbar->setFormAction($ilCtrl->getFormActionByClass('iltestexpresspageobjectgui', 'edit'));
     if ($this->object->evalTotalPersons() == 0) {
         /*
         include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
         $pool = new ilObjQuestionPool();
         $questionTypes = $pool->getQuestionTypes();$options = array();
         foreach($questionTypes as $label => $data) {
         $options[$data['question_type_id']] = $label;
         }
         
         		include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
         		$si = new ilSelectInputGUI($lng->txt("test_add_new_question"), "qtype");
         		$si->setOptions($options);
         		$ilToolbar->addInputItem($si, true);
         /*
         		// use pool
         		if ($this->object->isExpressModeQuestionPoolAllowed()) {
         			include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
         			$cb = new ilCheckboxInputGUI($lng->txt("test_use_pool"), "use_pool");
         			$ilToolbar->addInputItem($cb, true);
         		}
         */
         $ilToolbar->addFormButton($lng->txt("ass_create_question"), "addQuestion");
         $ilToolbar->addSeparator();
         if ($this->object->getPoolUsage()) {
             require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
             $this->populateQuestionBrowserToolbarButtons($ilToolbar, ilTestQuestionBrowserTableGUI::CONTEXT_PAGE_VIEW);
             $show_separator = true;
         }
     }
     $questions = $this->object->getQuestionTitlesAndIndexes();
     // desc
     $options = array();
     foreach ($questions as $id => $label) {
         $options[$id] = $label . ' [' . $this->lng->txt('question_id_short') . ': ' . $id . ']';
     }
     $optionKeys = array_keys($options);
     if (!$options) {
         $options[] = $lng->txt('none');
     }
     //else if (count($options) > 1) {
     //                    $addSeparator = false;
     //                    if ($optionKeys[0] != $qid) {
     //                        //$ilToolbar->addFormButton($lng->txt("test_prev_question"), "prevQuestion");
     //                        $ilToolbar->addLink($lng->txt("test_prev_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
     //                        $addSeparator = true;
     //                    }
     //		    else {
     //			$ilToolbar->addSpacer(45);
     //		    }
     //
     //                    if ($optionKeys[count($optionKeys)-1] != $qid) {
     //                        //$ilToolbar->addFormButton($lng->txt("test_next_question"), "nextQuestion");
     //                        $ilToolbar->addLink($lng->txt("test_next_question"), $ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
     //			$addSeparator = true;
     //                    }
     //		    else {
     //			$ilToolbar->addSpacer(45);
     //		    }
     //
     //                    //if ($addSeparator) {
     //                        $ilToolbar->addSeparator();
     //                    //}
     if (count($questions)) {
         if (isset($show_separator) && $show_separator) {
             $ilToolbar->addSeparator();
         }
         $btn = ilLinkButton::getInstance();
         $btn->setCaption("test_prev_question");
         $btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'prevQuestion'));
         $ilToolbar->addButtonInstance($btn);
         if (count($options) <= 1 || $optionKeys[0] == $qid) {
             $btn->setDisabled(true);
         }
         $btn = ilLinkButton::getInstance();
         $btn->setCaption("test_next_question");
         $btn->setUrl($ilCtrl->getLinkTargetByClass('iltestexpresspageobjectgui', 'nextQuestion'));
         $ilToolbar->addButtonInstance($btn);
         if (count($options) <= 1 || $optionKeys[count($optionKeys) - 1] == $qid) {
             $btn->setDisabled(true);
         }
     }
     if (count($questions) > 1) {
         $ilToolbar->addSeparator();
         include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
         $si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
         $si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
         $si->setOptions($options);
         if ($qid) {
             $si->setValue($qid);
         }
         $ilToolbar->addInputItem($si, true);
     }
     $total = $this->object->evalTotalPersons();
     /*if (count($options)) {
     			include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
     			$si = new ilSelectInputGUI($lng->txt("test_jump_to"), "q_id");
     			$si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
     			$si->setOptions($options);
     
     			if ($qid) {
     				$si->setValue($qid);
     			}
     
     			$ilToolbar->addInputItem($si, true);
     		}*/
     if (count($questions) && !$total) {
         $ilCtrl->setParameter($this, 'q_id', $_REQUEST['q_id']);
         $ilToolbar->addSeparator();
         $ilToolbar->addButton($lng->txt("test_delete_page"), $ilCtrl->getLinkTarget($this, "removeQuestions"));
     }
     if (count($questions) > 1 && !$total) {
         $ilToolbar->addSeparator();
         $ilToolbar->addButton($lng->txt("test_move_page"), $ilCtrl->getLinkTarget($this, "movePageForm"));
     }
     global $ilAccess, $ilUser;
     $online_access = false;
     if ($this->object->getFixedParticipants()) {
         include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
         $online_access_result = ilObjTestAccess::_lookupOnlineTestAccess($this->object->getId(), $ilUser->getId());
         if ($online_access_result === true) {
             $online_access = true;
         }
     }
     if ($this->object->isOnline() && $this->object->isComplete($this->testQuestionSetConfigFactory->getQuestionSetConfig())) {
         if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) {
             $testSession = $this->testSessionFactory->getSession();
             $executable = $this->object->isExecutable($testSession, $ilUser->getId(), $allowPassIncrease = TRUE);
             if ($executable["executable"]) {
                 $player_factory = new ilTestPlayerFactory($this->object);
                 $player_instance = $player_factory->getPlayerGUI();
                 if ($testSession->getActiveId() > 0) {
                     $ilToolbar->addSeparator();
                     $ilToolbar->addButton($lng->txt('tst_resume_test'), $ilCtrl->getLinkTarget($player_instance, 'resumePlayer'));
                 } else {
                     $ilToolbar->addSeparator();
                     $ilToolbar->addButton($lng->txt('tst_start_test'), $ilCtrl->getLinkTarget($player_instance, 'startTest'));
                 }
             }
         }
     }
 }
コード例 #8
0
 /**
  * Execute Command
  */
 public function executeCommand()
 {
     global $ilUser, $ilDB, $ilPluginAdmin, $lng, $ilTabs;
     $ilTabs->clearTargets();
     $cmd = $this->ctrl->getCmd();
     $next_class = $this->ctrl->getNextClass($this);
     $this->ctrl->saveParameter($this, "sequence");
     $this->ctrl->saveParameter($this, "active_id");
     if (preg_match("/^gotoquestion_(\\d+)\$/", $cmd, $matches)) {
         $cmd = "gotoquestion";
         if (strlen($matches[1])) {
             $this->ctrl->setParameter($this, 'gotosequence', $matches[1]);
         }
     }
     $testSessionFactory = new ilTestSessionFactory($this->object);
     $this->testSession = $testSessionFactory->getSession($_GET['active_id']);
     $this->ensureExistingTestSession($this->testSession);
     $this->initProcessLocker($this->testSession->getActiveId());
     $testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object);
     $this->testSequence = $testSequenceFactory->getSequence($this->testSession);
     $this->testSequence->loadFromDb();
     $this->testSequence->loadQuestions();
     include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
     iljQueryUtil::initjQuery();
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initConnectionWithAnimation();
     $this->handlePasswordProtectionRedirect();
     $cmd = $this->getCommand($cmd);
     switch ($next_class) {
         case 'ilassquestionpagegui':
             $questionId = $this->testSequence->getQuestionForSequence($this->calculateSequence());
             require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
             $page_gui = new ilAssQuestionPageGUI($questionId);
             $ret = $this->ctrl->forwardCommand($page_gui);
             break;
         case 'iltestsubmissionreviewgui':
             require_once './Modules/Test/classes/class.ilTestSubmissionReviewGUI.php';
             $gui = new ilTestSubmissionReviewGUI($this, $this->object, $this->testSession);
             $ret = $this->ctrl->forwardCommand($gui);
             break;
         case 'ilassquestionhintrequestgui':
             $questionGUI = $this->object->createQuestionGUI("", $this->testSequence->getQuestionForSequence($this->calculateSequence()));
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
             $questionHintTracking = new ilAssQuestionHintTracking($questionGUI->object->getId(), $this->testSession->getActiveId(), $this->testSession->getPass());
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
             $gui = new ilAssQuestionHintRequestGUI($this, 'redirectQuestion', $questionGUI, $questionHintTracking);
             $ret = $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestsignaturegui':
             require_once './Modules/Test/classes/class.ilTestSignatureGUI.php';
             $gui = new ilTestSignatureGUI($this);
             $ret = $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestpasswordprotectiongui':
             require_once 'Modules/Test/classes/class.ilTestPasswordProtectionGUI.php';
             $gui = new ilTestPasswordProtectionGUI($this->ctrl, $this->tpl, $this->lng, $this, $this->passwordChecker);
             $ret = $this->ctrl->forwardCommand($gui);
             break;
         default:
             $cmd .= 'Cmd';
             $ret =& $this->{$cmd}();
             break;
     }
     return $ret;
 }
コード例 #9
0
 /**
 * Retrieves the number of answered questions for a given user in a given test
 *
 * @param integer $user_id The user id
 * @param integer $test_id The test id
 * @param integer $pass The pass of the test (optional)
 * @return integer The number of answered questions
 * @access public
 */
 function getAnsweredQuestionCount($active_id, $pass = NULL)
 {
     if ($this->isDynamicTest()) {
         global $tree, $ilDB, $lng, $ilPluginAdmin;
         require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
         $testSessionFactory = new ilTestSessionFactory($this);
         $testSession = $testSessionFactory->getSession($active_id);
         require_once 'Modules/Test/classes/class.ilTestSequenceFactory.php';
         $testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this);
         $testSequence = $testSequenceFactory->getSequence($testSession);
         require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
         $dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this);
         $dynamicQuestionSetConfig->loadFromDb();
         $testSequence->loadFromDb($dynamicQuestionSetConfig);
         $testSequence->loadQuestions($dynamicQuestionSetConfig, array());
         return $testSequence->getTrackedQuestionCount();
     }
     if ($this->isRandomTest()) {
         $this->loadQuestions($active_id, $pass);
     }
     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
     $workedthrough = 0;
     foreach ($this->questions as $value) {
         if (assQuestion::_isWorkedThrough($active_id, $value, $pass)) {
             $workedthrough += 1;
         }
     }
     return $workedthrough;
 }
コード例 #10
0
 /**
  * Returns (request cached) information if a specific user has finished at least one test pass
  *
  * @param integer $user_id obj_id of the user
  * @param integer $a_obj_id obj_id of the test
  * @return bool
  */
 public static function hasFinished($a_user_id, $a_obj_id)
 {
     if (!isset(self::$hasFinishedCache["{$a_user_id}:{$a_obj_id}"])) {
         require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
         require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
         require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
         global $ilDB, $lng;
         $testOBJ = ilObjectFactory::getInstanceByObjId($a_obj_id);
         $partData = new ilTestParticipantData($ilDB, $lng);
         $partData->setUserIds(array($a_user_id));
         $partData->load($testOBJ->getTestId());
         $activeId = $partData->getActiveIdByUserId($a_user_id);
         $testSessionFactory = new ilTestSessionFactory($testOBJ);
         $testSession = $testSessionFactory->getSession($activeId);
         $testPassesSelector = new ilTestPassesSelector($ilDB, $testOBJ);
         $testPassesSelector->setActiveId($activeId);
         $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass());
         self::$hasFinishedCache["{$a_user_id}:{$a_obj_id}"] = count($testPassesSelector->getClosedPasses());
     }
     return self::$hasFinishedCache["{$a_user_id}:{$a_obj_id}"];
 }
コード例 #11
0
 public static function visibleUserResultExists($testObjId, $userId)
 {
     $testOBJ = ilObjectFactory::getInstanceByObjId($testObjId, false);
     if (!$testOBJ instanceof ilObjTest) {
         return false;
     }
     require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
     $testSessionFactory = new ilTestSessionFactory($testOBJ);
     $testSession = $testSessionFactory->getSessionByUserId($userId);
     return $testOBJ->canShowTestResults($testSession);
 }
コード例 #12
0
 /**
  * Execute Command
  */
 public function executeCommand()
 {
     global $ilUser, $ilDB, $ilPluginAdmin, $lng, $ilTabs;
     $ilTabs->clearTargets();
     $cmd = $this->ctrl->getCmd();
     $next_class = $this->ctrl->getNextClass($this);
     $this->ctrl->saveParameter($this, "sequence");
     $this->ctrl->saveParameter($this, "active_id");
     if (preg_match("/^gotoquestion_(\\d+)\$/", $cmd, $matches)) {
         $cmd = "gotoquestion";
         if (strlen($matches[1])) {
             $this->ctrl->setParameter($this, 'gotosequence', $matches[1]);
         }
     }
     $testSessionFactory = new ilTestSessionFactory($this->object);
     $this->testSession = $testSessionFactory->getSession($_GET['active_id']);
     if (!$this->testSession->getActiveId()) {
         $this->testSession->setUserId($ilUser->getId());
         $this->testSession->setAnonymousId($_SESSION["tst_access_code"][$this->object->getTestId()]);
         $this->testSession->saveToDb();
     }
     $testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object);
     $this->testSequence = $testSequenceFactory->getSequence($this->testSession);
     $this->testSequence->loadFromDb();
     $this->testSequence->loadQuestions();
     include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
     iljQueryUtil::initjQuery();
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initConnectionWithAnimation();
     // Ensure that the selector for unicode characters respects the test settings
     // This should be done before ilMainMenu gets the current selector for display
     global $ilSetting;
     if ($ilSetting->get('char_selector_availability') > 0) {
         require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php';
         ilCharSelectorGUI::_getCurrentGUI($this->object);
     }
     $cmd = $this->getCommand($cmd);
     switch ($next_class) {
         case 'iltestsubmissionreviewgui':
             require_once './Modules/Test/classes/class.ilTestSubmissionReviewGUI.php';
             $gui = new ilTestSubmissionReviewGUI($this, $this->object);
             $ret = $this->ctrl->forwardCommand($gui);
             break;
         case 'ilassquestionhintrequestgui':
             $questionGUI = $this->object->createQuestionGUI("", $this->testSequence->getQuestionForSequence($this->calculateSequence()));
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
             $gui = new ilAssQuestionHintRequestGUI($this, $this->testSession, $questionGUI);
             $ret = $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestsignaturegui':
             require_once './Modules/Test/classes/class.ilTestSignatureGUI.php';
             $gui = new ilTestSignatureGUI($this);
             $ret = $this->ctrl->forwardCommand($gui);
             break;
         default:
             $cmd .= 'Cmd';
             $ret =& $this->{$cmd}();
             break;
     }
     return $ret;
 }
コード例 #13
0
 /**
  * Returns the pass overview for a given active ID
  *
  * @return string HTML code of the pass overview
  * @access public
  * 
  * @deprecated
  */
 public function getPassOverview($active_id, $targetclass = "", $targetcommand = "", $short = FALSE, $hide_details = FALSE)
 {
     require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
     require_once 'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php';
     $table = new ilTestPassOverviewTableGUI($this, '', $short ? ilTestPassOverviewTableGUI::CONTEXT_SHORT : ilTestPassOverviewTableGUI::CONTEXT_LONG, isset($_GET['pdf']) && $_GET['pdf'] == 1);
     $data = array();
     $counted_pass = $this->object->_getResultPass($active_id);
     $reached_pass = $this->object->_getPass($active_id);
     require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
     $testPassesSelector = new ilTestPassesSelector($GLOBALS['ilDB'], $this->object);
     $testPassesSelector->setActiveId($active_id);
     $lastFinishedPass = $this->testSessionFactory->getSession($active_id)->getLastFinishedPass();
     $testPassesSelector->setLastFinishedPass($lastFinishedPass);
     foreach ($testPassesSelector->getReportablePasses() as $pass) {
         $row = array();
         if (!$short) {
             $result_array =& $this->object->getTestResult($active_id, $pass);
             if (!$result_array['pass']['total_max_points']) {
                 $percentage = 0;
             } else {
                 $percentage = $result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points'] * 100;
             }
             $total_max = $result_array['pass']['total_max_points'];
             $total_reached = $result_array['pass']['total_reached_points'];
             $total_requested_hints = $result_array['pass']['total_requested_hints'];
         }
         if (!$hide_details) {
             if (strlen($targetclass) && strlen($targetcommand)) {
                 $this->ctrl->setParameterByClass($targetclass, 'active_id', $active_id);
                 $this->ctrl->setParameterByClass($targetclass, 'pass', $pass);
                 $aslgui = new ilAdvancedSelectionListGUI();
                 $aslgui->setListTitle($this->lng->txt('actions'));
                 $aslgui->setId($pass);
                 $aslgui->addItem($this->lng->txt('tst_pass_details'), 'tst_pass_details', $this->ctrl->getLinkTargetByClass($targetclass, $targetcommand));
                 if ($this->object->isPassDeletionAllowed() && $pass != $counted_pass) {
                     $aslgui->addItem($this->lng->txt('delete'), 'tst_pass_delete', $this->ctrl->getLinkTargetByClass($targetclass, 'confirmDeletePass'));
                     $delete_entry = true;
                 }
                 if ($delete_entry == true) {
                     $row['pass_details'] = $aslgui->getHTML();
                 } else {
                     $row['pass_details'] = '<a href="' . $this->ctrl->getLinkTargetByClass($targetclass, $targetcommand) . '">' . $this->lng->txt('tst_pass_details') . '</a>';
                 }
             }
         }
         if (!$short) {
             if ($pass == $counted_pass) {
                 $row['scored'] = '&otimes;';
             } else {
                 $row['scored'] = '';
             }
         }
         $row['pass'] = $pass + 1;
         $row['date'] = $this->object->getPassFinishDate($active_id, $pass);
         if (!$short) {
             $row['answered'] = $result_array['pass']['num_workedthrough'] . ' ' . strtolower($this->lng->txt('of')) . ' ' . (count($result_array) - 2);
             if ($this->object->isOfferingQuestionHintsEnabled()) {
                 $row['hints'] = $total_requested_hints;
             }
             $row['reached'] = $total_reached . ' ' . strtolower($this->lng->txt('of')) . ' ' . $total_max;
             $row['percentage'] = $percentage;
         }
         $data[] = $row;
     }
     $table->setData($data);
     return $table->getHTML();
 }