public function outQuestionType() { $count = $this->object->isInUse(); if (assQuestion::_questionExistsInPool($this->object->getId()) && $count) { global $rbacsystem; if ($rbacsystem->checkAccess("write", $_GET["ref_id"])) { ilUtil::sendInfo(sprintf($this->lng->txt("qpl_question_is_in_use"), $count)); } } return assQuestion::_getQuestionTypeName($this->object->getQuestionType()); }
/** * called by prepare output */ function setTitleAndDescription() { parent::setTitleAndDescription(); if ($_GET["q_id"] > 0) { include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]); if ($q_gui->object instanceof assQuestion) { $q_gui->object->setObjId($this->object->getId()); $title = $q_gui->object->getTitle(); if (!$title) { $title = $this->lng->txt('new') . ': ' . assQuestion::_getQuestionTypeName($q_gui->object->getQuestionType()); } $this->tpl->setTitle($title); $this->tpl->setDescription($q_gui->object->getComment()); if ($this->object instanceof ilObjectPlugin) { $this->tpl->setTitleIcon($this->object->plugin->getImagePath("icon_" . $this->object->getType() . ".svg"), $this->lng->txt("obj_" . $this->object->getType())); } else { $this->tpl->setTitleIcon(ilObject::_getIcon("", "big", $this->object->getType())); } } else { // Workaround for context issues: If no object was found, redirect without q_id parameter $this->ctrl->setParameter($this, 'q_id', ''); $this->ctrl->redirect($this); } } else { $this->tpl->setTitle($this->object->getTitle()); $this->tpl->setDescription($this->object->getLongDescription()); $this->tpl->setTitleIcon(ilObject::_getIcon("", "big", $this->object->getType())); } }
/** * fill row * * @access public * @param * @return */ public function fillRow($data) { global $ilUser, $ilAccess; $q_id = $data["question_id"]; $this->tpl->setVariable("QUESTION_ID", $q_id); if (isset($this->visibleOptionalColumns['qid'])) { $this->tpl->setVariable("QUESTION_ID_PRESENTATION", $q_id); } if ($this->getWriteAccess() && !$this->getTotal() && $data["obj_fi"] > 0) { if (!$data['complete']) { $this->tpl->setVariable("IMAGE_WARNING", ilUtil::getImagePath("warning.png")); $this->tpl->setVariable("ALT_WARNING", $this->lng->txt("warning_question_not_complete")); $this->tpl->setVariable("TITLE_WARNING", $this->lng->txt("warning_question_not_complete")); } $qpl_ref_id = current(ilObject::_getAllReferences($data["obj_fi"])); $this->tpl->setVariable("QUESTION_TITLE", "<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(), "questions") . "&eqid={$q_id}&eqpl={$qpl_ref_id}" . "\">" . $data["title"] . "</a>"); // obligatory checkbox (when obligation is possible) if ($data["obligationPossible"]) { $CHECKED = $data["obligatory"] ? "checked=\"checked\" " : ""; $OBLIGATORY = "<input type=\"checkbox\" name=\"obligatory[{$q_id}]\" value=\"1\" {$CHECKED}/>"; } else { $OBLIGATORY = ""; } } else { global $lng; $this->tpl->setVariable("QUESTION_TITLE", $data["title"]); // obligatory icon if ($data["obligatory"]) { $OBLIGATORY = "<img src=\"" . ilUtil::getImagePath("obligatory.gif", "Modules/Test") . "\" alt=\"" . $lng->txt("question_obligatory") . "\" title=\"" . $lng->txt("question_obligatory") . "\" />"; } else { $OBLIGATORY = ''; } } if ($this->parent_obj->object->areObligationsEnabled()) { $this->tpl->setVariable("QUESTION_OBLIGATORY", $OBLIGATORY); } $this->tpl->setVariable("QUESTION_SEQUENCE", $this->lng->txt("tst_sequence")); if ($this->getWriteAccess() && !$this->getTotal()) { if ($data["sequence"] != 1) { $this->tpl->setVariable("BUTTON_UP", "<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(), "questions") . "&up=" . $data["question_id"] . "\"><img src=\"" . ilUtil::getImagePath("a_up.png") . "\" alt=\"" . $this->lng->txt("up") . "\" border=\"0\" /></a>"); } if ($data["sequence"] != count($this->getData())) { $this->tpl->setVariable("BUTTON_DOWN", "<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(), "questions") . "&down=" . $data["question_id"] . "\"><img src=\"" . ilUtil::getImagePath("a_down.png") . "\" alt=\"" . $this->lng->txt("down") . "\" border=\"0\" /></a>"); } } if (isset($this->visibleOptionalColumns['description'])) { if ($data["description"]) { $this->tpl->setVariable("QUESTION_COMMENT", $data["description"] ? $data["description"] : ' '); } else { $this->tpl->touchBlock('question_comment_block'); } } include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $this->tpl->setVariable("QUESTION_TYPE", assQuestion::_getQuestionTypeName($data["type_tag"])); $this->tpl->setVariable("QUESTION_POINTS", $data["points"]); $this->totalPoints += $data["points"]; if (isset($this->visibleOptionalColumns['author'])) { $this->tpl->setVariable("QUESTION_AUTHOR", $data["author"]); } if (ilObject::_lookupType($data["orig_obj_fi"]) == 'qpl') { $this->tpl->setVariable("QUESTION_POOL", ilObject::_lookupTitle($data["orig_obj_fi"])); } else { $this->tpl->setVariable("QUESTION_POOL", ' '); } $this->position += 10; $field = "<input type=\"text\" name=\"order[q_" . $data["question_id"] . "]\" value=\"" . $this->position . "\" maxlength=\"3\" style=\"width:30px\" />"; $this->tpl->setVariable("QUESTION_POSITION", $field); }
/** * fill row * * @param array $data * * @return void */ public function fillRow($data) { $this->tpl->setVariable("QUESTION_ID", $data["question_id"]); $this->tpl->setVariable("QUESTION_TITLE", $data["title"]); $this->tpl->setVariable("QUESTION_COMMENT", $data["description"]); include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $this->tpl->setVariable("QUESTION_TYPE", assQuestion::_getQuestionTypeName($data["type_tag"])); $this->tpl->setVariable("QUESTION_AUTHOR", $data["author"]); $this->tpl->setVariable("QUESTION_CREATED", ilDatePresentation::formatDate(new ilDate($data['created'], IL_CAL_UNIX))); $this->tpl->setVariable("QUESTION_UPDATED", ilDatePresentation::formatDate(new ilDate($data["tstamp"], IL_CAL_UNIX))); $this->tpl->setVariable("QUESTION_POOL", $data['qpl']); $this->tpl->setVariable("WORKING_TIME", $data['working_time']); }
/** * Displays a form to confirm the removal of questions from the test * * Displays a form to confirm the removal of questions from the test * * @access public */ function removeQuestionsForm($checked_questions) { $total = $this->object->evalTotalPersons(); if ($total) { // the test was executed previously $question = sprintf($this->lng->txt("tst_remove_questions_and_results"), $total); } else { if (count($checked_questions) == 1) { $question = $this->lng->txt("tst_remove_question"); } else { $question = $this->lng->txt("tst_remove_questions"); } } include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php"; $cgui = new ilConfirmationGUI(); $cgui->setHeaderText($question); $this->ctrl->saveParameter($this, 'test_express_mode'); $this->ctrl->saveParameter($this, 'q_id'); $cgui->setFormAction($this->ctrl->getFormAction($this)); $cgui->setCancel($this->lng->txt("cancel"), "cancelRemoveQuestions"); $cgui->setConfirm($this->lng->txt("confirm"), "confirmRemoveQuestions"); include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $removablequestions =& $this->object->getTestQuestions(); if (count($removablequestions)) { foreach ($removablequestions as $data) { if (in_array($data["question_id"], $checked_questions)) { $txt = $data["title"] . " (" . assQuestion::_getQuestionTypeName($data["type_tag"]) . ")"; $txt .= ' [' . $this->lng->txt('question_id_short') . ': ' . $data['question_id'] . ']'; if ($data["description"]) { $txt .= "<div class=\"small\">" . $data["description"] . "</div>"; } $cgui->addItem("q_id[]", $data["question_id"], $txt); } } } $this->tpl->setContent($cgui->getHTML()); }
/** * fill row * * @access public * @param * @return */ public function fillRow($data) { global $ilUser, $ilAccess; include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $class = strtolower(assQuestionGUI::_getGUIClassNameForId($data["question_id"])); $this->ctrl->setParameterByClass("ilpageobjectgui", "q_id", $data["question_id"]); $this->ctrl->setParameterByClass($class, "q_id", $data["question_id"]); $points = 0; if (!$this->confirmdelete) { $this->tpl->setCurrentBlock('checkbox'); $this->tpl->setVariable('CB_QUESTION_ID', $data["question_id"]); $this->tpl->parseCurrentBlock(); if ($this->getEditable()) { $this->tpl->setCurrentBlock("edit_link"); $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit")); $this->tpl->setVariable("LINK_EDIT", $this->ctrl->getLinkTargetByClass("ilpageobjectgui", "edit")); $this->tpl->parseCurrentBlock(); } if ($data["complete"] == 0) { $this->tpl->setCurrentBlock("qpl_warning"); $this->tpl->setVariable("IMAGE_WARNING", ilUtil::getImagePath("warning.png")); $this->tpl->setVariable("ALT_WARNING", $this->lng->txt("warning_question_not_complete")); $this->tpl->setVariable("TITLE_WARNING", $this->lng->txt("warning_question_not_complete")); $this->tpl->parseCurrentBlock(); } else { $points = $data["points"]; } $this->totalPoints += $points; foreach ($this->getSelectedColumns() as $c) { if (strcmp($c, 'points') == 0) { $this->tpl->setCurrentBlock('points'); $this->tpl->setVariable("QUESTION_POINTS", $points); $this->tpl->parseCurrentBlock(); } if (strcmp($c, 'statistics') == 0) { $this->tpl->setCurrentBlock('statistics'); $this->tpl->setVariable("LINK_ASSESSMENT", $this->ctrl->getLinkTargetByClass($class, "assessment")); $this->tpl->setVariable("TXT_ASSESSMENT", $this->lng->txt("statistics")); include_once "./Services/Utilities/classes/class.ilUtil.php"; $this->tpl->setVariable("IMG_ASSESSMENT", ilUtil::getImagePath("assessment.gif", "Modules/TestQuestionPool")); $this->tpl->parseCurrentBlock(); } if (strcmp($c, 'author') == 0) { $this->tpl->setCurrentBlock('author'); $this->tpl->setVariable("QUESTION_AUTHOR", $data["author"]); $this->tpl->parseCurrentBlock(); } if (strcmp($c, 'created') == 0) { $this->tpl->setCurrentBlock('created'); $this->tpl->setVariable('QUESTION_CREATED', ilDatePresentation::formatDate(new ilDateTime($data['created'], IL_CAL_UNIX))); $this->tpl->parseCurrentBlock(); } if (strcmp($c, 'tstamp') == 0) { $this->tpl->setCurrentBlock('updated'); $this->tpl->setVariable('QUESTION_UPDATED', ilDatePresentation::formatDate(new ilDateTime($data['tstamp'], IL_CAL_UNIX))); $this->tpl->parseCurrentBlock(); } } $this->tpl->setCurrentBlock('preview'); $this->tpl->setVariable("TXT_PREVIEW", $this->lng->txt("preview")); $this->tpl->setVariable("LINK_PREVIEW", $this->ctrl->getLinkTargetByClass("ilpageobjectgui", "preview")); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock('hidden'); $this->tpl->setVariable('HIDDEN_QUESTION_ID', $data["question_id"]); $this->tpl->parseCurrentBlock(); } foreach ($this->getSelectedColumns() as $c) { if (strcmp($c, 'description') == 0) { $this->tpl->setCurrentBlock('description'); $this->tpl->setVariable("QUESTION_COMMENT", strlen($data["description"]) ? $data["description"] : " "); $this->tpl->parseCurrentBlock(); } if (strcmp($c, 'type') == 0) { $this->tpl->setCurrentBlock('type'); $this->tpl->setVariable("QUESTION_TYPE", assQuestion::_getQuestionTypeName($data["type_tag"])); $this->tpl->parseCurrentBlock(); } } $this->tpl->setVariable('QUESTION_ID', $data["question_id"]); $this->tpl->setVariable("QUESTION_TITLE", $data["title"]); }
/** * Fill row * * @param array $a_set data array */ public function fillRow($a_set) { global $ilCtrl, $lng; //var_dump($a_set); // action: copy $ilCtrl->setParameter($this->parent_obj, "q_id", $a_set["question_id"]); $ilCtrl->setParameter($this->parent_obj, "subCmd", "copyQuestion"); $this->tpl->setCurrentBlock("cmd"); $this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd)); $this->tpl->setVariable("TXT_CMD", $lng->txt("cont_copy_question_into_page")); $this->tpl->parseCurrentBlock(); $ilCtrl->setParameter($this->parent_obj, "subCmd", "listPoolQuestions"); // properties $this->tpl->setVariable("TITLE", $a_set["title"]); $this->tpl->setVariable("TYPE", assQuestion::_getQuestionTypeName($a_set["type_tag"])); }
public function outQuestionType() { include_once "./Services/UICore/classes/class.ilTemplate.php"; $template = new ilTemplate("tpl.il_as_qpl_questiontype.html", TRUE, TRUE, "Modules/TestQuestionPool"); $count = $this->object->isInUse(); if (assQuestion::_questionExistsInPool($this->object->getId()) && $count) { global $rbacsystem; if ($rbacsystem->checkAccess("write", $_GET["ref_id"])) { $template->setCurrentBlock("infosign"); $template->setVariable("INFO_IMG_SRC", ilUtil::getImagePath("messagebox_tip.png")); $template->setVariable("INFO_IMG_ALT", sprintf($this->lng->txt("qpl_question_is_in_use"), $count)); $template->setVariable("INFO_IMG_TITLE", sprintf($this->lng->txt("qpl_question_is_in_use"), $count)); $template->parseCurrentBlock(); } } $template->setVariable("TEXT_QUESTION_TYPE", assQuestion::_getQuestionTypeName($this->object->getQuestionType())); return $template->get(); }