ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilQuestionEditGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
18 {
19 
23  function __construct()
24  {
25  global $ilCtrl, $lng;
26 
27  if ($_GET["qpool_ref_id"])
28  {
29  $this->setPoolRefId($_GET["qpool_ref_id"]);
30  }
31  else if ($_GET["qpool_obj_id"])
32  {
33  $this->setPoolObjId($_GET["qpool_obj_id"]);
34  }
35  $this->setQuestionId($_GET["q_id"]);
36  $this->setQuestionType($_GET["q_type"]);
37  $lng->loadLanguageModule("assessment");
38 
39  $ilCtrl->saveParameter($this, array("qpool_ref_id", "qpool_obj_id", "q_id", "q_type"));
40 
41  $this->new_id_listeners = array();
42  $this->new_id_listener_cnt = 0;
43  }
44 
50  function setSelfAssessmentEditingMode($a_selfassessmenteditingmode)
51  {
52  $this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
53  }
54 
61  {
62  return $this->selfassessmenteditingmode;
63  }
64 
70  function setDefaultNrOfTries($a_defaultnroftries)
71  {
72  $this->defaultnroftries = $a_defaultnroftries;
73  }
74 
81  {
82  return $this->defaultnroftries;
83  }
84 
90  function setPageConfig($a_val)
91  {
92  $this->page_config = $a_val;
93  }
94 
100  function getPageConfig()
101  {
102  return $this->page_config;
103  }
104 
105 
110  function addNewIdListener(&$a_object, $a_method, $a_parameters = "")
111  {
112  $cnt = $this->new_id_listener_cnt;
113  $this->new_id_listeners[$cnt]["object"] =& $a_object;
114  $this->new_id_listeners[$cnt]["method"] = $a_method;
115  $this->new_id_listeners[$cnt]["parameters"] = $a_parameters;
116  $this->new_id_listener_cnt++;
117  }
118 
122  function executeCommand()
123  {
124  global $ilCtrl,$lng;
125 
126  $cmd = $ilCtrl->getCmd();
127  $next_class = $ilCtrl->getNextClass();
128 
129 //echo "-".$cmd."-".$next_class."-".$_GET["q_id"]."-";
130 
131  switch($next_class)
132  {
133  default:
134  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
136  $this->getQuestionId());
137  $q_gui->object->setSelfAssessmentEditingMode(
139  $q_gui->object->setDefaultNrOfTries(
140  $this->getDefaultNrOfTries());
141 
142  if (is_object($this->page_config))
143  {
144  $q_gui->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
145  }
146  $q_gui->object->setObjId((int) $this->getPoolObjId());
147 
148  for ($i=0; $i<$this->new_id_listener_cnt; $i++)
149  {
150  $object =& $this->new_id_listeners[$i]["object"];
151  $method = $this->new_id_listeners[$i]["method"];
152  $parameters = $this->new_id_listeners[$i]["parameters"];
153  $q_gui->addNewIdListener($object, $method,
154  $parameters);
155 //var_dump($object);
156 //var_dump($method);
157 //var_dump($parameters);
158  }
159 
160  //$q_gui->setQuestionTabs();
161  $count = $q_gui->object->isInUse();
162  if ($count > 0)
163  {
164  global $rbacsystem;
165  if ($rbacsystem->checkAccess("write", $this->pool_ref_id))
166  {
167  ilUtil::sendInfo(sprintf($lng->txt("qpl_question_is_in_use"), $count));
168  }
169  }
170  $ilCtrl->setCmdClass(get_class($q_gui));
171  $ret = $ilCtrl->forwardCommand($q_gui);
172  break;
173  }
174 
175  return $ret;
176  }
177 
183  function setQuestionId($a_questionid)
184  {
185  $this->questionid = $a_questionid;
186  $_GET["q_id"] = $this->questionid;
187  }
188 
194  function getQuestionId()
195  {
196  return $this->questionid;
197  }
198 
204  function setPoolRefId($a_poolrefid)
205  {
206 //echo "<br>Setting Pool Ref ID:".$a_poolrefid;
207  $this->poolrefid = $a_poolrefid;
208  $_GET["qpool_ref_id"] = $this->poolrefid;
210  }
211 
217  function getPoolRefId()
218  {
219  return $this->poolrefid;
220  }
221 
227  function setPoolObjId($a_poolobjid)
228  {
229 //echo "<br>Setting Pool Obj ID:".$a_poolobjid;
230  $this->poolobjid = $a_poolobjid;
231  $_GET["qpool_obj_id"] = $this->poolobjid;
232  }
233 
239  function getPoolObjId()
240  {
241  return $this->poolobjid;
242  }
243 
249  function setQuestionType($a_questiontype)
250  {
251  $this->questiontype = $a_questiontype;
252  $_GET["q_type"] = $this->questiontype;
253  }
254 
260  function getQuestionType()
261  {
262  return $this->questiontype;
263  }
264 }
265 ?>