ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAssQuestionSkillAssignmentsGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 
20 {
21  const CMD_SHOW_SKILL_QUEST_ASSIGNS = 'showSkillQuestionAssignments';
22  const CMD_SHOW_SKILL_SELECT = 'showSkillSelection';
23  const CMD_UPDATE_SKILL_QUEST_ASSIGNS = 'updateSkillQuestionAssignments';
24  const CMD_SHOW_SKILL_QUEST_ASSIGN_PROPERTIES_FORM = 'showSkillQuestionAssignmentPropertiesForm';
25  const CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM = 'saveSkillQuestionAssignmentPropertiesForm';
26  const CMD_SAVE_SKILL_POINTS = 'saveSkillPoints';
27  const CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION = 'showSyncOriginalConfirmation';
28  const CMD_SYNC_ORIGINAL = 'syncOriginal';
29 
30  const PARAM_SKILL_SELECTION = 'skill_ids';
31 
35  private $ctrl;
36 
40  private $access;
41 
45  private $tpl;
46 
50  private $lng;
51 
55  private $db;
56 
60  private $questionList;
61 
66 
71 
76 
81 
90  {
91  $this->ctrl = $ctrl;
92  $this->access = $access;
93  $this->tpl = $tpl;
94  $this->lng = $lng;
95  $this->db = $db;
96  }
97 
101  public function getQuestionOrderSequence()
102  {
104  }
105 
110  {
112  }
113 
118  {
119  $this->assignmentConfigurationHintMessage = $assignmentConfigurationHintMessage;
120  }
121 
126  {
127  $this->questionOrderSequence = $questionOrderSequence;
128  }
129 
133  public function getQuestionList()
134  {
135  return $this->questionList;
136  }
137 
142  {
143  $this->questionList = $questionList;
144  }
145 
149  public function getQuestionContainerId()
150  {
152  }
153 
158  {
159  $this->questionContainerId = $questionContainerId;
160  }
161 
165  public function isAssignmentEditingEnabled()
166  {
168  }
169 
174  {
175  $this->assignmentEditingEnabled = $assignmentEditingEnabled;
176  }
177 
178  public function executeCommand()
179  {
180  $nextClass = $this->ctrl->getNextClass();
181 
182  $command = $this->ctrl->getCmd(self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
183 
184  if ($this->isAvoidManipulationRedirectRequired($command)) {
185  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
186  }
187 
188  switch ($nextClass) {
189  case strtolower(__CLASS__):
190  case '':
191 
192  $command .= 'Cmd';
193  $this->$command();
194  break;
195 
196  default:
197 
198  throw new ilTestQuestionPoolException('unsupported next class in ctrl flow');
199  }
200  }
201 
202  private function isAvoidManipulationRedirectRequired($command)
203  {
204  if ($this->isAssignmentEditingEnabled()) {
205  return false;
206  }
207 
208  switch ($command) {
209  case self::CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM:
210  case self::CMD_UPDATE_SKILL_QUEST_ASSIGNS:
211 
212  return true;
213  }
214 
215  return false;
216  }
217 
218  private function saveSkillPointsCmd()
219  {
220  $success = true;
221 
222  if (is_array($_POST['skill_points'])) {
223  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
224 
225  for ($i = 0; $i < 2; $i++) {
226  foreach ($_POST['skill_points'] as $assignmentKey => $skillPoints) {
227  $assignmentKey = explode(':', $assignmentKey);
228  $skillBaseId = (int) $assignmentKey[0];
229  $skillTrefId = (int) $assignmentKey[1];
230  $questionId = (int) $assignmentKey[2];
231 
232  if ($this->isTestQuestion($questionId)) {
233  $assignment = new ilAssQuestionSkillAssignment($this->db);
234 
235  if ($i == 0) {
236  if (!$assignment->isValidSkillPoint($skillPoints)) {
237  $success = false;
238  break 2;
239  }
240  continue;
241  }
242 
243  $assignment->setParentObjId($this->getQuestionContainerId());
244  $assignment->setQuestionId($questionId);
245  $assignment->setSkillBaseId($skillBaseId);
246  $assignment->setSkillTrefId($skillTrefId);
247 
248  if ($assignment->dbRecordExists()) {
249  $assignment->loadFromDb();
250 
251  if (!$assignment->hasEvalModeBySolution()) {
252  $assignment->setSkillPoints((int) $skillPoints);
253  $assignment->saveToDb();
254  }
255  }
256  }
257  }
258  }
259  }
260 
261  if ($success) {
262  ilUtil::sendSuccess($this->lng->txt('tst_msg_skl_qst_assign_points_saved'), true);
263  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
264  } else {
265  ilUtil::sendFailure($this->lng->txt('tst_msg_skl_qst_assign_points_not_saved'));
266  $this->showSkillQuestionAssignmentsCmd(true);
267  }
268  }
269 
271  {
272  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
273 
274  $questionId = (int) $_GET['question_id'];
275 
276  if ($this->isTestQuestion($questionId)) {
277  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
278  $assignmentList->setParentObjId($this->getQuestionContainerId());
279  $assignmentList->loadFromDb();
280 
281  $handledSkills = array();
282 
283  //$skillIds = (array)$_POST['skill_ids'];
284  $sgui = $this->buildSkillSelectorExplorerGUI(array());
285  $skillIds = $sgui->getSelectedSkills();
286 
287  foreach ($skillIds as $skillId) {
288  $skill = explode(':', $skillId);
289  $skillBaseId = (int) $skill[0];
290  $skillTrefId = (int) $skill[1];
291 
292  if ($skillBaseId) {
293  if (!$assignmentList->isAssignedToQuestionId($skillBaseId, $skillTrefId, $questionId)) {
294  $assignment = new ilAssQuestionSkillAssignment($this->db);
295 
296  $assignment->setParentObjId($this->getQuestionContainerId());
297  $assignment->setQuestionId($questionId);
298  $assignment->setSkillBaseId($skillBaseId);
299  $assignment->setSkillTrefId($skillTrefId);
300 
301  $assignment->setSkillPoints(ilAssQuestionSkillAssignment::DEFAULT_COMPETENCE_POINTS);
303  $assignment->saveToDb();
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 
318  ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assigns_updated'), true);
319 
320  if ($this->isSyncOriginalPossibleAndAllowed($questionId)) {
321  $this->keepAssignmentParameters();
322  $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
323  }
324  }
325 
326  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
327  }
328 
329  private function showSkillSelectionCmd()
330  {
331  $this->ctrl->saveParameter($this, 'question_id');
332  $questionId = (int) $_GET['question_id'];
333 
334  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
335  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
336  $assignmentList->setParentObjId($this->getQuestionContainerId());
337  $assignmentList->loadFromDb();
338 
339  $skillSelectorExplorerGUI = $this->buildSkillSelectorExplorerGUI(
340  $assignmentList->getAssignmentsByQuestionId($questionId)
341  );
342 
343  if (!$skillSelectorExplorerGUI->handleCommand()) {
344  $tpl = new ilTemplate('tpl.qpl_qst_skl_assign_selection.html', false, false, 'Modules/TestQuestionPool');
345 
346  $tpl->setVariable('SKILL_SELECTOR_HEADER', $this->getSkillSelectorHeader($questionId));
347 
348  $skillSelectorToolbarGUI = $this->buildSkillSelectorToolbarGUI();
349 
350  $skillSelectorToolbarGUI->setOpenFormTag(true);
351  $skillSelectorToolbarGUI->setCloseFormTag(false);
352  $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
353  $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_TOP', $this->ctrl->getHTML($skillSelectorToolbarGUI));
354 
355  $tpl->setVariable('SKILL_SELECTOR_EXPLORER', $this->ctrl->getHTML($skillSelectorExplorerGUI));
356 
357  $skillSelectorToolbarGUI->setOpenFormTag(false);
358  $skillSelectorToolbarGUI->setCloseFormTag(true);
359  $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
360  $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_BOTTOM', $this->ctrl->getHTML($skillSelectorToolbarGUI));
361 
362  $this->tpl->setContent($tpl->get());
363  }
364  }
365 
367  assQuestionGUI $questionGUI = null,
368  ilAssQuestionSkillAssignment $assignment = null,
369  ilPropertyFormGUI $form = null
370  ) {
372 
373  $this->keepAssignmentParameters();
374 
375  if ($questionGUI === null) {
376  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
377  $questionGUI = assQuestionGUI::_getQuestionGUI('', (int) $_GET['question_id']);
378  }
379 
380  if ($assignment === null) {
381  $assignment = $this->buildQuestionSkillAssignment(
382  (int) $_GET['question_id'],
383  (int) $_GET['skill_base_id'],
384  (int) $_GET['skill_tref_id']
385  );
386  }
387 
388  if ($form === null) {
389  $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
390  }
391 
392  $questionPageHTML = $this->buildQuestionPage($questionGUI);
393 
394  $lacLegendHTML = $this->buildLacLegendHTML($questionGUI->object, $assignment);
395 
396  $this->tpl->setContent($this->ctrl->getHTML($form) . '<br />' . $questionPageHTML . $lacLegendHTML);
397  }
398 
400  {
401  $questionId = (int) $_GET['question_id'];
402 
403  if ($this->isTestQuestion($questionId)) {
404  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
405  $questionGUI = assQuestionGUI::_getQuestionGUI('', $questionId);
406 
407  $assignment = $this->buildQuestionSkillAssignment(
408  (int) $_GET['question_id'],
409  (int) $_GET['skill_base_id'],
410  (int) $_GET['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  ilUtil::sendFailure($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  ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_properties_modified'), true);
450 
451  if ($this->isSyncOriginalPossibleAndAllowed($questionId)) {
452  $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
453  }
454  }
455 
456  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
457  }
458 
460  {
461  require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssQuestionSkillAssignmentPropertyFormGUI.php';
462  $form = new ilAssQuestionSkillAssignmentPropertyFormGUI($this->ctrl, $this->lng, $this);
463 
464  $form->setQuestion($question);
465  $form->setAssignment($assignment);
466  $form->setManipulationEnabled($this->isAssignmentEditingEnabled());
467 
468  $form->build();
469 
470  return $form;
471  }
472 
473  private function showSkillQuestionAssignmentsCmd($loadSkillPointsFromRequest = false)
474  {
476 
477  $table = $this->buildTableGUI();
478  $table->loadSkillPointsFromRequest($loadSkillPointsFromRequest);
479 
480  $assignmentList = $this->buildSkillQuestionAssignmentList();
481  $assignmentList->loadFromDb();
482  $assignmentList->loadAdditionalSkillData();
483  $table->setSkillQuestionAssignmentList($assignmentList);
484  $table->setData($this->orderQuestionData($this->questionList->getQuestionDataArray()));
485 
486  $this->tpl->setContent($this->ctrl->getHTML($table));
487  }
488 
489  private function isSyncOriginalPossibleAndAllowed($questionId)
490  {
491  $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
492 
493  if (!$questionData['original_id']) {
494  return false;
495  }
496 
497  require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
498  $parentObjId = assQuestion::lookupParentObjId($questionData['original_id']);
499 
500  if (!$this->doesObjectTypeMatch($parentObjId)) {
501  return false;
502  }
503 
504  foreach (ilObject::_getAllReferences($parentObjId) as $parentRefId) {
505  if ($this->access->checkAccess('write', '', $parentRefId)) {
506  return true;
507  }
508  }
509 
510  return false;
511  }
512 
514  {
515  $questionId = (int) $_GET['question_id'];
516 
517  require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
518  $confirmation = new ilConfirmationGUI();
519 
520  $confirmation->setHeaderText($this->lng->txt('qpl_sync_quest_skl_assigns_confirmation'));
521 
522  $confirmation->setFormAction($this->ctrl->getFormAction($this));
523  $confirmation->addHiddenItem('question_id', $questionId);
524  $confirmation->setConfirm($this->lng->txt('yes'), self::CMD_SYNC_ORIGINAL);
525  $confirmation->setCancel($this->lng->txt('no'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
526 
527  $this->tpl->setContent($this->ctrl->getHTML($confirmation));
528  }
529 
530  private function syncOriginalCmd()
531  {
532  $questionId = (int) $_POST['question_id'];
533 
534  if ($this->isTestQuestion($questionId) && $this->isSyncOriginalPossibleAndAllowed($questionId)) {
535  $question = assQuestion::_instantiateQuestion($questionId);
536 
537  $question->syncSkillAssignments(
538  $question->getObjId(),
539  $question->getId(),
540  $question->lookupParentObjId($question->getOriginalId()),
541  $question->getOriginalId()
542  );
543 
544  ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_synced_to_orig'), true);
545  }
546 
547  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
548  }
549 
550  private function buildTableGUI()
551  {
552  require_once 'Modules/TestQuestionPool/classes/tables/class.ilAssQuestionSkillAssignmentsTableGUI.php';
553  $table = new ilAssQuestionSkillAssignmentsTableGUI($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS, $this->ctrl, $this->lng);
554  $table->setManipulationsEnabled($this->isAssignmentEditingEnabled());
555  $table->init();
556 
557  return $table;
558  }
559 
561  {
562  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
563  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
564  $assignmentList->setParentObjId($this->getQuestionContainerId());
565 
566  return $assignmentList;
567  }
568 
572  private function buildSkillSelectorExplorerGUI($assignments)
573  {
574  require_once 'Services/Skill/classes/class.ilSkillSelectorGUI.php';
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 
602  private function buildSkillSelectorToolbarGUI()
603  {
604  require_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
605 
606  $skillSelectorToolbarGUI = new ilToolbarGUI();
607 
608  $skillSelectorToolbarGUI->setFormAction($this->ctrl->getFormAction($this));
609  $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_save_skill_assigns_update'), self::CMD_UPDATE_SKILL_QUEST_ASSIGNS);
610  $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_cancel_skill_assigns_update'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
611 
612  return $skillSelectorToolbarGUI;
613  }
614 
615  private function buildQuestionPage(assQuestionGUI $questionGUI)
616  {
617  $this->tpl->addCss('Services/COPage/css/content.css');
618 
619  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
620  $pageGUI = new ilAssQuestionPageGUI($questionGUI->object->getId());
621 
622  $pageGUI->setOutputMode("presentation");
623  $pageGUI->setRenderPageContainer(true);
624 
625  $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
626 
627  $questionGUI->object->setShuffle(false); // dirty, but works ^^
628  $questionHTML = $questionGUI->getSolutionOutput(0, 0, false, false, true, false, true, false, true);
629  $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML));
630 
631  $pageHTML = $pageGUI->presentation();
632  $pageHTML = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $pageHTML);
633 
634  return $pageHTML;
635  }
636 
640  private function buildQuestionSkillAssignment($questionId, $skillBaseId, $skillTrefId)
641  {
642  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
643 
644  $assignment = new ilAssQuestionSkillAssignment($this->db);
645 
646  $assignment->setParentObjId($this->getQuestionContainerId());
647  $assignment->setQuestionId($questionId);
648  $assignment->setSkillBaseId($skillBaseId);
649  $assignment->setSkillTrefId($skillTrefId);
650 
651  $assignment->loadFromDb();
652  $assignment->loadAdditionalSkillData();
653 
654  return $assignment;
655  }
656 
657  private function isTestQuestion($questionId)
658  {
659  return $this->questionList->isInList($questionId);
660  }
661 
663  {
664  $errors = array();
665 
666  foreach ($input->getValues() as $expression) {
667  $result = $this->validateSolutionCompareExpression($expression, $question);
668 
669  if ($result !== true) {
670  $errors[] = "{$this->lng->txt('ass_lac_expression')} {$expression->getOrderIndex()}: {$result}";
671  }
672  }
673 
674  if (count($errors)) {
675  $alert = $this->lng->txt('ass_lac_validation_error');
676  $alert .= '<br />' . implode('<br />', $errors);
677  $input->setAlert($alert);
678  return false;
679  }
680 
681  return true;
682  }
683 
685  {
686  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacConditionParser.php';
687  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacQuestionProvider.php';
688  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacCompositeValidator.php';
689 
690  try {
691  $conditionParser = new ilAssLacConditionParser();
692  $conditionComposite = $conditionParser->parse($expression->getExpression());
693  $questionProvider = new ilAssLacQuestionProvider();
694  $questionProvider->setQuestion($question);
695  $conditionValidator = new ilAssLacCompositeValidator($questionProvider);
696 
697  $conditionValidator->validate($conditionComposite);
698  } catch (ilAssLacException $e) {
699  if ($e instanceof ilAssLacFormAlertProvider) {
700  return $e->getFormAlert($this->lng);
701  }
702 
703  throw $e;
704  }
705 
706  return true;
707  }
708 
709  private function keepAssignmentParameters()
710  {
711  $this->ctrl->saveParameter($this, 'question_id');
712  $this->ctrl->saveParameter($this, 'skill_base_id');
713  $this->ctrl->saveParameter($this, 'skill_tref_id');
714  }
715 
716  private function orderQuestionData($questionData)
717  {
718  $orderedQuestionsData = array();
719 
720  if ($this->getQuestionOrderSequence()) {
721  foreach ($this->getQuestionOrderSequence() as $questionId) {
722  $orderedQuestionsData[$questionId] = $questionData[$questionId];
723  }
724 
725  return $orderedQuestionsData;
726  }
727 
728  foreach ($questionData as $questionId => $data) {
729  $orderedQuestionsData[$questionId] = $data['title'];
730  }
731 
732  $orderedQuestionsData = $this->sortAlphabetically($orderedQuestionsData);
733 
734  foreach ($orderedQuestionsData as $questionId => $questionTitle) {
735  $orderedQuestionsData[$questionId] = $questionData[$questionId];
736  }
737 
738  return $orderedQuestionsData;
739  }
740 
742  {
745  }
746  }
747 
748  private function getSkillSelectorHeader($questionId)
749  {
750  $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
751 
752  return sprintf($this->lng->txt('qpl_qst_skl_selection_for_question_header'), $questionData['title']);
753  }
754 
755  private function sortAlphabetically($array)
756  {
757  $flags = SORT_REGULAR;
758 
759  if (defined('SORT_NATURAL')) {
760  $flags = SORT_NATURAL;
761  } elseif (defined('SORT_STRING')) {
762  $flags = SORT_STRING;
763  }
764 
765  if (defined('SORT_FLAG_CASE')) {
766  $flags = $flags | SORT_FLAG_CASE;
767  }
768 
769  asort($array, $flags);
770 
771  return $array;
772  }
773 
774  protected function doesObjectTypeMatch($objectId)
775  {
776  return ilObject::_lookupType($objectId) == 'qpl';
777  }
778 
785  private function buildLacLegendHTML(assQuestion $questionOBJ, ilAssQuestionSkillAssignment $assignment)
786  {
787  // #19192
788  if ($questionOBJ instanceof iQuestionCondition && $this->isAssignmentEditingEnabled()) {
789  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/class.ilAssLacLegendGUI.php';
790  $legend = new ilAssLacLegendGUI($this->lng, $this->tpl);
791  $legend->setQuestionOBJ($questionOBJ);
792  $legend->setInitialVisibilityEnabled($assignment->hasEvalModeBySolution());
793  $lacLegendHTML = $this->ctrl->getHTML($legend);
794  return $lacLegendHTML;
795  }
796 
797  return '';
798  }
799 }
This class provides processing control methods.
Class iQuestionCondition.
setAssignmentConfigurationHintMessage($assignmentConfigurationHintMessage)
validateSolutionCompareExpression(ilAssQuestionSolutionComparisonExpression $expression, iQuestionCondition $question)
$result
This class represents a property form user interface.
$_GET["client_id"]
Abstract basic class which is to be extended by the concrete assessment question type classes...
$legend
if(!array_key_exists('StateId', $_REQUEST)) $id
__construct(ilCtrl $ctrl, ilAccessHandler $access, ilTemplate $tpl, ilLanguage $lng, ilDBInterface $db)
static lookupParentObjId($questionId)
ilDBInterface $ilDB
Question page GUI class.
static _getAllReferences($a_id)
get all reference ids of object
buildSkillQuestionAssignmentPropertiesForm(assQuestion $question, ilAssQuestionSkillAssignment $assignment)
setAlert($a_alert)
Set Alert Text.
Interface ilAccessHandler.
showSkillQuestionAssignmentsCmd($loadSkillPointsFromRequest=false)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$success
Definition: Utf8Test.php:86
if(isset($_POST['submit'])) $form
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
buildQuestionSkillAssignment($questionId, $skillBaseId, $skillTrefId)
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
special template class to simplify handling of ITX/PEAR
Basic GUI class for assessment questions.
buildLacLegendHTML(assQuestion $questionOBJ, ilAssQuestionSkillAssignment $assignment)
static _lookupType($a_id, $a_reference=false)
lookup object type
static _instantiateQuestion($question_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
checkSolutionCompareExpressionInput(ilLogicalAnswerComparisonExpressionInputGUI $input, assQuestion $question)
Explorer class that works on tree objects (Services/Tree)
$errors
Definition: index.php:6
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)
Class ilParserQuestionProvider.
$i
Definition: disco.tpl.php:19
language handling
showSkillQuestionAssignmentPropertiesFormCmd(assQuestionGUI $questionGUI=null, ilAssQuestionSkillAssignment $assignment=null, ilPropertyFormGUI $form=null)
if(empty($password)) $table
Definition: pwgen.php:24
$_POST["username"]
setOutputMode($a_mode=IL_PAGE_PRESENTATION)
Set Output Mode.
Confirmation screen class.
$data
Definition: bench.php:6