ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
43 case OQ_TERMS:
44
45 $this->addCommandButton(
46 "changeToPictures", $this->lng->txt("oq_btn_use_order_pictures"), $this->buildCommandButtonId(OQ_PICTURES)
47 );
48 $this->addCommandButton(
49 "orderNestedTerms", $this->lng->txt("oq_btn_nest_terms"), $this->buildCommandButtonId(OQ_NESTED_TERMS)
50 );
51 break;
52
53 case OQ_PICTURES:
54
55 $this->addCommandButton(
56 "changeToText", $this->lng->txt("oq_btn_use_order_terms"), $this->buildCommandButtonId(OQ_TERMS)
57 );
58 $this->addCommandButton(
59 "orderNestedPictures", $this->lng->txt("oq_btn_nest_pictures"), $this->buildCommandButtonId(OQ_NESTED_PICTURES)
60 );
61 break;
62
63 case OQ_NESTED_TERMS:
64
65 $this->addCommandButton(
66 "changeToPictures", $this->lng->txt("oq_btn_use_order_pictures"), $this->buildCommandButtonId(OQ_PICTURES)
67 );
68 $this->addCommandButton(
69 "changeToText", $this->lng->txt("oq_btn_define_terms"), $this->buildCommandButtonId(OQ_TERMS)
70 );
71 break;
72
74
75 $this->addCommandButton(
76 "changeToText", $this->lng->txt("oq_btn_use_order_terms"), 'assOrderingQuestionBtn_'.OQ_TERMS
77 );
78 $this->addCommandButton(
79 "changeToPictures", $this->lng->txt("oq_btn_define_pictures"), 'assOrderingQuestionBtn_'.OQ_PICTURES
80 );
81 break;
82 }
83 }
84
89 {
90 return $this->getItemByPostVar(
92 );
93 }
94
95 public function prepareValuesReprintable(assOrderingQuestion $questionOBJ)
96 {
97 $this->getOrderingElementInputField()->prepareReprintable($questionOBJ);
98 }
99
101 {
102 $this->renewOrderingElementInput($questionOBJ);
103 $this->renewOrderingCommandButtons($questionOBJ);
104 }
105
110 protected function renewOrderingElementInput(assOrderingQuestion $questionOBJ)
111 {
112 $replacingInput = $questionOBJ->buildOrderingElementInputGui();
113 $questionOBJ->initOrderingElementAuthoringProperties($replacingInput);
114 $dodgingInput = $this->getItemByPostVar($replacingInput->getPostVar());
115 $replacingInput->setElementList($dodgingInput->getElementList($questionOBJ->getId()));
116 $this->replaceFormItemByPostVar($replacingInput);
117 }
118
119 protected function buildCommandButtonId($orderingType)
120 {
121 return self::COMMAND_BUTTON_PREFIX.$orderingType;
122 }
123
124 protected function renewOrderingCommandButtons(assOrderingQuestion $questionOBJ)
125 {
126 $this->clearCommandButtons();
129 }
130}
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.