ILIAS  release_8 Revision v8.24
ilAssQuestionPageCommandForwarder Class Reference
+ Collaboration diagram for ilAssQuestionPageCommandForwarder:

Public Member Functions

 getTestObj ()
 
 setTestObj (ilObjTest $testObj)
 
 forward ()
 

Protected Attributes

ilObjTest $testObj
 
ILIAS Test InternalRequestService $testrequest
 

Detailed Description

Definition at line 27 of file class.ilAssQuestionPageCommandForwarder.php.

Member Function Documentation

◆ forward()

ilAssQuestionPageCommandForwarder::forward ( )

Definition at line 43 of file class.ilAssQuestionPageCommandForwarder.php.

43 : void
44 {
45 /* @var ILIAS\DI\Container $DIC */
46 global $DIC;
47 $ctrl = $DIC->ctrl();
48 $main_template = $DIC->ui()->mainTemplate();
49 $lng = $DIC->language();
50
51 $this->testrequest = $DIC->test()->internal()->request();
52
53 //echo $_REQUEST['prev_qid'];
54 if ($this->testrequest->raw('prev_qid')) {
55 $ctrl->setParameter($this, 'prev_qid', $this->testrequest->raw('prev_qid'));
56 }
57
58 $main_template->setCurrentBlock("ContentStyle");
59 $main_template->setVariable(
60 "LOCATION_CONTENT_STYLESHEET",
62 );
63 $main_template->parseCurrentBlock();
64
65 // syntax style
66 $main_template->setCurrentBlock("SyntaxStyle");
67 $main_template->setVariable(
68 "LOCATION_SYNTAX_STYLESHEET",
70 );
71 $main_template->parseCurrentBlock();
72 $q_gui = assQuestionGUI::_getQuestionGUI("", $this->testrequest->getQuestionId());
73
74 $q_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PREVIEW);
75 $q_gui->setQuestionTabs();
76 $q_gui->outAdditionalOutput();
77 $q_gui->object->setObjId($this->getTestObj()->getId());
78 $question = &$q_gui->object;
79
80 if ($ctrl->getCmd() === 'edit' && $question->isInActiveTest()) {
81 $main_template->setOnScreenMessage('failure', $lng->txt("question_is_part_of_running_test"));
82 $ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
83 }
84
85 $ctrl->saveParameter($this, "q_id");
86 $lng->loadLanguageModule("content");
87 $ctrl->setReturnByClass("ilAssQuestionPageGUI", "view");
88 $ctrl->setReturnByClass("ilObjTestGUI", "questions");
89 $page_gui = new ilAssQuestionPageGUI($this->testrequest->getQuestionId());
90
91 $page_gui->setEditPreview(true);
92 if (strlen($ctrl->getCmd()) == 0) {
93 $ctrl->setCmdClass(get_class($page_gui));
94 $ctrl->setCmd("preview");
95 }
96 $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(true)));
97 $page_gui->setTemplateTargetVar("ADM_CONTENT");
98 $page_gui->setOutputMode($this->getTestObj()->evalTotalPersons() == 0 ? "edit" : 'preview');
99 $page_gui->setHeader($question->getTitleForHTMLOutput());
100 $page_gui->setPresentationTitle($question->getTitleForHTMLOutput() . ' [' . $lng->txt('question_id_short') . ': ' . $question->getId() . ']');
101
102 $html = $ctrl->forwardCommand($page_gui);
103 $main_template->setContent($html);
104 }
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
global $DIC
Definition: feed.php:28
$lng

References $DIC, $lng, assQuestionGUI\_getQuestionGUI(), ilAssQuestionPreviewGUI\CMD_SHOW, ilObjStyleSheet\getContentStylePath(), ILIAS\Survey\Mode\getId(), ilObjStyleSheet\getSyntaxStylePath(), getTestObj(), and assQuestionGUI\RENDER_PURPOSE_PREVIEW.

+ Here is the call graph for this function:

◆ getTestObj()

ilAssQuestionPageCommandForwarder::getTestObj ( )

Definition at line 33 of file class.ilAssQuestionPageCommandForwarder.php.

References $testObj.

Referenced by forward(), and ilAssQuestionPageCommandForwarderTest\testTestObj().

+ Here is the caller graph for this function:

◆ setTestObj()

ilAssQuestionPageCommandForwarder::setTestObj ( ilObjTest  $testObj)

Definition at line 38 of file class.ilAssQuestionPageCommandForwarder.php.

38 : void
39 {
40 $this->testObj = $testObj;
41 }

References $testObj.

Field Documentation

◆ $testObj

ilObjTest ilAssQuestionPageCommandForwarder::$testObj
protected

Definition at line 29 of file class.ilAssQuestionPageCommandForwarder.php.

Referenced by getTestObj(), and setTestObj().

◆ $testrequest

ILIAS Test InternalRequestService ilAssQuestionPageCommandForwarder::$testrequest
protected

Definition at line 31 of file class.ilAssQuestionPageCommandForwarder.php.


The documentation for this class was generated from the following file: