ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAssQuestionHintRequestGUI Class Reference
+ Inheritance diagram for ilAssQuestionHintRequestGUI:
+ Collaboration diagram for ilAssQuestionHintRequestGUI:

Public Member Functions

 __construct (private ilTestPlayerAbstractGUI|ilAssQuestionPreviewGUI $parent_gui, private string $parent_cmd, assQuestionGUI $question_gui, private $question_hint_tracking, protected ilCtrl $ctrl, protected ilLanguage $lng, private ilGlobalTemplateInterface $tpl, protected ilTabsGUI $tabs, private GlobalScreen $global_screen)
 
 executeCommand ()
 
 getHintPresentationLinkTarget ($hint_id, $xml_style=true)
 
- Public Member Functions inherited from ilAssQuestionHintAbstractGUI
 __construct (assQuestionGUI $question_gui)
 Constructor. More...
 

Data Fields

const CMD_SHOW_LIST = 'showList'
 
const CMD_SHOW_HINT = 'showHint'
 
const CMD_CONFIRM_REQUEST = 'confirmRequest'
 
const CMD_PERFORM_REQUEST = 'performRequest'
 
const CMD_BACK_TO_QUESTION = 'backToQuestion'
 

Private Member Functions

 showListCmd ()
 
 showHintCmd ()
 
 confirmRequestCmd ()
 
 performRequestCmd ()
 
 backToQuestionCmd ()
 
 populateContent ($content, $tpl)
 

Additional Inherited Members

- Protected Attributes inherited from ilAssQuestionHintAbstractGUI
RequestDataCollector $request_data_collector
 
assQuestionGUI $question_gui = null
 
assQuestion $question_obj = null
 
ilTabsGUI $tabs
 
ilLanguage $lng
 
ilCtrl $ctrl
 

Detailed Description

Definition at line 32 of file class.ilAssQuestionHintRequestGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionHintRequestGUI::__construct ( private ilTestPlayerAbstractGUI|ilAssQuestionPreviewGUI  $parent_gui,
private string  $parent_cmd,
assQuestionGUI  $question_gui,
private  $question_hint_tracking,
protected ilCtrl  $ctrl,
protected ilLanguage  $lng,
private ilGlobalTemplateInterface  $tpl,
protected ilTabsGUI  $tabs,
private GlobalScreen  $global_screen 
)

Definition at line 40 of file class.ilAssQuestionHintRequestGUI.php.

References ILIAS\GlobalScreen\Provider\__construct().

50  {
51 
52  parent::__construct($question_gui);
53  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ backToQuestionCmd()

ilAssQuestionHintRequestGUI::backToQuestionCmd ( )
private

Definition at line 221 of file class.ilAssQuestionHintRequestGUI.php.

References ILIAS\Repository\ctrl().

221  : void
222  {
223  $this->ctrl->redirect($this->parent_gui, $this->parent_cmd);
224  }
+ Here is the call graph for this function:

◆ confirmRequestCmd()

ilAssQuestionHintRequestGUI::confirmRequestCmd ( )
private

Definition at line 157 of file class.ilAssQuestionHintRequestGUI.php.

References Vendor\Package\$e, ilUtil\appendUrlParameterString(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), populateContent(), and ilTestPlayerLayoutProvider\TEST_PLAYER_VIEW_TITLE.

157  : void
158  {
159  if ($this->global_screen->tool()->context()->current()->getAdditionalData()
161  $this->global_screen->tool()->context()->current()->getAdditionalData()->replace(
163  $this->parent_gui->getObject()->getTitle() . ' - ' . $this->lng->txt('tst_question_hints_confirm_request')
164  );
165  }
166 
167  try {
168  $next_requestable_hint = $this->question_hint_tracking->getNextRequestableHint();
170  $this->ctrl->redirect($this, self::CMD_BACK_TO_QUESTION);
171  }
172 
173  $confirmation = new ilConfirmationGUI();
174 
175  $form_action = ilUtil::appendUrlParameterString(
176  $this->ctrl->getFormAction($this),
177  "hintId={$next_requestable_hint->getId()}"
178  );
179 
180  $confirmation->setFormAction($form_action);
181 
182  $confirmation->setConfirm($this->lng->txt('tst_question_hints_confirm_request'), self::CMD_PERFORM_REQUEST);
183  $confirmation->setCancel($this->lng->txt('tst_question_hints_cancel_request'), self::CMD_BACK_TO_QUESTION);
184 
185  if ($next_requestable_hint->getPoints() == 0.0) {
186  $confirmation->setHeaderText($this->lng->txt('tst_question_hints_request_confirmation_no_deduction'));
187  } else {
188  $confirmation->setHeaderText(sprintf(
189  $this->lng->txt('tst_question_hints_request_confirmation'),
190  $next_requestable_hint->getIndex(),
191  $next_requestable_hint->getPoints()
192  ));
193  }
194 
195  $this->populateContent($this->ctrl->getHtml($confirmation), $this->tpl);
196  }
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
+ Here is the call graph for this function:

◆ executeCommand()

ilAssQuestionHintRequestGUI::executeCommand ( )

Definition at line 55 of file class.ilAssQuestionHintRequestGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilAssQuestionHintPageObjectCommandForwarder\PRESENTATION_MODE_REQUEST, and ILIAS\Repository\tabs().

56  {
57  $cmd = $this->ctrl->getCmd(self::CMD_SHOW_LIST);
58  $next_class = $this->ctrl->getNextClass($this);
59 
60  switch ($next_class) {
61  case 'ilasshintpagegui':
63  $this->question_obj,
64  $this->ctrl,
65  $this->tabs,
66  $this->lng
67  );
69  $forwarder->forward();
70  return '';
71 
72  default:
73  $cmd .= 'Cmd';
74  return $this->$cmd();
75  }
76  }
+ Here is the call graph for this function:

