ILIAS  release_7 Revision v7.30-3-g800a261c036
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 }
162
163 $count = $q_gui->object->isInUse();
164 if ($count > 0) {
165 global $DIC;
166 $rbacsystem = $DIC['rbacsystem'];
167 if ($rbacsystem->checkAccess("write", $this->pool_ref_id)) {
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 public function setQuestionId($a_questionid)
185 {
186 $this->questionid = $a_questionid;
187 $_GET["q_id"] = $this->questionid;
188 }
189
195 public function getQuestionId()
196 {
197 return $this->questionid;
198 }
199
205 public 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 public function getPoolRefId()
219 {
220 return $this->poolrefid;
221 }
222
228 public 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 public function getPoolObjId()
241 {
242 return $this->poolobjid;
243 }
244
250 public function setQuestionType($a_questiontype)
251 {
252 $this->questiontype = $a_questiontype;
253 $_GET["q_type"] = $this->questiontype;
254 }
255
261 public function getQuestionType()
262 {
263 return $this->questiontype;
264 }
265}
$_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.
global $DIC
Definition: goto.php:24
$i
Definition: metadata.php:24
$ret
Definition: parser.php:6
$lng