/** * @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; }
/** * list questions of question pool */ function questionsObject($arrFilter = null) { global $rbacsystem; global $ilUser; if (get_class($this->object) == "ilObjTest") { if ($_GET["calling_test"] > 0) { $ref_id = $_GET["calling_test"]; $q_id = $_GET["q_id"]; if ($_REQUEST['test_express_mode']) { if ($q_id) { ilUtil::redirect("ilias.php?ref_id=" . $ref_id . "&q_id=" . $q_id . "&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI"); } else { ilUtil::redirect("ilias.php?ref_id=" . $ref_id . "&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI"); } } else { ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&ref_id=" . $ref_id . "&cmd=questions"); } } } $this->object->purgeQuestions(); // reset test_id SESSION variable $_SESSION["test_id"] = ""; $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_qpl_questionbrowser.html", "Modules/TestQuestionPool"); include_once "./Modules/TestQuestionPool/classes/tables/class.ilQuestionBrowserTableGUI.php"; $table_gui = new ilQuestionBrowserTableGUI($this, 'questions', $rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false); $table_gui->setEditable($rbacsystem->checkAccess('write', $_GET['ref_id'])); $arrFilter = array(); foreach ($table_gui->getFilterItems() as $item) { if ($item->getValue() !== false) { $arrFilter[$item->getPostVar()] = $item->getValue(); } } $data = $this->object->getQuestionBrowserData($arrFilter); $table_gui->setData($data); $this->tpl->setVariable('TABLE', $table_gui->getHTML()); if ($rbacsystem->checkAccess('write', $_GET['ref_id'])) { $this->tpl->setCurrentBlock("QTypes"); $types =& $this->object->getQuestionTypes(false, true); $lastquestiontype = $ilUser->getPref("tst_lastquestiontype"); foreach ($types as $translation => $data) { if ($data["type_tag"] == $lastquestiontype) { $this->tpl->setVariable("QUESTION_TYPE_SELECTED", " selected=\"selected\""); } $this->tpl->setVariable("QUESTION_TYPE_ID", $data["type_tag"]); $this->tpl->setVariable("QUESTION_TYPE", $translation); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("QUESTION_ADD", $this->lng->txt("create")); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, 'questions')); $this->tpl->parseCurrentBlock(); } }