ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAssQuestionHintPageObjectCommandForwarder Class Reference
+ Inheritance diagram for ilAssQuestionHintPageObjectCommandForwarder:
+ Collaboration diagram for ilAssQuestionHintPageObjectCommandForwarder:

Public Member Functions

 __construct (assQuestion $questionOBJ, ilCtrl $ctrl, ilTabsGUI $tabs, ilLanguage $lng)
 Constructor. More...
 
 forward ()
 forward method More...
 
 getPresentationMode ()
 getter for presentation mode More...
 
 setPresentationMode ($presentationMode)
 setter for presentation mode More...
 
- Public Member Functions inherited from ilAssQuestionAbstractPageObjectCommandForwarder
 __construct (assQuestion $questionOBJ, ilCtrl $ctrl, ilTabsGUI $tabs, ilLanguage $lng)
 Constructor. More...
 
 forward ()
 this is the actual forward method that is to be implemented by derived forwarder classes More...
 

Data Fields

const PRESENTATION_MODE_AUTHOR = 'PRESENTATION_MODE_AUTHOR'
 presentation mode for authoring More...
 
const PRESENTATION_MODE_PREVIEW = 'PRESENTATION_MODE_PREVIEW'
 presentation mode for authoring More...
 
const PRESENTATION_MODE_REQUEST = 'PRESENTATION_MODE_REQUEST'
 presentation mode for requesting More...
 

Protected Member Functions

 getPageObjectGUI ($pageObjectType, $pageObjectId)
 instantiates, initialises and returns a page object gui object More...
 
 ensurePageObjectExists ($pageObjectType, $pageObjectId)
 ensures an existing page object with giben type/id More...
 
- Protected Member Functions inherited from ilAssQuestionAbstractPageObjectCommandForwarder
 ensurePageObjectExists ($pageObjectType, $pageObjectId)
 ensures an existing page object with giben type/id More...
 
 getPageObjectGUI ($pageObjectType, $pageObjectId)
 instantiates, initialises and returns a page object gui object More...
 

Protected Attributes

 $presentationMode = null
 
 $questionHint = null
 
- Protected Attributes inherited from ilAssQuestionAbstractPageObjectCommandForwarder
 $questionOBJ = null
 
 $ctrl = null
 
 $tabs = null
 
 $lng = null
 

Private Member Functions

 buildPreviewPresentationPageObjectGUI ()
 forwards the command to page object gui for author presentation More...
 
 buildRequestPresentationPageObjectGUI ()
 forwards the command to page object gui for author presentation More...
 
 buildAuthorPresentationPageObjectGUI ()
 forwards the command to page object gui for author presentation More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionHintPageObjectCommandForwarder::__construct ( assQuestion  $questionOBJ,
ilCtrl  $ctrl,
ilTabsGUI  $tabs,
ilLanguage  $lng 
)

Constructor.

public

Parameters
assQuestion$questionOBJ
ilCtrl$ctrl
ilTabsGUI$tabs
ilLanguage$lng

Definition at line 56 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

References $_GET, ILIAS\GlobalScreen\Provider\__construct(), ilAssQuestionHintsGUI\CMD_SHOW_LIST, and ilUtil\sendFailure().

57  {
58  parent::__construct($questionOBJ, $ctrl, $tabs, $lng);
59 
60  $this->questionHint = new ilAssQuestionHint();
61 
62  if (!isset($_GET['hint_id']) || !(int) $_GET['hint_id'] || !$this->questionHint->load((int) $_GET['hint_id'])) {
63  ilUtil::sendFailure('invalid hint id given: ' . (int) $_GET['hint_id'], true);
64  $this->ctrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
65  }
66  }
$_GET["client_id"]
const CMD_SHOW_LIST
command constants
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ buildAuthorPresentationPageObjectGUI()

ilAssQuestionHintPageObjectCommandForwarder::buildAuthorPresentationPageObjectGUI ( )
private

forwards the command to page object gui for author presentation

private

Returns
page object gui object

Definition at line 158 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

References ilAssQuestionHintsGUI\CMD_SHOW_LIST, ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

