/** * Init filter */ function initFilter() { global $lng; // title include_once "./Services/Form/classes/class.ilTextInputGUI.php"; $ti = new ilTextInputGUI($lng->txt("title"), "title"); $ti->setMaxLength(64); $ti->setSize(20); $ti->setValidationRegexp('/^[^%]+$/is'); $this->addFilterItem($ti); $ti->readFromSession(); $this->filter["title"] = $ti->getValue(); // description $ti = new ilTextInputGUI($lng->txt("description"), "description"); $ti->setMaxLength(64); $ti->setSize(20); $ti->setValidationRegexp('/^[^%]+$/is'); $this->addFilterItem($ti); $ti->readFromSession(); $this->filter["description"] = $ti->getValue(); // questiontype include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; $types = ilObjQuestionPool::_getQuestionTypes(); $options = array(); $options[""] = $lng->txt('filter_all_question_types'); foreach ($types as $translation => $row) { $options[$row['type_tag']] = $translation; } $si = new ilSelectInputGUI($this->lng->txt("question_type"), "type"); $si->setOptions($options); $this->addFilterItem($si); $si->readFromSession(); $this->filter["type"] = $si->getValue(); // author $ti = new ilTextInputGUI($lng->txt("author"), "author"); $ti->setMaxLength(64); $ti->setSize(20); $this->addFilterItem($ti); $ti->setValidationRegexp('/^[^%]+$/is'); $ti->readFromSession(); $this->filter["author"] = $ti->getValue(); // question pool $ti = new ilTextInputGUI($lng->txt("qpl"), "qpl"); $ti->setMaxLength(64); $ti->setSize(20); $ti->setValidationRegexp('/^[^%]+$/is'); $this->addFilterItem($ti); $ti->readFromSession(); $this->filter["qpl"] = $ti->getValue(); }
/** * Get all self assessment question types. * * @todo Make it more flexible */ static function &_getSelfAssessmentQuestionTypes($all_tags = FALSE) { /* $allowed_types = array( "assSingleChoice" => 1, "assMultipleChoice" => 2, "assClozeTest" => 3, "assMatchingQuestion" => 4, "assOrderingQuestion" => 5, "assOrderingHorizontal" => 6, "assImagemapQuestion" => 7, "assTextQuestion" => 8, "assTextSubset" => 9, "assErrorText" => 10 );*/ $allowed_types = array("assSingleChoice" => 1, "assMultipleChoice" => 2, "assClozeTest" => 3, "assMatchingQuestion" => 4, "assOrderingQuestion" => 5, "assOrderingHorizontal" => 6, "assImagemapQuestion" => 7, "assTextSubset" => 9, "assErrorText" => 10); $satypes = array(); $qtypes = ilObjQuestionPool::_getQuestionTypes($all_tags); foreach ($qtypes as $k => $t) { //if (in_array($t["type_tag"], $allowed_types)) if (isset($allowed_types[$t["type_tag"]])) { $t["order"] = $allowed_types[$t["type_tag"]]; $satypes[$k] = $t; } } return $satypes; }
/** * Save Assessment settings */ public function saveSettingsObject() { global $ilAccess; if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) { $this->ctrl->redirect($this, 'settings'); } $form = $this->buildSettingsForm(); if (!$form->checkInput()) { $form->setValuesByPost(); return $this->settingsObject($form); } $this->object->_setManualScoring($_POST["chb_manual_scoring"]); include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; $questiontypes =& ilObjQuestionPool::_getQuestionTypes(TRUE); $forbidden_types = array(); foreach ($questiontypes as $name => $row) { if (!in_array($row["question_type_id"], $_POST["chb_allowed_questiontypes"])) { array_push($forbidden_types, $row["question_type_id"]); } } $this->object->_setForbiddenQuestionTypes($forbidden_types); $this->object->setScoringAdjustmentEnabled($_POST['chb_scoring_adjust']); $scoring_types = array(); foreach ($questiontypes as $name => $row) { if (in_array($row["question_type_id"], (array) $_POST["chb_scoring_adjustment"])) { array_push($scoring_types, $row["question_type_id"]); } } $this->object->setScoringAdjustableQuestions($scoring_types); if (!$_POST['ass_process_lock']) { $this->object->setAssessmentProcessLockMode(ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE); } elseif (in_array($_POST['ass_process_lock_mode'], ilObjAssessmentFolder::getValidAssessmentProcessLockModes())) { $this->object->setAssessmentProcessLockMode($_POST['ass_process_lock_mode']); } $assessmentSetting = new ilSetting('assessment'); $assessmentSetting->set('use_javascript', '1'); if (strlen($_POST['imap_line_color']) == 6) { $assessmentSetting->set('imap_line_color', ilUtil::stripSlashes($_POST['imap_line_color'])); } $assessmentSetting->set('user_criteria', ilUtil::stripSlashes($_POST['user_criteria'])); ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirect($this, 'settings'); }
public function initFilter() { // title include_once "./Services/Form/classes/class.ilTextInputGUI.php"; $ti = new ilTextInputGUI($this->lng->txt("tst_qbt_filter_question_title"), "title"); $ti->setMaxLength(64); $ti->setSize(20); $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is'); $this->addFilterItem($ti); $ti->readFromSession(); $this->filter["title"] = $ti->getValue(); // description $ti = new ilTextInputGUI($this->lng->txt("description"), "description"); $ti->setMaxLength(64); $ti->setSize(20); $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is'); $this->addFilterItem($ti); $ti->readFromSession(); $this->filter["description"] = $ti->getValue(); // questiontype include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; $types = ilObjQuestionPool::_getQuestionTypes(); $options = array(); $options[""] = $this->lng->txt('filter_all_question_types'); foreach ($types as $translation => $row) { $options[$row['type_tag']] = $translation; } $si = new ilSelectInputGUI($this->lng->txt("question_type"), "type"); $si->setOptions($options); $this->addFilterItem($si); $si->readFromSession(); $this->filter["type"] = $si->getValue(); // author $ti = new ilTextInputGUI($this->lng->txt("author"), "author"); $ti->setMaxLength(64); $ti->setSize(20); $this->addFilterItem($ti); $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is'); $ti->readFromSession(); $this->filter["author"] = $ti->getValue(); // question pool $ti = new ilTextInputGUI($this->getParentObjectLabel(), 'parent_title'); $ti->setMaxLength(64); $ti->setSize(20); $ti->setValidationRegexp('/(^[^%]+$)|(^$)/is'); $this->addFilterItem($ti); $ti->readFromSession(); $this->filter['parent_title'] = $ti->getValue(); // repo root node require_once 'Services/Form/classes/class.ilRepositorySelectorInputGUI.php'; $ri = new ilRepositorySelectorInputGUI($this->lng->txt('repository'), 'repository_root_node'); $ri->setHeaderMessage($this->lng->txt('question_browse_area_info')); $this->addFilterItem($ri); $ri->readFromSession(); $this->filter['repository_root_node'] = $ri->getValue(); }
/** * Init filter */ function initFilter() { global $lng, $rbacreview, $ilUser; // title include_once "./Services/Form/classes/class.ilTextInputGUI.php"; $ti = new ilTextInputGUI($lng->txt("title"), "title"); $ti->setMaxLength(64); $ti->setValidationRegexp('/^[^%]+$/is'); $ti->setSize(20); $this->addFilterItem($ti); $ti->readFromSession(); $this->filter["title"] = $ti->getValue(); // description $ti = new ilTextInputGUI($lng->txt("description"), "description"); $ti->setMaxLength(64); $ti->setSize(20); $ti->setValidationRegexp('/^[^%]+$/is'); $this->addFilterItem($ti); $ti->readFromSession(); $this->filter["description"] = $ti->getValue(); if (!$this->confirmdelete) { // author $ti = new ilTextInputGUI($lng->txt("author"), "author"); $ti->setMaxLength(64); $ti->setSize(20); $ti->setValidationRegexp('/^[^%]+$/is'); $this->addFilterItem($ti); $ti->readFromSession(); $this->filter["author"] = $ti->getValue(); } // questiontype include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; $types = ilObjQuestionPool::_getQuestionTypes(); $options = array(); $options[""] = $lng->txt('filter_all_question_types'); foreach ($types as $translation => $row) { $options[$row['type_tag']] = $translation; } $si = new ilSelectInputGUI($this->lng->txt("question_type"), "type"); $si->setOptions($options); $this->addFilterItem($si); $si->readFromSession(); $this->filter["type"] = $si->getValue(); if ($this->parent_obj->object->getShowTaxonomies()) { require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php'; foreach ($this->taxIds as $taxId) { if ($taxId == $this->parent_obj->object->getNavTaxonomyId()) { continue; } $postvar = "tax_{$taxId}"; $inp = new ilTaxSelectInputGUI($taxId, $postvar, true); $this->addFilterItem($inp); $inp->readFromSession(); $this->filter[$postvar] = $inp->getValue(); } } }
/** * Save Assessment settings */ public function saveSettingsObject() { global $ilAccess; if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) { $this->ctrl->redirect($this, 'settings'); } if ($_POST["chb_assessment_logging"] == 1) { $this->object->_enableAssessmentLogging(1); } else { $this->object->_enableAssessmentLogging(0); } $this->object->_setLogLanguage($_POST["reporting_language"]); $this->object->_setManualScoring($_POST["chb_manual_scoring"]); include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; $questiontypes =& ilObjQuestionPool::_getQuestionTypes(TRUE); $forbidden_types = array(); foreach ($questiontypes as $name => $row) { if (!in_array($row["question_type_id"], $_POST["chb_allowed_questiontypes"])) { array_push($forbidden_types, $row["question_type_id"]); } } $this->object->_setForbiddenQuestionTypes($forbidden_types); ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirect($this, 'settings'); }
function questionsObject() { global $ilAccess, $ilTabs; $ilTabs->activateTab('assQuestions'); if (!$ilAccess->checkAccess("write", "", $this->ref_id)) { // allow only write access ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true); $this->ctrl->redirect($this, "infoScreen"); } if ($_GET['browse']) { return $this->questionbrowser(); } $this->getQuestionsSubTabs(); if ($this->object->isRandomTest()) { $this->randomQuestionsObject(); return; } if ($_GET["eqid"] && $_GET["eqpl"]) { ilUtil::redirect("ilias.php?baseClass=ilObjQuestionPoolGUI&ref_id=" . $_GET["eqpl"] . "&cmd=editQuestionForTest&calling_test=" . $_GET["ref_id"] . "&q_id=" . $_GET["eqid"]); } if ($_GET["up"] > 0) { $this->object->questionMoveUp($_GET["up"]); } if ($_GET["down"] > 0) { $this->object->questionMoveDown($_GET["down"]); } if ($_GET["add"]) { $selected_array = array(); array_push($selected_array, $_GET["add"]); $total = $this->object->evalTotalPersons(); if ($total) { // the test was executed previously ilUtil::sendInfo(sprintf($this->lng->txt("tst_insert_questions_and_results"), $total)); } else { ilUtil::sendInfo($this->lng->txt("tst_insert_questions")); } $this->insertQuestions($selected_array); return; } $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_questions.html", "Modules/Test"); $total = $this->object->evalTotalPersons(); if ($ilAccess->checkAccess("write", "", $this->ref_id)) { if ($total != 0) { $link = $this->ctrl->getLinkTarget($this, "participants"); $link = "<a href=\"" . $link . "\">" . $this->lng->txt("test_has_datasets_warning_page_view_link") . "</a>"; ilUtil::sendInfo($this->lng->txt("test_has_datasets_warning_page_view") . " " . $link); } else { global $ilToolbar; $qtypes = array(); include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; foreach (ilObjQuestionPool::_getQuestionTypes(false, true) as $trans => $data) { $qtypes[$data['type_tag']] = $trans; } $ilToolbar->setFormAction($this->ctrl->getFormAction($this)); include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $types = new ilSelectInputGUI($this->lng->txt("create_new"), "sel_question_types"); $types->setOptions($qtypes); $ilToolbar->addInputItem($types); $ilToolbar->addFormButton($this->lng->txt("test_create_question"), "createQuestion"); if ($this->object->getPoolUsage()) { $ilToolbar->addSeparator(); $ilToolbar->addButton($this->lng->txt("tst_browse_for_questions"), $this->ctrl->getLinkTarget($this, 'browseForQuestions')); } $ilToolbar->addSeparator(); $ilToolbar->addButton($this->lng->txt("random_selection"), $this->ctrl->getLinkTarget($this, "randomselect")); global $ilAccess, $ilUser, $lng, $ilCtrl; $seq = $this->object->getTestSession()->getLastSequence(); $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()) { if ((!$this->object->getFixedParticipants() || $online_access) && $ilAccess->checkAccess("read", "", $this->ref_id)) { $executable = $this->object->isExecutable($ilUser->getId(), $allowPassIncrease = TRUE); if ($executable["executable"]) { if ($this->object->getTestSession()->getActiveId() > 0) { $ilToolbar->addSeparator(); $ilToolbar->addButton($lng->txt('tst_resume_test'), $ilCtrl->getLinkTargetByClass('iltestoutputgui', 'resume')); } else { $ilToolbar->addSeparator(); $ilToolbar->addButton($lng->txt('tst_start_test'), $ilCtrl->getLinkTargetByClass('iltestoutputgui', 'startTest')); } } } } } } $this->tpl->setCurrentBlock("adm_content"); include_once "./Modules/Test/classes/tables/class.ilTestQuestionsTableGUI.php"; $checked_move = is_array($_SESSION['tst_qst_move_' . $this->object->getTestId()]) && count($_SESSION['tst_qst_move_' . $this->object->getTestId()]); $table_gui = new ilTestQuestionsTableGUI($this, 'questions', $ilAccess->checkAccess("write", "", $this->ref_id) ? true : false, $checked_move, $total); $data = $this->object->getTestQuestions(); $table_gui->setData($data); $this->tpl->setVariable('QUESTIONBROWSER', $table_gui->getHTML()); $this->tpl->setVariable("ACTION_QUESTION_FORM", $this->ctrl->getFormAction($this)); $this->tpl->parseCurrentBlock(); }