ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 public function __construct()
25 {
26 global $DIC;
27 $ilCtrl = $DIC['ilCtrl'];
28 $lng = $DIC['lng'];
29
30 if ($_GET["qpool_ref_id"]) {
31 $this->setPoolRefId($_GET["qpool_ref_id"]);
32 } elseif ($_GET["qpool_obj_id"]) {
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 public function setSelfAssessmentEditingMode($a_selfassessmenteditingmode)
51 {
52 $this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
53 }
54
61 {
62 return $this->selfassessmenteditingmode;
63 }
64
70 public function setDefaultNrOfTries($a_defaultnroftries)
71 {
72 $this->defaultnroftries = $a_defaultnroftries;
73 }
74
80 public function getDefaultNrOfTries()
81 {
82 return $this->defaultnroftries;
83 }
84
90 public function setPageConfig($a_val)
91 {
92 $this->page_config = $a_val;
93 }
94
100 public function getPageConfig()
101 {
102 return $this->page_config;
103 }
104
105
110 public 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 public function executeCommand()
123 {
124 global $DIC;
125 $ilCtrl = $DIC['ilCtrl'];
126 $lng = $DIC['lng'];
127
128 $cmd = $ilCtrl->getCmd();
129 $next_class = $ilCtrl->getNextClass();
130
131 //echo "-".$cmd."-".$next_class."-".$_GET["q_id"]."-";
132
133 switch ($next_class) {
134 default:
135 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
137 $this->getQuestionType(),
138 $this->getQuestionId()
139 );
140 $q_gui->object->setSelfAssessmentEditingMode(
142 );
143 $q_gui->object->setDefaultNrOfTries(
144 $this->getDefaultNrOfTries()
145 );
146
147 if (is_object($this->page_config)) {
148 $q_gui->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
149 }
150 $q_gui->object->setObjId((int) $this->getPoolObjId());
151
152 for ($i = 0; $i < $this->new_id_listener_cnt; $i++) {
153 $object = &$this->new_id_listeners[$i]["object"];
154 $method = $this->new_id_listeners[$i]["method"];
155 $parameters = $this->new_id_listeners[$i]["parameters"];
156 $q_gui->addNewIdListener(
157 $object,
158 $method,
159 $parameters
160 );
161 //var_dump($object);
162//var_dump($method);
163//var_dump($parameters);
164 }
165
166 //$q_gui->setQuestionTabs();
167 $count = $q_gui->object->isInUse();
168 if ($count > 0) {
169 global $DIC;
170 $rbacsystem = $DIC['rbacsystem'];
171 if ($rbacsystem->checkAccess("write", $this->pool_ref_id)) {
172 ilUtil::sendInfo(sprintf($lng->txt("qpl_question_is_in_use"), $count));
173 }
174 }
175 $ilCtrl->setCmdClass(get_class($q_gui));
176 $ret = $ilCtrl->forwardCommand($q_gui);
177 break;
178 }
179
180 return $ret;
181 }
182
188 public function setQuestionId($a_questionid)
189 {
190 $this->questionid = $a_questionid;
191 $_GET["q_id"] = $this->questionid;
192 }
193
199 public function getQuestionId()
200 {
201 return $this->questionid;
202 }
203
209 public function setPoolRefId($a_poolrefid)
210 {
211 //echo "<br>Setting Pool Ref ID:".$a_poolrefid;
212 $this->poolrefid = $a_poolrefid;
213 $_GET["qpool_ref_id"] = $this->poolrefid;
215 }
216
222 public function getPoolRefId()
223 {
224 return $this->poolrefid;
225 }
226
232 public function setPoolObjId($a_poolobjid)
233 {
234 //echo "<br>Setting Pool Obj ID:".$a_poolobjid;
235 $this->poolobjid = $a_poolobjid;
236 $_GET["qpool_obj_id"] = $this->poolobjid;
237 }
238
244 public function getPoolObjId()
245 {
246 return $this->poolobjid;
247 }
248
254 public function setQuestionType($a_questiontype)
255 {
256 $this->questiontype = $a_questiontype;
257 $_GET["q_type"] = $this->questiontype;
258 }
259
265 public function getQuestionType()
266 {
267 return $this->questiontype;
268 }
269}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
static _lookupObjId($a_id)
Class ilQuestionEditGUI.
setQuestionId($a_questionid)
Set Question Id.
getQuestionType()
Get Question Type.
getPoolObjId()
Get Pool Obj Id.
executeCommand()
execute command
getPoolRefId()
Get Pool Ref ID.
getQuestionId()
Get Question Id.
getDefaultNrOfTries()
Get Default Nr of Tries.
getPageConfig()
Get Page Config.
addNewIdListener(&$a_object, $a_method, $a_parameters="")
Add a listener that is notified with the new question ID, when a new question is saved.
getSelfAssessmentEditingMode()
Get Self-Assessment Editing Mode.
setSelfAssessmentEditingMode($a_selfassessmenteditingmode)
Set Self-Assessment Editing Mode.
setPageConfig($a_val)
Set Page Config.
setQuestionType($a_questiontype)
Set Question Type.
setDefaultNrOfTries($a_defaultnroftries)
Set Default Nr of Tries.
setPoolObjId($a_poolobjid)
Set Pool Obj Id.
setPoolRefId($a_poolrefid)
Set Pool Ref ID.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$i
Definition: disco.tpl.php:19
global $ilCtrl
Definition: ilias.php:18
$ret
Definition: parser.php:6
global $DIC
Definition: saml.php:7
$lng