ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.assLongMenuGUI.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 require_once './Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5 require_once './Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6 include_once './Modules/Test/classes/inc.AssessmentConstants.php';
7 
16 {
17  private $rbacsystem, $ilTabs;
18  public $lng;
19 
20  function __construct($id = -1)
21  {
22  parent::__construct();
23  include_once './Modules/TestQuestionPool/classes/class.assLongMenu.php';
24  $this->object = new assLongMenu();
25  if ($id >= 0)
26  {
27  $this->object->loadFromDb($id);
28  }
29  global $rbacsystem, $ilTabs, $lng;
30  $this->rbacsystem = $rbacsystem;
31  $this->ilTabs = $ilTabs;
32  $this->lng = $lng;
33  }
34 
40  protected function getUserSolution($active_id, $pass)
41  {
42  $user_solution = array();
43  if($active_id)
44  {
45  // hey: prevPassSolutions - obsolete due to central check
46  #$solutions = NULL;
47  #include_once "./Modules/Test/classes/class.ilObjTest.php";
48  #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
49  #{
50  # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
51  #}
52  $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
53  // hey.
54  foreach($solutions as $idx => $solution_value)
55  {
56  $user_solution[$solution_value["value1"]] = $solution_value["value2"];
57  }
58  return $user_solution;
59  }
60  return $user_solution;
61  }
62 
63  function getCommand($cmd)
64  {
65  return $cmd;
66  }
67 
71  protected function writePostData($always = false)
72  {
73  $form = $this->buildEditForm();
74  $form->setValuesByPost();
76  $this->writeQuestionSpecificPostData($form);
77  $custom_check = $this->object->checkQuestionCustomPart();
78  if( !$form->checkInput() || !$custom_check)
79  {
80  if(!$custom_check)
81  {
82  ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
83  }
84  $this->editQuestion($form);
85  return 1;
86  }
87  $this->saveTaxonomyAssignments();
88  return 0;
89  }
90 
92  {
93  $this->object->setLongMenuTextValue(ilUtil::stripSlashesRecursive($_POST['longmenu_text']));
94  $this->object->setAnswers(json_decode(ilUtil::stripSlashesRecursive($_POST['hidden_text_files'])));
95  $this->object->setCorrectAnswers(json_decode(ilUtil::stripSlashesRecursive($_POST['hidden_correct_answers'])));
96  $this->object->setAnswerType(ilUtil::stripSlashesRecursive($_POST['long_menu_type']));
97  $this->object->setQuestion($_POST['question']);
98  $this->object->setLongMenuTextValue($_POST["longmenu_text"]);
99  $this->object->setMinAutoComplete((int)$_POST["min_auto_complete"]);
100  $this->saveTaxonomyAssignments();
101  }
102 
103  protected function editQuestion(ilPropertyFormGUI $form = null)
104  {
105  if( $form === null )
106  {
107  $form = $this->buildEditForm();
108  }
109 
110  $this->getQuestionTemplate();
111  $this->tpl->addCss('Modules/Test/templates/default/ta.css');
112 
113  $this->tpl->setVariable("QUESTION_DATA", $this->ctrl->getHTML($form));
114  }
118  protected function buildEditForm()
119  {
120  $form = $this->buildBasicEditFormObject();
121 
122  $this->addQuestionFormCommandButtons($form);
123 
124  $this->addBasicQuestionFormProperties($form);
125 
126  $this->populateQuestionSpecificFormPart($form);
127  $this->populateAnswerSpecificFormPart($form);
128 
129  $this->populateTaxonomyFormSection($form);
130 
131  return $form;
132  }
138  {
139  $long_menu_text = new ilTextAreaInputGUI($this->lng->txt("longmenu_text"), 'longmenu_text');
140  $long_menu_text->setRequired(true);
141  //$long_menu_text->setInfo($this->lng->txt("longmenu_hint"));
142  $long_menu_text->setRows( 10 );
143  $long_menu_text->setCols( 80 );
144  if (!$this->object->getSelfAssessmentEditingMode())
145  {
146  if( $this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT )
147  {
148  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
149  $long_menu_text->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
150  $long_menu_text->addPlugin("latex");
151  $long_menu_text->addButton("latex");
152  $long_menu_text->addButton("pastelatex");
153  $long_menu_text->setRTESupport($this->object->getId(), "qpl", "assessment");
154  $long_menu_text->setUseRte(TRUE);
155  }
156  }
157  else
158  {
159  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
161  $long_menu_text->setUseTagsForRteOnly(false);
162  }
163 
164  $long_menu_text->setValue($this->object->prepareTextareaOutput($this->object->getLongMenuTextValue()));
165  $form->addItem($long_menu_text);
166 
167  $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_gap_button_code.html", TRUE, TRUE, "Modules/TestQuestionPool");
168  $tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap'));
169  $tpl->parseCurrentBlock();
170  $button = new ilCustomInputGUI('&nbsp;','');
171  $button->setHtml($tpl->get());
172  $form->addItem($button);
173 
174  require_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
175  $modal = ilModalGUI::getInstance();
176  $modal->setHeading('');
177  $modal->setId("ilGapModal");
178  //$modal->setBackdrop(ilModalGUI::BACKDROP_OFF);
179  $modal->setBody('');
180 
181  $min_auto_complete = new ilNumberInputGUI($this->lng->txt("min_auto_complete"), 'min_auto_complete');
182 
183  $auto_complete = $this->object->getMinAutoComplete();
184  if($auto_complete == 0)
185  {
186  $auto_complete = assLongMenu::MIN_LENGTH_AUTOCOMPLETE;
187  }
188  $min_auto_complete->setValue($auto_complete);
189  $min_auto_complete->setMinValue(1);
190  $min_auto_complete->setMaxValue(99);
191  $min_auto_complete->setSize(5);
192  $form->addItem($min_auto_complete);
193 
194  $hidden_text = new ilHiddenInputGUI('hidden_text_files');
195  $form->addItem($hidden_text);
196 
197  $hidden_correct = new ilHiddenInputGUI('hidden_correct_answers');
198  $form->addItem($hidden_correct);
199 
200  $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_gap.html", TRUE, TRUE, "Modules/TestQuestionPool");
201  if(is_array($_POST) && array_key_exists('hidden_text_files', $_POST))
202  {
203  $tpl->setVariable('CORRECT_ANSWERS', $_POST['hidden_correct_answers']);
204  $tpl->setVariable('ALL_ANSWERS', $_POST['hidden_text_files']);
205  }
206  else
207  {
208  $tpl->setVariable('CORRECT_ANSWERS', $this->object->getJsonStructure());
209  $tpl->setVariable('ALL_ANSWERS', $this->object->getAnswersObject());
210  }
211  $tpl->setVariable('MAX_INPUT_FIELDS', assLongMenu::MAX_INPUT_FIELDS);
212  $tpl->setVariable('GAP_PLACEHOLDER', assLongMenu::GAP_PLACEHOLDER);
213  $tpl->setVariable('SELECT_BOX', $this->lng->txt('insert_gap'));
214  $tpl->setVariable("SELECT", $this->lng->txt('answers_select'));
215  $tpl->setVariable("TEXT", $this->lng->txt('answers_text_box'));
216  $tpl->setVariable("POINTS", $this->lng->txt('points'));
217  $tpl->setVariable("INFO_TEXT_UPLOAD", $this->lng->txt('info_text_upload'));
218  $tpl->setVariable("TXT_BROWSE", $this->lng->txt('select_file'));
219  $tpl->setVariable("MANUAL_EDITING", $this->lng->txt('manual_editing'));
220  $tpl->setVariable("CORRECT_ANSWER_TXT", $this->lng->txt('correct_answers'));
221  $tpl->setVariable("ANSWER_OPTIONS_TXT", $this->lng->txt('answer_options'));
222  $tpl->setVariable("ANSWERS_TXT", $this->lng->txt('answers'));
223  $tpl->setVariable("TYPE_TXT", $this->lng->txt('type'));
224  $tpl->setVariable("EDIT_TXT", $this->lng->txt('edit'));
225  $tpl->setVariable("ADD_ANSWER_TXT", $this->lng->txt('add_answers'));
226  $tpl->setVariable('POINTS_ERROR', $this->lng->txt('enter_enough_positive_points'));
227  $tpl->setVariable('AUTOCOMPLETE_ERROR', $this->lng->txt('autocomplete_error'));
228  $tpl->setVariable('MISSING_VALUE', $this->lng->txt('msg_input_is_required'));
229  $tpl->setVariable('SAVE', $this->lng->txt('save'));
230  $tpl->setVariable('CANCEL', $this->lng->txt('cancel'));
231  require_once("Services/Form/classes/class.ilTagInputGUI.php");
232  $tag_input = new ilTagInputGUI();
233  $tag_input->setTypeAhead(true);
234  $tag_input->setPostVar('taggable');
235  $tag_input->setJsSelfInit(false);
236  $tag_input->setTypeAheadMinLength(1);
237  $tpl->setVariable("TAGGING_PROTOTYPE", $tag_input->render(''));
238 
239  $tpl->setVariable("MY_MODAL", $modal->getHTML());
240 
241  $tpl->parseCurrentBlock();
242  $button = new ilCustomInputGUI('&nbsp;','');
243  $button->setHtml($tpl->get());
244  $form->addItem($button);
245  return $form;
246  }
247 
253  {
254  return $form;
255  }
256 
271  $active_id,
272  $pass = NULL,
273  $graphicalOutput = FALSE,
274  $result_output = FALSE,
275  $show_question_only = TRUE,
276  $show_feedback = FALSE,
277  $show_correct_solution = FALSE,
278  $show_manual_scoring = FALSE,
279  $show_question_text = TRUE
280  )
281  {
282  include_once "./Services/UICore/classes/class.ilTemplate.php";
283  $template = new ilTemplate("tpl.il_as_qpl_lome_question_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
284 
285  if($show_question_text)
286  {
287  $question_text = $this->object->getQuestion();
288  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($question_text, TRUE));
289  }
290  if (($active_id > 0) && (!$show_correct_solution))
291  {
292  $correct_solution = $this->getUserSolution($active_id, $pass);
293  }
294  else
295  {
296  $correct_solution = $this->object->getCorrectAnswersForQuestionSolution($this->object->getId());
297  }
298  $template->setVariable('LONGMENU_TEXT_SOLUTION', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($correct_solution, true, $graphicalOutput));
299  $solution_template = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
300  $question_output = $template->get();
301  $feedback = '';
302  if($show_feedback)
303  {
304  if( !$this->isTestPresentationContext() )
305  {
306  $fb = $this->getGenericFeedbackOutput($active_id, $pass);
307  $feedback .= strlen($fb) ? $fb : '';
308  }
309 
310  $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
311  $feedback .= strlen($fb) ? $fb : '';
312  }
313  if (strlen($feedback))
314  {
315  $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
317  );
318 
319  $solution_template->setVariable("ILC_FB_CSS_CLASS", $cssClass);
320  $solution_template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
321  }
322 
323  $solution_template->setVariable("SOLUTION_OUTPUT", $question_output);
324 
325  $solution_output = $solution_template->get();
326 
327  if (!$show_question_only)
328  {
329  $solution_output = $this->getILIASPage($solution_output);
330  }
331 
332  return $solution_output;
333  }
334 
335  function getPreview($show_question_only = FALSE, $showInlineFeedback = false)
336  {
337  $user_solution = is_object($this->getPreviewSession()) ? (array)$this->getPreviewSession()->getParticipantsSolution() : array();
338  $user_solution = array_values($user_solution);
339 
340  include_once "./Services/UICore/classes/class.ilTemplate.php";
341  $template = new ilTemplate("tpl.il_as_qpl_longmenu_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
342 
343  $question_text = $this->object->getQuestion();
344  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($question_text, TRUE));
345  $template->setVariable("ANSWER_OPTIONS_JSON", json_encode($this->object->getAvailableAnswerOptions()));
346  $template->setVariable('AUTOCOMPLETE_LENGTH',$this->object->getMinAutoComplete());
347  $template->setVariable('LONGMENU_TEXT', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution));
348 
349  $question_output = $template->get();
350  if (!$show_question_only)
351  {
352  $question_output = $this->getILIASPage($question_output);
353  }
354  return $question_output;
355  }
356 
357 
358 
359  function getTestOutput($active_id,
360  // hey: prevPassSolutions - will be always available from now on
361  $pass,
362  // hey.
363  $is_postponed = FALSE,
364  $use_post_solutions = FALSE,
365  $show_feedback = FALSE
366  )
367  {
368  $user_solution = array();
369  if ($active_id)
370  {
371  $solutions = NULL;
372  include_once "./Modules/Test/classes/class.ilObjTest.php";
373  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
374  {
375  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
376  }
377  $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
378  foreach ($solutions as $idx => $solution_value)
379  {
380  $user_solution[$solution_value["value1"]] = $solution_value["value2"];
381  }
382  }
383 
384  // generate the question output
385  include_once "./Services/UICore/classes/class.ilTemplate.php";
386  $template = new ilTemplate("tpl.il_as_qpl_longmenu_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
387 
388  $question_text = $this->object->getQuestion();
389  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($question_text, TRUE));
390  $template->setVariable("ANSWER_OPTIONS_JSON", json_encode($this->object->getAvailableAnswerOptions()));
391  $template->setVariable('LONGMENU_TEXT', $this->getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution));
392  $template->setVariable('AUTOCOMPLETE_LENGTH',$this->object->getMinAutoComplete());
393  $question_output = $template->get();
394  $page_output = $this->outQuestionPage("", $is_postponed, $active_id, $question_output);
395  return $page_output;
396  }
397 
404  function setQuestionTabs()
405  {
406  $this->ilTabs->clearTargets();
407 
408  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
409  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
410  $q_type = $this->object->getQuestionType();
411 
412  if (strlen($q_type))
413  {
414  $classname = $q_type . "GUI";
415  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
416  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
417  }
418 
419  if ($_GET["q_id"])
420  {
421  if ($this->rbacsystem->checkAccess('write', $_GET["ref_id"]))
422  {
423  // edit page
424  $this->ilTabs->addTarget("edit_page",
425  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
426  array("edit", "insert", "exec_pg"),
427  "", "", $force_active);
428  }
429 
430  $this->addTab_QuestionPreview($this->ilTabs);
431  }
432 
433  $force_active = false;
434  if ($this->rbacsystem->checkAccess('write', $_GET["ref_id"]))
435  {
436  $url = "";
437  if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
438  $commands = $_POST["cmd"];
439  if (is_array($commands))
440  {
441  foreach ($commands as $key => $value)
442  {
443  if (preg_match("/^delete_.*/", $key, $matches))
444  {
445  $force_active = true;
446  }
447  }
448  }
449  // edit question properties
450  $this->ilTabs->addTarget("edit_question",
451  $url,
452  array("editQuestion", "save", "saveEdit", "addkvp", "removekvp", "originalSyncForm"),
453  $classname, "", $force_active);
454  }
455 
456  // add tab for question feedback within common class assQuestionGUI
457  $this->addTab_QuestionFeedback($this->ilTabs);
458 
459  // add tab for question hint within common class assQuestionGUI
460  $this->addTab_QuestionHints($this->ilTabs);
461 
462  // add tab for question's suggested solution within common class assQuestionGUI
463  $this->addTab_SuggestedSolution($this->ilTabs, $classname);
464 
465  // Assessment of questions sub menu entry
466  if ($_GET["q_id"])
467  {
468  $this->ilTabs->addTarget("statistics",
469  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
470  array("assessment"),
471  $classname, "");
472  }
473 
474  $this->addBackTab($this->ilTabs);
475  }
476 
477  function getSpecificFeedbackOutput($active_id, $pass)
478  {
479  if( !$this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), 0) )
480  {
481  return '';
482  }
483 
484  $feedback = '<table class="test_specific_feedback"><tbody>';
485  $gaps = $this->object->getCorrectAnswers();
486  foreach ($gaps as $index => $answer)
487  {
488  $caption = assLongMenu::GAP_PLACEHOLDER . ' ';
489  $caption .= $index + 1 .': ';
490 
491  $feedback .= '<tr><td>';
492 
493  $feedback .= $caption .'</td><td>';
494  $feedback .= $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
495  $this->object->getId(), $index
496  ) . '</td> </tr>';
497  }
498  $feedback .= '</tbody></table>';
499  return $this->object->prepareTextareaOutput($feedback, TRUE);
500  }
501 
502 
513  {
514  return array();
515  }
516 
525  public function getAggregatedAnswersView($relevant_answers)
526  {
527  $overview = array();
528  $aggregation = array();
529  foreach ($relevant_answers as $answer)
530  {
531  $overview[$answer['active_fi']][$answer['pass']][$answer['value1']] = $answer['value2'];
532  }
533 
534  foreach($overview as $active)
535  {
536  foreach ($active as $answer)
537  {
538  foreach ($answer as $option => $value)
539  {
540  $aggregation[$option][$value] = $aggregation[$option][$value] + 1;
541  }
542  }
543  }
544  $tpl = new ilTemplate('tpl.il_as_aggregated_long_menu_answers_table.html', true, true, "Modules/TestQuestionPool");
545  $json = json_decode($this->object->getJsonStructure());
546  foreach ($json as $key => $value)
547  {
548  $tpl->setVariable('TITLE','Longmenu '. ($key+1));
549  if(array_key_exists($key, $aggregation))
550  {
551  $aggregate = $aggregation[$key];
552  foreach($aggregate as $answer => $counts)
553  {
554  $tpl->setVariable('OPTION',$answer);
555  $tpl->setVariable('COUNT',$counts);
556  $tpl->parseCurrentBlock();
557  }
558  }
559  }
560 
561  return $tpl->get();
562  }
563 
564  public function getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution = array(), $solution = false, $graphical = false)
565  {
566  $return_value = '';
567  $text_array = preg_split("/\\[".assLongMenu::GAP_PLACEHOLDER." (\\d+)\\]/", $this->object->getLongMenuTextValue());
568  $correct_answers = $this->object->getCorrectAnswers();
569  $answers = $this->object->getAnswers();
570  foreach($text_array as $key => $value)
571  {
572  $answer_is_correct = false;
573  $user_value = '';
574  $return_value .= $value;
575  if($key < sizeof($text_array) - 1 )
576  {
577  if($correct_answers[$key][2] == assLongMenu::ANSWER_TYPE_TEXT_VAL)
578  {
579  if(array_key_exists($key,$user_solution))
580  {
581  $user_value = $user_solution[$key];
582  if(in_array($user_value, $correct_answers[$key][0]))
583  {
584  $answer_is_correct = true;
585  }
586  }
587 
588  $return_value .= $this->getTextGapTemplate($key, $user_value, $solution, $answer_is_correct, $graphical);
589  }
590  else if($correct_answers[$key][2] == assLongMenu::ANSWER_TYPE_SELECT_VAL)
591  {
592  if(array_key_exists($key,$user_solution))
593  {
594  $user_value = $user_solution[$key];
595  if(in_array($user_value, $correct_answers[$key][0]))
596  {
597  $answer_is_correct = true;
598  }
599  }
600  $return_value .= $this->getSelectGapTemplate($key, $answers[$key], $user_value, $solution, $answer_is_correct, $graphical);
601  }
602  }
603  }
604  return $return_value;
605  }
606 
607  private function getTextGapTemplate($key, $value, $solution, $ok = false, $graphical = false)
608  {
609  $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_text_gap.html", TRUE, TRUE, "Modules/TestQuestionPool");
610  if($solution)
611  {
612  $tpl->setVariable('DISABLED', 'disabled');
613  $tpl->setVariable('JS_IGNORE', '_ignore');
614  if($graphical)
615  {
616  if($ok)
617  {
618  $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
619  $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
620  }
621  else
622  {
623  $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_not_ok.svg"));
624  $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_wrong"));
625  }
626  }
627  }
628  $tpl->setVariable('VALUE', $value);
629  $tpl->setVariable('KEY', $key);
630 
631  return $tpl->get();
632  }
633 
634  private function getSelectGapTemplate($key, $answers, $user_value, $solution, $ok = false, $graphical = false)
635  {
636  $tpl = new ilTemplate("tpl.il_as_qpl_long_menu_select_gap.html", TRUE, TRUE, "Modules/TestQuestionPool");
637  $tpl->setVariable('KEY', $key);
638  if($solution)
639  {
640  $tpl->setVariable('DISABLED', 'disabled');
641  $tpl->setVariable('JS_IGNORE', '_ignore');
642  $tpl->setCurrentBlock('best_solution');
643  if($user_value == -1)
644  {
645  $tpl->setVariable("SOLUTION", $this->lng->txt("please_select"));
646  }
647  else
648  {
649  $tpl->setVariable('SOLUTION', $user_value);
650  }
651  if($graphical)
652  {
653  if($ok)
654  {
655  $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
656  $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
657  }
658  else
659  {
660  $tpl->setVariable("ICON_OK", ilUtil::getImagePath("icon_not_ok.svg"));
661  $tpl->setVariable("TEXT_OK", $this->lng->txt("answer_is_wrong"));
662  }
663  }
664  $tpl->parseCurrentBlock();
665  }
666  else
667  {
668  $tpl->setVariable("PLEASE_SELECT", $this->lng->txt("please_select"));
669  foreach($answers as $value)
670  {
671  $tpl->setCurrentBlock('select_option');
672  $tpl->setVariable('VALUE', $value);
673  if($value == $user_value)
674  {
675  $tpl->setVariable('SELECTED', 'selected');
676  }
677  $tpl->parseCurrentBlock();
678  }
679  }
680  return $tpl->get();
681  }
682 }
static getSelfAssessmentTags()
Get tags allowed in question tags in self assessment mode.
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
This class represents a tag list property in a property form.
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
getSelectGapTemplate($key, $answers, $user_value, $solution, $ok=false, $graphical=false)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
This class represents a property form user interface.
getUserSolution($active_id, $pass)
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)
Get the question solution output.
$_GET["client_id"]
getTestOutput($active_id, $pass, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
$cmd
Definition: sahs_server.php:35
getLongMenuTextWithInputFieldsInsteadOfGaps($user_solution=array(), $solution=false, $graphical=false)
addItem($a_item)
Add Item (Property, SectionHeader).
$url
Definition: shib_logout.php:72
writePostData($always=false)
{}
getQuestionTemplate()
get question template
populateTaxonomyFormSection(ilPropertyFormGUI $form)
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
editQuestion(ilPropertyFormGUI $form=null)
const MIN_LENGTH_AUTOCOMPLETE
This class represents a hidden form property in a property form.
const ANSWER_TYPE_TEXT_VAL
getILIASPage($html="")
Returns the ILIAS Page around a question.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a number property in a property form.
special template class to simplify handling of ITX/PEAR
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
setQuestionTabs()
Sets the ILIAS tabs for this question type.
Basic GUI class for assessment questions.
Create styles array
The data for the language used.
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getSpecificFeedbackOutput($active_id, $pass)
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT
constant for additional content editing mode "default"
static getInstance()
Get instance.
This class represents a custom property in a property form.
getPreview($show_question_only=FALSE, $showInlineFeedback=false)
getTextGapTemplate($key, $value, $solution, $ok=false, $graphical=false)
Create new PHPExcel object
obj_idprivate
This class represents a text area property in a property form.
addBackTab(ilTabsGUI $ilTabs)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
Interface ilGuiQuestionScoringAdjustable.
static _getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
const ANSWER_TYPE_SELECT_VAL
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
$_POST["username"]
setRequired($a_required)
Set Required.
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.