public function executeCommand()
 {
     if ($this->isAccessDenied()) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     $nextClass = $this->ctrl->getNextClass();
     $this->manageTabs($nextClass);
     switch ($nextClass) {
         case 'ilassquestionskillassignmentsgui':
             $questionContainerId = $this->getQuestionContainerId();
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
             $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
             $questionList->setParentObjId($questionContainerId);
             $questionList->setQuestionInstanceTypeFilter($this->getRequiredQuestionInstanceTypeFilter());
             $questionList->load();
             $gui = new ilAssQuestionSkillAssignmentsGUI($this->ctrl, $this->access, $this->tpl, $this->lng, $this->db);
             $gui->setAssignmentEditingEnabled($this->isAssignmentEditingRequired());
             $gui->setQuestionContainerId($questionContainerId);
             $gui->setQuestionList($questionList);
             if ($this->testOBJ->isFixedTest()) {
                 $gui->setQuestionOrderSequence($this->testOBJ->getQuestions());
             } else {
                 $gui->setAssignmentConfigurationHintMessage($this->buildAssignmentConfigurationInPoolHintMessage());
             }
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestskilllevelthresholdsgui':
             $gui = new ilTestSkillLevelThresholdsGUI($this->ctrl, $this->tpl, $this->lng, $this->db, $this->testOBJ->getTestId());
             $gui->setQuestionAssignmentColumnsEnabled(!$this->testOBJ->isRandomTest());
             $gui->setQuestionContainerId($this->getQuestionContainerId());
             $this->ctrl->forwardCommand($gui);
             break;
     }
 }
 /**
  * Get questions
  *
  * @param
  * @return
  */
 function getQuestions()
 {
     global $ilAccess, $ilDB, $lng, $ilPluginAdmin;
     include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
     $all_types = ilObjQuestionPool::_getSelfAssessmentQuestionTypes();
     $all_ids = array();
     foreach ($all_types as $k => $v) {
         $all_ids[] = $v["question_type_id"];
     }
     $questions = array();
     if ($ilAccess->checkAccess("read", "", $this->pool_ref_id)) {
         require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
         $questionList = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin, $this->pool_obj_id);
         $questionList->load();
         $data = $questionList->getQuestionDataArray();
         $questions = array();
         foreach ($data as $d) {
             // list only self assessment question types
             if (in_array($d["question_type_fi"], $all_ids)) {
                 $questions[] = $d;
             }
         }
     }
     $this->setData($questions);
 }
 protected function buildTestPassQuestionList()
 {
     global $ilPluginAdmin;
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
     $questionList = new ilAssQuestionList($this->db, $this->lng, $ilPluginAdmin);
     $questionList->setParentObjId($this->object->getId());
     $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
     return $questionList;
 }
 /**
  * forward method
  */
 public function forward()
 {
     $this->tabs->setTabActive('settings');
     $this->lng->loadLanguageModule('tax');
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
     $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin, $this->poolOBJ->getId());
     $questionList->load();
     require_once 'Services/Taxonomy/classes/class.ilObjTaxonomyGUI.php';
     $taxGUI = new ilObjTaxonomyGUI();
     $taxGUI->setAssignedObject($this->poolOBJ->getId());
     $taxGUI->setMultiple(true);
     $taxGUI->activateAssignedItemSorting($questionList, 'qpl', $this->poolOBJ->getId(), 'quest');
     $this->ctrl->forwardCommand($taxGUI);
 }
