ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilAssQuestionPageGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
33 {
34  private $question_info_html = '';
35  private $question_actions_html = '';
36 
37  public function __construct(int $a_id = 0)
38  {
39  parent::__construct('qpl', $a_id);
40  $this->setEnabledPageFocus(false);
41  }
42 
43  protected function isPageContainerToBeRendered(): bool
44  {
45  return $this->getRenderPageContainer();
46  }
47 
48  public function showPage(): string
49  {
50  $config = $this->getPageConfig();
51  $config->setEnablePageToc(true);
52  $this->setPageConfig($config);
53  // fau.
54  return parent::showPage();
55  }
56 
57  public function finishEditing(): void
58  {
59  $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
60  }
61 
62  public function postOutputProcessing(string $output): string
63  {
64  return preg_replace('/src="\./ims', 'src="' . ILIAS_HTTP_PATH . '/', $output);
65  }
66 
67  // fau: testNav - support the addition of question info and actions below the title
68 
73  public function setQuestionInfoHTML($a_html): void
74  {
75  $this->question_info_html = $a_html;
76  }
77 
82  public function setQuestionActionsHTML($a_html): void
83  {
84  $this->question_actions_html = $a_html;
85  }
86 
92  public function insertPageToc(string $a_output): string
93  {
94  if (!empty($this->question_info_html) || !empty($this->question_actions_html)) {
95  $tpl = new ilTemplate('tpl.tst_question_subtitle_blocks.html', true, true, 'components/ILIAS/TestQuestionPool');
96  $tpl->setVariable('QUESTION_INFO', $this->question_info_html);
97  $tpl->setVariable('QUESTION_ACTIONS', $this->question_actions_html);
98  $a_output = str_replace("{{{{{PageTOC}}}}}", $tpl->get(), $a_output);
99  } else {
100  $a_output = str_replace("{{{{{PageTOC}}}}}", '', $a_output);
101  }
102  return $a_output;
103  }
104  // fau.
105 }
Class ilPageObjectGUI.
setPageConfig(ilPageConfig $a_val)
setEnabledPageFocus(bool $a_enabledpagefocus)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
Question page GUI class.
ilGlobalTemplateInterface $tpl
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
__construct(Container $dic, ilPlugin $plugin)
setQuestionActionsHTML($a_html)
Set the HTML of a question actions block below the title.
insertPageToc(string $a_output)
Replace page toc placeholder with question info and actions.
setQuestionInfoHTML($a_html)
Set the HTML of a question info block below the title (number, status, ...)