ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
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 
19 {
20 
24  function __construct()
25  {
26  global $ilCtrl, $lng;
27 
28  if ($_GET["qpool_ref_id"])
29  {
30  $this->setPoolRefId($_GET["qpool_ref_id"]);
31  }
32  else if ($_GET["qpool_obj_id"])
33  {
34  $this->setPoolObjId($_GET["qpool_obj_id"]);
35  }
36  $this->setQuestionId($_GET["q_id"]);
37  $this->setQuestionType($_GET["q_type"]);
38  $lng->loadLanguageModule("assessment");
39 
40  $ilCtrl->saveParameter($this, array("qpool_ref_id", "qpool_obj_id", "q_id", "q_type"));
41 
42  $this->new_id_listeners = array();
43  $this->new_id_listener_cnt = 0;
44  }
45 
51  function setSelfAssessmentEditingMode($a_selfassessmenteditingmode)
52  {
53  $this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
54  }
55 
62  {
63  return $this->selfassessmenteditingmode;
64  }
65 
71  function setDefaultNrOfTries($a_defaultnroftries)
72  {
73  $this->defaultnroftries = $a_defaultnroftries;
74  }
75 
82  {
83  return $this->defaultnroftries;
84  }
85 
91  function setPageConfig($a_val)
92  {
93  $this->page_config = $a_val;
94  }
95 
101  function getPageConfig()
102  {
103  return $this->page_config;
104  }
105 
106 
111  function addNewIdListener(&$a_object, $a_method, $a_parameters = "")
112  {
113  $cnt = $this->new_id_listener_cnt;
114  $this->new_id_listeners[$cnt]["object"] =& $a_object;
115  $this->new_id_listeners[$cnt]["method"] = $a_method;
116  $this->new_id_listeners[$cnt]["parameters"] = $a_parameters;
117  $this->new_id_listener_cnt++;
118  }
119 
123  function executeCommand()
124  {
125  global $ilCtrl,$lng;
126 
127  $cmd = $ilCtrl->getCmd();
128  $next_class = $ilCtrl->getNextClass();
129 
130 //echo "-".$cmd."-".$next_class."-".$_GET["q_id"]."-";
131 
132  switch($next_class)
133  {
134  default:
135  include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
137  $this->getQuestionId());
138  $q_gui->object->setSelfAssessmentEditingMode(
140  $q_gui->object->setDefaultNrOfTries(
141  $this->getDefaultNrOfTries());
142 
143  if (is_object($this->page_config))
144  {
145  $q_gui->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
146  }
147  $q_gui->object->setObjId((int) $this->getPoolObjId());
148 
149  for ($i=0; $i<$this->new_id_listener_cnt; $i++)
150  {
151  $object =& $this->new_id_listeners[$i]["object"];
152  $method = $this->new_id_listeners[$i]["method"];
153  $parameters = $this->new_id_listeners[$i]["parameters"];
154  $q_gui->addNewIdListener($object, $method,
155  $parameters);
156 //var_dump($object);
157 //var_dump($method);
158 //var_dump($parameters);
159  }
160 
161  //$q_gui->setQuestionTabs();
162  $count = $q_gui->object->isInUse();
163  if ($count > 0)
164  {
165  global $rbacsystem;
166  if ($rbacsystem->checkAccess("write", $this->pool_ref_id))
167  {
168  ilUtil::sendInfo(sprintf($lng->txt("qpl_question_is_in_use"), $count));
169  }
170  }
171  $ilCtrl->setCmdClass(get_class($q_gui));
172  $ret = $ilCtrl->forwardCommand($q_gui);
173  break;
174  }
175 
176  return $ret;
177  }
178 
184  function setQuestionId($a_questionid)
185  {
186  $this->questionid = $a_questionid;
187  $_GET["q_id"] = $this->questionid;
188  }
189 
195  function getQuestionId()
196  {
197  return $this->questionid;
198  }
199 
205  function setPoolRefId($a_poolrefid)
206  {
207 //echo "<br>Setting Pool Ref ID:".$a_poolrefid;
208  $this->poolrefid = $a_poolrefid;
209  $_GET["qpool_ref_id"] = $this->poolrefid;
211  }
212 
218  function getPoolRefId()
219  {
220  return $this->poolrefid;
221  }
222 
228  function setPoolObjId($a_poolobjid)
229  {
230 //echo "<br>Setting Pool Obj ID:".$a_poolobjid;
231  $this->poolobjid = $a_poolobjid;
232  $_GET["qpool_obj_id"] = $this->poolobjid;
233  }
234 
240  function getPoolObjId()
241  {
242  return $this->poolobjid;
243  }
244 
250  function setQuestionType($a_questiontype)
251  {
252  $this->questiontype = $a_questiontype;
253  $_GET["q_type"] = $this->questiontype;
254  }
255 
261  function getQuestionType()
262  {
263  return $this->questiontype;
264  }
265 }
266 ?>
Class ilQuestionEditGUI.
setDefaultNrOfTries($a_defaultnroftries)
Set Default Nr of Tries.
$_GET["client_id"]
getQuestionId()
Get Question Id.
$cmd
Definition: sahs_server.php:35
setPoolRefId($a_poolrefid)
Set Pool Ref ID.
setQuestionType($a_questiontype)
Set Question Type.
getQuestionType()
Get Question Type.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getPoolObjId()
Get Pool Obj Id.
executeCommand()
execute command
setQuestionId($a_questionid)
Set Question Id.
getSelfAssessmentEditingMode()
Get Self-Assessment Editing Mode.
static _lookupObjId($a_id)
& _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
getPoolRefId()
Get Pool Ref ID.
setPoolObjId($a_poolobjid)
Set Pool Obj Id.
setSelfAssessmentEditingMode($a_selfassessmenteditingmode)
Set Self-Assessment Editing Mode.
getDefaultNrOfTries()
Get Default Nr of Tries.
setPageConfig($a_val)
Set Page Config.
global $lng
Definition: privfeed.php:40
addNewIdListener(&$a_object, $a_method, $a_parameters="")
Add a listener that is notified with the new question ID, when a new question is saved.
getPageConfig()
Get Page Config.