Beispiel #5
0
 /**
  * Process answer
  */
 function processAnswer()
 {
     global $ilUser, $ilDB, $lng, $ilPluginAdmin, $ilLog;
     parent::processAnswer();
     //
     // Send notifications to authors that want to be informed on blocked users
     //
     $parent_id = ilPageObject::lookupParentId((int) $_GET["page_id"], "lm");
     // is restriction mode set?
     include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
     if (ilObjContentObject::_lookupRestrictForwardNavigation($parent_id)) {
         // check if user is blocked
         $id = ilUtil::stripSlashes($_POST["id"]);
         include_once "./Services/COPage/classes/class.ilPageQuestionProcessor.php";
         $as = ilPageQuestionProcessor::getAnswerStatus($id, $ilUser->getId());
         // get question information
         include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionList.php";
         $qlist = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin);
         $qlist->setParentObjId(0);
         $qlist->addFieldFilter("question_id", array($id));
         $qlist->load();
         $qdata = $qlist->getQuestionDataArray();
         // has the user been blocked?
         if ($as["try"] >= $qdata[$as["qst_id"]]["nr_of_tries"] && $qdata[$as["qst_id"]]["nr_of_tries"] > 0 && !$as["passed"]) {
             include_once "./Services/Notification/classes/class.ilNotification.php";
             $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_LM_BLOCKED_USERS, $parent_id);
             if (count($users) > 0) {
                 include_once "./Modules/LearningModule/classes/class.ilLMMailNotification.php";
                 $not = new ilLMMailNotification();
                 $not->setType(ilLMMailNotification::TYPE_USER_BLOCKED);
                 $not->setQuestionId($id);
                 $not->setRefId((int) $_GET["ref_id"]);
                 $not->setRecipients($users);
                 $not->send();
             }
         }
     }
 }
 /**
  * @param array $taxIds
  * @global ilRbacSystem  $rbacsystem
  * @global ilDB $ilDB
  * @global ilLanguage $lng
  * @global ilPluginAdmin $ilPluginAdmin
  * @return ilQuestionBrowserTableGUI
  */
 private function buildQuestionBrowserTableGUI($taxIds)
 {
     global $rbacsystem, $ilDB, $lng, $ilPluginAdmin;
     include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php";
     $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', $rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false, false, $taxIds);
     $table_gui->setEditable($rbacsystem->checkAccess('write', $_GET['ref_id']));
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
     $questionList = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin, $this->object->getId());
     foreach ($table_gui->getFilterItems() as $item) {
         if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
             $v = $item->getValue();
             if (is_array($v) && count($v) && !(int) $v[0]) {
                 continue;
             }
             $taxId = substr($item->getPostVar(), strlen('tax_'));
             $questionList->addTaxonomyFilter($taxId, $item->getValue());
         } elseif ($item->getValue() !== false) {
             $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
         }
     }
     if ($this->object->isNavTaxonomyActive() && (int) $_GET['tax_node']) {
         $questionList->addTaxonomyFilter($this->object->getNavTaxonomyId(), array((int) $_GET['tax_node']));
     }
     $questionList->load();
     $data = $questionList->getQuestionDataArray();
     $table_gui->setData($data);
     return $table_gui;
 }
