ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilAssQuestionHintPageObjectCommandForwarder.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionAbstractPageObjectCommandForwarder.php';
5require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
6
16{
20 const PRESENTATION_MODE_AUTHOR = 'PRESENTATION_MODE_AUTHOR';
21
25 const PRESENTATION_MODE_REQUEST = 'PRESENTATION_MODE_REQUEST';
26
32 protected $presentationMode = null;
33
40 protected $questionHint = null;
41
52 {
53 parent::__construct($questionOBJ, $ctrl, $tabs, $lng);
54
55 $this->questionHint = new ilAssQuestionHint();
56
57 if( !isset($_GET['hint_id']) || !(int)$_GET['hint_id'] || !$this->questionHint->load((int)$_GET['hint_id']) )
58 {
59 ilUtil::sendFailure('invalid hint id given: '.(int)$_GET['hint_id'], true);
60 $this->ctrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
61 }
62 }
63
69 public function forward()
70 {
71 switch( $this->getPresentationMode() )
72 {
74
75 $pageObjectGUI = $this->buildAuthorPresentationPageObjectGUI();
76 break;
77
79
80 $pageObjectGUI = $this->buildRequestPresentationPageObjectGUI();
81 break;
82 }
83
84 $this->ctrl->setParameter($pageObjectGUI, 'hint_id', $this->questionHint->getId());
85
86 $this->ctrl->forwardCommand($pageObjectGUI);
87 }
88
96 {
97 $this->tabs->setBackTarget(
98 $this->lng->txt('tst_question_hints_back_to_hint_list'),
99 $this->ctrl->getLinkTargetByClass('ilAssQuestionHintRequestGUI', ilAssQuestionHintRequestGUI::CMD_SHOW_LIST)
100 );
101
102 $pageObjectGUI = $this->getPageObjectGUI(
103 $this->questionHint->getPageObjectType(), $this->questionHint->getId()
104 );
105
106 $pageObjectGUI->setEnabledTabs(false);
107
108 $pageObjectGUI->setPresentationTitle(
109 ilAssQuestionHint::getHintIndexLabel($this->lng, $this->questionHint->getIndex())
110 );
111
112 return $pageObjectGUI;
113 }
114
122 {
123 $this->tabs->setBackTarget(
124 $this->lng->txt('tst_question_hints_back_to_hint_list'),
125 $this->ctrl->getLinkTargetByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST)
126 );
127
129 $this->questionHint->getPageObjectType(), $this->questionHint->getId()
130 );
131
132 $pageObjectGUI = $this->getPageObjectGUI(
133 $this->questionHint->getPageObjectType(), $this->questionHint->getId()
134 );
135
136 $pageObjectGUI->setEnabledTabs(true);
137
138 return $pageObjectGUI;
139 }
140
146 public function getPresentationMode()
147 {
149 }
150
158 {
159 switch( $presentationMode )
160 {
163
164 $this->presentationMode = $presentationMode;
165 break;
166
167 default: throw new ilTestQuestionPoolException('invalid presentation mode given: '.$presentationMode);
168 }
169 }
170
177 protected function getPageObjectGUI($pageObjectType, $pageObjectId)
178 {
179 include_once("./Modules/TestQuestionPool/classes/class.ilAssHintPageGUI.php");
180 $pageObjectGUI = new ilAssHintPageGUI($pageObjectId);
181 $pageObjectGUI->obj->addUpdateListener(
182 $this->questionOBJ,
183 'updateTimestamp'
184 );
185 return $pageObjectGUI;
186 }
187
193 protected function ensurePageObjectExists($pageObjectType, $pageObjectId)
194 {
195 include_once("./Modules/TestQuestionPool/classes/class.ilAssHintPage.php");
196 if( !ilAssHintPage::_exists($pageObjectType, $pageObjectId) )
197 {
198 $pageObject = new ilAssHintPage();
199 $pageObject->setParentId($this->questionOBJ->getId());
200 $pageObject->setId($pageObjectId);
201 $pageObject->createFromXML();
202 }
203 }
204
205}
$_GET["client_id"]
Abstract basic class which is to be extended by the concrete assessment question type classes.
Assessment hint page GUI class.
Assessment hint page object.
getPageObjectGUI($pageObjectType, $pageObjectId)
instantiates, initialises and returns a page object gui object
buildRequestPresentationPageObjectGUI()
forwards the command to page object gui for author presentation
buildAuthorPresentationPageObjectGUI()
forwards the command to page object gui for author presentation
ensurePageObjectExists($pageObjectType, $pageObjectId)
ensures an existing page object with giben type/id
__construct(assQuestion $questionOBJ, ilCtrl $ctrl, ilTabsGUI $tabs, ilLanguage $lng)
Constructor.
static getHintIndexLabel(ilLanguage $lng, $hintIndex)
const CMD_SHOW_LIST
command constants
This class provides processing control methods.
language handling
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
Tabs GUI.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.