ILIAS  Release_4_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
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 
89  function addNewIdListener(&$a_object, $a_method, $a_parameters = "")
90  {
91  $cnt = $this->new_id_listener_cnt;
92  $this->new_id_listeners[$cnt]["object"] =& $a_object;
93  $this->new_id_listeners[$cnt]["method"] = $a_method;
94  $this->new_id_listeners[$cnt]["parameters"] = $a_parameters;
95  $this->new_id_listener_cnt++;
96  }
97 
101  function executeCommand()
102  {
103  global $ilCtrl,$lng;
104 
105  $cmd = $ilCtrl->getCmd();
106  $next_class = $ilCtrl->getNextClass();
107 
108 //echo "-".$cmd."-".$next_class."-".$_GET["q_id"]."-";
109 
110  switch($next_class)
111  {
112  default:
113  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
115  $this->getQuestionId());
116  $q_gui->setSelfAssessmentEditingMode(
118  $q_gui->setDefaultNrOfTries(
119  $this->getDefaultNrOfTries());
120  $q_gui->object->setObjId((int) $this->getPoolObjId());
121 
122  for ($i=0; $i<$this->new_id_listener_cnt; $i++)
123  {
124  $object =& $this->new_id_listeners[$i]["object"];
125  $method = $this->new_id_listeners[$i]["method"];
126  $parameters = $this->new_id_listeners[$i]["parameters"];
127  $q_gui->addNewIdListener($object, $method,
128  $parameters);
129 //var_dump($object);
130 //var_dump($method);
131 //var_dump($parameters);
132  }
133 
134  //$q_gui->setQuestionTabs();
135  $count = $q_gui->object->isInUse();
136  if ($count > 0)
137  {
138  global $rbacsystem;
139  if ($rbacsystem->checkAccess("write", $this->pool_ref_id))
140  {
141  ilUtil::sendInfo(sprintf($lng->txt("qpl_question_is_in_use"), $count));
142  }
143  }
144  $ilCtrl->setCmdClass(get_class($q_gui));
145  $ret = $ilCtrl->forwardCommand($q_gui);
146  break;
147  }
148 
149  return $ret;
150  }
151 
157  function setQuestionId($a_questionid)
158  {
159  $this->questionid = $a_questionid;
160  $_GET["q_id"] = $this->questionid;
161  }
162 
168  function getQuestionId()
169  {
170  return $this->questionid;
171  }
172 
178  function setPoolRefId($a_poolrefid)
179  {
180 //echo "<br>Setting Pool Ref ID:".$a_poolrefid;
181  $this->poolrefid = $a_poolrefid;
182  $_GET["qpool_ref_id"] = $this->poolrefid;
184  }
185 
191  function getPoolRefId()
192  {
193  return $this->poolrefid;
194  }
195 
201  function setPoolObjId($a_poolobjid)
202  {
203 //echo "<br>Setting Pool Obj ID:".$a_poolobjid;
204  $this->poolobjid = $a_poolobjid;
205  $_GET["qpool_obj_id"] = $this->poolobjid;
206  }
207 
213  function getPoolObjId()
214  {
215  return $this->poolobjid;
216  }
217 
223  function setQuestionType($a_questiontype)
224  {
225  $this->questiontype = $a_questiontype;
226  $_GET["q_type"] = $this->questiontype;
227  }
228 
234  function getQuestionType()
235  {
236  return $this->questiontype;
237  }
238 }
239 ?>