Beispiel #7
0
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilAccess, $ilNavigationHistory, $ilCtrl, $ilErr, $tpl, $lng, $ilTabs, $ilPluginAdmin, $ilDB, $tree, $ilias, $ilUser;
     if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE);
     }
     $cmd = $this->ctrl->getCmd("infoScreen");
     $cmdsDisabledDueToOfflineStatus = array('resumePlayer', 'resumePlayer', 'outUserResultsOverview', 'outUserListOfAnswerPasses');
     if (!$this->getCreationMode() && !$this->object->isOnline() && in_array($cmd, $cmdsDisabledDueToOfflineStatus)) {
         $cmd = 'infoScreen';
     }
     $next_class = $this->ctrl->getNextClass($this);
     $this->ctrl->setReturn($this, "infoScreen");
     if (method_exists($this->object, "getTestStyleLocation")) {
         $this->tpl->addCss($this->object->getTestStyleLocation("output"), "screen");
     }
     // add entry to navigation history
     if (!$this->getCreationMode() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $ilNavigationHistory->addItem($_GET["ref_id"], "ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=" . $_GET["ref_id"], "tst");
     }
     if (!$this->getCreationMode()) {
         if (IS_PAYMENT_ENABLED) {
             require_once 'Services/Payment/classes/class.ilPaymentObject.php';
             if (ilPaymentObject::_requiresPurchaseToAccess($this->object->getRefId(), $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) {
                 $this->setLocator();
                 $this->tpl->getStandardTemplate();
                 include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
                 $pp = new ilShopPurchaseGUI((int) $_GET['ref_id']);
                 $ret = $this->ctrl->forwardCommand($pp);
                 $this->tpl->show();
                 exit;
             }
         }
     }
     // elba hack for storing question id for inserting new question after
     if ($_REQUEST['prev_qid']) {
         global $___prev_question_id;
         $___prev_question_id = $_REQUEST['prev_qid'];
         $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
     }
     if (!$this->getCreationMode() && $this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken()) {
         if (!$this->isValidRequestOnBrokenQuestionSetDepencies($next_class, $cmd)) {
             $this->ctrl->redirectByClass('ilObjTestGUI', 'infoScreen');
         }
     }
     $this->determineObjectiveOrientedContainer();
     switch ($next_class) {
         case 'iltestexportgui':
             if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
                 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
             }
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilTestExportGUI.php';
             $ilCtrl->forwardCommand(new ilTestExportGUI($this));
             break;
         case "ilinfoscreengui":
             $this->prepareOutput();
             $this->addHeaderAction();
             $this->infoScreen();
             // forwards command
             break;
         case 'ilmdeditorgui':
             if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
                 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
             }
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
             $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
             $md_gui->addObserver($this->object, 'MDUpdateListener', 'General');
             $this->ctrl->forwardCommand($md_gui);
             break;
         case "iltestplayerfixedquestionsetgui":
             require_once "./Modules/Test/classes/class.ilTestPlayerFixedQuestionSetGUI.php";
             if (!$this->object->getKioskMode()) {
                 $this->prepareOutput();
             }
             $gui = new ilTestPlayerFixedQuestionSetGUI($this->object);
             $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
             $this->ctrl->forwardCommand($gui);
             break;
         case "iltestplayerrandomquestionsetgui":
             require_once "./Modules/Test/classes/class.ilTestPlayerRandomQuestionSetGUI.php";
             if (!$this->object->getKioskMode()) {
                 $this->prepareOutput();
             }
             $gui = new ilTestPlayerRandomQuestionSetGUI($this->object);
             $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
             $this->ctrl->forwardCommand($gui);
             break;
         case "iltestplayerdynamicquestionsetgui":
             require_once "./Modules/Test/classes/class.ilTestPlayerDynamicQuestionSetGUI.php";
             if (!$this->object->getKioskMode()) {
                 $this->prepareOutput();
             }
             $gui = new ilTestPlayerDynamicQuestionSetGUI($this->object);
             $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
             $this->ctrl->forwardCommand($gui);
             break;
         case "iltestevaluationgui":
             $this->forwardToEvaluationGUI();
             break;
         case "iltestevalobjectiveorientedgui":
             $this->forwardToEvalObjectiveOrientedGUI();
             break;
         case "iltestservicegui":
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once "./Modules/Test/classes/class.ilTestServiceGUI.php";
             $serviceGUI =& new ilTestServiceGUI($this->object);
             $this->ctrl->forwardCommand($serviceGUI);
             break;
         case 'ilpermissiongui':
             $this->prepareOutput();
             $this->addHeaderAction();
             include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
             $perm_gui =& new ilPermissionGUI($this);
             $ret =& $this->ctrl->forwardCommand($perm_gui);
             break;
         case "illearningprogressgui":
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
             $new_gui =& new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId());
             $this->ctrl->forwardCommand($new_gui);
             break;
         case "ilcertificategui":
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
             require_once "./Modules/Test/classes/class.ilTestCertificateAdapter.php";
             $output_gui = new ilCertificateGUI(new ilTestCertificateAdapter($this->object));
             $this->ctrl->forwardCommand($output_gui);
             break;
         case "iltestscoringgui":
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once "./Modules/Test/classes/class.ilTestScoringGUI.php";
             $output_gui = new ilTestScoringGUI($this->object);
             $this->ctrl->forwardCommand($output_gui);
             break;
         case 'ilmarkschemagui':
             if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
                 ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true);
                 $this->ctrl->redirect($this, 'infoScreen');
             }
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilMarkSchemaGUI.php';
             $mark_schema_gui = new ilMarkSchemaGUI($this->object);
             $this->ctrl->forwardCommand($mark_schema_gui);
             break;
         case 'iltestscoringbyquestionsgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             include_once 'Modules/Test/classes/class.ilTestScoringByQuestionsGUI.php';
             $output_gui = new ilTestScoringByQuestionsGUI($this->object);
             $this->ctrl->forwardCommand($output_gui);
             break;
         case 'ilobjtestsettingsgeneralgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php';
             $gui = new ilObjTestSettingsGeneralGUI($this->ctrl, $ilAccess, $this->lng, $this->tpl, $this->tree, $ilDB, $ilPluginAdmin, $ilUser, $this);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilobjtestsettingsscoringresultsgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php';
             $gui = new ilObjTestSettingsScoringResultsGUI($this->ctrl, $ilAccess, $this->lng, $this->tpl, $this->tree, $ilDB, $ilPluginAdmin, $this);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilobjtestdynamicquestionsetconfiggui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfigGUI.php';
             $gui = new ilObjTestDynamicQuestionSetConfigGUI($this->ctrl, $ilAccess, $ilTabs, $this->lng, $this->tpl, $ilDB, $tree, $ilPluginAdmin, $this->object);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestrandomquestionsetconfiggui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetConfigGUI.php';
             $gui = new ilTestRandomQuestionSetConfigGUI($this->ctrl, $ilAccess, $ilTabs, $this->lng, $this->tpl, $ilDB, $tree, $ilPluginAdmin, $this->object);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestquestionbrowsertablegui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
             $gui = new ilTestQuestionBrowserTableGUI($this->ctrl, $this->tpl, $ilTabs, $this->lng, $tree, $ilDB, $ilPluginAdmin, $this->object);
             $gui->setWriteAccess($ilAccess->checkAccess("write", "", $this->ref_id));
             $gui->init();
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestskilladministrationgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilTestSkillAdministrationGUI.php';
             $gui = new ilTestSkillAdministrationGUI($ilias, $this->ctrl, $ilAccess, $ilTabs, $this->tpl, $this->lng, $ilDB, $tree, $ilPluginAdmin, $this->object, $this->ref_id);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestskillevaluationgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
             if ($this->object->isDynamicTest()) {
                 require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
                 $dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this->object);
                 $dynamicQuestionSetConfig->loadFromDb();
                 $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
                 $questionList->setParentObjId($dynamicQuestionSetConfig->getSourceQuestionPoolId());
                 $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS);
             } else {
                 $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
                 $questionList->setParentObjId($this->object->getId());
                 $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
             }
             $questionList->load();
             require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
             $testSessionFactory = new ilTestSessionFactory($this->object);
             $testSession = $testSessionFactory->getSession();
             $testResults = $this->object->getTestResult($testSession->getActiveId(), $testSession->getPass(), true);
             require_once 'Modules/Test/classes/class.ilTestSkillEvaluationGUI.php';
             $gui = new ilTestSkillEvaluationGUI($this->ctrl, $ilTabs, $this->tpl, $this->lng, $ilDB, $this->object->getTestId(), $this->object->getRefId(), $this->object->getId());
             $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
             $gui->setQuestionList($questionList);
             $gui->setTestSession($testSession);
             $gui->setTestResults($testResults);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilobjectcopygui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once './Services/Object/classes/class.ilObjectCopyGUI.php';
             $cp = new ilObjectCopyGUI($this);
             $cp->setType('tst');
             $this->ctrl->forwardCommand($cp);
             break;
         case 'ilrepositorysearchgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
             $rep_search =& new ilRepositorySearchGUI();
             $rep_search->setCallback($this, 'addParticipantsObject', array());
             // Set tabs
             $this->ctrl->setReturn($this, 'participants');
             $ret =& $this->ctrl->forwardCommand($rep_search);
             $this->tabs_gui->setTabActive('participants');
             break;
         case 'ilpageeditorgui':
         case 'iltestexpresspageobjectgui':
             require_once 'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
             $incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($ilDB);
             $incompleteQuestionPurger->setOwnerId($ilUser->getId());
             $incompleteQuestionPurger->purge();
             $qid = $_REQUEST['q_id'];
             // :FIXME: does not work
             // $this->ctrl->saveParameterByClass(array('iltestexpresspageobjectgui', 'assorderingquestiongui', 'ilpageeditorgui', 'ilpcquestion', 'ilpcquestiongui'), 'test_express_mode');
             if (!$qid || $qid == 'Array') {
                 $questions = $this->object->getQuestionTitlesAndIndexes();
                 if (!is_array($questions)) {
                     $questions = array();
                 }
                 $keys = array_keys($questions);
                 $qid = $keys[0];
                 $_REQUEST['q_id'] = $qid;
                 $_GET['q_id'] = $qid;
                 $_POST['q_id'] = $qid;
             }
             $this->prepareOutput();
             if (!in_array($cmd, array('addQuestion', 'browseForQuestions'))) {
                 $this->buildPageViewToolbar($qid);
             }
             if (!$qid || in_array($cmd, array('insertQuestions', 'browseForQuestions'))) {
                 require_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php";
                 $pageObject = new ilTestExpressPageObjectGUI(0);
                 $pageObject->test_object = $this->object;
                 $ret =& $this->ctrl->forwardCommand($pageObject);
                 break;
             }
             require_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $this->tpl->setCurrentBlock("ContentStyle");
             $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
             $this->tpl->parseCurrentBlock();
             // syntax style
             $this->tpl->setCurrentBlock("SyntaxStyle");
             $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
             $this->tpl->parseCurrentBlock();
             require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui = assQuestionGUI::_getQuestionGUI("", $qid);
             if (!$q_gui instanceof assQuestionGUI) {
                 $this->ctrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', '');
                 $this->ctrl->redirectByClass('iltestexpresspageobjectgui', $this->ctrl->getCmd());
             }
             $q_gui->outAdditionalOutput();
             $q_gui->object->setObjId($this->object->getId());
             $question = $q_gui->object;
             $this->ctrl->saveParameter($this, "q_id");
             #$this->lng->loadLanguageModule("content");
             $this->ctrl->setReturnByClass("ilTestExpressPageObjectGUI", "view");
             $this->ctrl->setReturn($this, "questions");
             require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
             require_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php";
             $page_gui = new ilTestExpressPageObjectGUI($qid);
             $page_gui->test_object = $this->object;
             $page_gui->setEditPreview(true);
             $page_gui->setEnabledTabs(false);
             if (strlen($this->ctrl->getCmd()) == 0) {
                 $this->ctrl->setCmdClass(get_class($page_gui));
                 $this->ctrl->setCmd("preview");
             }
             $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE)));
             $page_gui->setTemplateTargetVar("ADM_CONTENT");
             $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? "edit" : 'preview');
             $page_gui->setHeader($question->getTitle());
             $page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, "downloadFile"));
             $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "fullscreen"));
             $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this));
             $page_gui->setPresentationTitle($question->getTitle() . ' [' . $this->lng->txt('question_id_short') . ': ' . $question->getId() . ']');
             $ret =& $this->ctrl->forwardCommand($page_gui);
             global $ilTabs;
             $ilTabs->activateTab('assQuestions');
             $this->tpl->setContent($ret);
             break;
         case 'ilassquestionpreviewgui':
             $this->prepareOutput();
             $this->ctrl->saveParameter($this, "q_id");
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewGUI.php';
             $gui = new ilAssQuestionPreviewGUI($this->ctrl, $this->tabs_gui, $this->tpl, $this->lng, $ilDB);
             $gui->initQuestion((int) $_GET['q_id'], $this->object->getId());
             $gui->initPreviewSettings($this->object->getRefId());
             $gui->initPreviewSession($ilUser->getId(), (int) $_GET['q_id']);
             $gui->initHintTracking();
             $gui->initStyleSheets();
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilassquestionpagegui':
             require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
             //echo $_REQUEST['prev_qid'];
             if ($_REQUEST['prev_qid']) {
                 $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
             }
             $this->prepareOutput();
             //global $___test_express_mode;
             //$___test_express_mode = true;
             $_GET['calling_test'] = $this->object->getRefId();
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $this->tpl->setCurrentBlock("ContentStyle");
             $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
             $this->tpl->parseCurrentBlock();
             // syntax style
             $this->tpl->setCurrentBlock("SyntaxStyle");
             $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
             $this->tpl->parseCurrentBlock();
             require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
             $q_gui->setQuestionTabs();
             $q_gui->outAdditionalOutput();
             $q_gui->object->setObjId($this->object->getId());
             $question =& $q_gui->object;
             $this->ctrl->saveParameter($this, "q_id");
             $this->lng->loadLanguageModule("content");
             $this->ctrl->setReturnByClass("ilAssQuestionPageGUI", "view");
             $this->ctrl->setReturn($this, "questions");
             $page_gui = new ilAssQuestionPageGUI($_GET["q_id"]);
             $page_gui->setEditPreview(true);
             if (strlen($this->ctrl->getCmd()) == 0) {
                 $this->ctrl->setCmdClass(get_class($page_gui));
                 $this->ctrl->setCmd("preview");
             }
             $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE)));
             $page_gui->setTemplateTargetVar("ADM_CONTENT");
             $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? "edit" : 'preview');
             $page_gui->setHeader($question->getTitle());
             $page_gui->setPresentationTitle($question->getTitle() . ' [' . $this->lng->txt('question_id_short') . ': ' . $question->getId() . ']');
             $ret =& $this->ctrl->forwardCommand($page_gui);
             $this->tpl->setContent($ret);
             break;
         case 'ilassspecfeedbackpagegui':
             require_once "./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php";
             $pg_gui = new ilAssSpecFeedbackPageGUI((int) $_GET["feedback_id"]);
             $this->ctrl->forwardCommand($pg_gui);
             break;
         case 'ilassgenfeedbackpagegui':
             require_once "./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php";
             $pg_gui = new ilAssGenFeedbackPageGUI((int) $_GET["feedback_id"]);
             $this->ctrl->forwardCommand($pg_gui);
             break;
         case 'illocalunitconfigurationgui':
             $this->prepareSubGuiOutput();
             // set return target
             $this->ctrl->setReturn($this, "questions");
             // set context tabs
             require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
             $questionGUI = assQuestionGUI::_getQuestionGUI('', $_GET['q_id']);
             $questionGUI->object->setObjId($this->object->getId());
             $questionGUI->setQuestionTabs();
             require_once 'Modules/TestQuestionPool/classes/class.ilLocalUnitConfigurationGUI.php';
             require_once 'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php';
             $gui = new ilLocalUnitConfigurationGUI(new ilUnitConfigurationRepository((int) $_GET['q_id']));
             $this->ctrl->forwardCommand($gui);
             break;
         case "ilcommonactiondispatchergui":
             require_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilassquestionhintsgui':
             $this->prepareSubGuiOutput();
             // set return target
             $this->ctrl->setReturn($this, "questions");
             // set context tabs
             require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
             $questionGUI =& assQuestionGUI::_getQuestionGUI($q_type, $_GET['q_id']);
             $questionGUI->object->setObjId($this->object->getId());
             $questionGUI->setQuestionTabs();
             // forward to ilAssQuestionHintsGUI
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
             $gui = new ilAssQuestionHintsGUI($questionGUI);
             $ilCtrl->forwardCommand($gui);
             break;
         case 'ilassquestionfeedbackeditinggui':
             $this->prepareSubGuiOutput();
             // set return target
             $this->ctrl->setReturn($this, "questions");
             // set context tabs
             require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
             $questionGUI = assQuestionGUI::_getQuestionGUI('', $_GET['q_id']);
             $questionGUI->object->setObjId($this->object->getId());
             $questionGUI->setQuestionTabs();
             // forward to ilAssQuestionFeedbackGUI
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
             $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng);
             $ilCtrl->forwardCommand($gui);
             break;
         case 'iltesttoplistgui':
             $this->prepareOutput();
             require_once './Modules/Test/classes/class.ilTestToplistGUI.php';
             $gui = new ilTestToplistGUI($this);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilscoringadjustmentgui':
             $this->prepareOutput();
             require_once './Modules/Test/classes/class.ilScoringAdjustmentGUI.php';
             $gui = new ilScoringAdjustmentGUI($this->object);
             $this->ctrl->forwardCommand($gui);
             break;
         case '':
         case 'ilobjtestgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             if (strcmp($cmd, "properties") == 0 && $_GET["browse"]) {
                 $this->questionBrowser();
                 return;
             }
             if (strcmp($cmd, "properties") == 0 && ($_GET["up"] || $_GET["down"])) {
                 $this->questionsObject();
                 return;
             }
             $cmd .= "Object";
             $ret =& $this->{$cmd}();
             break;
         default:
             // elba hack for storing question id for inserting new question after
             if ($_REQUEST['prev_qid']) {
                 global $___prev_question_id;
                 $___prev_question_id = $_REQUEST['prev_qid'];
                 $this->ctrl->setParameterByClass('ilassquestionpagegui', 'prev_qid', $_REQUEST['prev_qid']);
                 $this->ctrl->setParameterByClass($_GET['sel_question_types'] . 'gui', 'prev_qid', $_REQUEST['prev_qid']);
             }
             $this->create_question_mode = true;
             $this->prepareOutput();
             $this->ctrl->setReturn($this, "questions");
             require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui =& assQuestionGUI::_getQuestionGUI($_GET['sel_question_types'], $_GET["q_id"]);
             $q_gui->object->setObjId($this->object->getId());
             if (!$_GET['sel_question_types']) {
                 $qType = assQuestion::getQuestionTypeFromDb($_GET['q_id']);
             } else {
                 $qType = $_GET['sel_question_types'];
             }
             $this->ctrl->setParameterByClass($qType . "GUI", 'prev_qid', $_REQUEST['prev_qid']);
             $this->ctrl->setParameterByClass($qType . "GUI", 'test_ref_id', $_REQUEST['ref_id']);
             $this->ctrl->setParameterByClass($qType . "GUI", 'q_id', $_REQUEST['q_id']);
             if ($_REQUEST['test_express_mode']) {
                 $this->ctrl->setParameterByClass($qType . "GUI", 'test_express_mode', 1);
             }
             #global $___test_express_mode;
             #$___test_express_mode = true;
             if (!$q_gui->isSaveCommand()) {
                 $_GET['calling_test'] = $this->object->getRefId();
             }
             $q_gui->setQuestionTabs();
             #unset($___test_express_mode);
             $ret =& $this->ctrl->forwardCommand($q_gui);
             break;
     }
     if (!in_array(strtolower($_GET["baseClass"]), array('iladministrationgui', 'ilrepositorygui')) && $this->getCreationMode() != true) {
         $this->tpl->show();
     }
 }
 public function getAllQuestionsData()
 {
     return $this->completeQuestionList->getQuestionDataArray();
 }
 public function executeCommand()
 {
     if ($this->isAccessDenied()) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     $nextClass = $this->ctrl->getNextClass();
     $this->manageTabs($nextClass);
     switch ($nextClass) {
         case 'ilassquestionskillassignmentsgui':
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
             $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
             $questionList->setParentObjId($this->poolOBJ->getId());
             $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS);
             $questionList->load();
             $gui = new ilAssQuestionSkillAssignmentsGUI($this->ctrl, $this->access, $this->tpl, $this->lng, $this->db);
             $gui->setAssignmentEditingEnabled(true);
             $gui->setQuestionContainerId($this->poolOBJ->getId());
             $gui->setQuestionList($questionList);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilassquestionskillusagestablegui':
             $gui = new ilAssQuestionSkillUsagesTableGUI($this->ctrl, $this->tpl, $this->lng, $this->db, $this->poolOBJ->getId());
             $this->ctrl->forwardCommand($gui);
             break;
     }
 }
 /**
  * @return array
  */
 private function getQuestionsData()
 {
     $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
     $questionList->setQuestionInstanceTypeFilter($this->getQuestionInstanceTypeFilter());
     $questionList->setExcludeQuestionIdsFilter($this->testOBJ->getExistingQuestions());
     $repositoryRootNode = self::REPOSITORY_ROOT_NODE_ID;
     foreach ($this->getFilterItems() as $item) {
         if ($item->getValue() !== false) {
             switch ($item->getPostVar()) {
                 case 'title':
                 case 'description':
                 case 'author':
                 case 'type':
                 case 'parent_title':
                     $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
                     break;
                 case 'repository_root_node':
                     $repositoryRootNode = $item->getValue();
             }
         }
     }
     $parentObjectIds = $this->getQuestionParentObjIds($repositoryRootNode);
     if (!count($parentObjectIds)) {
         return array();
     }
     $questionList->setParentObjIdsFilter($parentObjectIds);
     $questionList->load();
     return $questionList->getQuestionDataArray();
 }
