19 declare(strict_types=1);
51 $main_template = $DIC->ui()->mainTemplate();
52 $lng = $DIC->language();
53 $this->questioninfo = $DIC->testQuestionPool()->questionInfo();
55 $this->testrequest = $DIC->test()->internal()->request();
58 if ($this->testrequest->raw(
'prev_qid')) {
59 $ctrl->setParameter($this,
'prev_qid', $this->testrequest->raw(
'prev_qid'));
62 $main_template->setCurrentBlock(
"ContentStyle");
63 $main_template->setVariable(
64 "LOCATION_CONTENT_STYLESHEET",
67 $main_template->parseCurrentBlock();
70 $main_template->setCurrentBlock(
"SyntaxStyle");
71 $main_template->setVariable(
72 "LOCATION_SYNTAX_STYLESHEET",
75 $main_template->parseCurrentBlock();
79 $q_gui->setQuestionTabs();
80 $q_gui->outAdditionalOutput();
82 $question = &$q_gui->object;
84 if ($ctrl->getCmd() ===
'edit' && $this->questioninfo->isInActiveTest($this->testrequest->getQuestionId())) {
85 $main_template->setOnScreenMessage(
'failure',
$lng->txt(
"question_is_part_of_running_test"));
89 $ctrl->saveParameter($this,
"q_id");
90 $lng->loadLanguageModule(
"content");
91 $ctrl->setReturnByClass(
"ilAssQuestionPageGUI",
"view");
92 $ctrl->setReturnByClass(
"ilObjTestGUI",
"questions");
96 if (strlen($ctrl->getCmd()) == 0) {
97 $ctrl->setCmdClass(get_class($page_gui));
98 $ctrl->setCmd(
"preview");
100 $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(
true)));
101 $page_gui->setTemplateTargetVar(
"ADM_CONTENT");
102 $page_gui->setOutputMode($this->
getTestObj()->evalTotalPersons() == 0 ?
"edit" :
'preview');
103 $page_gui->setHeader($question->getTitleForHTMLOutput());
104 $page_gui->setPresentationTitle($question->getTitleForHTMLOutput() .
' [' .
$lng->txt(
'question_id_short') .
': ' . $question->getId() .
']');
106 $html = $ctrl->forwardCommand($page_gui);
107 $main_template->setContent($html);
setEditPreview(bool $a_editpreview)
Set Display first Edit tab, then Preview tab, instead of Page and Edit.
setTestObj(ilObjTest $testObj)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
ILIAS Test InternalRequestService $testrequest
static getSyntaxStylePath()
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
ILIAS TestQuestionPool QuestionInfoService $questioninfo
const RENDER_PURPOSE_PREVIEW