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