3 include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
4 include_once
'Modules/Test/classes/class.ilTestExpressPage.php';
29 $questions = array_keys(
$obj->getQuestionTitlesAndIndexes());
31 $pos = array_search(
$_REQUEST[
'q_id'], $questions);
33 if ($pos == count($questions) - 1) {
35 $next = $questions[0];
36 }
else if ($pos !==
false) {
37 $next = $questions[$pos + 1];
39 $next = $questions[0];
42 $this->ctrl->setParameter($this,
'q_id', $next);
43 $link = $this->ctrl->getLinkTarget($this,
'edit',
'',
'',
false);
50 $questions = array_keys(
$obj->getQuestionTitlesAndIndexes());
52 $pos = array_search(
$_REQUEST[
'q_id'], $questions);
56 $next = $questions[count($questions) - 1];
57 }
else if ($pos !==
false) {
58 $next = $questions[$pos - 1];
60 $next = $questions[0];
63 $this->ctrl->setParameter($this,
'q_id', $next);
64 $link = $this->ctrl->getLinkTarget($this,
'edit',
'',
'',
false);
72 $next_class = $this->ctrl->getNextClass($this);
73 $cmd = $this->ctrl->getCmd();
75 switch ($next_class) {
76 case 'ilobjquestionpoolgui':
77 $nodeParts = explode(
':',
$_GET[
'cmdNode']);
80 'ref_id' =>
$_GET[
'ref_id'],
81 'calling_test' =>
$_GET[
'ref_id'],
82 'q_id' =>
$_GET[
'q_id'],
83 'cmd' =>
$_GET[
'cmd'],
84 'cmdClass' =>
$_GET[
'cmdClass'],
85 'cmdNode' => $nodeParts[count($nodeParts) - 2] .
':' . $nodeParts[count($nodeParts) - 1],
86 'baseClass' =>
'ilObjQuestionPoolGUI',
87 'test_express_mode' =>
'1'
92 case "ilpageeditorgui":
95 $ilCtrl->redirect($this,
"preview");
98 $page_editor->setLocator($this->locator);
99 $page_editor->setHeader($this->
getHeader());
100 $page_editor->setPageBackTitle($this->page_back_title);
103 $page_editor->setIntLinkHelpDefault($this->int_link_def_type,
104 $this->int_link_def_id);
105 $page_editor->setIntLinkReturn($this->int_link_return);
108 $this->ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_mode');
110 $ret = & $this->ctrl->forwardCommand($page_editor);
114 case 'iltestexpresspageobjectgui':
115 include_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
121 if ($q_gui->object) {
123 $q_gui->object->setObjId(
$obj->getId());
126 if (in_array(
$cmd, array(
127 'handleToolbarCommand',
131 'browseForQuestions',
132 'filterAvailableQuestions',
133 'resetfilterAvailableQuestions'
135 return $this->
$cmd();
137 else if ($q_gui->object) {
139 $total = $this->test_object->evalTotalPersons();
145 $link = $ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
"participants");
146 $link =
"<a href=\"".$link.
"\">".$lng->txt(
"test_has_datasets_warning_page_view_link").
"</a>";
147 ilUtil::sendInfo($lng->txt(
"test_has_datasets_warning_page_view").
" ".$link);
150 if (in_array(
$cmd, array(
'view',
'showPage')) ||
$cmd ==
'edit' && $this->test_object->evalTotalPersons()) {
161 if (!
$_GET[
'q_id']) {
163 $q_gui->setQuestionTabs();
165 $ret = $this->ctrl->forwardCommand($q_gui);
171 $this->ctrl->setReturn($this,
"questions");
172 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
175 if ($q_gui->object) {
177 $q_gui->object->setObjId(
$obj->getId());
179 $this->ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_id');
180 $this->ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_mode');
182 $q_gui->setQuestionTabs();
183 $ret = & $this->ctrl->forwardCommand($q_gui);
195 $this->ctrl->setReturn($this,
"questions");
196 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
199 $q_gui->object->setObjId(
$obj->getId());
204 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
206 include_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
209 else if (
$_REQUEST[
'sel_question_types']) {
210 $questionType =
$_REQUEST[
'sel_question_types'];
213 $q_gui->object->setObjId(
$_GET[
'ref_id']);
214 $q_gui->object->createNewQuestion();
217 $previousQuestionId =
$_REQUEST[
'position'];
222 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_qpl',
$_REQUEST[
'sel_qpl']);
223 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_question_types', $questionType);
224 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'q_id', $q_gui->object->getId());
225 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'prev_qid', $previousQuestionId);
227 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'test_express_mode', 1);
228 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'usage', 3);
229 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'calling_test', $this->test_object->getId());
231 $link = $ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
'executeCreateQuestion',
false,
false,
false);
236 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'txt_qpl',
$_REQUEST[
'txt_qpl']);
237 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_question_types', $questionType);
238 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'q_id', $q_gui->object->getId());
239 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'prev_qid', $previousQuestionId);
241 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'test_express_mode', 1);
242 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'usage', 2);
243 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'calling_test', $this->test_object->getId());
245 $link = $ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
'executeCreateQuestion',
false,
false,
false);
258 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
260 $ilCtrl->setParameter($this,
'qtype',
$_REQUEST[
'qtype']);
264 $ilCtrl->setParameter($this,
'test_express_mode', 1);
266 $form->setFormAction($ilCtrl->getFormAction($this,
"handleToolbarCommand"));
267 $form->setTitle($lng->txt(
"test_create_question"));
268 include_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
271 $questionTypes = $pool->getQuestionTypes();
275 foreach($questionTypes as $label =>
$data) {
276 $options[
$data[
'question_type_id']] = $label;
279 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
282 $form->addItem($si,
true);
285 $questions = $this->test_object->getQuestionTitlesAndIndexes();
288 $options = array(
'0' => $lng->txt(
'first'));
289 foreach($questions as $key =>
$title) {
290 $options[$key] = $lng->txt(
'behind') .
' '.
$title;
292 $si->setOptions($options);
294 $form->addItem($si,
true);
297 if ($this->test_object->getPoolUsage()) {
301 $no_pool =
new ilRadioOption($this->lng->txt(
"assessment_no_pool"), 1);
302 $usage->addOption($no_pool);
303 $existing_pool =
new ilRadioOption($this->lng->txt(
"assessment_existing_pool"), 3);
304 $usage->addOption($existing_pool);
305 $new_pool =
new ilRadioOption($this->lng->txt(
"assessment_new_pool"), 2);
306 $usage->addOption($new_pool);
307 $form->addItem($usage);
312 $pools_data = array();
313 foreach($questionpools as $key => $p) {
314 $pools_data[$key] = $p[
'title'];
316 $pools =
new ilSelectInputGUI($this->lng->txt(
"select_questionpool"),
"sel_qpl");
318 $existing_pool->addSubItem($pools);
321 $name =
new ilTextInputGUI($this->lng->txt(
"cat_create_qpl"),
"txt_qpl");
323 $name->setMaxLength(50);
324 $new_pool->addSubItem($name);
328 $form->addCommandButton(
"handleToolbarCommand", $lng->txt(
"submit"));
329 $form->addCommandButton(
"questions", $lng->txt(
"cancel"));
331 return $tpl->setContent($form->getHTML());
337 $ilCtrl->saveParameterByClass(
'ilobjtestgui',
'q_id');
338 $ilCtrl->redirectByClass(
'ilobjtestgui',
'showPage');
342 include_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
345 $sel_question_types = $questionType;
346 $cmd =
'editQuestion';
347 $cmdClass = strtolower($questionType);
348 $cmdNode =
$_GET[
'cmdNode'];
349 $baseClass =
'ilObjTestGUI';
353 $cmdNodes = explode(
':',
$_GET[
'cmdNode']);
354 $firstNode = $cmdNodes[0];
357 'ref_id' =>
$_GET[
'ref_id'],
358 'sel_question_types' => $questionType,
359 'cmd' =>
'editQuestion',
360 'cmdClass' => strtolower($questionType) .
'gui',
361 'cmdNode' => $firstNode .
':' . $node,
362 'baseClass' =>
'ilObjTestGUI',
363 'test_ref_id' =>
$_GET[
'ref_id'],
364 'calling_test' =>
$_GET[
'ref_id'],
367 'prev_qid' => $prev_qid
371 $linkParams[
'test_express_mode'] = 1;
373 ilUtil::redirect(
'ilias.php?' . http_build_query($linkParams,
'null',
'&'));
377 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'ref_id',
$_REQUEST[
'ref_id']);
378 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'q_id', $qid);
379 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'sel_question_types', $questionType);
380 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'prev_qid', $prev_qid);
381 $redir = $this->ctrl->getLinkTargetByClass(
'ilObjTestGUI',
'createQuestion',
'',
false,
false);
390 $ilCtrl->setParameterByClass(get_class($this),
"browse",
"1");
392 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
394 $arrFilter = array();
395 foreach ($table_gui->getFilterItems() as $item)
397 if ($item->getValue() !==
false)
399 $arrFilter[$item->getPostVar()] = $item->getValue();
402 $data = $this->test_object->getAvailableQuestions($arrFilter, 1);
404 $table_gui->setData(
$data);
405 $tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
410 $selected_array = (is_array(
$_POST[
'q_id'])) ?
$_POST[
'q_id'] : array();
411 if (!count($selected_array))
414 $this->ctrl->redirect($this,
"browseForQuestions");
418 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
420 foreach ($selected_array as $key => $value)
422 $last_question_id = $this->test_object->insertQuestion($value);
428 $this->test_object->saveCompleteStatus();
438 $this->ctrl->setParameter($this,
'q_id', $last_question_id);
439 $this->ctrl->redirect($this,
"showPage");
446 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
448 $table_gui->writeFilterToSession();
449 $this->ctrl->redirect($this,
"browseForQuestions");
454 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
456 $table_gui->resetFilter();
457 $this->ctrl->redirect($this,
"browseForQuestions");