◆ getHintPresentationLinkTarget()

ilAssQuestionHintRequestGUI::getHintPresentationLinkTarget (   $hint_id,
  $xml_style = true 
)

Definition at line 232 of file class.ilAssQuestionHintRequestGUI.php.

References ILIAS\Repository\ctrl().

Referenced by performRequestCmd().

232  : string
233  {
234  if ($this->question_obj->isAdditionalContentEditingModePageObject()) {
235  $this->ctrl->setParameterByClass('ilasshintpagegui', 'hint_id', $hint_id);
236  return $this->ctrl->getLinkTargetByClass('ilAssHintPageGUI', '', '', false, $xml_style);
237  }
238 
239  $this->ctrl->setParameter($this, 'hintId', $hint_id);
240  return $this->ctrl->getLinkTarget($this, self::CMD_SHOW_HINT, '', false, $xml_style);
241  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performRequestCmd()

ilAssQuestionHintRequestGUI::performRequestCmd ( )
private

Definition at line 198 of file class.ilAssQuestionHintRequestGUI.php.

References Vendor\Package\$e, ILIAS\Repository\ctrl(), getHintPresentationLinkTarget(), ILIAS\Repository\int(), and ilUtil\redirect().

198  : void
199  {
200  if (!$this->request_data_collector->isset('hintId') || !(int) $this->request_data_collector->raw('hintId')) {
201  throw new ilTestException('no hint id given');
202  }
203 
204  try {
205  $next_requestable_hint = $this->question_hint_tracking->getNextRequestableHint();
207  $this->ctrl->redirect($this, self::CMD_BACK_TO_QUESTION);
208  }
209 
210  if ($next_requestable_hint->getId() != (int) $this->request_data_collector->raw('hintId')) {
211  throw new ilTestException('given hint id does not relate to the next requestable hint');
212  }
213 
214  $this->question_hint_tracking->storeRequest($next_requestable_hint);
215 
216  $redirectTarget = $this->getHintPresentationLinkTarget($next_requestable_hint->getId(), false);
217 
218  ilUtil::redirect($redirectTarget);
219  }
Base Exception for all Exceptions relating to Modules/Test.
static redirect(string $a_script)
getHintPresentationLinkTarget($hint_id, $xml_style=true)
+ Here is the call graph for this function:

◆ populateContent()

ilAssQuestionHintRequestGUI::populateContent (   $content,
  $tpl 
)
private

Definition at line 226 of file class.ilAssQuestionHintRequestGUI.php.

Referenced by confirmRequestCmd(), showHintCmd(), and showListCmd().

226  : void
227  {
228  $tpl->setContent($content);
229  return;
230  }
+ Here is the caller graph for this function:

◆ showHintCmd()

ilAssQuestionHintRequestGUI::showHintCmd ( )
private

Definition at line 100 of file class.ilAssQuestionHintRequestGUI.php.

References ILIAS\Repository\ctrl(), ilAssQuestionHint\getInstanceById(), ILIAS\Repository\lng(), populateContent(), ilLegacyFormElementsUtil\prepareTextareaOutput(), and ilTestPlayerLayoutProvider\TEST_PLAYER_VIEW_TITLE.

100  : void
101  {
102  if (!$this->request_data_collector->isset('hintId') || $this->request_data_collector->int('hintId') === 0) {
103  throw new ilTestException('no hint id given');
104  }
105 
106  $is_requested = $this->question_hint_tracking->isRequested($this->request_data_collector->int('hintId'));
107 
108  if (!$is_requested) {
109  throw new ilTestException('hint with given id is not yet requested for given testactive and testpass');
110  }
111 
112  $question_hint = ilAssQuestionHint::getInstanceById((int) $this->request_data_collector->raw('hintId'));
113 
114  if ($this->global_screen->tool()->context()->current()->getAdditionalData()
116  $this->global_screen->tool()->context()->current()->getAdditionalData()->replace(
118  $this->parent_gui->getObject()->getTitleForHTMLOutput() . ' - ' . sprintf(
119  $this->lng->txt('tst_question_hints_form_header_edit'),
120  $question_hint->getIndex(),
121  $this->request_data_collector->int('sequence') ?? 0
122  )
123  );
124  }
125 
126  $form = new ilPropertyFormGUI();
127  $form->setFormAction($this->ctrl->getFormAction($this));
128  $form->setTableWidth('100%');
129  $form->setTitle(sprintf(
130  $this->lng->txt('tst_question_hints_form_header_edit'),
131  $question_hint->getIndex(),
132  $this->question_obj->getTitleForHTMLOutput()
133  ));
134  $form->addCommandButton(self::CMD_BACK_TO_QUESTION, $this->lng->txt('tst_question_hints_back_to_question'));
135 
136  $num_existing_requests = $this->question_hint_tracking->getNumExistingRequests();
137 
138  if ($num_existing_requests > 1) {
139  $form->addCommandButton(self::CMD_SHOW_LIST, $this->lng->txt('show_requested_question_hints'));
140  }
141 
142  // form input: hint text
143 
144  $non_editable_hint_text = new ilNonEditableValueGUI($this->lng->txt('tst_question_hints_form_label_hint_text'), 'hint_text', true);
145  $non_editable_hint_text->setValue(ilLegacyFormElementsUtil::prepareTextareaOutput($question_hint->getText(), true));
146  $form->addItem($non_editable_hint_text);
147 
148  // form input: hint points
149 
150  $non_editable_hint_point = new ilNonEditableValueGUI($this->lng->txt('tst_question_hints_form_label_hint_points'), 'hint_points');
151  $non_editable_hint_point->setValue($question_hint->getPoints());
152  $form->addItem($non_editable_hint_point);
153 
154  $this->populateContent($this->ctrl->getHtml($form), $this->tpl);
155  }
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
Base Exception for all Exceptions relating to Modules/Test.
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
+ Here is the call graph for this function:

◆ showListCmd()

ilAssQuestionHintRequestGUI::showListCmd ( )
private

Definition at line 78 of file class.ilAssQuestionHintRequestGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), populateContent(), and ilTestPlayerLayoutProvider\TEST_PLAYER_VIEW_TITLE.

