ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilAssQuestionPageCommandForwarder Class Reference
+ Collaboration diagram for ilAssQuestionPageCommandForwarder:

Public Member Functions

 __construct (private readonly ilObjTest $test_obj, private readonly ilLanguage $lng, private readonly ilCtrlInterface $ctrl, private readonly ilGlobalTemplateInterface $tpl, private readonly ContentStyle $content_style, private readonly RequestDataCollector $testrequest)
 
 forward ()
 

Private Attributes

int $question_id
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionPageCommandForwarder::__construct ( private readonly ilObjTest  $test_obj,
private readonly ilLanguage  $lng,
private readonly ilCtrlInterface  $ctrl,
private readonly ilGlobalTemplateInterface  $tpl,
private readonly ContentStyle  $content_style,
private readonly RequestDataCollector  $testrequest 
)

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

43 {
44 $this->question_id = $this->testrequest->getQuestionId();
45 }

Member Function Documentation

◆ forward()

ilAssQuestionPageCommandForwarder::forward ( )

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

47 : void
48 {
49 if ($this->testrequest->raw('prev_qid')) {
50 $this->ctrl->setParameter($this, 'prev_qid', $this->testrequest->raw('prev_qid'));
51 }
52
53 $this->content_style->gui()->addCss(
54 $this->tpl,
55 $this->test_obj->getRefId()
56 );
57
58 // syntax style
59 $this->tpl->setCurrentBlock("SyntaxStyle");
60 $this->tpl->setVariable(
61 "LOCATION_SYNTAX_STYLESHEET",
63 );
64 $this->tpl->parseCurrentBlock();
65 $q_gui = assQuestionGUI::_getQuestionGUI("", $this->question_id);
66
67 $q_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PREVIEW);
68 $q_gui->setQuestionTabs();
69 $question = $q_gui->getObject();
70 $question->setObjId($this->test_obj->getId());
71 $q_gui->setObject($question);
72
73 if ($this->ctrl->getCmd() === 'edit'
74 && $this->test_obj->evalTotalPersons() !== 0) {
75 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('question_is_part_of_running_test'), true);
76 $this->ctrl->redirectByClass(ilAssQuestionPreviewGUI::class, ilAssQuestionPreviewGUI::CMD_SHOW);
77 }
78
79 $this->ctrl->saveParameter($this, 'q_id');
80 $this->lng->loadLanguageModule('content');
81 $this->ctrl->setReturnByClass(ilAssQuestionPageGUI::class, 'view');
82 $this->ctrl->setReturnByClass(ilObjTestGUI::class, ilObjTestGUI::SHOW_QUESTIONS_CMD);
83 $page_gui = new ilAssQuestionPageGUI($this->testrequest->getQuestionId());
84 $page_gui->setFileDownloadLink(
85 $this->ctrl->getLinkTargetByClass(ilObjTestGUI::class, 'downloadFile')
86 );
87 $page_gui->setEditPreview(true);
88 $page_gui->setQuestionHTML([$q_gui->getObject()->getId() => $q_gui->getPreview(true)]);
89 $page_gui->setTemplateTargetVar("ADM_CONTENT");
90 $page_gui->setOutputMode($this->test_obj->evalTotalPersons() == 0 ? "edit" : 'preview');
91 $page_gui->setHeader($question->getTitleForHTMLOutput());
92 $page_gui->setPresentationTitle(
93 $question->getTitle()
94 . ' [' . $this->lng->txt('question_id_short')
95 . ': ' . $question->getId() . ']'
96 );
97 $page_gui->setStyleId(
98 $this->content_style
99 ->domain()
100 ->styleForRefId($this->test_obj->getRefId())
101 ->getEffectiveStyleId()
102 );
103
104 $html = $this->ctrl->forwardCommand($page_gui);
105 $this->tpl->setContent($html);
106 }
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
Question page GUI class.

References assQuestionGUI\_getQuestionGUI(), ilAssQuestionPreviewGUI\CMD_SHOW, ILIAS\Repository\ctrl(), ilObjStyleSheet\getSyntaxStylePath(), ILIAS\Repository\lng(), assQuestionGUI\RENDER_PURPOSE_PREVIEW, and ilObjTestGUI\SHOW_QUESTIONS_CMD.

+ Here is the call graph for this function:

Field Documentation

◆ $question_id

int ilAssQuestionPageCommandForwarder::$question_id
private

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


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