ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilQuestionEditGUI.php
Go to the documentation of this file.
1 <?php
16 {
17 
21  function __construct()
22  {
23  global $ilCtrl, $lng;
24 
25  if ($_GET["qpool_ref_id"])
26  {
27  $this->setPoolRefId($_GET["qpool_ref_id"]);
28  }
29  else if ($_GET["qpool_obj_id"])
30  {
31  $this->setPoolObjId($_GET["qpool_obj_id"]);
32  }
33  $this->setQuestionId($_GET["q_id"]);
34  $this->setQuestionType($_GET["q_type"]);
35  $lng->loadLanguageModule("assessment");
36 
37  $ilCtrl->saveParameter($this, array("qpool_ref_id", "qpool_obj_id", "q_id", "q_type"));
38 
39  $this->new_id_listeners = array();
40  $this->new_id_listener_cnt = 0;
41  }
42 
48  function setSelfAssessmentEditingMode($a_selfassessmenteditingmode)
49  {
50  $this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
51  }
52 
59  {
60  return $this->selfassessmenteditingmode;
61  }
62 
68  function setDefaultNrOfTries($a_defaultnroftries)
69  {
70  $this->defaultnroftries = $a_defaultnroftries;
71  }
72 
79  {
80  return $this->defaultnroftries;
81  }
82 
88  function setPageConfig($a_val)
89  {
90  $this->page_config = $a_val;
91  }
92 
98  function getPageConfig()
99  {
100  return $this->page_config;
101  }
102 
103 
108  function addNewIdListener(&$a_object, $a_method, $a_parameters = "")
109  {
110  $cnt = $this->new_id_listener_cnt;
111  $this->new_id_listeners[$cnt]["object"] =& $a_object;
112  $this->new_id_listeners[$cnt]["method"] = $a_method;
113  $this->new_id_listeners[$cnt]["parameters"] = $a_parameters;
114  $this->new_id_listener_cnt++;
115  }
116 
120  function executeCommand()
121  {
122  global $ilCtrl,$lng;
123 
124  $cmd = $ilCtrl->getCmd();
125  $next_class = $ilCtrl->getNextClass();
126 
127 //echo "-".$cmd."-".$next_class."-".$_GET["q_id"]."-";
128 
129  switch($next_class)
130  {
131  default:
132  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
134  $this->getQuestionId());
135  $q_gui->setSelfAssessmentEditingMode(
137  $q_gui->setDefaultNrOfTries(
138  $this->getDefaultNrOfTries());
139 
140  if (is_object($this->page_config))
141  {
142  $q_gui->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
143  }
144  $q_gui->object->setObjId((int) $this->getPoolObjId());
145 
146  for ($i=0; $i<$this->new_id_listener_cnt; $i++)
147  {
148  $object =& $this->new_id_listeners[$i]["object"];
149  $method = $this->new_id_listeners[$i]["method"];
150  $parameters = $this->new_id_listeners[$i]["parameters"];
151  $q_gui->addNewIdListener($object, $method,
152  $parameters);
153 //var_dump($object);
154 //var_dump($method);
155 //var_dump($parameters);
156  }
157 
158  //$q_gui->setQuestionTabs();
159  $count = $q_gui->object->isInUse();
160  if ($count > 0)
161  {
162  global $rbacsystem;
163  if ($rbacsystem->checkAccess("write", $this->pool_ref_id))
164  {
165  ilUtil::sendInfo(sprintf($lng->txt("qpl_question_is_in_use"), $count));
166  }
167  }
168  $ilCtrl->setCmdClass(get_class($q_gui));
169  $ret = $ilCtrl->forwardCommand($q_gui);
170  break;
171  }
172 
173  return $ret;
174  }
175 
181  function setQuestionId($a_questionid)
182  {
183  $this->questionid = $a_questionid;
184  $_GET["q_id"] = $this->questionid;
185  }
186 
192  function getQuestionId()
193  {
194  return $this->questionid;
195  }
196 
202  function setPoolRefId($a_poolrefid)
203  {
204 //echo "<br>Setting Pool Ref ID:".$a_poolrefid;
205  $this->poolrefid = $a_poolrefid;
206  $_GET["qpool_ref_id"] = $this->poolrefid;
208  }
209 
215  function getPoolRefId()
216  {
217  return $this->poolrefid;
218  }
219 
225  function setPoolObjId($a_poolobjid)
226  {
227 //echo "<br>Setting Pool Obj ID:".$a_poolobjid;
228  $this->poolobjid = $a_poolobjid;
229  $_GET["qpool_obj_id"] = $this->poolobjid;
230  }
231 
237  function getPoolObjId()
238  {
239  return $this->poolobjid;
240  }
241 
247  function setQuestionType($a_questiontype)
248  {
249  $this->questiontype = $a_questiontype;
250  $_GET["q_type"] = $this->questiontype;
251  }
252 
258  function getQuestionType()
259  {
260  return $this->questiontype;
261  }
262 }
263 ?>