ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
186  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
187  }
188 
189  switch($nextClass)
190  {
191  case strtolower(__CLASS__):
192  case '':
193 
194  $command .= 'Cmd';
195  $this->$command();
196  break;
197 
198  default:
199 
200  throw new ilTestQuestionPoolException('unsupported next class in ctrl flow');
201  }
202  }
203 
204  private function isAvoidManipulationRedirectRequired($command)
205  {
206  if( $this->isAssignmentEditingEnabled() )
207  {
208  return false;
209  }
210 
211  switch($command)
212  {
213  case self::CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM:
214  case self::CMD_UPDATE_SKILL_QUEST_ASSIGNS:
215 
216  return true;
217  }
218 
219  return false;
220  }
221 
222  private function saveSkillPointsCmd()
223  {
224  $success = true;
225 
226  if( is_array($_POST['skill_points']) )
227  {
228  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
229 
230  for($i = 0; $i < 2; $i++) foreach($_POST['skill_points'] as $assignmentKey => $skillPoints)
231  {
232  $assignmentKey = explode(':', $assignmentKey);
233  $skillBaseId = (int)$assignmentKey[0];
234  $skillTrefId = (int)$assignmentKey[1];
235  $questionId = (int)$assignmentKey[2];
236 
237  if($this->isTestQuestion($questionId))
238  {
239  $assignment = new ilAssQuestionSkillAssignment($this->db);
240 
241  if($i == 0)
242  {
243  if(!$assignment->isValidSkillPoint($skillPoints))
244  {
245  $success = false;
246  break 2;
247  }
248  continue;
249  }
250 
251  $assignment->setParentObjId($this->getQuestionContainerId());
252  $assignment->setQuestionId($questionId);
253  $assignment->setSkillBaseId($skillBaseId);
254  $assignment->setSkillTrefId($skillTrefId);
255 
256  if($assignment->dbRecordExists())
257  {
258  $assignment->loadFromDb();
259 
260  if(!$assignment->hasEvalModeBySolution())
261  {
262  $assignment->setSkillPoints((int)$skillPoints);
263  $assignment->saveToDb();
264  }
265  }
266  }
267  }
268  }
269 
270  if($success)
271  {
272  ilUtil::sendSuccess($this->lng->txt('tst_msg_skl_qst_assign_points_saved'), true);
273  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
274  }
275  else
276  {
277  ilUtil::sendFailure($this->lng->txt('tst_msg_skl_qst_assign_points_not_saved'));
278  $this->showSkillQuestionAssignmentsCmd(true);
279  }
280  }
281 
283  {
284  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
285 
286  $questionId = (int)$_GET['question_id'];
287 
288  if( $this->isTestQuestion($questionId) )
289  {
290  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
291  $assignmentList->setParentObjId($this->getQuestionContainerId());
292  $assignmentList->loadFromDb();
293 
294  $handledSkills = array();
295 
296  //$skillIds = (array)$_POST['skill_ids'];
297  $sgui = $this->buildSkillSelectorExplorerGUI(array());
298  $skillIds = $sgui->getSelectedSkills();
299 
300  foreach($skillIds as $skillId)
301  {
302  $skill = explode(':',$skillId);
303  $skillBaseId = (int)$skill[0];
304  $skillTrefId = (int)$skill[1];
305 
306  if( $skillBaseId )
307  {
308  if( !$assignmentList->isAssignedToQuestionId($skillBaseId, $skillTrefId, $questionId) )
309  {
310  $assignment = new ilAssQuestionSkillAssignment($this->db);
311 
312  $assignment->setParentObjId($this->getQuestionContainerId());
313  $assignment->setQuestionId($questionId);
314  $assignment->setSkillBaseId($skillBaseId);
315  $assignment->setSkillTrefId($skillTrefId);
316 
317  $assignment->setSkillPoints(ilAssQuestionSkillAssignment::DEFAULT_COMPETENCE_POINTS);
319  $assignment->saveToDb();
320  }
321 
322  $handledSkills[$skillId] = $skill;
323  }
324  }
325 
326  foreach($assignmentList->getAssignmentsByQuestionId($questionId) as $assignment)
327  {
328  if( isset($handledSkills["{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}"]) )
329  {
330  continue;
331  }
332 
333  $assignment->deleteFromDb();
334  }
335 
336  ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assigns_updated'), true);
337 
338  if( $this->isSyncOriginalPossibleAndAllowed($questionId) )
339  {
340  $this->keepAssignmentParameters();
341  $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
342  }
343  }
344 
345  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
346  }
347 
348  private function showSkillSelectionCmd()
349  {
350  $this->ctrl->saveParameter($this, 'question_id');
351  $questionId = (int)$_GET['question_id'];
352 
353  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
354  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
355  $assignmentList->setParentObjId($this->getQuestionContainerId());
356  $assignmentList->loadFromDb();
357 
358  $skillSelectorExplorerGUI = $this->buildSkillSelectorExplorerGUI(
359  $assignmentList->getAssignmentsByQuestionId($questionId)
360  );
361 
362  if( !$skillSelectorExplorerGUI->handleCommand() )
363  {
364  $tpl = new ilTemplate('tpl.qpl_qst_skl_assign_selection.html', false, false, 'Modules/TestQuestionPool');
365 
366  $tpl->setVariable('SKILL_SELECTOR_HEADER', $this->getSkillSelectorHeader($questionId));
367 
368  $skillSelectorToolbarGUI = $this->buildSkillSelectorToolbarGUI();
369 
370  $skillSelectorToolbarGUI->setOpenFormTag(true);
371  $skillSelectorToolbarGUI->setCloseFormTag(false);
372  $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
373  $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_TOP', $this->ctrl->getHTML($skillSelectorToolbarGUI));
374 
375  $tpl->setVariable('SKILL_SELECTOR_EXPLORER', $this->ctrl->getHTML($skillSelectorExplorerGUI));
376 
377  $skillSelectorToolbarGUI->setOpenFormTag(false);
378  $skillSelectorToolbarGUI->setCloseFormTag(true);
379  $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
380  $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_BOTTOM', $this->ctrl->getHTML($skillSelectorToolbarGUI));
381 
382  $this->tpl->setContent($tpl->get());
383  }
384  }
385 
387  assQuestionGUI $questionGUI = null, ilAssQuestionSkillAssignment $assignment = null, ilPropertyFormGUI $form = null
388  )
389  {
391 
392  $this->keepAssignmentParameters();
393 
394  if( $questionGUI === null )
395  {
396  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
397  $questionGUI = assQuestionGUI::_getQuestionGUI('', (int)$_GET['question_id']);
398  }
399 
400  if( $assignment === null )
401  {
402  $assignment = $this->buildQuestionSkillAssignment(
403  (int)$_GET['question_id'], (int)$_GET['skill_base_id'], (int)$_GET['skill_tref_id']
404  );
405  }
406 
407  if( $form === null )
408  {
409  $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
410  }
411 
412  $questionPageHTML = $this->buildQuestionPage($questionGUI);
413 
414  $lacLegendHTML = $this->buildLacLegendHTML($questionGUI->object, $assignment);
415 
416  $this->tpl->setContent( $this->ctrl->getHTML($form).'<br />'.$questionPageHTML.$lacLegendHTML );
417  }
418 
420  {
421  $questionId = (int)$_GET['question_id'];
422 
423  if( $this->isTestQuestion($questionId) )
424  {
425  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
426  $questionGUI = assQuestionGUI::_getQuestionGUI('', $questionId);
427 
428  $assignment = $this->buildQuestionSkillAssignment(
429  (int)$_GET['question_id'], (int)$_GET['skill_base_id'], (int)$_GET['skill_tref_id']
430  );
431 
432  $this->keepAssignmentParameters();
433  $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
434  if( !$form->checkInput() )
435  {
436  $form->setValuesByPost();
437  $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
438  return;
439  }
440  $form->setValuesByPost();
441 
442  if($form->getItemByPostVar('eval_mode'))
443  {
444  $assignment->setEvalMode($form->getItemByPostVar('eval_mode')->getValue());
445  }
446  else
447  {
449  }
450 
451  if($assignment->hasEvalModeBySolution())
452  {
453  $solCmpExprInput = $form->getItemByPostVar('solution_compare_expressions');
454 
455  if( !$this->checkSolutionCompareExpressionInput($solCmpExprInput, $questionGUI->object) )
456  {
457  ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
458  $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
459  return;
460  }
461 
462  $assignment->initSolutionComparisonExpressionList();
463  $assignment->getSolutionComparisonExpressionList()->reset();
464 
465  foreach($solCmpExprInput->getValues() as $expression)
466  {
467  $assignment->getSolutionComparisonExpressionList()->add($expression);
468  }
469  }
470  else
471  {
472  $assignment->setSkillPoints($form->getItemByPostVar('q_res_skill_points')->getValue());
473  }
474 
475  $assignment->saveToDb();
476 
477  ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_properties_modified'), true);
478 
479  if( $this->isSyncOriginalPossibleAndAllowed($questionId) )
480  {
481  $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
482  }
483  }
484 
485  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
486  }
487 
489  {
490  require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssQuestionSkillAssignmentPropertyFormGUI.php';
491  $form = new ilAssQuestionSkillAssignmentPropertyFormGUI($this->ctrl, $this->lng, $this);
492 
493  $form->setQuestion($question);
494  $form->setAssignment($assignment);
495  $form->setManipulationEnabled($this->isAssignmentEditingEnabled());
496 
497  $form->build();
498 
499  return $form;
500  }
501 
502  private function showSkillQuestionAssignmentsCmd($loadSkillPointsFromRequest = false)
503  {
505 
506  $table = $this->buildTableGUI();
507  $table->loadSkillPointsFromRequest($loadSkillPointsFromRequest);
508 
509  $assignmentList = $this->buildSkillQuestionAssignmentList();
510  $assignmentList->loadFromDb();
511  $assignmentList->loadAdditionalSkillData();
512  $table->setSkillQuestionAssignmentList($assignmentList);
513  $table->setData($this->orderQuestionData($this->questionList->getQuestionDataArray()));
514 
515  $this->tpl->setContent($this->ctrl->getHTML($table));
516  }
517 
518  private function isSyncOriginalPossibleAndAllowed($questionId)
519  {
520  $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
521 
522  if( !$questionData['original_id'] )
523  {
524  return false;
525  }
526 
527  require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
528  $parentObjId = assQuestion::lookupParentObjId($questionData['original_id']);
529 
530  if( !$this->doesObjectTypeMatch($parentObjId) )
531  {
532  return false;
533  }
534 
535  foreach( ilObject::_getAllReferences($parentObjId) as $parentRefId )
536  {
537  if( $this->access->checkAccess('write', '', $parentRefId) )
538  {
539  return true;
540  }
541  }
542 
543  return false;
544  }
545 
547  {
548  $questionId = (int)$_GET['question_id'];
549 
550  require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
551  $confirmation = new ilConfirmationGUI();
552 
553  $confirmation->setHeaderText($this->lng->txt('qpl_sync_quest_skl_assigns_confirmation'));
554 
555  $confirmation->setFormAction($this->ctrl->getFormAction($this));
556  $confirmation->addHiddenItem('question_id', $questionId);
557  $confirmation->setConfirm($this->lng->txt('yes'), self::CMD_SYNC_ORIGINAL);
558  $confirmation->setCancel($this->lng->txt('no'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
559 
560  $this->tpl->setContent($this->ctrl->getHTML($confirmation));
561  }
562 
563  private function syncOriginalCmd()
564  {
565  $questionId = (int)$_POST['question_id'];
566 
567  if( $this->isTestQuestion($questionId) && $this->isSyncOriginalPossibleAndAllowed($questionId) )
568  {
569  $question = assQuestion::_instantiateQuestion($questionId);
570 
571  $question->syncSkillAssignments($question->getObjId(), $question->getId(),
572  $question->lookupParentObjId($question->getOriginalId()), $question->getOriginalId()
573  );
574 
575  ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_synced_to_orig'), true);
576  }
577 
578  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
579  }
580 
581  private function buildTableGUI()
582  {
583  require_once 'Modules/TestQuestionPool/classes/tables/class.ilAssQuestionSkillAssignmentsTableGUI.php';
584  $table = new ilAssQuestionSkillAssignmentsTableGUI($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS, $this->ctrl, $this->lng);
585  $table->setManipulationsEnabled($this->isAssignmentEditingEnabled());
586  $table->init();
587 
588  return $table;
589  }
590 
592  {
593  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
594  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
595  $assignmentList->setParentObjId($this->getQuestionContainerId());
596 
597  return $assignmentList;
598  }
599 
603  private function buildSkillSelectorExplorerGUI($assignments)
604  {
605  require_once 'Services/Skill/classes/class.ilSkillSelectorGUI.php';
606 
607  $skillSelectorExplorerGUI = new ilSkillSelectorGUI(
608  $this, self::CMD_SHOW_SKILL_SELECT, $this, self::CMD_UPDATE_SKILL_QUEST_ASSIGNS, self::PARAM_SKILL_SELECTION
609  );
610 
611  $skillSelectorExplorerGUI->setSelectMode(self::PARAM_SKILL_SELECTION, true);
612  $skillSelectorExplorerGUI->setNodeOnclickEnabled(false);
613 
614  // parameter name for skill selection is actually taken from value passed to constructor,
615  // but passing a non empty name to setSelectMode is neccessary to keep input fields enabled
616 
617  foreach($assignments as $assignment)
618  {
619  $id = "{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}";
620  //$skillSelectorExplorerGUI->setNodeSelected($id);
621  $skillSelectorExplorerGUI->setSkillSelected($id);
622  }
623 
624  return $skillSelectorExplorerGUI;
625  }
626 
630  private function buildSkillSelectorToolbarGUI()
631  {
632  require_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
633 
634  $skillSelectorToolbarGUI = new ilToolbarGUI();
635 
636  $skillSelectorToolbarGUI->setFormAction($this->ctrl->getFormAction($this));
637  $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_save_skill_assigns_update'), self::CMD_UPDATE_SKILL_QUEST_ASSIGNS);
638  $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_cancel_skill_assigns_update'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
639 
640  return $skillSelectorToolbarGUI;
641  }
642 
643  private function buildQuestionPage(assQuestionGUI $questionGUI)
644  {
645  $this->tpl->addCss('Services/COPage/css/content.css');
646 
647  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
648  $pageGUI = new ilAssQuestionPageGUI($questionGUI->object->getId());
649 
650  $pageGUI->setOutputMode("presentation");
651  $pageGUI->setRenderPageContainer(true);
652 
653  $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
654 
655  $questionGUI->object->setShuffle(false); // dirty, but works ^^
656  $questionHTML = $questionGUI->getSolutionOutput(0, 0, false, false, true, false, true, false, true);
657  $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML));
658 
659  $pageHTML = $pageGUI->presentation();
660  $pageHTML = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $pageHTML);
661 
662  return $pageHTML;
663  }
664 
668  private function buildQuestionSkillAssignment($questionId, $skillBaseId, $skillTrefId)
669  {
670  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
671 
672  $assignment = new ilAssQuestionSkillAssignment($this->db);
673 
674  $assignment->setParentObjId($this->getQuestionContainerId());
675  $assignment->setQuestionId($questionId);
676  $assignment->setSkillBaseId($skillBaseId);
677  $assignment->setSkillTrefId($skillTrefId);
678 
679  $assignment->loadFromDb();
680  $assignment->loadAdditionalSkillData();
681 
682  return $assignment;
683  }
684 
685  private function isTestQuestion($questionId)
686  {
687  return $this->questionList->isInList($questionId);
688  }
689 
691  {
692  $errors = array();
693 
694  foreach($input->getValues() as $expression)
695  {
696  $result = $this->validateSolutionCompareExpression($expression, $question);
697 
698  if( $result !== true )
699  {
700  $errors[] = "{$this->lng->txt('ass_lac_expression')} {$expression->getOrderIndex()}: {$result}";
701  }
702  }
703 
704  if( count($errors) )
705  {
706  $alert = $this->lng->txt('ass_lac_validation_error');
707  $alert .= '<br />'.implode('<br />', $errors);
708  $input->setAlert($alert);
709  return false;
710  }
711 
712  return true;
713  }
714 
716  {
717  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacConditionParser.php';
718  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacQuestionProvider.php';
719  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacCompositeValidator.php';
720 
721  try
722  {
723  $conditionParser = new ilAssLacConditionParser();
724  $conditionComposite = $conditionParser->parse($expression->getExpression());
725  $questionProvider = new ilAssLacQuestionProvider();
726  $questionProvider->setQuestion($question);
727  $conditionValidator = new ilAssLacCompositeValidator($questionProvider);
728 
729  $conditionValidator->validate($conditionComposite);
730  }
731  catch (ilAssLacException $e)
732  {
733  if( $e instanceof ilAssLacFormAlertProvider )
734  {
735  return $e->getFormAlert($this->lng);
736  }
737 
738  throw $e;
739  }
740 
741  return true;
742  }
743 
744  private function keepAssignmentParameters()
745  {
746  $this->ctrl->saveParameter($this, 'question_id');
747  $this->ctrl->saveParameter($this, 'skill_base_id');
748  $this->ctrl->saveParameter($this, 'skill_tref_id');
749  }
750 
751  private function orderQuestionData($questionData)
752  {
753  $orderedQuestionsData = array();
754 
755  if( $this->getQuestionOrderSequence() )
756  {
757  foreach($this->getQuestionOrderSequence() as $questionId)
758  {
759  $orderedQuestionsData[$questionId] = $questionData[$questionId];
760  }
761 
762  return $orderedQuestionsData;
763  }
764 
765  foreach($questionData as $questionId => $data)
766  {
767  $orderedQuestionsData[$questionId] = $data['title'];
768  }
769 
770  $orderedQuestionsData = $this->sortAlphabetically($orderedQuestionsData);
771 
772  foreach($orderedQuestionsData as $questionId => $questionTitle)
773  {
774  $orderedQuestionsData[$questionId] = $questionData[$questionId];
775  }
776 
777  return $orderedQuestionsData;
778  }
779 
781  {
783  {
785  }
786  }
787 
788  private function getSkillSelectorHeader($questionId)
789  {
790  $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
791 
792  return sprintf($this->lng->txt('qpl_qst_skl_selection_for_question_header'), $questionData['title']);
793  }
794 
795  private function sortAlphabetically($array)
796  {
797  $flags = SORT_REGULAR;
798 
799  if( defined('SORT_NATURAL') )
800  {
801  $flags = SORT_NATURAL;
802  }
803  elseif( defined('SORT_STRING') )
804  {
805  $flags = SORT_STRING;
806  }
807 
808  if( defined('SORT_FLAG_CASE') )
809  {
810  $flags = $flags | SORT_FLAG_CASE;
811  }
812 
813  asort($array, $flags);
814 
815  return $array;
816  }
817 
818  protected function doesObjectTypeMatch($objectId)
819  {
820  return ilObject::_lookupType($objectId) == 'qpl';
821  }
822 
829  private function buildLacLegendHTML(assQuestion $questionOBJ, ilAssQuestionSkillAssignment $assignment)
830  {
831  // #19192
832  if( $questionOBJ instanceof iQuestionCondition && $this->isAssignmentEditingEnabled())
833  {
834  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/class.ilAssLacLegendGUI.php';
835  $legend = new ilAssLacLegendGUI($this->lng, $this->tpl);
836  $legend->setQuestionOBJ($questionOBJ);
837  $legend->setInitialVisibilityEnabled($assignment->hasEvalModeBySolution());
838  $lacLegendHTML = $this->ctrl->getHTML($legend);
839  return $lacLegendHTML;
840  }
841 
842  return '';
843  }
844 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 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...
__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.
showSkillQuestionAssignmentsCmd($loadSkillPointsFromRequest=false)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Interface ilDBInterface.
$success
Definition: Utf8Test.php:86
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)
Create styles array
The data for the language used.
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
Class ilParserQuestionProvider.
language handling
showSkillQuestionAssignmentPropertiesFormCmd(assQuestionGUI $questionGUI=null, ilAssQuestionSkillAssignment $assignment=null, ilPropertyFormGUI $form=null)
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
$_POST["username"]
setOutputMode($a_mode=IL_PAGE_PRESENTATION)
Set Output Mode.
Confirmation screen class.
Class ilAccessHandler.