ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilAssOrderingQuestionAuthoringFormGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssQuestionAuthoringFormGUI.php';
12{
13 const COMMAND_BUTTON_PREFIX = 'assOrderingQuestionBtn_';
14
16
17 public function __construct()
18 {
24 ));
25
26 parent::__construct();
27 }
28
30 {
31 $this->availableCommandButtonIds = $availableCommandButtonIds;
32 }
33
34 protected function getAvailableCommandButtonIds()
35 {
37 }
38
40 {
41 switch ($questionOBJ->getOrderingType()) {
42 case OQ_TERMS:
43
44 $this->addCommandButton(
45 "changeToPictures",
46 $this->lng->txt("oq_btn_use_order_pictures"),
47 $this->buildCommandButtonId(OQ_PICTURES)
48 );
49 $this->addCommandButton(
50 "orderNestedTerms",
51 $this->lng->txt("oq_btn_nest_terms"),
52 $this->buildCommandButtonId(OQ_NESTED_TERMS)
53 );
54 break;
55
56 case OQ_PICTURES:
57
58 $this->addCommandButton(
59 "changeToText",
60 $this->lng->txt("oq_btn_use_order_terms"),
61 $this->buildCommandButtonId(OQ_TERMS)
62 );
63 $this->addCommandButton(
64 "orderNestedPictures",
65 $this->lng->txt("oq_btn_nest_pictures"),
66 $this->buildCommandButtonId(OQ_NESTED_PICTURES)
67 );
68 break;
69
70 case OQ_NESTED_TERMS:
71
72 $this->addCommandButton(
73 "changeToPictures",
74 $this->lng->txt("oq_btn_use_order_pictures"),
75 $this->buildCommandButtonId(OQ_PICTURES)
76 );
77 $this->addCommandButton(
78 "changeToText",
79 $this->lng->txt("oq_btn_define_terms"),
80 $this->buildCommandButtonId(OQ_TERMS)
81 );
82 break;
83
85
86 $this->addCommandButton(
87 "changeToText",
88 $this->lng->txt("oq_btn_use_order_terms"),
89 'assOrderingQuestionBtn_' . OQ_TERMS
90 );
91 $this->addCommandButton(
92 "changeToPictures",
93 $this->lng->txt("oq_btn_define_pictures"),
94 'assOrderingQuestionBtn_' . OQ_PICTURES
95 );
96 break;
97 }
98 }
99
104 {
105 return $this->getItemByPostVar(
107 );
108 }
109
110 public function prepareValuesReprintable(assOrderingQuestion $questionOBJ)
111 {
112 $this->getOrderingElementInputField()->prepareReprintable($questionOBJ);
113 }
114
116 {
117 $this->renewOrderingElementInput($questionOBJ);
118 $this->renewOrderingCommandButtons($questionOBJ);
119 }
120
125 protected function renewOrderingElementInput(assOrderingQuestion $questionOBJ)
126 {
127 $replacingInput = $questionOBJ->buildOrderingElementInputGui();
128 $questionOBJ->initOrderingElementAuthoringProperties($replacingInput);
129 $dodgingInput = $this->getItemByPostVar($replacingInput->getPostVar());
130 $replacingInput->setElementList($dodgingInput->getElementList($questionOBJ->getId()));
131 $this->replaceFormItemByPostVar($replacingInput);
132 }
133
134 protected function buildCommandButtonId($orderingType)
135 {
136 return self::COMMAND_BUTTON_PREFIX . $orderingType;
137 }
138
139 protected function renewOrderingCommandButtons(assOrderingQuestion $questionOBJ)
140 {
141 $this->clearCommandButtons();
144 }
145}
An exception for terminatinating execution or to throw for unit testing.
Class for ordering questions.
initOrderingElementAuthoringProperties(ilFormPropertyGUI $formField)
getOrderingType()
Returns the ordering question type.
getId()
Gets the id of the assQuestion object.
__construct()
ilAssQuestionAuthoringFormGUI constructor.
addSpecificOrderingQuestionCommandButtons(assOrderingQuestion $questionOBJ)
replaceFormItemByPostVar(ilFormPropertyGUI $replacingItem)
addGenericAssessmentQuestionCommandButtons(assQuestion $questionOBJ)
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
clearCommandButtons()
Remove all command buttons.
getItemByPostVar($a_post_var)
Get Item by POST variable.
const OQ_NESTED_PICTURES
const OQ_TERMS
const OQ_NESTED_TERMS
const OQ_PICTURES
Ordering question constants.