78  : void
79  {
80  if ($this->global_screen->tool()->context()->current()->getAdditionalData()
82  $this->global_screen->tool()->context()->current()->getAdditionalData()->replace(
84  $this->parent_gui->getObject()->getTitleForHTMLOutput() . ' - ' . $this->lng->txt('show_requested_question_hints')
85  );
86  }
87 
88  $question_hint_list = $this->question_hint_tracking->getRequestedHintsList();
89 
90  $table = new ilAssQuestionHintsTableGUI(
91  $this->question_obj,
92  $question_hint_list,
93  $this,
94  self::CMD_SHOW_LIST
95  );
96 
97  $this->populateContent($this->ctrl->getHtml($table), $this->tpl);
98  }
+ Here is the call graph for this function:

Field Documentation

◆ CMD_BACK_TO_QUESTION

const ilAssQuestionHintRequestGUI::CMD_BACK_TO_QUESTION = 'backToQuestion'

◆ CMD_CONFIRM_REQUEST

const ilAssQuestionHintRequestGUI::CMD_CONFIRM_REQUEST = 'confirmRequest'

◆ CMD_PERFORM_REQUEST

const ilAssQuestionHintRequestGUI::CMD_PERFORM_REQUEST = 'performRequest'

Definition at line 37 of file class.ilAssQuestionHintRequestGUI.php.

◆ CMD_SHOW_HINT

const ilAssQuestionHintRequestGUI::CMD_SHOW_HINT = 'showHint'

Definition at line 35 of file class.ilAssQuestionHintRequestGUI.php.

◆ CMD_SHOW_LIST


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