ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAssLongmenuCorrectionsInputGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4
14{
15 public function checkInput()
16 {
17 return true;
18 }
19
20 public function insert($a_tpl)
21 {
22 $tpl = new ilTemplate('tst.longmenu_corrections_input.html', true, true, 'Modules/TestQuestionPool');
23
24 $tpl->setVariable('ANSWERS_MODAL', $this->buildAnswersModal()->getHTML());
25
26 $tpl->setVariable('TAG_INPUT', $this->buildTagInput()->render());
27
28 $tpl->setVariable('NUM_ANSWERS', $this->values['answers_all_count']);
29
30 $tpl->setVariable('TXT_ANSWERS', $this->lng->txt('answer_options'));
31 $tpl->setVariable('TXT_SHOW', $this->lng->txt('show'));
32 $tpl->setVariable('TXT_CORRECT_ANSWERS', $this->lng->txt('correct_answers'));
33
34 $tpl->setVariable('POSTVAR', $this->getPostVar());
35
36 $a_tpl->setCurrentBlock("prop_generic");
37 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
38 $a_tpl->parseCurrentBlock();
39 }
40
41 protected function buildAnswersModal()
42 {
43 $closeButton = ilJsLinkButton::getInstance();
44 $closeButton->setCaption('close');
45 $closeButton->setOnClick("$('#modal_{$this->getPostVar()}').modal('hide');");
46
47 $modal = ilModalGUI::getInstance();
48 $modal->setId('modal_' . $this->getPostVar());
49 $modal->setHeading($this->lng->txt('answer_options'));
50 $modal->addButton($closeButton);
51
52 $inp = new ilTextWizardInputGUI('', '');
53 $inp->setValues(current($this->values['answers_all']));
54 $inp->setDisabled(true);
55
56 $modal->setBody($inp->render());
57
58 return $modal;
59 }
60
61 protected function buildTagInput()
62 {
63 $tagInput = new ilTagInputGUI('', $this->getPostVar() . '_tags');
64 $tagInput->setTypeAhead(true);
65 $tagInput->setTypeAheadMinLength(1);
66
67 $tagInput->setOptions($this->values['answers_correct']);
68 $tagInput->setTypeAheadList($this->values['answers_all']);
69
70 return $tagInput;
71 }
72}
$tpl
Definition: ilias.php:10
An exception for terminatinating execution or to throw for unit testing.
This class represents a single choice wizard property in a property form.
getPostVar()
Get Post Variable.
static getInstance()
Get instance.
This class represents a tag list property in a property form.
special template class to simplify handling of ITX/PEAR
This class represents a text wizard property in a property form.