Beispiel #11
0
 /**
  * Get blocked users information
  *
  * @param
  * @return
  */
 function getBlockedUsersInformation()
 {
     global $ilDB, $lng, $ilPluginAdmin, $ilUser;
     $blocked_users = array();
     // load question/pages information
     $this->page_questions = array();
     $this->all_questions = array();
     $page_for_question = array();
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     $q = ilLMPageObject::queryQuestionsOfLearningModule($this->lm_obj_id, "", "", 0, 0);
     foreach ($q["set"] as $quest) {
         $this->page_questions[$quest["page_id"]][] = $quest["question_id"];
         $this->all_questions[] = $quest["question_id"];
         $page_for_question[$quest["question_id"]] = $quest["page_id"];
     }
     // get question information
     include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionList.php";
     $qlist = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin);
     $qlist->setParentObjId(0);
     $qlist->addFieldFilter("question_id", $this->all_questions);
     $qlist->load();
     $qdata = $qlist->getQuestionDataArray();
     // load question answer information
     include_once "./Services/COPage/classes/class.ilPageQuestionProcessor.php";
     $this->answer_status = ilPageQuestionProcessor::getAnswerStatus($this->all_questions);
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     foreach ($this->answer_status as $as) {
         if ($as["try"] >= $qdata[$as["qst_id"]]["nr_of_tries"] && $qdata[$as["qst_id"]]["nr_of_tries"] > 0 && !$as["passed"]) {
             //var_dump($qdata[$as["qst_id"]]);
             $name = ilObjUser::_lookupName($as["user_id"]);
             $as["user_name"] = $name["lastname"] . ", " . $name["firstname"] . " [" . $name["login"] . "]";
             $as["question_text"] = $qdata[$as["qst_id"]]["question_text"];
             $as["page_id"] = $page_for_question[$as["qst_id"]];
             $as["page_title"] = ilLMPageObject::_lookupTitle($as["page_id"]);
             $blocked_users[] = $as;
         }
     }
     return $blocked_users;
 }
 private function getSkillSelectorHeader($questionId)
 {
     $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
     return sprintf($this->lng->txt('qpl_qst_skl_selection_for_question_header'), $questionData['title']);
 }
 protected function getFilteredTestResult($active_id, $pass)
 {
     global $ilDB, $ilPluginAdmin;
     $testResults = $this->object->getTestResult($active_id, $pass);
     $questionIds = array();
     foreach ($testResults as $resultItemKey => $resultItemValue) {
         if ($resultItemKey === 'test' || $resultItemKey === 'pass') {
             continue;
         }
         $questionIds[] = $resultItemValue['qid'];
     }
     $table_gui = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
     $table_gui->initFilter();
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
     $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin, null);
     $questionList->setQuestionIdsFilter($questionIds);
     $questionList->setQuestionInstanceTypeFilter(null);
     foreach ($table_gui->getFilterItems() as $item) {
         if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
             $v = $item->getValue();
             if (is_array($v) && count($v) && !(int) $v[0]) {
                 continue;
             }
             $taxId = substr($item->getPostVar(), strlen('tax_'));
             $questionList->addTaxonomyFilter($taxId, $item->getValue());
         } elseif ($item->getValue() !== false) {
             $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
         }
     }
     $questionList->load();
     $filteredTestResult = array();
     foreach ($testResults as $resultItemKey => $resultItemValue) {
         if ($resultItemKey === 'test' || $resultItemKey === 'pass') {
             continue;
         }
         if (!$questionList->isInList($resultItemValue['qid'])) {
             continue;
         }
         $filteredTestResult[] = $resultItemValue;
     }
     return $filteredTestResult;
 }
 public function getFilteredQuestionsData()
 {
     return $this->filteredQuestionList->getQuestionDataArray();
 }
 private static function getQuestionData($testObjId, $questionIds)
 {
     global $ilDB, $lng, $ilPluginAdmin;
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
     $questionList = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin, $testObjId);
     $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
     $questionList->setQuestionIdsFilter($questionIds);
     $questionList->load();
     return $questionList->getQuestionDataArray();
 }
 protected function buildTestPassQuestionList()
 {
     global $ilPluginAdmin;
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
     $questionList = new ilAssQuestionList($this->db, $this->lng, $ilPluginAdmin);
     $questionList->setParentObjId($this->dynamicQuestionSetConfig->getSourceQuestionPoolId());
     $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS);
     return $questionList;
 }