ILIAS  release_4-4 Revision
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_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

 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 51 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

References $_GET, ilAssQuestionHintsGUI\CMD_SHOW_LIST, and ilUtil\sendFailure().

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  }
$_GET["client_id"]
const CMD_SHOW_LIST
command constants
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ 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 121 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

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

Referenced by forward().

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 
128  $this->ensurePageObjectExists(
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  }
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:

◆ buildRequestPresentationPageObjectGUI()

ilAssQuestionHintPageObjectCommandForwarder::buildRequestPresentationPageObjectGUI ( )
private

forwards the command to page object gui for author presentation

private

Returns
page object gui object

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

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

Referenced by forward().

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  }
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 190 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

References ilPageObject\_exists().

Referenced by buildAuthorPresentationPageObjectGUI().

191  {
192  include_once("./Modules/TestQuestionPool/classes/class.ilAssHintPage.php");
193  if( !ilAssHintPage::_exists($pageObjectType, $pageObjectId) )
194  {
195  $pageObject = new ilAssHintPage();
196  $pageObject->setParentId($this->questionOBJ->getId());
197  $pageObject->setId($pageObjectId);
198  $pageObject->createFromXML();
199  }
200  }
Assessment hint page object.
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
+ 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 69 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

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

70  {
71  switch( $this->getPresentationMode() )
72  {
73  case self::PRESENTATION_MODE_AUTHOR:
74 
75  $pageObjectGUI = $this->buildAuthorPresentationPageObjectGUI();
76  break;
77 
78  case self::PRESENTATION_MODE_REQUEST:
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  }
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 177 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

Referenced by buildAuthorPresentationPageObjectGUI(), and buildRequestPresentationPageObjectGUI().

178  {
179  include_once("./Modules/TestQuestionPool/classes/class.ilAssHintPageGUI.php");
180  $pageObjectGUI = new ilAssHintPageGUI($pageObjectId);
181 
182  return $pageObjectGUI;
183  }
Assessment hint page GUI class.
+ Here is the caller graph for this function:

◆ getPresentationMode()

ilAssQuestionHintPageObjectCommandForwarder::getPresentationMode ( )

getter for presentation mode

Returns
string

Definition at line 146 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 157 of file class.ilAssQuestionHintPageObjectCommandForwarder.php.

References $presentationMode.

158  {
159  switch( $presentationMode )
160  {
161  case self::PRESENTATION_MODE_AUTHOR:
162  case self::PRESENTATION_MODE_REQUEST:
163 
164  $this->presentationMode = $presentationMode;
165  break;
166 
167  default: throw new ilTestQuestionPoolException('invalid presentation mode given: '.$presentationMode);
168  }
169  }

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_REQUEST

const ilAssQuestionHintPageObjectCommandForwarder::PRESENTATION_MODE_REQUEST = 'PRESENTATION_MODE_REQUEST'

presentation mode for requesting

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

Referenced by ilAssQuestionHintRequestGUI\executeCommand().


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