ILIAS  release_8 Revision v8.24
class.ilAssQuestionPageGUI.php
Go to the documentation of this file.
1<?php
2
19require_once('./Services/COPage/classes/class.ilPageObjectGUI.php');
20require_once('./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php');
21
34{
35 public const TEMP_PRESENTATION_TITLE_PLACEHOLDER = '___TEMP_PRESENTATION_TITLE_PLACEHOLDER___';
36
38 private $questionInfoHTML = '';
40
41
48 public function __construct($a_id = 0, $a_old_nr = 0)
49 {
50 global $DIC;
51 $cmd_class = '';
52 if ($DIC->http()->wrapper()->query()->has('cmdClass')) {
53 $cmd_class = $DIC->http()->wrapper()->query()->retrieve(
54 'cmdClass',
55 $DIC->refinery()->kindlyTo()->string()
56 );
57 }
58
59 parent::__construct('qpl', $a_id, $a_old_nr);
60 $this->setEnabledPageFocus(false);
61 if (strtolower($cmd_class) === 'ilassquestionpreviewgui') {
62 $this->setFileDownloadLink($this->ctrl->getLinkTargetByClass(ilObjQuestionPoolGUI::class, 'downloadFile'));
63 } else {
64 $this->setFileDownloadLink($this->ctrl->getLinkTargetByClass(ilObjTestGUI::class, 'downloadFile'));
65 }
66 }
67
68 public function getOriginalPresentationTitle(): string
69 {
71 }
72
74 {
75 $this->originalPresentationTitle = $originalPresentationTitle;
76 }
77
78 protected function isPageContainerToBeRendered(): bool
79 {
80 return $this->getRenderPageContainer();
81 }
82
83 public function showPage(): string
84 {
85 if ($this->getPresentationTitle() !== null) {
87 $this->setPresentationTitle(self::TEMP_PRESENTATION_TITLE_PLACEHOLDER);
88 }
89
90 // fau: testNav - enable page toc as placeholder for info and actions block (see self::insertPageToc)
91 $config = $this->getPageConfig();
92 $config->setEnablePageToc('y');
93 $this->setPageConfig($config);
94 // fau.
95 return parent::showPage();
96 }
97
98 public function finishEditing(): void
99 {
100 $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
101 }
102
103 public function postOutputProcessing(string $a_output): string
104 {
105 $a_output = str_replace(
106 self::TEMP_PRESENTATION_TITLE_PLACEHOLDER,
108 $a_output
109 );
110
111 $a_output = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $a_output);
112
113 return $a_output;
114 }
115
116 // fau: testNav - support the addition of question info and actions below the title
117
122 public function setQuestionInfoHTML($a_html): void
123 {
124 $this->questionInfoHTML = $a_html;
125 }
126
131 public function setQuestionActionsHTML($a_html): void
132 {
133 $this->questionActionsHTML = $a_html;
134 }
135
141 public function insertPageToc(string $a_output): string
142 {
143 if (!empty($this->questionInfoHTML) || !empty($this->questionActionsHTML)) {
144 $tpl = new ilTemplate('tpl.tst_question_subtitle_blocks.html', true, true, 'Modules/TestQuestionPool');
145 $tpl->setVariable('QUESTION_INFO', $this->questionInfoHTML);
146 $tpl->setVariable('QUESTION_ACTIONS', $this->questionActionsHTML);
147 $a_output = str_replace("{{{{{PageTOC}}}}}", $tpl->get(), $a_output);
148 } else {
149 $a_output = str_replace("{{{{{PageTOC}}}}}", '', $a_output);
150 }
151 return $a_output;
152 }
153 // fau.
154}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
insertPageToc(string $a_output)
Replace page toc placeholder with question info and actions.
postOutputProcessing(string $a_output)
Finalizing output processing.
setQuestionInfoHTML($a_html)
Set the HTML of a question info block below the title (number, status, ...)
__construct($a_id=0, $a_old_nr=0)
Constructor.
setQuestionActionsHTML($a_html)
Set the HTML of a question actions block below the title.
setOriginalPresentationTitle($originalPresentationTitle)
showPage()
display content of page
Class ilPageObjectGUI.
setPresentationTitle(string $a_title="")
setEnabledPageFocus(bool $a_enabledpagefocus)
setPageConfig(ilPageConfig $a_val)
ilGlobalTemplateInterface $tpl
setFileDownloadLink(string $a_download_link)
special template class to simplify handling of ITX/PEAR
global $DIC
Definition: feed.php:28
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc