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);
33 if( $pos == count($questions) - 1 )
36 $next = $questions[0];
38 elseif( $pos !==
false )
40 $next = $questions[$pos + 1];
44 $next = $questions[0];
47 $this->ctrl->setParameter($this,
'q_id', $next);
48 $link = $this->ctrl->getLinkTarget($this,
'edit',
'',
'',
false);
56 $questions = array_keys(
$obj->getQuestionTitlesAndIndexes());
58 $pos = array_search(
$_REQUEST[
'q_id'], $questions);
63 $next = $questions[count($questions) - 1];
65 elseif( $pos !==
false )
67 $next = $questions[$pos - 1];
71 $next = $questions[0];
74 $this->ctrl->setParameter($this,
'q_id', $next);
75 $link = $this->ctrl->getLinkTarget($this,
'edit',
'',
'',
false);
88 $next_class = $this->ctrl->getNextClass($this);
89 $cmd = $this->ctrl->getCmd();
93 case 'ilobjquestionpoolgui':
95 $nodeParts = explode(
':',
$_GET[
'cmdNode']);
98 'ref_id' =>
$_GET[
'ref_id'],
99 'calling_test' =>
$_GET[
'ref_id'],
100 'q_id' =>
$_GET[
'q_id'],
101 'cmd' =>
$_GET[
'cmd'],
102 'cmdClass' =>
$_GET[
'cmdClass'],
103 'cmdNode' => $nodeParts[count($nodeParts) - 2] .
':' . $nodeParts[count($nodeParts) - 1],
104 'baseClass' =>
'ilObjQuestionPoolGUI',
105 'test_express_mode' =>
'1'
112 case "ilpageeditorgui":
117 $ilCtrl->redirect($this,
"preview");
121 $page_editor->setLocator($this->locator);
122 $page_editor->setHeader($this->
getHeader());
123 $page_editor->setPageBackTitle($this->page_back_title);
124 $page_editor->setIntLinkReturn($this->int_link_return);
126 $this->ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_mode');
128 $ret = & $this->ctrl->forwardCommand($page_editor);
133 case 'iltestexpresspageobjectgui':
135 include_once
'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
147 $q_gui->object->setObjId(
$obj->getId());
151 'handleToolbarCommand',
155 'browseForQuestions',
156 'filterAvailableQuestions',
157 'resetfilterAvailableQuestions'
160 if( in_array(
$cmd, $cmds) )
162 return $this->
$cmd();
164 elseif( $q_gui->object )
166 $total = $this->test_object->evalTotalPersons();
172 $link = $ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
"participants");
173 $link =
"<a href=\"".$link.
"\">".$lng->txt(
"test_has_datasets_warning_page_view_link").
"</a>";
174 ilUtil::sendInfo($lng->txt(
"test_has_datasets_warning_page_view").
" ".$link);
177 if( in_array(
$cmd, array(
'view',
'showPage')) ||
$cmd ==
'edit' && $this->test_object->evalTotalPersons() )
195 $q_gui->setQuestionTabs();
197 $ret = $this->ctrl->forwardCommand($q_gui);
202 $this->ctrl->setReturn($this,
"questions");
204 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
210 $q_gui->object->setObjId(
$obj->getId());
213 $this->ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_id');
214 $this->ctrl->saveParameterByClass(
'ilpageeditorgui',
'q_mode');
216 $q_gui->setQuestionTabs();
217 $ret = & $this->ctrl->forwardCommand($q_gui);
234 $this->ctrl->setReturn($this,
"questions");
236 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
241 $q_gui->object->setObjId(
$obj->getId());
250 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
254 include_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
257 elseif(
$_REQUEST[
'sel_question_types'] )
259 $questionType =
$_REQUEST[
'sel_question_types'];
261 require_once
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
264 $addContEditMode =
$_POST[
'add_quest_cont_edit_mode'];
274 $q_gui->object->setObjId(
$_GET[
'ref_id']);
275 $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
277 $q_gui->object->createNewQuestion();
279 $previousQuestionId =
$_REQUEST[
'position'];
285 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_qpl',
$_REQUEST[
'sel_qpl']);
286 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_question_types', $questionType);
287 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'q_id', $q_gui->object->getId());
288 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'prev_qid', $previousQuestionId);
292 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'test_express_mode', 1);
295 if( isset(
$_REQUEST[
'add_quest_cont_edit_mode']) )
297 $ilCtrl->setParameterByClass(
298 'ilobjtestgui',
'add_quest_cont_edit_mode',
$_REQUEST[
'add_quest_cont_edit_mode']
302 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'usage', 3);
303 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'calling_test', $this->test_object->getId());
305 $link = $ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
'executeCreateQuestion',
false,
false,
false);
313 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'txt_qpl',
$_REQUEST[
'txt_qpl']);
314 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_question_types', $questionType);
315 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'q_id', $q_gui->object->getId());
316 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'prev_qid', $previousQuestionId);
320 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'test_express_mode', 1);
323 if( isset(
$_REQUEST[
'add_quest_cont_edit_mode']) )
325 $ilCtrl->setParameterByClass(
326 'ilobjtestgui',
'add_quest_cont_edit_mode',
$_REQUEST[
'add_quest_cont_edit_mode']
330 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'usage', 2);
331 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'calling_test', $this->test_object->getId());
333 $link = $ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
'executeCreateQuestion',
false,
false,
false);
351 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
353 $ilCtrl->setParameter($this,
'qtype',
$_REQUEST[
'qtype']);
357 $ilCtrl->setParameter($this,
'test_express_mode', 1);
359 $form->setFormAction($ilCtrl->getFormAction($this,
"handleToolbarCommand"));
360 $form->setTitle($lng->txt(
"ass_create_question"));
361 include_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
364 $questionTypes = $pool->getQuestionTypes(
false,
true);
368 foreach($questionTypes as $label => $data)
370 $options[$data[
'question_type_id']] = $label;
373 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
376 $form->addItem(
$si,
true);
379 $questions = $this->test_object->getQuestionTitlesAndIndexes();
383 $options = array(
'0' => $lng->txt(
'first'));
384 foreach($questions as $key => $title)
386 $options[$key] = $lng->txt(
'behind') .
' '. $title .
' ['.$this->lng->txt(
'question_id_short') .
': '. $key .
']';
388 $si->setOptions($options);
390 $form->addItem(
$si,
true);
396 $ri =
new ilRadioGroupInputGUI($lng->txt(
"tst_add_quest_cont_edit_mode"),
"add_quest_cont_edit_mode");
399 $lng->txt(
'tst_add_quest_cont_edit_mode_default'),
404 $lng->txt(
'tst_add_quest_cont_edit_mode_page_object'),
410 $form->addItem($ri,
true);
416 $form->addItem($hi,
true);
419 if($this->test_object->getPoolUsage())
424 $no_pool =
new ilRadioOption($this->lng->txt(
"assessment_no_pool"), 1);
425 $usage->addOption($no_pool);
426 $existing_pool =
new ilRadioOption($this->lng->txt(
"assessment_existing_pool"), 3);
427 $usage->addOption($existing_pool);
428 $new_pool =
new ilRadioOption($this->lng->txt(
"assessment_new_pool"), 2);
429 $usage->addOption($new_pool);
430 $form->addItem($usage);
435 $pools_data = array();
436 foreach($questionpools as $key => $p)
438 $pools_data[$key] = $p[
'title'];
440 $pools =
new ilSelectInputGUI($this->lng->txt(
"select_questionpool"),
"sel_qpl");
442 $existing_pool->addSubItem($pools);
446 $name->setMaxLength(50);
447 $new_pool->addSubItem($name);
450 $form->addCommandButton(
"handleToolbarCommand", $lng->txt(
"create"));
451 $form->addCommandButton(
"questions", $lng->txt(
"cancel"));
453 return $tpl->setContent($form->getHTML());
460 $ilCtrl->saveParameterByClass(
'ilobjtestgui',
'q_id');
462 $ilCtrl->redirectByClass(
'ilobjtestgui',
'showPage');
467 $cmdClass = $questionType.
'GUI';
469 $this->ctrl->setParameterByClass($cmdClass,
'ref_id',
$_GET[
'ref_id']);
470 $this->ctrl->setParameterByClass($cmdClass,
'sel_question_types', $questionType);
471 $this->ctrl->setParameterByClass($cmdClass,
'test_ref_id',
$_GET[
'ref_id']);
472 $this->ctrl->setParameterByClass($cmdClass,
'calling_test',
$_GET[
'ref_id']);
473 $this->ctrl->setParameterByClass($cmdClass,
'q_id', $qid);
474 $this->ctrl->setParameterByClass($cmdClass,
'prev_qid', $prev_qid);
478 $this->ctrl->setParameterByClass($cmdClass,
'test_express_mode', 1);
481 $this->ctrl->redirectByClass(
482 array(
'ilRepositoryGUI',
'ilObjTestGUI', $questionType.
"GUI"),
'editQuestion'
488 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'ref_id',
$_REQUEST[
'ref_id']);
489 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'q_id', $qid);
490 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'sel_question_types', $questionType);
491 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'prev_qid', $prev_qid);
492 $redir = $this->ctrl->getLinkTargetByClass(
'ilObjTestGUI',
'createQuestion',
'',
false,
false);
501 $ilCtrl->setParameterByClass(get_class($this),
"browse",
"1");
503 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
505 $arrFilter = array();
506 foreach ($table_gui->getFilterItems() as $item)
508 if ($item->getValue() !==
false)
510 $arrFilter[$item->getPostVar()] = $item->getValue();
513 $data = $this->test_object->getAvailableQuestions($arrFilter, 1);
516 $tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
521 $selected_array = (is_array(
$_POST[
'q_id'])) ?
$_POST[
'q_id'] : array();
522 if (!count($selected_array))
525 $this->ctrl->redirect($this,
"browseForQuestions");
529 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
532 global $tree, $ilDB, $ilPluginAdmin;
534 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
536 $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig();
538 foreach ($selected_array as $key => $value)
540 $last_question_id = $this->test_object->insertQuestion( $testQuestionSetConfig, $value );
547 $this->test_object->saveCompleteStatus( $testQuestionSetConfig );
557 $this->ctrl->setParameter($this,
'q_id', $last_question_id);
558 $this->ctrl->redirect($this,
"showPage");
565 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
567 $table_gui->writeFilterToSession();
568 $this->ctrl->redirect($this,
"browseForQuestions");
573 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
575 $table_gui->resetFilter();
576 $this->ctrl->redirect($this,
"browseForQuestions");