159  {
160  $this->tabs->setBackTarget(
161  $this->lng->txt('tst_question_hints_back_to_hint_list'),
162  $this->ctrl->getLinkTargetByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST)
163  );
164 
165  $this->ensurePageObjectExists(
166  $this->questionHint->getPageObjectType(),
167  $this->questionHint->getId()
168  );
169 
170  $pageObjectGUI = $this->getPageObjectGUI(
171  $this->questionHint->getPageObjectType(),
172  $this->questionHint->getId()
173  );
174 
175  $pageObjectGUI->setEnabledTabs(true);
176 
177  return $pageObjectGUI;
178  }
ensurePageObjectExists($pageObjectType, $pageObjectId)
ensures an existing page object with giben type/id
const CMD_SHOW_LIST
command constants
getPageObjectGUI($pageObjectType, $pageObjectId)
instantiates, initialises and returns a page object gui object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildPreviewPresentationPageObjectGUI()

ilAssQuestionHintPageObjectCommandForwarder::buildPreviewPresentationPageObjectGUI ( )
private

forwards the command to page object gui for author presentation

private

Returns
page object gui object

Definition at line 103 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

References ilAssQuestionHintsGUI\CMD_SHOW_LIST, ilAssQuestionHint\getHintIndexLabel(), and getPageObjectGUI().

Referenced by forward().

104  {
105  $this->tabs->setBackTarget(
106  $this->lng->txt('tst_question_hints_back_to_hint_list'),
107  $this->ctrl->getLinkTargetByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST)
108  );
109 
110  $pageObjectGUI = $this->getPageObjectGUI(
111  $this->questionHint->getPageObjectType(),
112  $this->questionHint->getId()
113  );
114 
115  $pageObjectGUI->setEnabledTabs(false);
116 
117  $pageObjectGUI->setPresentationTitle(
118  ilAssQuestionHint::getHintIndexLabel($this->lng, $this->questionHint->getIndex())
119  );
120 
121  return $pageObjectGUI;
122  }
const CMD_SHOW_LIST
command constants
static getHintIndexLabel(ilLanguage $lng, $hintIndex)
getPageObjectGUI($pageObjectType, $pageObjectId)
instantiates, initialises and returns a page object gui object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildRequestPresentationPageObjectGUI()

ilAssQuestionHintPageObjectCommandForwarder::buildRequestPresentationPageObjectGUI ( )
private

forwards the command to page object gui for author presentation

private

Returns
page object gui object

Definition at line 130 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

References ilAssQuestionHintRequestGUI\CMD_SHOW_LIST, ilAssQuestionHint\getHintIndexLabel(), and getPageObjectGUI().

Referenced by forward().

131  {
132  $this->tabs->setBackTarget(
133  $this->lng->txt('tst_question_hints_back_to_hint_list'),
134  $this->ctrl->getLinkTargetByClass('ilAssQuestionHintRequestGUI', ilAssQuestionHintRequestGUI::CMD_SHOW_LIST)
135  );
136 
137  $pageObjectGUI = $this->getPageObjectGUI(
138  $this->questionHint->getPageObjectType(),
139  $this->questionHint->getId()
140  );
141 
142  $pageObjectGUI->setEnabledTabs(false);
143  $pageObjectGUI->setEnableEditing(false);
144 
145  $pageObjectGUI->setPresentationTitle(
146  ilAssQuestionHint::getHintIndexLabel($this->lng, $this->questionHint->getIndex())
147  );
148 
149  return $pageObjectGUI;
150  }
static getHintIndexLabel(ilLanguage $lng, $hintIndex)
getPageObjectGUI($pageObjectType, $pageObjectId)
instantiates, initialises and returns a page object gui object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensurePageObjectExists()

ilAssQuestionHintPageObjectCommandForwarder::ensurePageObjectExists (   $pageObjectType,
  $pageObjectId 
)
protected

ensures an existing page object with giben type/id

protected

Definition at line 233 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

References ilPageObject\_exists().

Referenced by buildAuthorPresentationPageObjectGUI(), and getPageObjectGUI().

234  {
235  include_once("./Modules/TestQuestionPool/classes/class.ilAssHintPage.php");
236  if (!ilAssHintPage::_exists($pageObjectType, $pageObjectId, '', true)) {
237  $pageObject = new ilAssHintPage();
238  $pageObject->setParentId($this->questionOBJ->getId());
239  $pageObject->setId($pageObjectId);
240  $pageObject->createFromXML();
241  }
242  }
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
Assessment hint page object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ forward()

ilAssQuestionHintPageObjectCommandForwarder::forward ( )

forward method

Exceptions
ilTestQuestionPoolException

Definition at line 73 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

