private function getTaxonomyTreeLabel($taxonomyTreeId) { if (!$taxonomyTreeId) { return ''; } return $this->taxonomyLabelTranslater->getTaxonomyTreeLabel($taxonomyTreeId); }
/** * 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)); }
/** * build title by definition * @param ilTestRandomQuestionSetSourcePoolDefinition $def */ protected static function buildQplTitleByDefinition(ilTestRandomQuestionSetSourcePoolDefinition $def, ilTestTaxonomyFilterLabelTranslater $trans) { $title = $def->getPoolTitle(); $tax_id = $def->getMappedFilterTaxId(); if ($tax_id) { $title .= ' -> ' . $trans->getTaxonomyTreeLabel($tax_id); } $tax_node = $def->getMappedFilterTaxNodeId(); if ($tax_node) { $title .= ' -> ' . $trans->getTaxonomyNodeLabel($tax_node); } return $title; }
private function addMiscSettingsFormSection(ilPropertyFormGUI $form) { // misc settings $header_misc = new ilFormSectionHeaderGUI(); $header_misc->setTitle($this->lng->txt('misc')); $form->addItem($header_misc); // result filter taxonomies if ($this->testQuestionSetConfigFactory->getQuestionSetConfig()->isResultTaxonomyFilterSupported()) { $availableTaxonomyIds = $this->getAvailableTaxonomyIds(); if (count($availableTaxonomyIds)) { require_once 'Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php'; $labelTranslater = new ilTestTaxonomyFilterLabelTranslater($this->db); $labelTranslater->loadLabelsFromTaxonomyIds($availableTaxonomyIds); $results_presentation = new ilCheckboxGroupInputGUI($this->lng->txt('tst_results_tax_filters'), 'results_tax_filters'); foreach ($availableTaxonomyIds as $taxonomyId) { $results_presentation->addOption(new ilCheckboxOption($labelTranslater->getTaxonomyTreeLabel($taxonomyId), $taxonomyId, '')); } $results_presentation->setValue($this->testOBJ->getResultFilterTaxIds()); $form->addItem($results_presentation); } } // anonymity $anonymity = new ilRadioGroupInputGUI($this->lng->txt('tst_anonymity'), 'anonymity'); if ($this->testOBJ->participantDataExist()) { $anonymity->setDisabled(true); } $rb = new ilRadioOption($this->lng->txt('tst_anonymity_no_anonymization'), 0); $anonymity->addOption($rb); $rb = new ilRadioOption($this->lng->txt('tst_anonymity_anonymous_test'), 1); $anonymity->addOption($rb); $anonymity->setValue((int) $this->testOBJ->getAnonymity()); $form->addItem($anonymity); // enable_archiving $enable_archiving = new ilCheckboxInputGUI($this->lng->txt('test_enable_archiving'), 'enable_archiving'); $enable_archiving->setInfo($this->lng->txt('test_enable_archiving_desc')); $enable_archiving->setValue(1); $enable_archiving->setChecked($this->testOBJ->getEnableArchiving()); $form->addItem($enable_archiving); }
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; }