forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass.ilAssQuestionPageGUI.php
More file actions
executable file
·129 lines (109 loc) · 3.46 KB
/
class.ilAssQuestionPageGUI.php
File metadata and controls
executable file
·129 lines (109 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
require_once('./Services/COPage/classes/class.ilPageObjectGUI.php');
require_once('./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php');
/**
* Question page GUI class
*
* @author Alex Killing <alex.killing@gmx.de>
*
* @ilCtrl_Calls ilAssQuestionPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI
* @ilCtrl_Calls ilAssQuestionPageGUI: ilPublicUserProfileGUI, ilNoteGUI, ilPCPluggedGUI
* @ilCtrl_Calls ilAssQuestionPageGUI: ilPropertyFormGUI, ilInternalLinkGUI
*
* @ingroup ModulesTestQuestionPool
*/
class ilAssQuestionPageGUI extends ilPageObjectGUI
{
const TEMP_PRESENTATION_TITLE_PLACEHOLDER = '___TEMP_PRESENTATION_TITLE_PLACEHOLDER___';
private $originalPresentationTitle = '';
// fau: testNav - variables for info and actions HTML
private $questionInfoHTML = '';
private $questionActionsHTML = '';
// fau.
/**
* Constructor
*
* @param int $a_id
* @param int $a_old_nr
*
* @return \ilAssQuestionPageGUI
*/
public function __construct($a_id = 0, $a_old_nr = 0)
{
parent::__construct('qpl', $a_id, $a_old_nr);
$this->setEnabledPageFocus(false);
}
public function getOriginalPresentationTitle()
{
return $this->originalPresentationTitle;
}
public function setOriginalPresentationTitle($originalPresentationTitle)
{
$this->originalPresentationTitle = $originalPresentationTitle;
}
protected function isPageContainerToBeRendered()
{
return $this->getRenderPageContainer();
}
public function showPage()
{
$this->setOriginalPresentationTitle($this->getPresentationTitle());
$this->setPresentationTitle(self::TEMP_PRESENTATION_TITLE_PLACEHOLDER);
// fau: testNav - enable page toc as placeholder for info and actions block (see self::insertPageToc)
$config = $this->getPageConfig();
$config->setEnablePageToc('y');
$this->setPageConfig($config);
// fau.
return parent::showPage();
}
function postOutputProcessing($output)
{
$output = str_replace(
self::TEMP_PRESENTATION_TITLE_PLACEHOLDER, $this->getOriginalPresentationTitle(), $output
);
$output = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $output);
return $output;
}
// fau: testNav - support the addition of question info and actions below the title
/**
* Set the HTML of a question info block below the title (number, status, ...)
* @param string $a_html
*/
public function setQuestionInfoHTML($a_html)
{
$this->questionInfoHTML = $a_html;
}
/**
* Set the HTML of a question actions block below the title
* @param string $a_html
*/
public function setQuestionActionsHTML($a_html)
{
$this->questionActionsHTML = $a_html;
}
/**
* Replace page toc placeholder with question info and actions
* @todo: support question info and actions in the page XSL directly
* the current workaround avoids changing the COPage service
*
* @param $a_output
* @return mixed
*/
function insertPageToc($a_output)
{
if (!empty($this->questionInfoHTML) || !empty($this->questionActionsHTML))
{
$tpl = new ilTemplate('tpl.tst_question_subtitle_blocks.html', true, true, 'Modules/TestQuestionPool');
$tpl->setVariable('QUESTION_INFO',$this->questionInfoHTML);
$tpl->setVariable('QUESTION_ACTIONS',$this->questionActionsHTML);
$a_output = str_replace("{{{{{PageTOC}}}}}", $tpl->get(), $a_output);
}
else
{
$a_output = str_replace("{{{{{PageTOC}}}}}", '', $a_output);
}
return $a_output;
}
// fau.
}