References buildAuthorPresentationPageObjectGUI(), buildPreviewPresentationPageObjectGUI(), buildRequestPresentationPageObjectGUI(), and getPresentationMode().

74  {
75  switch ($this->getPresentationMode()) {
76  case self::PRESENTATION_MODE_AUTHOR:
77 
78  $pageObjectGUI = $this->buildAuthorPresentationPageObjectGUI();
79  break;
80 
81  case self::PRESENTATION_MODE_PREVIEW:
82 
83  $pageObjectGUI = $this->buildPreviewPresentationPageObjectGUI();
84  break;
85 
86  case self::PRESENTATION_MODE_REQUEST:
87 
88  $pageObjectGUI = $this->buildRequestPresentationPageObjectGUI();
89  break;
90  }
91 
92  $this->ctrl->setParameter($pageObjectGUI, 'hint_id', $this->questionHint->getId());
93 
94  $this->ctrl->forwardCommand($pageObjectGUI);
95  }
buildPreviewPresentationPageObjectGUI()
forwards the command to page object gui for author presentation
buildAuthorPresentationPageObjectGUI()
forwards the command to page object gui for author presentation
buildRequestPresentationPageObjectGUI()
forwards the command to page object gui for author presentation
+ Here is the call graph for this function:

◆ getPageObjectGUI()

ilAssQuestionHintPageObjectCommandForwarder::getPageObjectGUI (   $pageObjectType,
  $pageObjectId 
)
protected

instantiates, initialises and returns a page object gui object

protected

Returns
page object gui object

Definition at line 216 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

References ensurePageObjectExists().

Referenced by buildAuthorPresentationPageObjectGUI(), buildPreviewPresentationPageObjectGUI(), and buildRequestPresentationPageObjectGUI().

217  {
218  include_once("./Modules/TestQuestionPool/classes/class.ilAssHintPageGUI.php");
219  $this->ensurePageObjectExists('qht', $pageObjectId);
220  $pageObjectGUI = new ilAssHintPageGUI($pageObjectId);
221  $pageObjectGUI->obj->addUpdateListener(
222  $this->questionOBJ,
223  'updateTimestamp'
224  );
225  return $pageObjectGUI;
226  }
ensurePageObjectExists($pageObjectType, $pageObjectId)
ensures an existing page object with giben type/id
Assessment hint page GUI class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPresentationMode()

ilAssQuestionHintPageObjectCommandForwarder::getPresentationMode ( )

getter for presentation mode

Returns
string

Definition at line 185 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

References $presentationMode.

Referenced by forward().

+ Here is the caller graph for this function:

◆ setPresentationMode()

ilAssQuestionHintPageObjectCommandForwarder::setPresentationMode (   $presentationMode)

setter for presentation mode

Parameters
string$presentationMode
Exceptions
ilTestQuestionPoolException

Definition at line 196 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

References $presentationMode.

197  {
198  switch ($presentationMode) {
199  case self::PRESENTATION_MODE_AUTHOR:
200  case self::PRESENTATION_MODE_PREVIEW:
201  case self::PRESENTATION_MODE_REQUEST:
202 
203  $this->presentationMode = $presentationMode;
204  break;
205 
206  default: throw new ilTestQuestionPoolException('invalid presentation mode given: ' . $presentationMode);
207  }
208  }

Field Documentation

◆ $presentationMode

ilAssQuestionHintPageObjectCommandForwarder::$presentationMode = null
protected

◆ $questionHint

ilAssQuestionHintPageObjectCommandForwarder::$questionHint = null
protected

◆ PRESENTATION_MODE_AUTHOR

const ilAssQuestionHintPageObjectCommandForwarder::PRESENTATION_MODE_AUTHOR = 'PRESENTATION_MODE_AUTHOR'

◆ PRESENTATION_MODE_PREVIEW

const ilAssQuestionHintPageObjectCommandForwarder::PRESENTATION_MODE_PREVIEW = 'PRESENTATION_MODE_PREVIEW'

presentation mode for authoring

Definition at line 25 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

Referenced by ilAssQuestionHintsGUI\executeCommand().

◆ PRESENTATION_MODE_REQUEST

const ilAssQuestionHintPageObjectCommandForwarder::PRESENTATION_MODE_REQUEST = 'PRESENTATION_MODE_REQUEST'

presentation mode for requesting

Definition at line 30 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

Referenced by ilAssQuestionHintRequestGUI\executeCommand().


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