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 
4 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssQuestionAuthoringFormGUI.php';
12 {
13  const COMMAND_BUTTON_PREFIX = 'assOrderingQuestionBtn_';
14 
15  protected $availableCommandButtonIds = null;
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 
73  case OQ_NESTED_PICTURES:
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 
88  public function getOrderingElementInputField()
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();
127  $this->addSpecificOrderingQuestionCommandButtons($questionOBJ);
128  $this->addGenericAssessmentQuestionCommandButtons($questionOBJ);
129  }
130 }
initOrderingElementAuthoringProperties(ilFormPropertyGUI $formField)
getId()
Gets the id of the assQuestion object.
addGenericAssessmentQuestionCommandButtons(assQuestion $questionOBJ)
getItemByPostVar($a_post_var)
Get Item by POST variable.
getOrderingType()
Returns the ordering question type.
const OQ_NESTED_TERMS
clearCommandButtons()
Remove all command buttons.
replaceFormItemByPostVar(ilFormPropertyGUI $replacingItem)
addSpecificOrderingQuestionCommandButtons(assOrderingQuestion $questionOBJ)
const OQ_PICTURES
Ordering question constants.
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
Create styles array
The data for the language used.
const OQ_TERMS
const OQ_NESTED_PICTURES
Class for ordering questions.