ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilAssQuestionSkillAssignmentsGUI.php
Go to the documentation of this file.
1 <?php
2 
20 
36 {
37  public const CMD_SHOW_SKILL_QUEST_ASSIGNS = 'showSkillQuestionAssignments';
38  public const CMD_SHOW_SKILL_SELECT = 'showSkillSelection';
39  public const CMD_UPDATE_SKILL_QUEST_ASSIGNS = 'updateSkillQuestionAssignments';
40  public const CMD_SHOW_SKILL_QUEST_ASSIGN_PROPERTIES_FORM = 'showSkillQuestionAssignmentPropertiesForm';
41  public const CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM = 'saveSkillQuestionAssignmentPropertiesForm';
42  public const CMD_SAVE_SKILL_POINTS = 'saveSkillPoints';
43  public const CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION = 'showSyncOriginalConfirmation';
44  public const CMD_SYNC_ORIGINAL = 'syncOriginal';
45 
46  public const PARAM_SKILL_SELECTION = 'skill_ids';
47 
48  private ilCtrl $ctrl;
51  private ilLanguage $lng;
52  private ilDBInterface $db;
53 
57  private $questionList;
58 
63 
68 
73 
78 
79  private \ILIAS\TestQuestionPool\InternalRequestService $request;
80 
82 
90  public function __construct(ilCtrl $ctrl, ilAccessHandler $access, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilDBInterface $db)
91  {
92  $this->ctrl = $ctrl;
93  $this->access = $access;
94  $this->tpl = $tpl;
95  $this->lng = $lng;
96  $this->db = $db;
97  global $DIC;
98  $this->request = $DIC->testQuestionPool()->internal()->request();
99  $this->skillUsageService = $DIC->skills()->usage();
100  }
101 
102  public function getQuestionOrderSequence(): ?array
103  {
105  }
106 
107  public function getAssignmentConfigurationHintMessage(): ?string
108  {
110  }
111 
116  {
117  $this->assignmentConfigurationHintMessage = $assignmentConfigurationHintMessage;
118  }
119 
124  {
125  $this->questionOrderSequence = $questionOrderSequence;
126  }
127 
132  {
133  return $this->questionList;
134  }
135 
139  public function setQuestionList($questionList): void
140  {
141  $this->questionList = $questionList;
142  }
143 
147  public function getQuestionContainerId(): int
148  {
150  }
151 
156  {
157  $this->questionContainerId = $questionContainerId;
158  }
159 
163  public function isAssignmentEditingEnabled(): bool
164  {
166  }
167 
172  {
173  $this->assignmentEditingEnabled = $assignmentEditingEnabled;
174  }
175 
176  public function executeCommand(): void
177  {
178  $nextClass = $this->ctrl->getNextClass();
179 
180  $command = $this->ctrl->getCmd(self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
181 
182  if ($this->isAvoidManipulationRedirectRequired($command)) {
183  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
184  }
185 
186  switch ($nextClass) {
187  case strtolower(__CLASS__):
188  case '':
189 
190  $command .= 'Cmd';
191  $this->$command();
192  break;
193 
194  default:
195 
196  throw new ilTestQuestionPoolException('unsupported next class in ctrl flow');
197  }
198  }
199 
200  private function isAvoidManipulationRedirectRequired($command): bool
201  {
202  if ($this->isAssignmentEditingEnabled()) {
203  return false;
204  }
205 
206  switch ($command) {
207  case self::CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM:
208  case self::CMD_UPDATE_SKILL_QUEST_ASSIGNS:
209 
210  return true;
211  }
212 
213  return false;
214  }
215 
216  private function saveSkillPointsCmd(): void
217  {
218  $success = true;
219 
220  if (is_array($_POST['skill_points'])) {
221  for ($i = 0; $i < 2; $i++) {
222  foreach ($_POST['skill_points'] as $assignmentKey => $skillPoints) {
223  $assignmentKey = explode(':', $assignmentKey);
224  $skillBaseId = (int) $assignmentKey[0];
225  $skillTrefId = (int) $assignmentKey[1];
226  $questionId = (int) $assignmentKey[2];
227 
228  if ($this->isTestQuestion($questionId)) {
229  $assignment = new ilAssQuestionSkillAssignment($this->db);
230 
231  if ($i == 0) {
232  if (!$assignment->isValidSkillPoint($skillPoints)) {
233  $success = false;
234  break 2;
235  }
236  continue;
237  }
238 
239  $assignment->setParentObjId($this->getQuestionContainerId());
240  $assignment->setQuestionId($questionId);
241  $assignment->setSkillBaseId($skillBaseId);
242  $assignment->setSkillTrefId($skillTrefId);
243 
244  if ($assignment->dbRecordExists()) {
245  $assignment->loadFromDb();
246 
247  if (!$assignment->hasEvalModeBySolution()) {
248  $assignment->setSkillPoints((int) $skillPoints);
249  $assignment->saveToDb();
250 
251  // add skill usage
252  $this->skillUsageService->addUsage($this->getQuestionContainerId(), $skillBaseId, $skillTrefId);
253  }
254  }
255  }
256  }
257  }
258  }
259 
260  if ($success) {
261  $this->tpl->setOnScreenMessage('success', $this->lng->txt('tst_msg_skl_qst_assign_points_saved'), true);
262  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
263  } else {
264  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('tst_msg_skl_qst_assign_points_not_saved'));
265  $this->showSkillQuestionAssignmentsCmd(true);
266  }
267  }
268 
269  private function updateSkillQuestionAssignmentsCmd(): void
270  {
271  $questionId = (int) $this->request->raw('question_id');
272 
273  if ($this->isTestQuestion($questionId)) {
274  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
275  $assignmentList->setParentObjId($this->getQuestionContainerId());
276  $assignmentList->loadFromDb();
277 
278  $handledSkills = array();
279 
280  //$skillIds = (array)$_POST['skill_ids'];
281  $sgui = $this->buildSkillSelectorExplorerGUI(array());
282  $skillIds = $sgui->getSelectedSkills();
283 
284  foreach ($skillIds as $skillId) {
285  $skill = explode(':', $skillId);
286  $skillBaseId = (int) $skill[0];
287  $skillTrefId = (int) $skill[1];
288 
289  if ($skillBaseId) {
290  if (!$assignmentList->isAssignedToQuestionId($skillBaseId, $skillTrefId, $questionId)) {
291  $assignment = new ilAssQuestionSkillAssignment($this->db);
292 
293  $assignment->setParentObjId($this->getQuestionContainerId());
294  $assignment->setQuestionId($questionId);
295  $assignment->setSkillBaseId($skillBaseId);
296  $assignment->setSkillTrefId($skillTrefId);
297 
298  $assignment->setSkillPoints(ilAssQuestionSkillAssignment::DEFAULT_COMPETENCE_POINTS);
300  $assignment->saveToDb();
301 
302  // add skill usage
303  $this->skillUsageService->addUsage($this->getQuestionContainerId(), $skillBaseId, $skillTrefId);
304  }
305 
306  $handledSkills[$skillId] = $skill;
307  }
308  }
309 
310  foreach ($assignmentList->getAssignmentsByQuestionId($questionId) as $assignment) {
311  if (isset($handledSkills["{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}"])) {
312  continue;
313  }
314 
315  $assignment->deleteFromDb();
316 
317  // remove skill usage
318  if (!$assignment->isSkillUsed()) {
319  $this->skillUsageService->removeUsage(
320  $assignment->getParentObjId(),
321  $assignment->getSkillBaseId(),
322  $assignment->getSkillTrefId()
323  );
324  }
325  }
326 
327  $this->tpl->setOnScreenMessage('success', $this->lng->txt('qpl_qst_skl_assigns_updated'), true);
328 
329  if ($this->isSyncOriginalPossibleAndAllowed($questionId)) {
330  $this->keepAssignmentParameters();
331  $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
332  }
333  }
334 
335  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
336  }
337 
338  private function showSkillSelectionCmd(): void
339  {
340  $this->ctrl->saveParameter($this, 'question_id');
341  $questionId = (int) $this->request->raw('question_id');
342 
343  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
344  $assignmentList->setParentObjId($this->getQuestionContainerId());
345  $assignmentList->loadFromDb();
346 
347  $skillSelectorExplorerGUI = $this->buildSkillSelectorExplorerGUI(
348  $assignmentList->getAssignmentsByQuestionId($questionId)
349  );
350 
351  if (!$skillSelectorExplorerGUI->handleCommand()) {
352  $tpl = new ilTemplate('tpl.qpl_qst_skl_assign_selection.html', false, false, 'Modules/TestQuestionPool');
353 
354  $tpl->setVariable('SKILL_SELECTOR_HEADER', $this->getSkillSelectorHeader($questionId));
355 
356  $skillSelectorToolbarGUI = $this->buildSkillSelectorToolbarGUI();
357 
358  $skillSelectorToolbarGUI->setOpenFormTag(true);
359  $skillSelectorToolbarGUI->setCloseFormTag(false);
360  $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("nav/arrow_upright.svg"), " ");
361  $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_TOP', $this->ctrl->getHTML($skillSelectorToolbarGUI));
362 
363  $tpl->setVariable('SKILL_SELECTOR_EXPLORER', $this->ctrl->getHTML($skillSelectorExplorerGUI));
364 
365  $skillSelectorToolbarGUI->setOpenFormTag(false);
366  $skillSelectorToolbarGUI->setCloseFormTag(true);
367  $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("nav/arrow_downright.svg"), " ");
368  $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_BOTTOM', $this->ctrl->getHTML($skillSelectorToolbarGUI));
369 
370  $this->tpl->setContent($tpl->get());
371  }
372  }
373 
375  assQuestionGUI $questionGUI = null,
376  ilAssQuestionSkillAssignment $assignment = null,
377  ilPropertyFormGUI $form = null
378  ): void {
380 
381  $this->keepAssignmentParameters();
382 
383  if ($questionGUI === null) {
384  $questionGUI = assQuestionGUI::_getQuestionGUI('', (int) $this->request->raw('question_id'));
385  }
386 
387  if ($assignment === null) {
388  $assignment = $this->buildQuestionSkillAssignment(
389  (int) $this->request->raw('question_id'),
390  (int) $this->request->raw('skill_base_id'),
391  (int) $this->request->raw('skill_tref_id')
392  );
393  }
394 
395  if ($form === null) {
396  $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
397  }
398 
399  $questionPageHTML = $this->buildQuestionPage($questionGUI);
400 
401  $this->tpl->setContent($this->ctrl->getHTML($form) . '<br />' . $questionPageHTML);
402  }
403 
405  {
406  $questionId = (int) $this->request->raw('question_id');
407 
408  if ($this->isTestQuestion($questionId)) {
409  $questionGUI = assQuestionGUI::_getQuestionGUI('', $questionId);
410 
411  $assignment = $this->buildQuestionSkillAssignment(
412  (int) $this->request->raw('question_id'),
413  (int) $this->request->raw('skill_base_id'),
414  (int) $this->request->raw('skill_tref_id')
415  );
416 
417  $this->keepAssignmentParameters();
418  $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
419  if (!$form->checkInput()) {
420  $form->setValuesByPost();
421  $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
422  return;
423  }
424  $form->setValuesByPost();
425 
426  if ($form->getItemByPostVar('eval_mode')) {
427  $assignment->setEvalMode($form->getItemByPostVar('eval_mode')->getValue());
428  } else {
430  }
431 
432  if ($assignment->hasEvalModeBySolution()) {
433  $solCmpExprInput = $form->getItemByPostVar('solution_compare_expressions');
434 
435  if (!$this->checkSolutionCompareExpressionInput($solCmpExprInput, $questionGUI->object)) {
436  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("form_input_not_valid"));
437  $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
438  return;
439  }
440 
441  $assignment->initSolutionComparisonExpressionList();
442  $assignment->getSolutionComparisonExpressionList()->reset();
443 
444  foreach ($solCmpExprInput->getValues() as $expression) {
445  $assignment->getSolutionComparisonExpressionList()->add($expression);
446  }
447  } else {
448  $assignment->setSkillPoints($form->getItemByPostVar('q_res_skill_points')->getValue());
449  }
450 
451  $assignment->saveToDb();
452 
453  // add skill usage
454  $this->skillUsageService->addUsage(
455  $this->getQuestionContainerId(),
456  (int) $this->request->raw('skill_base_id'),
457  (int) $this->request->raw('skill_tref_id')
458  );
459 
460  $this->tpl->setOnScreenMessage('success', $this->lng->txt('qpl_qst_skl_assign_properties_modified'), true);
461 
462  if ($this->isSyncOriginalPossibleAndAllowed($questionId)) {
463  $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
464  }
465  }
466 
467  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
468  }
469 
471  {
472  $form = new ilAssQuestionSkillAssignmentPropertyFormGUI($this->tpl, $this->ctrl, $this->lng, $this);
473 
474  $form->setQuestion($question);
475  $form->setAssignment($assignment);
476  $form->setManipulationEnabled($this->isAssignmentEditingEnabled());
477 
478  $form->build();
479 
480  return $form;
481  }
482 
483  private function showSkillQuestionAssignmentsCmd($loadSkillPointsFromRequest = false): void
484  {
486 
487  $table = $this->buildTableGUI();
488  $table->loadSkillPointsFromRequest($loadSkillPointsFromRequest);
489 
490  $assignmentList = $this->buildSkillQuestionAssignmentList();
491  $assignmentList->loadFromDb();
492  $assignmentList->loadAdditionalSkillData();
493  $table->setSkillQuestionAssignmentList($assignmentList);
494  $table->setData($this->orderQuestionData($this->questionList->getQuestionDataArray()));
495 
496  $this->tpl->setContent($this->ctrl->getHTML($table));
497  }
498 
499  private function isSyncOriginalPossibleAndAllowed($questionId): bool
500  {
501  $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
502 
503  if (!$questionData['original_id']) {
504  return false;
505  }
506 
507  $parentObjId = assQuestion::lookupParentObjId($questionData['original_id']);
508 
509  if (!$this->doesObjectTypeMatch($parentObjId)) {
510  return false;
511  }
512 
513  foreach (ilObject::_getAllReferences($parentObjId) as $parentRefId) {
514  if ($this->access->checkAccess('write', '', $parentRefId)) {
515  return true;
516  }
517  }
518 
519  return false;
520  }
521 
522  private function showSyncOriginalConfirmationCmd(): void
523  {
524  $questionId = (int) $this->request->raw('question_id');
525 
526  $confirmation = new ilConfirmationGUI();
527 
528  $confirmation->setHeaderText($this->lng->txt('qpl_sync_quest_skl_assigns_confirmation'));
529 
530  $confirmation->setFormAction($this->ctrl->getFormAction($this));
531  $confirmation->addHiddenItem('question_id', $questionId);
532  $confirmation->setConfirm($this->lng->txt('yes'), self::CMD_SYNC_ORIGINAL);
533  $confirmation->setCancel($this->lng->txt('no'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
534 
535  $this->tpl->setContent($this->ctrl->getHTML($confirmation));
536  }
537 
538  private function syncOriginalCmd(): void
539  {
540  $questionId = (int) $_POST['question_id'];
541 
542  if ($this->isTestQuestion($questionId) && $this->isSyncOriginalPossibleAndAllowed($questionId)) {
543  $question = assQuestion::instantiateQuestion($questionId);
544 
545  $question->syncSkillAssignments(
546  $question->getObjId(),
547  $question->getId(),
548  $question->lookupParentObjId($question->getOriginalId()),
549  $question->getOriginalId()
550  );
551 
552  $this->tpl->setOnScreenMessage('success', $this->lng->txt('qpl_qst_skl_assign_synced_to_orig'), true);
553  }
554 
555  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
556  }
557 
559  {
560  $table = new ilAssQuestionSkillAssignmentsTableGUI($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS, $this->ctrl, $this->lng);
561  $table->setManipulationsEnabled($this->isAssignmentEditingEnabled());
562  $table->init();
563 
564  return $table;
565  }
566 
568  {
569  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
570  $assignmentList->setParentObjId($this->getQuestionContainerId());
571 
572  return $assignmentList;
573  }
574 
578  private function buildSkillSelectorExplorerGUI($assignments): ilSkillSelectorGUI
579  {
580  $skillSelectorExplorerGUI = new ilSkillSelectorGUI(
581  $this,
582  self::CMD_SHOW_SKILL_SELECT,
583  $this,
584  self::CMD_UPDATE_SKILL_QUEST_ASSIGNS,
585  self::PARAM_SKILL_SELECTION
586  );
587 
588  $skillSelectorExplorerGUI->setSelectMode(self::PARAM_SKILL_SELECTION, true);
589  //$skillSelectorExplorerGUI->setNodeOnclickEnabled(false);
590 
591  // parameter name for skill selection is actually taken from value passed to constructor,
592  // but passing a non empty name to setSelectMode is neccessary to keep input fields enabled
593 
594  foreach ($assignments as $assignment) {
595  $id = "{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}";
596  //$skillSelectorExplorerGUI->setNodeSelected($id);
597  $skillSelectorExplorerGUI->setSkillSelected($id);
598  }
599 
600  return $skillSelectorExplorerGUI;
601  }
602 
607  {
608  $skillSelectorToolbarGUI = new ilToolbarGUI();
609 
610  $skillSelectorToolbarGUI->setFormAction($this->ctrl->getFormAction($this));
611  $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_save_skill_assigns_update'), self::CMD_UPDATE_SKILL_QUEST_ASSIGNS);
612  $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_cancel_skill_assigns_update'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
613 
614  return $skillSelectorToolbarGUI;
615  }
616 
617  private function buildQuestionPage(assQuestionGUI $questionGUI)
618  {
619  $this->tpl->addCss('Services/COPage/css/content.css');
620 
621  $pageGUI = new ilAssQuestionPageGUI($questionGUI->object->getId());
622 
623  $pageGUI->setOutputMode("presentation");
624  $pageGUI->setRenderPageContainer(true);
625 
626  $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
627 
628  $questionGUI->object->setShuffle(false); // dirty, but works ^^
629  $questionHTML = $questionGUI->getSolutionOutput(0, 0, false, false, true, false, true, false, true);
630  $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML));
631 
632  $pageHTML = $pageGUI->presentation();
633  $pageHTML = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $pageHTML);
634 
635  return $pageHTML;
636  }
637 
641  private function buildQuestionSkillAssignment($questionId, $skillBaseId, $skillTrefId): ilAssQuestionSkillAssignment
642  {
643  $assignment = new ilAssQuestionSkillAssignment($this->db);
644 
645  $assignment->setParentObjId($this->getQuestionContainerId());
646  $assignment->setQuestionId($questionId);
647  $assignment->setSkillBaseId($skillBaseId);
648  $assignment->setSkillTrefId($skillTrefId);
649 
650  $assignment->loadFromDb();
651  $assignment->loadAdditionalSkillData();
652 
653  return $assignment;
654  }
655 
656  private function isTestQuestion($questionId): bool
657  {
658  return $this->questionList->isInList($questionId);
659  }
660 
661  private function checkSolutionCompareExpressionInput($input, assQuestion $question): bool
662  {
663  $errors = array();
664 
665  foreach ($input->getValues() as $expression) {
666  $result = $this->validateSolutionCompareExpression($expression, $question);
667 
668  if ($result !== true) {
669  $errors[] = "{$this->lng->txt('ass_lac_expression')} {$expression->getOrderIndex()}: {$result}";
670  }
671  }
672 
673  if (count($errors)) {
674  $alert = $this->lng->txt('ass_lac_validation_error');
675  $alert .= '<br />' . implode('<br />', $errors);
676  $input->setAlert($alert);
677  return false;
678  }
679 
680  return true;
681  }
682 
684  {
685  try {
686  $conditionParser = new ilAssLacConditionParser();
687  $conditionComposite = $conditionParser->parse($expression->getExpression());
688  $questionProvider = new ilAssLacQuestionProvider();
689  $questionProvider->setQuestion($question);
690  $conditionValidator = new ilAssLacCompositeValidator($questionProvider);
691  $conditionValidator->validate($conditionComposite);
692  } catch (ilAssLacException $e) {
693  if ($e instanceof ilAssLacFormAlertProvider) {
694  return $e->getFormAlert($this->lng);
695  }
696 
697  throw $e;
698  }
699 
700  return true;
701  }
702 
703  private function keepAssignmentParameters(): void
704  {
705  $this->ctrl->saveParameter($this, 'question_id');
706  $this->ctrl->saveParameter($this, 'skill_base_id');
707  $this->ctrl->saveParameter($this, 'skill_tref_id');
708  }
709 
710  private function orderQuestionData($questionData)
711  {
712  $orderedQuestionsData = array();
713 
714  if ($this->getQuestionOrderSequence()) {
715  foreach ($this->getQuestionOrderSequence() as $questionId) {
716  $orderedQuestionsData[$questionId] = $questionData[$questionId];
717  }
718 
719  return $orderedQuestionsData;
720  }
721 
722  foreach ($questionData as $questionId => $data) {
723  $orderedQuestionsData[$questionId] = $data['title'];
724  }
725 
726  $orderedQuestionsData = $this->sortAlphabetically($orderedQuestionsData);
727 
728  foreach ($orderedQuestionsData as $questionId => $questionTitle) {
729  $orderedQuestionsData[$questionId] = $questionData[$questionId];
730  }
731 
732  return $orderedQuestionsData;
733  }
734 
736  {
738  $this->tpl->setOnScreenMessage('info', $this->getAssignmentConfigurationHintMessage());
739  }
740  }
741 
742  private function getSkillSelectorHeader($questionId): string
743  {
744  $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
745 
746  return sprintf($this->lng->txt('qpl_qst_skl_selection_for_question_header'), $questionData['title']);
747  }
748 
749  private function sortAlphabetically($array)
750  {
751  $flags = SORT_REGULAR;
752 
753  if (defined('SORT_NATURAL')) {
754  $flags = SORT_NATURAL;
755  } elseif (defined('SORT_STRING')) {
756  $flags = SORT_STRING;
757  }
758 
759  if (defined('SORT_FLAG_CASE')) {
760  $flags = $flags | SORT_FLAG_CASE;
761  }
762 
763  asort($array, $flags);
764 
765  return $array;
766  }
767 
768  protected function doesObjectTypeMatch($objectId): bool
769  {
770  return ilObject::_lookupType($objectId) == 'qpl';
771  }
772 }
setAssignmentConfigurationHintMessage($assignmentConfigurationHintMessage)
setOutputMode(string $a_mode=self::PRESENTATION)
Abstract basic class which is to be extended by the concrete assessment question type classes...
static _getAllReferences(int $id)
get all reference ids for object ID
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
static lookupParentObjId(int $questionId)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
validateSolutionCompareExpression(ilAssQuestionSolutionComparisonExpression $expression, $question)
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
buildSkillQuestionAssignmentPropertiesForm(assQuestion $question, ilAssQuestionSkillAssignment $assignment)
showSkillQuestionAssignmentsCmd($loadSkillPointsFromRequest=false)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static instantiateQuestion(int $question_id)
buildQuestionSkillAssignment($questionId, $skillBaseId, $skillTrefId)
Basic GUI class for assessment questions.
__construct(ilCtrl $ctrl, ilAccessHandler $access, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilDBInterface $db)
ILIAS TestQuestionPool InternalRequestService $request
checkSolutionCompareExpressionInput($input, assQuestion $question)
Explorer class that works on tree objects (Services/Tree)
getSolutionOutput( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
showSkillQuestionAssignmentPropertiesFormCmd(assQuestionGUI $questionGUI=null, ilAssQuestionSkillAssignment $assignment=null, ilPropertyFormGUI $form=null)
static _lookupType(int $id, bool $reference=false)