ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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  if( is_array($_POST['skill_points']) )
225  {
226  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
227 
228  $success = false;
229 
230  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) && (int)$skillPoints > 0 )
238  {
239  $assignment = new ilAssQuestionSkillAssignment($this->db);
240 
241  $assignment->setParentObjId($this->getQuestionContainerId());
242  $assignment->setQuestionId($questionId);
243  $assignment->setSkillBaseId($skillBaseId);
244  $assignment->setSkillTrefId($skillTrefId);
245 
246  if( $assignment->dbRecordExists() )
247  {
248  $assignment->loadFromDb();
249 
250  if( !$assignment->hasEvalModeBySolution() )
251  {
252  $assignment->setSkillPoints((int)$skillPoints);
253  $assignment->saveToDb();
254  }
255  }
256  }
257  }
258  }
259 
260  ilUtil::sendSuccess($this->lng->txt('tst_msg_skl_qst_assign_points_saved'), true);
261  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
262  }
263 
265  {
266  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
267 
268  $questionId = (int)$_GET['question_id'];
269 
270  if( $this->isTestQuestion($questionId) )
271  {
272  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
273  $assignmentList->setParentObjId($this->getQuestionContainerId());
274  $assignmentList->loadFromDb();
275 
276  $handledSkills = array();
277 
278  //$skillIds = (array)$_POST['skill_ids'];
279  $sgui = $this->buildSkillSelectorExplorerGUI(array());
280  $skillIds = $sgui->getSelectedSkills();
281 
282  foreach($skillIds as $skillId)
283  {
284  $skill = explode(':',$skillId);
285  $skillBaseId = (int)$skill[0];
286  $skillTrefId = (int)$skill[1];
287 
288  if( $skillBaseId )
289  {
290  if( !$assignmentList->isAssignedToQuestionId($skillBaseId, $skillTrefId, $questionId) )
291  {
292  $assignment = new ilAssQuestionSkillAssignment($this->db);
293 
294  $assignment->setParentObjId($this->getQuestionContainerId());
295  $assignment->setQuestionId($questionId);
296  $assignment->setSkillBaseId($skillBaseId);
297  $assignment->setSkillTrefId($skillTrefId);
298 
299  $assignment->setSkillPoints(ilAssQuestionSkillAssignment::DEFAULT_COMPETENCE_POINTS);
301  $assignment->saveToDb();
302  }
303 
304  $handledSkills[$skillId] = $skill;
305  }
306  }
307 
308  foreach($assignmentList->getAssignmentsByQuestionId($questionId) as $assignment)
309  {
310  if( isset($handledSkills["{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}"]) )
311  {
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  {
322  $this->keepAssignmentParameters();
323  $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
324  }
325  }
326 
327  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
328  }
329 
330  private function showSkillSelectionCmd()
331  {
332  $this->ctrl->saveParameter($this, 'question_id');
333  $questionId = (int)$_GET['question_id'];
334 
335  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
336  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
337  $assignmentList->setParentObjId($this->getQuestionContainerId());
338  $assignmentList->loadFromDb();
339 
340  $skillSelectorExplorerGUI = $this->buildSkillSelectorExplorerGUI(
341  $assignmentList->getAssignmentsByQuestionId($questionId)
342  );
343 
344  if( !$skillSelectorExplorerGUI->handleCommand() )
345  {
346  $tpl = new ilTemplate('tpl.qpl_qst_skl_assign_selection.html', false, false, 'Modules/TestQuestionPool');
347 
348  $tpl->setVariable('SKILL_SELECTOR_HEADER', $this->getSkillSelectorHeader($questionId));
349 
350  $skillSelectorToolbarGUI = $this->buildSkillSelectorToolbarGUI();
351 
352  $skillSelectorToolbarGUI->setOpenFormTag(true);
353  $skillSelectorToolbarGUI->setCloseFormTag(false);
354  $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
355  $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_TOP', $this->ctrl->getHTML($skillSelectorToolbarGUI));
356 
357  $tpl->setVariable('SKILL_SELECTOR_EXPLORER', $this->ctrl->getHTML($skillSelectorExplorerGUI));
358 
359  $skillSelectorToolbarGUI->setOpenFormTag(false);
360  $skillSelectorToolbarGUI->setCloseFormTag(true);
361  $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
362  $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_BOTTOM', $this->ctrl->getHTML($skillSelectorToolbarGUI));
363 
364  $this->tpl->setContent($tpl->get());
365  }
366  }
367 
369  assQuestionGUI $questionGUI = null, ilAssQuestionSkillAssignment $assignment = null, ilPropertyFormGUI $form = null
370  )
371  {
373 
374  $this->keepAssignmentParameters();
375 
376  if( $questionGUI === null )
377  {
378  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
379  $questionGUI = assQuestionGUI::_getQuestionGUI('', (int)$_GET['question_id']);
380  }
381 
382  if( $assignment === null )
383  {
384  $assignment = $this->buildQuestionSkillAssignment(
385  (int)$_GET['question_id'], (int)$_GET['skill_base_id'], (int)$_GET['skill_tref_id']
386  );
387  }
388 
389  if( $form === null )
390  {
391  $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
392  }
393 
394  $questionPageHTML = $this->buildQuestionPage($questionGUI);
395 
396  $lacLegendHTML = $this->buildLacLegendHTML($questionGUI->object, $assignment);
397 
398  $this->tpl->setContent( $this->ctrl->getHTML($form).'<br />'.$questionPageHTML.$lacLegendHTML );
399  }
400 
402  {
403  $questionId = (int)$_GET['question_id'];
404 
405  if( $this->isTestQuestion($questionId) )
406  {
407  require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
408  $questionGUI = assQuestionGUI::_getQuestionGUI('', $questionId);
409 
410  $assignment = $this->buildQuestionSkillAssignment(
411  (int)$_GET['question_id'], (int)$_GET['skill_base_id'], (int)$_GET['skill_tref_id']
412  );
413 
414  $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
415 
416  $form->setValuesByPost();
417 
418  if( !$form->checkInput() )
419  {
420  $this->keepAssignmentParameters();
421  $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
422  return;
423  }
424 
425  if($form->getItemByPostVar('eval_mode'))
426  {
427  $assignment->setEvalMode($form->getItemByPostVar('eval_mode')->getValue());
428  }
429  else
430  {
432  }
433 
434  if($assignment->hasEvalModeBySolution())
435  {
436  $solCmpExprInput = $form->getItemByPostVar('solution_compare_expressions');
437 
438  if( !$this->checkSolutionCompareExpressionInput($solCmpExprInput, $questionGUI->object) )
439  {
440  ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
441  $this->keepAssignmentParameters();
442  $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
443  return;
444  }
445 
446  $assignment->initSolutionComparisonExpressionList();
447  $assignment->getSolutionComparisonExpressionList()->reset();
448 
449  foreach($solCmpExprInput->getValues() as $expression)
450  {
451  $assignment->getSolutionComparisonExpressionList()->add($expression);
452  }
453  }
454  else
455  {
456  $assignment->setSkillPoints($form->getItemByPostVar('q_res_skill_points')->getValue());
457  }
458 
459  $assignment->saveToDb();
460 
461  ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_properties_modified'), true);
462 
463  if( $this->isSyncOriginalPossibleAndAllowed($questionId) )
464  {
465  $this->keepAssignmentParameters();
466  $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
467  }
468  }
469 
470  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
471  }
472 
474  {
475  require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssQuestionSkillAssignmentPropertyFormGUI.php';
476  $form = new ilAssQuestionSkillAssignmentPropertyFormGUI($this->ctrl, $this->lng, $this);
477 
478  $form->setQuestion($question);
479  $form->setAssignment($assignment);
480  $form->setManipulationEnabled($this->isAssignmentEditingEnabled());
481 
482  $form->build();
483 
484  return $form;
485  }
486 
488  {
490 
491  $table = $this->buildTableGUI();
492 
493  $assignmentList = $this->buildSkillQuestionAssignmentList();
494  $assignmentList->loadFromDb();
495  $assignmentList->loadAdditionalSkillData();
496  $table->setSkillQuestionAssignmentList($assignmentList);
497 
498  $table->setData($this->orderQuestionData(
499  $this->questionList->getQuestionDataArray()
500  ));
501 
502  $this->tpl->setContent($this->ctrl->getHTML($table));
503  }
504 
505  private function isSyncOriginalPossibleAndAllowed($questionId)
506  {
507  $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
508 
509  if( !$questionData['original_id'] )
510  {
511  return false;
512  }
513 
514  require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
515  $parentObjId = assQuestion::lookupParentObjId($questionData['original_id']);
516 
517  if( !$this->doesObjectTypeMatch($parentObjId) )
518  {
519  return false;
520  }
521 
522  foreach( ilObject::_getAllReferences($parentObjId) as $parentRefId )
523  {
524  if( $this->access->checkAccess('write', '', $parentRefId) )
525  {
526  return true;
527  }
528  }
529 
530  return false;
531  }
532 
534  {
535  $questionId = (int)$_GET['question_id'];
536 
537  require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
538  $confirmation = new ilConfirmationGUI();
539 
540  $confirmation->setHeaderText($this->lng->txt('qpl_sync_quest_skl_assigns_confirmation'));
541 
542  $confirmation->setFormAction($this->ctrl->getFormAction($this));
543  $confirmation->addHiddenItem('question_id', $questionId);
544  $confirmation->setConfirm($this->lng->txt('yes'), self::CMD_SYNC_ORIGINAL);
545  $confirmation->setCancel($this->lng->txt('no'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
546 
547  $this->tpl->setContent($this->ctrl->getHTML($confirmation));
548  }
549 
550  private function syncOriginalCmd()
551  {
552  $questionId = (int)$_POST['question_id'];
553 
554  if( $this->isTestQuestion($questionId) && $this->isSyncOriginalPossibleAndAllowed($questionId) )
555  {
556  $question = assQuestion::_instantiateQuestion($questionId);
557 
558  $question->syncSkillAssignments($question->getObjId(), $question->getId(),
559  $question->lookupParentObjId($question->getOriginalId()), $question->getOriginalId()
560  );
561 
562  ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_synced_to_orig'), true);
563  }
564 
565  $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
566  }
567 
568  private function buildTableGUI()
569  {
570  require_once 'Modules/TestQuestionPool/classes/tables/class.ilAssQuestionSkillAssignmentsTableGUI.php';
571  $table = new ilAssQuestionSkillAssignmentsTableGUI($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS, $this->ctrl, $this->lng);
572  $table->setManipulationsEnabled($this->isAssignmentEditingEnabled());
573  $table->init();
574 
575  return $table;
576  }
577 
579  {
580  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
581  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
582  $assignmentList->setParentObjId($this->getQuestionContainerId());
583 
584  return $assignmentList;
585  }
586 
590  private function buildSkillSelectorExplorerGUI($assignments)
591  {
592  require_once 'Services/Skill/classes/class.ilSkillSelectorGUI.php';
593 
594  $skillSelectorExplorerGUI = new ilSkillSelectorGUI(
595  $this, self::CMD_SHOW_SKILL_SELECT, $this, self::CMD_UPDATE_SKILL_QUEST_ASSIGNS, self::PARAM_SKILL_SELECTION
596  );
597 
598  $skillSelectorExplorerGUI->setSelectMode(self::PARAM_SKILL_SELECTION, true);
599  $skillSelectorExplorerGUI->setNodeOnclickEnabled(false);
600 
601  // parameter name for skill selection is actually taken from value passed to constructor,
602  // but passing a non empty name to setSelectMode is neccessary to keep input fields enabled
603 
604  foreach($assignments as $assignment)
605  {
606  $id = "{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}";
607  //$skillSelectorExplorerGUI->setNodeSelected($id);
608  $skillSelectorExplorerGUI->setSkillSelected($id);
609  }
610 
611  return $skillSelectorExplorerGUI;
612  }
613 
617  private function buildSkillSelectorToolbarGUI()
618  {
619  require_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
620 
621  $skillSelectorToolbarGUI = new ilToolbarGUI();
622 
623  $skillSelectorToolbarGUI->setFormAction($this->ctrl->getFormAction($this));
624  $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_save_skill_assigns_update'), self::CMD_UPDATE_SKILL_QUEST_ASSIGNS);
625  $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_cancel_skill_assigns_update'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
626 
627  return $skillSelectorToolbarGUI;
628  }
629 
630  private function buildQuestionPage(assQuestionGUI $questionGUI)
631  {
632  $this->tpl->addCss('Services/COPage/css/content.css');
633 
634  include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
635  $pageGUI = new ilAssQuestionPageGUI($questionGUI->object->getId());
636 
637  $pageGUI->setOutputMode("presentation");
638  $pageGUI->setRenderPageContainer(true);
639 
640  $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
641 
642  $questionGUI->object->setShuffle(false); // dirty, but works ^^
643  $questionHTML = $questionGUI->getSolutionOutput(0, 0, false, false, true, false, true, false, true);
644  $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML));
645 
646  $pageHTML = $pageGUI->presentation();
647  $pageHTML = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $pageHTML);
648 
649  return $pageHTML;
650  }
651 
655  private function buildQuestionSkillAssignment($questionId, $skillBaseId, $skillTrefId)
656  {
657  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
658 
659  $assignment = new ilAssQuestionSkillAssignment($this->db);
660 
661  $assignment->setParentObjId($this->getQuestionContainerId());
662  $assignment->setQuestionId($questionId);
663  $assignment->setSkillBaseId($skillBaseId);
664  $assignment->setSkillTrefId($skillTrefId);
665 
666  $assignment->loadFromDb();
667  $assignment->loadAdditionalSkillData();
668 
669  return $assignment;
670  }
671 
672  private function isTestQuestion($questionId)
673  {
674  return $this->questionList->isInList($questionId);
675  }
676 
678  {
679  $errors = array();
680 
681  foreach($input->getValues() as $expression)
682  {
683  $result = $this->validateSolutionCompareExpression($expression, $question);
684 
685  if( $result !== true )
686  {
687  $errors[] = "{$this->lng->txt('ass_lac_expression')} {$expression->getOrderIndex()}: {$result}";
688  }
689  }
690 
691  if( count($errors) )
692  {
693  $alert = $this->lng->txt('ass_lac_validation_error');
694  $alert .= '<br />'.implode('<br />', $errors);
695  $input->setAlert($alert);
696  return false;
697  }
698 
699  return true;
700  }
701 
703  {
704  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacConditionParser.php';
705  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacQuestionProvider.php';
706  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacCompositeValidator.php';
707 
708  try
709  {
710  $conditionParser = new ilAssLacConditionParser();
711  $conditionComposite = $conditionParser->parse($expression->getExpression());
712  $questionProvider = new ilAssLacQuestionProvider();
713  $questionProvider->setQuestion($question);
714  $conditionValidator = new ilAssLacCompositeValidator($questionProvider);
715 
716  $conditionValidator->validate($conditionComposite);
717  }
718  catch (ilAssLacException $e)
719  {
720  if( $e instanceof ilAssLacFormAlertProvider )
721  {
722  return $e->getFormAlert($this->lng);
723  }
724 
725  throw $e;
726  }
727 
728  return true;
729  }
730 
731  private function keepAssignmentParameters()
732  {
733  $this->ctrl->saveParameter($this, 'question_id');
734  $this->ctrl->saveParameter($this, 'skill_base_id');
735  $this->ctrl->saveParameter($this, 'skill_tref_id');
736  }
737 
738  private function orderQuestionData($questionData)
739  {
740  $orderedQuestionsData = array();
741 
742  if( $this->getQuestionOrderSequence() )
743  {
744  foreach($this->getQuestionOrderSequence() as $questionId)
745  {
746  $orderedQuestionsData[$questionId] = $questionData[$questionId];
747  }
748 
749  return $orderedQuestionsData;
750  }
751 
752  foreach($questionData as $questionId => $data)
753  {
754  $orderedQuestionsData[$questionId] = $data['title'];
755  }
756 
757  $orderedQuestionsData = $this->sortAlphabetically($orderedQuestionsData);
758 
759  foreach($orderedQuestionsData as $questionId => $questionTitle)
760  {
761  $orderedQuestionsData[$questionId] = $questionData[$questionId];
762  }
763 
764  return $orderedQuestionsData;
765  }
766 
768  {
770  {
772  }
773  }
774 
775  private function getSkillSelectorHeader($questionId)
776  {
777  $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
778 
779  return sprintf($this->lng->txt('qpl_qst_skl_selection_for_question_header'), $questionData['title']);
780  }
781 
782  private function sortAlphabetically($array)
783  {
784  $flags = SORT_REGULAR;
785 
786  if( defined('SORT_NATURAL') )
787  {
788  $flags = SORT_NATURAL;
789  }
790  elseif( defined('SORT_STRING') )
791  {
792  $flags = SORT_STRING;
793  }
794 
795  if( defined('SORT_FLAG_CASE') )
796  {
797  $flags = $flags | SORT_FLAG_CASE;
798  }
799 
800  asort($array, $flags);
801 
802  return $array;
803  }
804 
805  protected function doesObjectTypeMatch($objectId)
806  {
807  return ilObject::_lookupType($objectId) == 'qpl';
808  }
809 
816  private function buildLacLegendHTML(assQuestion $questionOBJ, ilAssQuestionSkillAssignment $assignment)
817  {
818  if( $questionOBJ instanceof iQuestionCondition )
819  {
820  require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/class.ilAssLacLegendGUI.php';
821  $legend = new ilAssLacLegendGUI($this->lng, $this->tpl);
822  $legend->setQuestionOBJ($questionOBJ);
823  $legend->setInitialVisibilityEnabled($assignment->hasEvalModeBySolution());
824  $lacLegendHTML = $this->ctrl->getHTML($legend);
825  return $lacLegendHTML;
826  }
827 
828  return '';
829  }
830 }
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)
$_POST['username']
Definition: cron.php:12
validateSolutionCompareExpression(ilAssQuestionSolutionComparisonExpression $expression, iQuestionCondition $question)
$result
This class represents a property form user interface.
$_GET["client_id"]
__construct(ilCtrl $ctrl, ilAccessHandler $access, ilTemplate $tpl, ilLanguage $lng, ilDB $db)
Abstract basic class which is to be extended by the concrete assessment question type classes...
$legend
static lookupParentObjId($questionId)
ilDB $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.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$data
$success
Definition: Utf8Test.php:87
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
buildQuestionSkillAssignment($questionId, $skillBaseId, $skillTrefId)
special template class to simplify handling of ITX/PEAR
& _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
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
Database Wrapper.
Definition: class.ilDB.php:28
Class ilParserQuestionProvider.
language handling
showSkillQuestionAssignmentPropertiesFormCmd(assQuestionGUI $questionGUI=null, ilAssQuestionSkillAssignment $assignment=null, ilPropertyFormGUI $form=null)
setOutputMode($a_mode=IL_PAGE_PRESENTATION)
Set Output Mode.
Confirmation screen class.
Class ilAccessHandler.