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