4 include_once
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
5 include_once
'Modules/Test/classes/class.ilTestExpressPage.php';
29 $questions = array_keys(
$obj->getQuestionTitlesAndIndexes());
31 $pos = array_search(
$_REQUEST[
'q_id'], $questions);
35 $next = $questions[$pos + 1];
39 $next = $questions[0];
42 $this->ctrl->setParameter($this,
'q_id', $next);
43 $link = $this->ctrl->getLinkTarget($this,
'edit',
'',
'',
false);
51 $questions = array_keys(
$obj->getQuestionTitlesAndIndexes());
53 $pos = array_search(
$_REQUEST[
'q_id'], $questions);
57 $next = $questions[$pos - 1];
61 $next = $questions[0];
64 $this->ctrl->setParameter($this,
'q_id', $next);
65 $link = $this->ctrl->getLinkTarget($this,
'edit',
'',
'',
false);
78 $next_class = $this->ctrl->getNextClass($this);
79 $cmd = $this->ctrl->getCmd();
83 case 'ilobjquestionpoolgui':
85 $nodeParts = explode(
':',
$_GET[
'cmdNode']);
88 'ref_id' =>
$_GET[
'ref_id'],
89 'calling_test' =>
$_GET[
'ref_id'],
90 'q_id' =>
$_GET[
'q_id'],
91 'cmd' =>
$_GET[
'cmd'],
92 'cmdClass' =>
$_GET[
'cmdClass'],
93 'cmdNode' => $nodeParts[count($nodeParts) - 2] .
':' . $nodeParts[count($nodeParts) - 1],
94 'baseClass' =>
'ilObjQuestionPoolGUI',
95 'test_express_mode' =>
'1'
102 case "ilpageeditorgui":
107 $ilCtrl->redirect($this,
"preview");
111 $page_editor->setLocator($this->locator);
112 $page_editor->setHeader($this->
getHeader());
113 $page_editor->setPageBackTitle($this->page_back_title);
114 $page_editor->setIntLinkReturn($this->int_link_return);
116 $this->ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_mode');
118 $ret = & $this->ctrl->forwardCommand($page_editor);
123 case 'iltestexpresspageobjectgui':
125 include_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
137 $q_gui->object->setObjId(
$obj->getId());
141 'handleToolbarCommand',
145 'browseForQuestions',
146 'filterAvailableQuestions',
147 'resetfilterAvailableQuestions'
150 if( in_array(
$cmd, $cmds) )
152 return $this->
$cmd();
154 elseif( $q_gui->object )
156 $total = $this->test_object->evalTotalPersons();
162 $link = $ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
"participants");
163 $link =
"<a href=\"".$link.
"\">".$lng->txt(
"test_has_datasets_warning_page_view_link").
"</a>";
164 ilUtil::sendInfo($lng->txt(
"test_has_datasets_warning_page_view").
" ".$link);
167 if( in_array(
$cmd, array(
'view',
'showPage')) ||
$cmd ==
'edit' && $this->test_object->evalTotalPersons() )
185 $q_gui->setQuestionTabs();
187 $ret = $this->ctrl->forwardCommand($q_gui);
192 $this->ctrl->setReturn($this,
"questions");
194 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
200 $q_gui->object->setObjId(
$obj->getId());
203 $this->ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_id');
204 $this->ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_mode');
206 $q_gui->setQuestionTabs();
207 $ret = & $this->ctrl->forwardCommand($q_gui);
224 $this->ctrl->setReturn($this,
"questions");
226 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
231 $q_gui->object->setObjId(
$obj->getId());
240 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
244 include_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
247 elseif(
$_REQUEST[
'sel_question_types'] )
249 $questionType =
$_REQUEST[
'sel_question_types'];
252 include_once
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
255 $addContEditMode =
$_POST[
'add_quest_cont_edit_mode'];
265 $q_gui->object->setObjId(
$_GET[
'ref_id']);
266 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
268 $q_gui->object->createNewQuestion();
270 $previousQuestionId =
$_REQUEST[
'position'];
276 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_qpl',
$_REQUEST[
'sel_qpl']);
277 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_question_types', $questionType);
278 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'q_id', $q_gui->object->getId());
279 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'prev_qid', $previousQuestionId);
283 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'test_express_mode', 1);
286 if( isset(
$_REQUEST[
'add_quest_cont_edit_mode']) )
288 $ilCtrl->setParameterByClass(
289 'ilobjtestgui',
'add_quest_cont_edit_mode',
$_REQUEST[
'add_quest_cont_edit_mode']
293 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'usage', 3);
294 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'calling_test', $this->test_object->getId());
296 $link = $ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
'executeCreateQuestion',
false,
false,
false);
304 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'txt_qpl',
$_REQUEST[
'txt_qpl']);
305 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_question_types', $questionType);
306 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'q_id', $q_gui->object->getId());
307 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'prev_qid', $previousQuestionId);
311 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'test_express_mode', 1);
314 if( isset(
$_REQUEST[
'add_quest_cont_edit_mode']) )
316 $ilCtrl->setParameterByClass(
317 'ilobjtestgui',
'add_quest_cont_edit_mode',
$_REQUEST[
'add_quest_cont_edit_mode']
321 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'usage', 2);
322 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'calling_test', $this->test_object->getId());
324 $link = $ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
'executeCreateQuestion',
false,
false,
false);
342 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
344 $ilCtrl->setParameter($this,
'qtype',
$_REQUEST[
'qtype']);
348 $ilCtrl->setParameter($this,
'test_express_mode', 1);
350 $form->setFormAction($ilCtrl->getFormAction($this,
"handleToolbarCommand"));
351 $form->setTitle($lng->txt(
"ass_create_question"));
352 include_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
355 $questionTypes = $pool->getQuestionTypes(
false,
true);
359 foreach($questionTypes as $label => $data)
361 $options[$data[
'question_type_id']] = $label;
364 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
367 $form->addItem(
$si,
true);
370 $questions = $this->test_object->getQuestionTitlesAndIndexes();
374 $options = array(
'0' => $lng->txt(
'first'));
375 foreach($questions as $key => $title)
377 $options[$key] = $lng->txt(
'behind') .
' '. $title .
' ['.$this->lng->txt(
'question_id_short') .
': '. $key .
']';
379 $si->setOptions($options);
381 $form->addItem(
$si,
true);
387 $ri =
new ilRadioGroupInputGUI($lng->txt(
"tst_add_quest_cont_edit_mode"),
"add_quest_cont_edit_mode");
390 $lng->txt(
'tst_add_quest_cont_edit_mode_default'),
395 $lng->txt(
'tst_add_quest_cont_edit_mode_page_object'),
401 $form->addItem($ri,
true);
407 $form->addItem($hi,
true);
410 if($this->test_object->getPoolUsage())
415 $no_pool =
new ilRadioOption($this->lng->txt(
"assessment_no_pool"), 1);
416 $usage->addOption($no_pool);
417 $existing_pool =
new ilRadioOption($this->lng->txt(
"assessment_existing_pool"), 3);
418 $usage->addOption($existing_pool);
419 $new_pool =
new ilRadioOption($this->lng->txt(
"assessment_new_pool"), 2);
420 $usage->addOption($new_pool);
421 $form->addItem($usage);
426 $pools_data = array();
427 foreach($questionpools as $key => $p)
429 $pools_data[$key] = $p[
'title'];
431 $pools =
new ilSelectInputGUI($this->lng->txt(
"select_questionpool"),
"sel_qpl");
433 $existing_pool->addSubItem($pools);
437 $name->setMaxLength(50);
438 $new_pool->addSubItem($name);
441 $form->addCommandButton(
"handleToolbarCommand", $lng->txt(
"create"));
442 $form->addCommandButton(
"questions", $lng->txt(
"cancel"));
444 return $tpl->setContent($form->getHTML());
451 $ilCtrl->saveParameterByClass(
'ilobjtestgui',
'q_id');
453 $ilCtrl->redirectByClass(
'ilobjtestgui',
'showPage');
458 $cmdClass = $questionType.
'GUI';
460 $this->ctrl->setParameterByClass($cmdClass,
'ref_id',
$_GET[
'ref_id']);
461 $this->ctrl->setParameterByClass($cmdClass,
'sel_question_types', $questionType);
462 $this->ctrl->setParameterByClass($cmdClass,
'test_ref_id',
$_GET[
'ref_id']);
463 $this->ctrl->setParameterByClass($cmdClass,
'calling_test',
$_GET[
'ref_id']);
464 $this->ctrl->setParameterByClass($cmdClass,
'q_id', $qid);
465 $this->ctrl->setParameterByClass($cmdClass,
'prev_qid', $prev_qid);
469 $this->ctrl->setParameterByClass($cmdClass,
'test_express_mode', 1);
472 $this->ctrl->redirectByClass(
473 array(
'ilRepositoryGUI',
'ilObjTestGUI', $questionType.
"GUI"),
'editQuestion'
479 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'ref_id',
$_REQUEST[
'ref_id']);
480 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'q_id', $qid);
481 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'sel_question_types', $questionType);
482 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'prev_qid', $prev_qid);
483 $redir = $this->ctrl->getLinkTargetByClass(
'ilObjTestGUI',
'createQuestion',
'',
false,
false);
492 $ilCtrl->setParameterByClass(get_class($this),
"browse",
"1");
494 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
496 $arrFilter = array();
497 foreach ($table_gui->getFilterItems() as $item)
499 if ($item->getValue() !==
false)
501 $arrFilter[$item->getPostVar()] = $item->getValue();
504 $data = $this->test_object->getAvailableQuestions($arrFilter, 1);
507 $tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
512 $selected_array = (is_array(
$_POST[
'q_id'])) ?
$_POST[
'q_id'] : array();
513 if (!count($selected_array))
516 $this->ctrl->redirect($this,
"browseForQuestions");
520 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
523 global $tree,
$ilDB, $ilPluginAdmin;
525 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
527 $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig();
529 foreach ($selected_array as $key => $value)
531 $last_question_id = $this->test_object->insertQuestion( $testQuestionSetConfig, $value );
538 $this->test_object->saveCompleteStatus( $testQuestionSetConfig );
548 $this->ctrl->setParameter($this,
'q_id', $last_question_id);
549 $this->ctrl->redirect($this,
"showPage");
556 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
558 $table_gui->resetOffset();
559 $table_gui->writeFilterToSession();
560 $this->ctrl->redirect($this,
"browseForQuestions");
565 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
567 $table_gui->resetOffset();
568 $table_gui->resetFilter();
569 $this->ctrl->redirect($this,
"browseForQuestions");