ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $ilCtrl, $lng;
27
28 if ($_GET["qpool_ref_id"]) {
29 $this->setPoolRefId($_GET["qpool_ref_id"]);
30 } elseif ($_GET["qpool_obj_id"]) {
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 public function setSelfAssessmentEditingMode($a_selfassessmenteditingmode)
49 {
50 $this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
51 }
52
59 {
60 return $this->selfassessmenteditingmode;
61 }
62
68 public function setDefaultNrOfTries($a_defaultnroftries)
69 {
70 $this->defaultnroftries = $a_defaultnroftries;
71 }
72
78 public function getDefaultNrOfTries()
79 {
80 return $this->defaultnroftries;
81 }
82
88 public function setPageConfig($a_val)
89 {
90 $this->page_config = $a_val;
91 }
92
98 public function getPageConfig()
99 {
100 return $this->page_config;
101 }
102
103
108 public 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 public 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 default:
131 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
133 $this->getQuestionType(),
134 $this->getQuestionId()
135 );
136 $q_gui->object->setSelfAssessmentEditingMode(
138 );
139 $q_gui->object->setDefaultNrOfTries(
140 $this->getDefaultNrOfTries()
141 );
142
143 if (is_object($this->page_config)) {
144 $q_gui->object->setPreventRteUsage($this->getPageConfig()->getPreventRteUsage());
145 }
146 $q_gui->object->setObjId((int) $this->getPoolObjId());
147
148 for ($i=0; $i<$this->new_id_listener_cnt; $i++) {
149 $object =&$this->new_id_listeners[$i]["object"];
150 $method = $this->new_id_listeners[$i]["method"];
151 $parameters = $this->new_id_listeners[$i]["parameters"];
152 $q_gui->addNewIdListener(
153 $object,
154 $method,
155 $parameters
156 );
157 //var_dump($object);
158//var_dump($method);
159//var_dump($parameters);
160 }
161
162 //$q_gui->setQuestionTabs();
163 $count = $q_gui->object->isInUse();
164 if ($count > 0) {
165 global $rbacsystem;
166 if ($rbacsystem->checkAccess("write", $this->pool_ref_id)) {
167 ilUtil::sendInfo(sprintf($lng->txt("qpl_question_is_in_use"), $count));
168 }
169 }
170 $ilCtrl->setCmdClass(get_class($q_gui));
171 $ret = $ilCtrl->forwardCommand($q_gui);
172 break;
173 }
174
175 return $ret;
176 }
177
183 public function setQuestionId($a_questionid)
184 {
185 $this->questionid = $a_questionid;
186 $_GET["q_id"] = $this->questionid;
187 }
188
194 public function getQuestionId()
195 {
196 return $this->questionid;
197 }
198
204 public function setPoolRefId($a_poolrefid)
205 {
206 //echo "<br>Setting Pool Ref ID:".$a_poolrefid;
207 $this->poolrefid = $a_poolrefid;
208 $_GET["qpool_ref_id"] = $this->poolrefid;
210 }
211
217 public function getPoolRefId()
218 {
219 return $this->poolrefid;
220 }
221
227 public function setPoolObjId($a_poolobjid)
228 {
229 //echo "<br>Setting Pool Obj ID:".$a_poolobjid;
230 $this->poolobjid = $a_poolobjid;
231 $_GET["qpool_obj_id"] = $this->poolobjid;
232 }
233
239 public function getPoolObjId()
240 {
241 return $this->poolobjid;
242 }
243
249 public function setQuestionType($a_questiontype)
250 {
251 $this->questiontype = $a_questiontype;
252 $_GET["q_type"] = $this->questiontype;
253 }
254
260 public function getQuestionType()
261 {
262 return $this->questiontype;
263 }
264}
sprintf('%.4f', $callTime)
$_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 $lng
Definition: privfeed.php:17