private function buildSourcePoolDefinitionListTableGUI() { require_once 'Modules/Test/classes/tables/class.ilTestRandomQuestionSetSourcePoolDefinitionListTableGUI.php'; $table = new ilTestRandomQuestionSetSourcePoolDefinitionListTableGUI($this->ctrl, $this->lng, $this, self::CMD_SHOW_SRC_POOL_DEF_LIST); if (!$this->testOBJ->participantDataExist()) { $table->setDefinitionEditModeEnabled(true); } $table->setQuestionAmountColumnEnabled($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()); require_once 'Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php'; $translater = new ilTestTaxonomyFilterLabelTranslater($this->db); $translater->loadLabels($this->sourcePoolDefinitionList); $table->setTaxonomyFilterLabelTranslater($translater); $table->build(); return $table; }
/** * Lookup assigned qpl name (including taxonomy) by sequence * @param type $a_test_ref_id * @param type $a_sequence_id * @return string */ public static function lookupQplBySequence($a_test_ref_id, $a_sequence_id) { if (!$a_sequence_id) { return ''; } $tst = ilObjectFactory::getInstanceByRefId($a_test_ref_id, false); if (!$tst instanceof ilObjTest) { return ''; } include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php'; include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php'; $list = new ilTestRandomQuestionSetSourcePoolDefinitionList($GLOBALS['ilDB'], $tst, new ilTestRandomQuestionSetSourcePoolDefinitionFactory($GLOBALS['ilDB'], $tst)); $list->loadDefinitions(); include_once './Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php'; $translator = new ilTestTaxonomyFilterLabelTranslater($GLOBALS['ilDB']); $translator->loadLabels($list); $title = ''; foreach ($list as $definition) { if ($definition->getId() != $a_sequence_id) { continue; } $title = self::buildQplTitleByDefinition($definition, $translator); } return $title; }
/** * Parse test * throws ilLOInvalidConfigurationException in case assigned test cannot be found. */ public function parse($a_tst_ref_id) { include_once './Modules/Test/classes/class.ilObjTest.php'; $tst = ilObjectFactory::getInstanceByRefId($a_tst_ref_id, false); if (!$tst instanceof ilObjTest) { throw new ilLOInvalidConfigurationException('No valid test given'); } $tst_data['ref_id'] = $tst->getRefId(); $tst_data['title'] = $tst->getTitle(); $tst_data['description'] = $tst->getLongDescription(); $tst_data['ttype'] = $tst->getQuestionSetType(); switch ($tst->getQuestionSetType()) { case ilObjTest::QUESTION_SET_TYPE_FIXED: $tst_data['qst_info'] = $this->lng->txt('crs_loc_tst_num_qst'); $tst_data['qst_info'] .= ' ' . count($tst->getAllQuestions()); break; default: // get available assiged question pools include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php'; include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php'; $list = new ilTestRandomQuestionSetSourcePoolDefinitionList($GLOBALS['ilDB'], $tst, new ilTestRandomQuestionSetSourcePoolDefinitionFactory($GLOBALS['ilDB'], $tst)); $list->loadDefinitions(); // tax translations include_once './Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php'; $translater = new ilTestTaxonomyFilterLabelTranslater($GLOBALS['ilDB']); $translater->loadLabels($list); $tst_data['qst_info'] = $this->lng->txt('crs_loc_tst_qpls'); $num = 0; foreach ($list as $definition) { /** @var ilTestRandomQuestionSetSourcePoolDefinition[] $definition */ $title = $definition->getPoolTitle(); $tax_id = $definition->getMappedFilterTaxId(); if ($tax_id) { $title .= ' -> ' . $translater->getTaxonomyTreeLabel($tax_id); } $tax_node = $definition->getMappedFilterTaxNodeId(); if ($tax_node) { $title .= ' -> ' . $translater->getTaxonomyNodeLabel($tax_node); } $tst_data['qpls'][] = $title; ++$num; } if (!$num) { $tst_data['qst_info'] .= ' ' . (int) 0; } break; } $this->setData(array($tst_data)); }
protected function getRandomTestQplOptions() { include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php'; include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php'; $tst_ref_id = $this->getSettings()->getTestByType($this->test_type); if ($tst_ref_id) { $tst = ilObjectFactory::getInstanceByRefId($tst_ref_id, false); } if (!$tst instanceof ilObjTest) { return array(); } $list = new ilTestRandomQuestionSetSourcePoolDefinitionList($GLOBALS['ilDB'], $tst, new ilTestRandomQuestionSetSourcePoolDefinitionFactory($GLOBALS['ilDB'], $tst)); $list->loadDefinitions(); include_once './Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php'; $translater = new ilTestTaxonomyFilterLabelTranslater($GLOBALS['ilDB']); $translater->loadLabels($list); $options[0] = $this->lng->txt('select_one'); foreach ($list as $definition) { $title = $definition->getPoolTitle(); $tax_id = $definition->getMappedFilterTaxId(); if ($tax_id) { $title .= ' -> ' . $translater->getTaxonomyTreeLabel($tax_id); } $tax_node = $definition->getMappedFilterTaxNodeId(); if ($tax_node) { $title .= ' -> ' . $translater->getTaxonomyNodeLabel($tax_node); } $options[$definition->getId()] = $title; } return $options; }