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'];
215 $q_gui->object->setObjId(
$_GET[
'ref_id']);
217 $q_gui->object->createNewQuestion();
220 $previousQuestionId =
$_REQUEST[
'position'];
225 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_qpl',
$_REQUEST[
'sel_qpl']);
226 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_question_types', $questionType);
227 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'q_id', $q_gui->object->getId());
228 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'prev_qid', $previousQuestionId);
230 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'test_express_mode', 1);
231 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'usage', 3);
232 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'calling_test', $this->test_object->getId());
234 $link = $ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
'executeCreateQuestion',
false,
false,
false);
239 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'txt_qpl',
$_REQUEST[
'txt_qpl']);
240 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'sel_question_types', $questionType);
241 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'q_id', $q_gui->object->getId());
242 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'prev_qid', $previousQuestionId);
244 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'test_express_mode', 1);
245 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'usage', 2);
246 $ilCtrl->setParameterByClass(
'ilobjtestgui',
'calling_test', $this->test_object->getId());
248 $link = $ilCtrl->getLinkTargetByClass(
'ilobjtestgui',
'executeCreateQuestion',
false,
false,
false);
261 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
263 $ilCtrl->setParameter($this,
'qtype',
$_REQUEST[
'qtype']);
267 $ilCtrl->setParameter($this,
'test_express_mode', 1);
269 $form->setFormAction($ilCtrl->getFormAction($this,
"handleToolbarCommand"));
270 $form->setTitle($lng->txt(
"test_create_question"));
271 include_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
274 $questionTypes = $pool->getQuestionTypes(
false,
true);
278 foreach($questionTypes as $label =>
$data) {
279 $options[
$data[
'question_type_id']] = $label;
282 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
284 $si->setOptions($options);
285 $form->addItem(
$si,
true);
288 $questions = $this->test_object->getQuestionTitlesAndIndexes();
291 $options = array(
'0' => $lng->txt(
'first'));
292 foreach($questions as $key =>
$title) {
293 $options[$key] = $lng->txt(
'behind') .
' '.
$title;
295 $si->setOptions($options);
297 $form->addItem(
$si,
true);
300 if ($this->test_object->getPoolUsage()) {
304 $no_pool =
new ilRadioOption($this->lng->txt(
"assessment_no_pool"), 1);
305 $usage->addOption($no_pool);
306 $existing_pool =
new ilRadioOption($this->lng->txt(
"assessment_existing_pool"), 3);
307 $usage->addOption($existing_pool);
308 $new_pool =
new ilRadioOption($this->lng->txt(
"assessment_new_pool"), 2);
309 $usage->addOption($new_pool);
310 $form->addItem($usage);
315 $pools_data = array();
316 foreach($questionpools as $key => $p) {
317 $pools_data[$key] = $p[
'title'];
319 $pools =
new ilSelectInputGUI($this->lng->txt(
"select_questionpool"),
"sel_qpl");
321 $existing_pool->addSubItem($pools);
326 $name->setMaxLength(50);
327 $new_pool->addSubItem($name);
331 $form->addCommandButton(
"handleToolbarCommand", $lng->txt(
"create"));
332 $form->addCommandButton(
"questions", $lng->txt(
"cancel"));
334 return $tpl->setContent($form->getHTML());
340 $ilCtrl->saveParameterByClass(
'ilobjtestgui',
'q_id');
341 $ilCtrl->redirectByClass(
'ilobjtestgui',
'showPage');
345 include_once
'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
348 $sel_question_types = $questionType;
349 $cmd =
'editQuestion';
350 $cmdClass = strtolower($questionType);
351 $cmdNode =
$_GET[
'cmdNode'];
352 $baseClass =
'ilObjTestGUI';
356 $cmdNodes = explode(
':',
$_GET[
'cmdNode']);
357 $firstNode = $cmdNodes[0];
360 'ref_id' =>
$_GET[
'ref_id'],
361 'sel_question_types' => $questionType,
362 'cmd' =>
'editQuestion',
363 'cmdClass' => strtolower($questionType) .
'gui',
364 'cmdNode' => $firstNode .
':' . $node,
365 'baseClass' =>
'ilObjTestGUI',
366 'test_ref_id' =>
$_GET[
'ref_id'],
367 'calling_test' =>
$_GET[
'ref_id'],
370 'prev_qid' => $prev_qid
374 $linkParams[
'test_express_mode'] = 1;
376 ilUtil::redirect(
'ilias.php?' . http_build_query($linkParams,
'null',
'&'));
380 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'ref_id',
$_REQUEST[
'ref_id']);
381 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'q_id', $qid);
382 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'sel_question_types', $questionType);
383 $this->ctrl->setParameterByClass(
'ilObjTestGUI',
'prev_qid', $prev_qid);
384 $redir = $this->ctrl->getLinkTargetByClass(
'ilObjTestGUI',
'createQuestion',
'',
false,
false);
393 $ilCtrl->setParameterByClass(get_class($this),
"browse",
"1");
395 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
397 $arrFilter = array();
398 foreach ($table_gui->getFilterItems() as $item)
400 if ($item->getValue() !==
false)
402 $arrFilter[$item->getPostVar()] = $item->getValue();
405 $data = $this->test_object->getAvailableQuestions($arrFilter, 1);
407 $table_gui->setData(
$data);
408 $tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
413 $selected_array = (is_array(
$_POST[
'q_id'])) ?
$_POST[
'q_id'] : array();
414 if (!count($selected_array))
417 $this->ctrl->redirect($this,
"browseForQuestions");
421 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
423 foreach ($selected_array as $key => $value)
425 $last_question_id = $this->test_object->insertQuestion($value);
431 $this->test_object->saveCompleteStatus();
441 $this->ctrl->setParameter($this,
'q_id', $last_question_id);
442 $this->ctrl->redirect($this,
"showPage");
449 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
451 $table_gui->writeFilterToSession();
452 $this->ctrl->redirect($this,
"browseForQuestions");
457 include_once
"./Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php";
459 $table_gui->resetFilter();
460 $this->ctrl->redirect($this,
"browseForQuestions");