ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilObjTestSettingsGeneralGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Modules/Test/classes/class.ilTestSettingsGUI.php';
5require_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
6
21{
25 const CMD_SHOW_FORM = 'showForm';
26 const CMD_SAVE_FORM = 'saveForm';
27 const CMD_CONFIRMED_SAVE_FORM = 'confirmedSaveForm';
28 const CMD_SHOW_RESET_TPL_CONFIRM = 'showResetTemplateConfirmation';
29 const CMD_CONFIRMED_RESET_TPL = 'confirmedResetTemplate';
30
32 protected $ctrl = null;
33
35 protected $access = null;
36
38 protected $lng = null;
39
41 protected $tpl = null;
42
44 protected $tree = null;
45
47 protected $db = null;
48
50 protected $pluginAdmin = null;
51
53 protected $activeUser = null;
54
56 protected $testGUI = null;
57
60
73 public function __construct(
79 ilDB $db,
83 )
84 {
85 $this->ctrl = $ctrl;
86 $this->access = $access;
87 $this->lng = $lng;
88 $this->tpl = $tpl;
89 $this->tree = $tree;
90 $this->db = $db;
91 $this->pluginAdmin = $pluginAdmin;
92 $this->activeUser = $activeUser;
93
94 $this->testGUI = $testGUI;
95
96 require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
97 $this->testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($this->tree, $this->db, $this->pluginAdmin, $testGUI->object);
98
99 parent::__construct($testGUI->object);
100 }
101
105 public function executeCommand()
106 {
107 // allow only write access
108
109 if (!$this->access->checkAccess("write", "", $this->testGUI->ref_id))
110 {
111 ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
112 $this->ctrl->redirect($this->testGUI, "infoScreen");
113 }
114
115 // process command
116
117 $nextClass = $this->ctrl->getNextClass();
118
119 switch($nextClass)
120 {
121 default:
122 $cmd = $this->ctrl->getCmd(self::CMD_SHOW_FORM).'Cmd';
123 $this->$cmd();
124 }
125 }
126
127 private function showFormCmd(ilPropertyFormGUI $form = null)
128 {
129 $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js");
130
131 if( $form === null )
132 {
133 $form = $this->buildForm();
134 }
135
136 $formHTML = $this->ctrl->getHTML($form);
137 $msgHTML = $this->getSettingsTemplateMessageHTML();
138
139 $this->tpl->setContent($formHTML.$msgHTML);
140 }
141
142 private function showConfirmation(ilPropertyFormGUI $form, $oldQuestionSetType, $newQuestionSetType, $hasQuestionsWithoutQuestionpool)
143 {
144 require_once 'Modules/Test/classes/confirmations/class.ilTestSettingsChangeConfirmationGUI.php';
145 $confirmation = new ilTestSettingsChangeConfirmationGUI($this->lng, $this->testOBJ);
146
147 $confirmation->setFormAction( $this->ctrl->getFormAction($this) );
148 $confirmation->setCancel($this->lng->txt('cancel'), self::CMD_SHOW_FORM);
149 $confirmation->setConfirm($this->lng->txt('confirm'), self::CMD_CONFIRMED_SAVE_FORM);
150
151 $confirmation->setOldQuestionSetType($oldQuestionSetType);
152 $confirmation->setNewQuestionSetType($newQuestionSetType);
153 $confirmation->setQuestionLossInfoEnabled($hasQuestionsWithoutQuestionpool);
154 $confirmation->build();
155
156 $confirmation->populateParametersFromPropertyForm($form, $this->activeUser->getTimeZone());
157
158 $this->tpl->setContent( $this->ctrl->getHTML($confirmation) );
159 }
160
162 {
163 if( $this->settingsTemplate )
164 {
165 global $tpl;
166
167 $link = $this->ctrl->getLinkTarget($this, self::CMD_SHOW_RESET_TPL_CONFIRM);
168 $link = "<a href=\"".$link."\">".$this->lng->txt("test_using_template_link")."</a>";
169
170 $msgHTML = $tpl->getMessageHTML(
171 sprintf($this->lng->txt("test_using_template"), $this->settingsTemplate->getTitle(), $link), "info"
172 );
173
174 $msgHTML = "<div style=\"margin-top:10px\">$msgHTML</div>";
175 }
176 else
177 {
178 $msgHTML = '';
179 }
180
181 return $msgHTML;
182 }
183
184 private function confirmedSaveFormCmd()
185 {
186 return $this->saveFormCmd(true);
187 }
188
189 private function saveFormCmd($isConfirmedSave = false)
190 {
191 $form = $this->buildForm();
192
193 // form validation and initialisation
194
195 $errors = !$form->checkInput(); // ALWAYS CALL BEFORE setValuesByPost()
196 $form->setValuesByPost(); // NEVER CALL THIS BEFORE checkInput()
197 // Sarcasm? No. Because checkInput checks the form graph against the POST without
198 // actually setting the values into the form. Sounds ridiculous? Indeed, and it is.
199
200 // return to form when any form validation errors exist
201
202 if($errors)
203 {
204 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
205 return $this->showFormCmd($form);
206 }
207
208 // return to form when online is to be set, but no questions are configured
209
210 $currentQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig();
211 if( $form->getItemByPostVar('online')->getChecked() && !$this->testOBJ->isComplete($currentQuestionSetConfig) )
212 {
213 $form->getItemByPostVar('online')->setAlert(
214 $this->lng->txt("cannot_switch_to_online_no_questions_andor_no_mark_steps")
215 );
216
217 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
218 return $this->showFormCmd($form);
219 }
220
221 $infoMsg = array();
222
223 // solve conflicts with question set type setting with confirmation screen if required
224 // determine wether question set type relating data is to be removed (questions/pools)
225
226 $questionSetTypeRelatingDataCleanupRequired = false;
227
228 $oldQuestionSetType = $this->testOBJ->getQuestionSetType();
229 if( $form->getItemByPostVar('question_set_type') instanceof ilFormPropertyGUI )
230 {
231 $newQuestionSetType = $form->getItemByPostVar('question_set_type')->getValue();
232
233 if( !$this->testOBJ->participantDataExist() && $newQuestionSetType != $oldQuestionSetType )
234 {
235 $oldQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfigByType(
236 $oldQuestionSetType
237 );
238
239 if( $oldQuestionSetConfig->doesQuestionSetRelatedDataExist() )
240 {
241 if( !$isConfirmedSave )
242 {
243 if( $oldQuestionSetType == ilObjTest::QUESTION_SET_TYPE_FIXED )
244 {
245 return $this->showConfirmation(
246 $form, $oldQuestionSetType, $newQuestionSetType,
247 $this->testOBJ->hasQuestionsWithoutQuestionpool()
248 );
249 }
250
251 return $this->showConfirmation(
252 $form, $oldQuestionSetType, $newQuestionSetType, false
253 );
254 }
255
256 $questionSetTypeRelatingDataCleanupRequired = true;
257 }
258
259 if( $form->getItemByPostVar('online')->getChecked() )
260 {
261 $form->getItemByPostVar('online')->setChecked(false);
262
263 if( $this->testOBJ->isOnline() )
264 {
265 $infoMsg[] = $this->lng->txt("tst_set_offline_due_to_switched_question_set_type_setting");
266 }
267 else
268 {
269 $infoMsg[] = $this->lng->txt("tst_cannot_online_due_to_switched_quest_set_type_setting");
270 }
271 }
272 }
273 }
274 else
275 {
276 $newQuestionSetType = $oldQuestionSetType;
277 }
278
279 // adjust settiue to desired question set type
280
281 if( $newQuestionSetType != ilObjTest::QUESTION_SET_TYPE_FIXED )
282 {
283 $form->getItemByPostVar('chb_use_previous_answers')->setChecked(false);
284
285 if( $this->isSkillServiceSettingToBeAdjusted($form) )
286 {
287 $form->getItemByPostVar('skill_service')->setChecked(false);
288
289 if( $this->testOBJ->isSkillServiceEnabled() )
290 {
291 $infoMsg[] = $this->lng->txt("tst_disabled_skl_due_to_non_fixed_quest_set_type");
292 }
293 else
294 {
295 $infoMsg[] = $this->lng->txt("tst_cannot_enable_skl_due_to_non_fixed_quest_set_type");
296 }
297 }
298 }
299
300 // avoid settings conflict "obligate questions" and "freeze answer"
301
302 if( $form->getItemByPostVar('obligations_enabled')->getChecked() )
303 {
304 $values = $form->getItemByPostVar('instant_feedback')->getValue();
305
306 if( in_array('instant_feedback_answer_fixation', $values) )
307 {
308 $values = array_diff($values, array('instant_feedback_answer_fixation'));
309 $form->getItemByPostVar('instant_feedback')->setValue($values);
310
311 $infoMsg[] = $this->lng->txt("tst_conflict_fbh_oblig_quest");
312 $infoMsg[] = $this->lng->txt("tst_conflict_reset_non_fbh");
313 }
314 }
315
316 // perform saving the form data
317
318 $this->performSaveForm($form);
319
320 // clean up test mode relating configuration data (questions/questionpools)
321
322 if( $questionSetTypeRelatingDataCleanupRequired )
323 {
324 $oldQuestionSetConfig->removeQuestionSetRelatedData();
325 }
326
327 // disinvite all invited users if required
328
329 if( !$this->testOBJ->participantDataExist() && !$this->testOBJ->getFixedParticipants() )
330 {
331 foreach ($this->testOBJ->getInvitedUsers() as $usrId => $usrData)
332 {
333 $this->testOBJ->disinviteUser($usrId);
334 }
335 }
336
337 // redirect to form output
338
339 if( count($infoMsg) )
340 {
341 ilUtil::sendInfo(implode('<br />', $infoMsg), true);
342 }
343
344 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
345 $this->ctrl->redirect($this, self::CMD_SHOW_FORM);
346 }
347
352 {
353 require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
354 $confirmationGUI = new ilConfirmationGUI();
355
356 $confirmationGUI->setFormAction($this->ctrl->getFormAction($this));
357 $confirmationGUI->setHeaderText($this->lng->txt("test_confirm_template_reset"));
358 $confirmationGUI->setCancel($this->lng->txt('cancel'), self::CMD_SHOW_FORM);
359 $confirmationGUI->setConfirm($this->lng->txt('confirm'), self::CMD_CONFIRMED_RESET_TPL);
360
361 $this->tpl->setContent( $this->ctrl->getHTML($confirmationGUI) );
362 }
363
367 private function confirmedResetTemplateCmd()
368 {
369 $this->testOBJ->setTemplate(null);
370 $this->testOBJ->saveToDB();
371
372 ilUtil::sendSuccess($this->lng->txt("test_template_reset"), true);
373 $this->ctrl->redirect($this, self::CMD_SHOW_FORM);
374 }
375
377 {
378 if( !($form->getItemByPostVar('skill_service') instanceof ilFormPropertyGUI) )
379 {
380 return false;
381 }
382
384 {
385 return false;
386 }
387
388 if( !$form->getItemByPostVar('skill_service')->getChecked() )
389 {
390 return false;
391 }
392
393 return true;
394 }
395
397 {
398 global $ilSetting;
399
400 return $ilSetting->get('char_selector_availability') > 0;
401 }
402
403
404 private function buildForm()
405 {
406 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
407 $form = new ilPropertyFormGUI();
408 $form->setFormAction($this->ctrl->getFormAction($this));
409 $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt("save"));
410 $form->setTableWidth("100%");
411 $form->setId("test_properties");
412
413 $this->addGeneralProperties($form);
414 $this->addAvailabilityProperties($form);
415 $this->addTestIntroProperties($form);
416 $this->addTestAccessProperties($form);
417 $this->addTestRunProperties($form);
418 $this->addQuestionBehaviourProperties($form);
419 $this->addTestSequenceProperties($form);
420 $this->addTestFinishProperties($form);
421
422 // Edit ecs export settings
423 include_once 'Modules/Test/classes/class.ilECSTestSettings.php';
424 $ecs = new ilECSTestSettings($this->testOBJ);
425 $ecs->addSettingsToForm($form, 'tst');
426
427 // skill service activation for FIXED tests only
428 if( $this->testOBJ->isFixedTest() && ilObjTest::isSkillManagementGloballyActivated() )
429 {
430 $otherHead = new ilFormSectionHeaderGUI();
431 $otherHead->setTitle($this->lng->txt('other'));
432 $form->addItem($otherHead);
433
434 $skillService = new ilCheckboxInputGUI($this->lng->txt('tst_activate_skill_service'), 'skill_service');
435 $skillService->setInfo($this->lng->txt('tst_activate_skill_service_desc'));
436 $skillService->setChecked($this->testOBJ->isSkillServiceEnabled());
437 if($this->testOBJ->participantDataExist()) $skillService->setDisabled(true);
438 $form->addItem($skillService);
439 }
440
441 // remove items when using template
442 $this->removeHiddenItems($form);
443
444 return $form;
445 }
446
447 private function performSaveForm(ilPropertyFormGUI $form)
448 {
449 $this->saveGeneralProperties($form);
450 $this->saveAvailabilityProperties($form);
451 $this->saveTestIntroProperties($form);
452 $this->saveTestAccessProperties($form);
453 $this->saveTestRunProperties($form);
455 $this->saveTestSequenceSettings($form);
456 $this->saveTestFinishProperties($form);
457
458 if( !$this->testOBJ->participantDataExist() )
459 {
460 // skill service
461 if( ilObjTest::isSkillManagementGloballyActivated() && $form->getItemByPostVar('skill_service') instanceof ilFormPropertyGUI )
462 {
463 $this->testOBJ->setSkillServiceEnabled($form->getItemByPostVar('skill_service')->getChecked());
464 }
465 }
466
467 // store settings to db
468 $this->testOBJ->saveToDb(true);
469
470 // Update ecs export settings
471 include_once 'Modules/Test/classes/class.ilECSTestSettings.php';
472 $ecs = new ilECSTestSettings($this->testOBJ);
473 $ecs->handleSettingsUpdate();
474 }
475
480 {
481 $header = new ilFormSectionHeaderGUI();
482 $header->setTitle($this->lng->txt("tst_general_properties"));
483 $form->addItem($header);
484
485 // title & description (meta data)
486
487 include_once 'Services/MetaData/classes/class.ilMD.php';
488 $md_obj = new ilMD($this->testOBJ->getId(), 0, "tst");
489 $md_section = $md_obj->getGeneral();
490
491 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
492 $title->setRequired(true);
493 $title->setValue($md_section->getTitle());
494 $form->addItem($title);
495
496 $ids = $md_section->getDescriptionIds();
497 if ($ids) {
498 $desc_obj = $md_section->getDescription(array_pop($ids));
499
500 $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
501 $desc->setCols(50);
502 $desc->setRows(4);
503 $desc->setValue($desc_obj->getDescription());
504 $form->addItem($desc);
505 }
506
507 // pool usage
508 $pool_usage = new ilRadioGroupInputGUI($this->lng->txt('test_question_pool_usage'), 'use_pool');
509
510 $optional_qpl = new ilRadioOption($this->lng->txt('test_question_pool_usage_optional'), 1);
511 $optional_qpl->setInfo($this->lng->txt('test_question_pool_usage_optional_info'));
512 $pool_usage->addOption($optional_qpl);
513
514 $tst_directly = new ilRadioOption($this->lng->txt('test_question_pool_usage_tst_directly'), 0);
515 $tst_directly->setInfo($this->lng->txt('test_question_pool_usage_tst_directly_info'));
516 $pool_usage->addOption($tst_directly);
517
518 $pool_usage->setValue($this->testOBJ->getPoolUsage() ? 1 : 0);
519 $form->addItem($pool_usage);
520
521 // test mode (question set type)
522 $questSetType = new ilRadioGroupInputGUI($this->lng->txt("tst_question_set_type"), 'question_set_type');
523 $questSetTypeFixed = new ilRadioOption(
524 $this->lng->txt("tst_question_set_type_fixed"), ilObjTest::QUESTION_SET_TYPE_FIXED,
525 $this->lng->txt("tst_question_set_type_fixed_desc")
526 );
527 $questSetType->addOption($questSetTypeFixed);
528 $questSetTypeRandom = new ilRadioOption(
529 $this->lng->txt("tst_question_set_type_random"), ilObjTest::QUESTION_SET_TYPE_RANDOM,
530 $this->lng->txt("tst_question_set_type_random_desc")
531 );
532 $questSetType->addOption($questSetTypeRandom);
533 $questSetTypeContinues = new ilRadioOption(
534 $this->lng->txt("tst_question_set_type_dynamic"), ilObjTest::QUESTION_SET_TYPE_DYNAMIC,
535 $this->lng->txt("tst_question_set_type_dynamic_desc")
536 );
537 $questSetType->addOption($questSetTypeContinues);
538 $questSetType->setValue($this->testOBJ->getQuestionSetType());
539 if ($this->testOBJ->participantDataExist()) {
540 $questSetType->setDisabled(true);
541 }
542 $form->addItem($questSetType);
543 }
544
549 {
550 include_once 'Services/MetaData/classes/class.ilMD.php';
551 $md_obj =& new ilMD($this->testOBJ->getId(), 0, "tst");
552 $md_section = $md_obj->getGeneral();
553
554 // title
555 $md_section->setTitle(ilUtil::stripSlashes($form->getItemByPostVar('title')->getValue()));
556 $md_section->update();
557
558 // Description
559 $md_desc_ids = $md_section->getDescriptionIds();
560 if ($md_desc_ids)
561 {
562 $md_desc = $md_section->getDescription(array_pop($md_desc_ids));
563 $md_desc->setDescription(ilUtil::stripSlashes($form->getItemByPostVar('description')->getValue()));
564 $md_desc->update();
565 }
566 else
567 {
568 $md_desc = $md_section->addDescription();
569 $md_desc->setDescription(ilUtil::stripSlashes($form->getItemByPostVar('description')->getValue()));
570 $md_desc->save();
571 }
572
573 $this->testOBJ->setTitle(ilUtil::stripSlashes($form->getItemByPostVar('title')->getValue()));
574 $this->testOBJ->setDescription(ilUtil::stripSlashes($form->getItemByPostVar('description')->getValue()));
575 $this->testOBJ->update();
576
577 // pool usage setting
578 if ($form->getItemByPostVar('use_pool') instanceof ilFormPropertyGUI)
579 {
580 $this->testOBJ->setPoolUsage((int)$form->getItemByPostVar('use_pool')->getValue());
581 }
582
583 if (!$this->testOBJ->participantDataExist())
584 {
585 // question set type
586 if ($form->getItemByPostVar('question_set_type') instanceof ilFormPropertyGUI)
587 {
588 $this->testOBJ->setQuestionSetType($form->getItemByPostVar('question_set_type')->getValue());
589 }
590 }
591 }
592
597 {
598 include_once "Services/Object/classes/class.ilObjectActivation.php";
599 $this->lng->loadLanguageModule('rep');
600
602 $section->setTitle($this->lng->txt('rep_activation_availability'));
603 $form->addItem($section);
604
605 // additional info only with multiple references
606 $act_obj_info = $act_ref_info = "";
607 if (sizeof(ilObject::_getAllReferences($this->testOBJ->getId())) > 1) {
608 $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
609 $act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
610 }
611
612 $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
613 $online->setChecked($this->testOBJ->isOnline());
614 $online->setInfo($this->lng->txt('tst_activation_online_info') . $act_obj_info);
615 $form->addItem($online);
616
617 $act_type = new ilCheckboxInputGUI($this->lng->txt('rep_visibility_until'), 'activation_type');
618 $act_type->setChecked($this->testOBJ->isActivationLimited());
619 // $act_type->setInfo($this->lng->txt('tst_availability_until_info'));
620
621 $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
622 include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
623 $dur = new ilDateDurationInputGUI($this->lng->txt("rep_time_period"), "access_period");
624 $dur->setShowTime(true);
625 $date = $this->testOBJ->getActivationStartingTime();
626 $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
627 $dur->setStartText($this->lng->txt('rep_activation_limited_start'));
628 $date = $this->testOBJ->getActivationEndingTime();
629 $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
630 $dur->setEndText($this->lng->txt('rep_activation_limited_end'));
631 $act_type->addSubItem($dur);
632
633 $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'activation_visibility');
634 $visible->setInfo($this->lng->txt('tst_activation_limited_visibility_info'));
635 $visible->setChecked($this->testOBJ->getActivationVisibility());
636 $act_type->addSubItem($visible);
637
638 $form->addItem($act_type);
639 }
640
645 {
646 // online status
647 $this->testOBJ->setOnline($form->getItemByPostVar('online')->getChecked());
648
649 // activation
650 if ($form->getItemByPostVar('activation_type')->getChecked())
651 {
652 $this->testOBJ->setActivationLimited(true);
653 $this->testOBJ->setActivationVisibility($form->getItemByPostVar('activation_visibility')->getChecked());
654
655 $period = $form->getItemByPostVar("access_period");
656 $this->testOBJ->setActivationStartingTime($period->getStart()->get(IL_CAL_UNIX));
657 $this->testOBJ->setActivationEndingTime($period->getEnd()->get(IL_CAL_UNIX));
658 }
659 else
660 {
661 $this->testOBJ->setActivationLimited(false);
662 }
663 }
664
669 {
671 $section->setTitle($this->lng->txt('tst_settings_header_intro'));
672 $form->addItem($section);
673
674 // introduction
675 $introEnabled = new ilCheckboxInputGUI($this->lng->txt("tst_introduction"), 'intro_enabled');
676 $introEnabled->setChecked($this->testOBJ->isIntroductionEnabled());
677 $introEnabled->setInfo($this->lng->txt('tst_introduction_desc'));
678 $form->addItem($introEnabled);
679 $intro = new ilTextAreaInputGUI($this->lng->txt("tst_introduction_text"), "introduction");
680 $intro->setRequired(true);
681 $intro->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getIntroduction(), false, true));
682 $intro->setRows(10);
683 $intro->setCols(80);
684 $intro->setUseRte(TRUE);
685 $intro->addPlugin("latex");
686 $intro->addButton("latex");
687 $intro->setRTESupport($this->testOBJ->getId(), "tst", "assessment");
688 $intro->setRteTagSet('full');
689 $introEnabled->addSubItem($intro);
690
691 // showinfo
692 $showinfo = new ilCheckboxInputGUI($this->lng->txt("showinfo"), "showinfo");
693 $showinfo->setValue(1);
694 $showinfo->setChecked($this->testOBJ->getShowInfo());
695 $showinfo->setInfo($this->lng->txt("showinfo_desc"));
696 $form->addItem($showinfo);
697 }
698
703 {
704 if ($form->getItemByPostVar('intro_enabled') instanceof ilFormPropertyGUI)
705 {
706 $this->testOBJ->setIntroductionEnabled($form->getItemByPostVar('intro_enabled')->getChecked());
707
708 if ($form->getItemByPostVar('intro_enabled')->getChecked())
709 {
710 $this->testOBJ->setIntroduction($form->getItemByPostVar('introduction')->getValue(), false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
711 }
712 else
713 {
714 $this->testOBJ->setIntroduction('');
715 }
716 }
717
718 if ($form->getItemByPostVar('showinfo') instanceof ilFormPropertyGUI)
719 {
720 $this->testOBJ->setShowInfo($form->getItemByPostVar('showinfo')->getChecked());
721 }
722 }
723
728 {
729 $header = new ilFormSectionHeaderGUI();
730 $header->setTitle($this->lng->txt("tst_settings_header_execution"));
731 $form->addItem($header);
732
733 // enable starting time
734 $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("tst_starting_time"), "chb_starting_time");
735 $enablestartingtime->setInfo($this->lng->txt("tst_starting_time_desc"));
736 $enablestartingtime->setChecked($this->testOBJ->isStartingTimeEnabled());
737
738 // starting time
739 $startingtime = new ilDateTimeInputGUI('', 'starting_time');
740 $startingtime->setShowTime(true);
741 if( strlen($this->testOBJ->getStartingTime()) )
742 {
743 $startingtime->setDate(new ilDateTime($this->testOBJ->getStartingTime(), IL_CAL_TIMESTAMP));
744 }
745 else
746 {
747 $startingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX));
748 }
749 $enablestartingtime->addSubItem($startingtime);
750 $form->addItem($enablestartingtime);
751 if ($this->testOBJ->participantDataExist())
752 {
753 $enablestartingtime->setDisabled(true);
754 $startingtime->setDisabled(true);
755 }
756
757 // enable ending time
758 $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("tst_ending_time"), "chb_ending_time");
759 $enableendingtime->setInfo($this->lng->txt("tst_ending_time_desc"));
760 $enableendingtime->setChecked($this->testOBJ->isEndingTimeEnabled());
761
762 // ending time
763 $endingtime = new ilDateTimeInputGUI('', 'ending_time');
764 $endingtime->setShowTime(true);
765 if (strlen($this->testOBJ->getEndingTime()))
766 {
767 $endingtime->setDate(new ilDateTime($this->testOBJ->getEndingTime(), IL_CAL_TIMESTAMP));
768 }
769 else
770 {
771 $endingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX));
772 }
773 $enableendingtime->addSubItem($endingtime);
774 $form->addItem($enableendingtime);
775
776 // test password
777 $pwEnabled = new ilCheckboxInputGUI($this->lng->txt('tst_password'), 'password_enabled');
778 $pwEnabled->setChecked($this->testOBJ->isPasswordEnabled());
779 $pwEnabled->setInfo($this->lng->txt("tst_password_details"));
780 $password = new ilTextInputGUI($this->lng->txt("tst_password_enter"), "password");
781 $password->setRequired(true);
782 $password->setSize(20);
783 $password->setValue($this->testOBJ->getPassword());
784 $pwEnabled->addSubItem($password);
785 $form->addItem($pwEnabled);
786
787 // fixed participants
788 $fixedparticipants = new ilCheckboxInputGUI($this->lng->txt('participants_invitation'), "fixedparticipants");
789 $fixedparticipants->setValue(1);
790 $fixedparticipants->setChecked($this->testOBJ->getFixedParticipants());
791 $fixedparticipants->setInfo($this->lng->txt("participants_invitation_description"));
792 $invited_users = $this->testOBJ->getInvitedUsers();
793 if ($this->testOBJ->participantDataExist() && (count($invited_users) == 0))
794 {
795 $fixedparticipants->setDisabled(true);
796 }
797 $form->addItem($fixedparticipants);
798
799 // simultaneous users
800 $simulLimited = new ilCheckboxInputGUI($this->lng->txt("tst_allowed_users"), 'limitUsers');
801 $simulLimited->setInfo($this->lng->txt("tst_allowed_users_desc"));
802 $simulLimited->setChecked($this->testOBJ->isLimitUsersEnabled());
803
804 // allowed simultaneous users
805 $simul = new ilNumberInputGUI($this->lng->txt("tst_allowed_users_max"), "allowedUsers");
806 $simul->setRequired(true);
807 $simul->allowDecimals(false);
808 $simul->setMinValue(1);
809 $simul->setMinvalueShouldBeGreater(false);
810 $simul->setSize(4);
811 $simul->setValue(($this->testOBJ->getAllowedUsers()) ? $this->testOBJ->getAllowedUsers() : '');
812 $simulLimited->addSubItem($simul);
813
814 // idle time
815 $idle = new ilNumberInputGUI($this->lng->txt("tst_allowed_users_time_gap"), "allowedUsersTimeGap");
816 $idle->setInfo($this->lng->txt("tst_allowed_users_time_gap_desc"));
817 $idle->setSize(4);
818 $idle->setSuffix($this->lng->txt("seconds"));
819 $idle->setValue(($this->testOBJ->getAllowedUsersTimeGap()) ? $this->testOBJ->getAllowedUsersTimeGap() : 300);
820 $simulLimited->addSubItem($idle);
821
822 $form->addItem($simulLimited);
823 return $header;
824 }
825
830 {
831 // starting time
832 if( $this->formPropertyExists($form, 'chb_starting_time') && !$this->testOBJ->participantDataExist() )
833 {
834 if( $form->getItemByPostVar('chb_starting_time')->getChecked() )
835 {
836 $this->testOBJ->setStartingTime(ilFormat::dateDB2timestamp(
837 $form->getItemByPostVar('starting_time')->getDate()->get(IL_CAL_DATETIME)
838 ));
839
840 $this->testOBJ->setStartingTimeEnabled(true);
841 }
842 else
843 {
844 $this->testOBJ->setStartingTimeEnabled(false);
845 }
846 }
847
848 // ending time
849 if( $this->formPropertyExists($form, 'chb_ending_time') )
850 {
851 if( $form->getItemByPostVar('chb_ending_time')->getChecked() )
852 {
853 $this->testOBJ->setEndingTime(ilFormat::dateDB2timestamp(
854 $form->getItemByPostVar('ending_time')->getDate()->get(IL_CAL_DATETIME)
855 ));
856
857 $this->testOBJ->setEndingTimeEnabled(true);
858 }
859 else
860 {
861 $this->testOBJ->setEndingTimeEnabled(false);
862 }
863 }
864
865 if( $this->formPropertyExists($form, 'password_enabled') )
866 {
867 $this->testOBJ->setPasswordEnabled($form->getItemByPostVar('password_enabled')->getChecked());
868
869 if( $form->getItemByPostVar('password_enabled')->getChecked() )
870 {
871 $this->testOBJ->setPassword($form->getItemByPostVar('password')->getValue());
872 }
873 else
874 {
875 $this->testOBJ->setPassword(''); // otherwise test will still respect value
876 }
877 }
878
879 if( $this->formPropertyExists($form, 'fixedparticipants') && !$this->testOBJ->participantDataExist() )
880 {
881 $this->testOBJ->setFixedParticipants($form->getItemByPostVar('fixedparticipants')->getChecked());
882 }
883
884 if( $this->formPropertyExists($form, 'limitUsers') )
885 {
886 $this->testOBJ->setLimitUsersEnabled($form->getItemByPostVar('limitUsers')->getChecked());
887
888 if( $form->getItemByPostVar('limitUsers')->getChecked() )
889 {
890 $this->testOBJ->setAllowedUsers($form->getItemByPostVar('allowedUsers')->getValue());
891 $this->testOBJ->setAllowedUsersTimeGap($form->getItemByPostVar('allowedUsersTimeGap')->getValue());
892 }
893 else
894 {
895 $this->testOBJ->setAllowedUsers(''); // otherwise test will still respect value
896 }
897 }
898 }
899
904 {
905 // section header test run
906 $header = new ilFormSectionHeaderGUI();
907 $header->setTitle($this->lng->txt("tst_settings_header_test_run"));
908 $form->addItem($header);
909
910 // max. number of passes
911 $limitPasses = new ilCheckboxInputGUI($this->lng->txt("tst_limit_nr_of_tries"), 'limitPasses');
912 $limitPasses->setInfo($this->lng->txt("tst_nr_of_tries_desc"));
913 $limitPasses->setChecked($this->testOBJ->getNrOfTries() > 0);
914 $nr_of_tries = new ilNumberInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries");
915 $nr_of_tries->setSize(3);
916 $nr_of_tries->allowDecimals(false);
917 $nr_of_tries->setMinValue(1);
918 $nr_of_tries->setMinvalueShouldBeGreater(false);
919 $nr_of_tries->setValue($this->testOBJ->getNrOfTries() ? $this->testOBJ->getNrOfTries() : 1);
920 $nr_of_tries->setRequired(true);
921 if( $this->testOBJ->participantDataExist() )
922 {
923 $limitPasses->setDisabled(true);
924 $nr_of_tries->setDisabled(true);
925 }
926 $limitPasses->addSubItem($nr_of_tries);
927 $form->addItem($limitPasses);
928
929 // enable max. processing time
930 $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time");
931 $processing->setInfo($this->lng->txt("tst_processing_time_desc"));
932 $processing->setValue(1);
933
934 if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_processing_time')) {
935 $processing->setChecked(true);
936 } else {
937 $processing->setChecked($this->testOBJ->getEnableProcessingTime());
938 }
939
940 // max. processing time
941 $processingtime = new ilNumberInputGUI($this->lng->txt("tst_processing_time_duration"), 'processing_time');
942 $processingtime->allowDecimals(false);
943 $processingtime->setMinValue(1);
944 $processingtime->setMinvalueShouldBeGreater(false);
945 $processingtime->setValue($this->testOBJ->getProcessingTimeAsMinutes());
946 $processingtime->setSize(5);
947 $processingtime->setSuffix($this->lng->txt('minutes'));
948 $processingtime->setInfo($this->lng->txt("tst_processing_time_duration_desc"));
949 $processing->addSubItem($processingtime);
950
951 // reset max. processing time
952 $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time");
953 $resetprocessing->setValue(1);
954 $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time"));
955 $resetprocessing->setChecked($this->testOBJ->getResetProcessingTime());
956 $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc"));
957 $processing->addSubItem($resetprocessing);
958 $form->addItem($processing);
959
960 if( $this->testOBJ->participantDataExist() )
961 {
962 $processing->setDisabled(true);
963 $processingtime->setDisabled(true);
964 $resetprocessing->setDisabled(true);
965 }
966
967 // kiosk mode
968 $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk");
969 $kiosk->setValue(1);
970 $kiosk->setChecked($this->testOBJ->getKioskMode());
971 $kiosk->setInfo($this->lng->txt("kiosk_description"));
972
973 // kiosk mode options
974 $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options");
975 $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', ''));
976 $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', ''));
977 $values = array();
978 if ($this->testOBJ->getShowKioskModeTitle()) array_push($values, 'kiosk_title');
979 if ($this->testOBJ->getShowKioskModeParticipant()) array_push($values, 'kiosk_participant');
980 $kiosktitle->setValue($values);
981 $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc"));
982 $kiosk->addSubItem($kiosktitle);
983
984 $form->addItem($kiosk);
985
986 $examIdInPass = new ilCheckboxInputGUI($this->lng->txt('examid_in_test_pass'), 'examid_in_test_pass');
987 $examIdInPass->setInfo($this->lng->txt('examid_in_test_pass_desc'));
988 $examIdInPass->setChecked($this->testOBJ->isShowExamIdInTestPassEnabled());
989 $form->addItem($examIdInPass);
990 }
991
996 {
997 if (!$this->testOBJ->participantDataExist())
998 {
999 // nr of tries (max passes)
1000 if ($form->getItemByPostVar('limitPasses') instanceof ilFormPropertyGUI)
1001 {
1002 if ($form->getItemByPostVar('limitPasses')->getChecked())
1003 {
1004 $this->testOBJ->setNrOfTries($form->getItemByPostVar('nr_of_tries')->getValue());
1005 }
1006 else
1007 {
1008 $this->testOBJ->setNrOfTries(0);
1009 }
1010 }
1011
1012 $this->testOBJ->setEnableProcessingTime($form->getItemByPostVar('chb_processing_time')->getChecked());
1013 if ($this->testOBJ->getEnableProcessingTime())
1014 {
1015 $this->testOBJ->setProcessingTimeByMinutes($form->getItemByPostVar('processing_time')->getValue());
1016 $this->testOBJ->setResetProcessingTime($form->getItemByPostVar('chb_reset_processing_time')->getChecked());
1017 }
1018 else
1019 {
1020 $this->testOBJ->setProcessingTime('');
1021 $this->testOBJ->setResetProcessingTime(false);
1022 }
1023 }
1024
1025 if ($form->getItemByPostVar('kiosk') instanceof ilFormPropertyGUI)
1026 {
1027 $this->testOBJ->setKioskMode($form->getInput('kiosk'));
1028 $kioskOptions = $form->getItemByPostVar('kiosk_options')->getValue();
1029 if (is_array($kioskOptions))
1030 {
1031 $this->testOBJ->setShowKioskModeTitle(in_array('kiosk_title', $kioskOptions));
1032 $this->testOBJ->setShowKioskModeParticipant(in_array('kiosk_participant', $kioskOptions));
1033 }
1034 else
1035 {
1036 $this->testOBJ->setShowKioskModeTitle(false);
1037 $this->testOBJ->setShowKioskModeParticipant(false);
1038 }
1039 }
1040
1041 if ($form->getItemByPostVar('examid_in_test_pass') instanceof ilFormPropertyGUI)
1042 {
1043 $value = $form->getItemByPostVar('examid_in_test_pass')->getChecked();
1044 $this->testOBJ->setShowExamIdInTestPassEnabled($value);
1045 }
1046 }
1047
1052 {
1053 $fields = array(
1054 'title_output', 'autosave', 'chb_shuffle_questions', 'chb_shuffle_questions',
1055 'offer_hints', 'instant_feedback', 'obligations_enabled',
1056 );
1057
1058 if( $this->isSectionHeaderRequired($fields) || $this->isCharSelectorPropertyRequired() )
1059 {
1060 // sequence properties
1061 $seqheader = new ilFormSectionHeaderGUI();
1062 $seqheader->setTitle($this->lng->txt("tst_presentation_properties"));
1063 $form->addItem($seqheader);
1064 }
1065
1066 // question title output
1067 $title_output = new ilRadioGroupInputGUI($this->lng->txt("tst_title_output"), "title_output");
1068 $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_full"), 0, ''));
1069 $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_hide_points"), 1, ''));
1070 $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_no_title"), 2, ''));
1071 $title_output->setValue($this->testOBJ->getTitleOutput());
1072 $form->addItem($title_output);
1073
1074 // Autosave
1075 $autosave_output = new ilCheckboxInputGUI($this->lng->txt('autosave'), 'autosave');
1076 $autosave_output->setValue(1);
1077 $autosave_output->setChecked($this->testOBJ->getAutosave());
1078 $autosave_output->setInfo($this->lng->txt('autosave_info'));
1079 $autosave_interval = new ilTextInputGUI($this->lng->txt('autosave_ival'), 'autosave_ival');
1080 $autosave_interval->setSize(10);
1081 $autosave_interval->setValue($this->testOBJ->getAutosaveIval()/1000);
1082 $autosave_interval->setSuffix($this->lng->txt('seconds'));
1083 $autosave_output->addSubItem($autosave_interval);
1084 $form->addItem($autosave_output);
1085
1086 // shuffle questions
1087 $shuffle = new ilCheckboxInputGUI($this->lng->txt("tst_shuffle_questions"), "chb_shuffle_questions");
1088 $shuffle->setValue(1);
1089 $shuffle->setChecked($this->testOBJ->getShuffleQuestions());
1090 $shuffle->setInfo($this->lng->txt("tst_shuffle_questions_description"));
1091 $form->addItem($shuffle);
1092
1093 // offer hints
1094 $checkBoxOfferHints = new ilCheckboxInputGUI($this->lng->txt('tst_setting_offer_hints_label'), 'offer_hints');
1095 $checkBoxOfferHints->setChecked($this->testOBJ->isOfferingQuestionHintsEnabled());
1096 $checkBoxOfferHints->setInfo($this->lng->txt('tst_setting_offer_hints_info'));
1097 if( $this->testOBJ->participantDataExist() )
1098 {
1099 $checkBoxOfferHints->setDisabled(true);
1100 }
1101 $form->addItem($checkBoxOfferHints);
1102
1103 // instant feedback
1104 $instant_feedback = new ilCheckboxGroupInputGUI($this->lng->txt('tst_instant_feedback'), 'instant_feedback');
1105 $instant_feedback->addOption(new ilCheckboxOption(
1106 $this->lng->txt('tst_instant_feedback_results'), 'instant_feedback_points',
1107 $this->lng->txt('tst_instant_feedback_results_desc')
1108 ));
1109 $instant_feedback->addOption(new ilCheckboxOption(
1110 $this->lng->txt('tst_instant_feedback_answer_generic'), 'instant_feedback_generic',
1111 $this->lng->txt('tst_instant_feedback_answer_generic_desc')
1112 ));
1113 $instant_feedback->addOption(new ilCheckboxOption(
1114 $this->lng->txt('tst_instant_feedback_answer_specific'), 'instant_feedback_specific',
1115 $this->lng->txt('tst_instant_feedback_answer_specific_desc')
1116 ));
1117 $instant_feedback->addOption(new ilCheckboxOption(
1118 $this->lng->txt('tst_instant_feedback_solution'), 'instant_feedback_solution',
1119 $this->lng->txt('tst_instant_feedback_solution_desc')
1120 ));
1121 $instant_feedback->addOption(new ilCheckboxOption(
1122 $this->lng->txt('tst_instant_feedback_fix_usr_answer'), 'instant_feedback_answer_fixation',
1123 $this->lng->txt('tst_instant_feedback_fix_usr_answer_desc')
1124 ));
1125 $values = array();
1126 if ($this->testOBJ->getSpecificAnswerFeedback()) array_push($values, 'instant_feedback_specific');
1127 if ($this->testOBJ->getGenericAnswerFeedback()) array_push($values, 'instant_feedback_generic');
1128 if ($this->testOBJ->getAnswerFeedbackPoints()) array_push($values, 'instant_feedback_points');
1129 if ($this->testOBJ->getInstantFeedbackSolution()) array_push($values, 'instant_feedback_solution');
1130 if( $this->testOBJ->isInstantFeedbackAnswerFixationEnabled() ) array_push($values, 'instant_feedback_answer_fixation');
1131 $instant_feedback->setValue($values);
1132 $form->addItem($instant_feedback);
1133
1134 // enable obligations
1135 $checkBoxEnableObligations = new ilCheckboxInputGUI($this->lng->txt('tst_setting_enable_obligations_label'), 'obligations_enabled');
1136 $checkBoxEnableObligations->setChecked($this->testOBJ->areObligationsEnabled());
1137 $checkBoxEnableObligations->setInfo($this->lng->txt('tst_setting_enable_obligations_info'));
1138 if( $this->testOBJ->participantDataExist() )
1139 {
1140 $checkBoxEnableObligations->setDisabled(true);
1141 }
1142 $form->addItem($checkBoxEnableObligations);
1143
1144 // selector for unicode characters
1145 if( $this->isCharSelectorPropertyRequired() )
1146 {
1147 require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php';
1149 $char_selector->getConfig()->setAvailability($this->testOBJ->getCharSelectorAvailability());
1150 $char_selector->getConfig()->setDefinition($this->testOBJ->getCharSelectorDefinition());
1151 $char_selector->addFormProperties($form);
1152 $char_selector->setFormValues($form);
1153 }
1154 }
1155
1160 {
1161 if ($form->getItemByPostVar('title_output') instanceof ilFormPropertyGUI)
1162 {
1163 $this->testOBJ->setTitleOutput($form->getItemByPostVar('title_output')->getValue());
1164 }
1165
1166 if ($form->getItemByPostVar('autosave') instanceof ilFormPropertyGUI)
1167 {
1168 $this->testOBJ->setAutosave($form->getItemByPostVar('autosave')->getChecked());
1169 $this->testOBJ->setAutosaveIval($form->getItemByPostVar('autosave_ival')->getValue() * 1000);
1170 }
1171
1172 if ($form->getItemByPostVar('chb_shuffle_questions') instanceof ilFormPropertyGUI)
1173 {
1174 $this->testOBJ->setShuffleQuestions($form->getItemByPostVar('chb_shuffle_questions')->getChecked());
1175 }
1176
1177 if (!$this->testOBJ->participantDataExist() && $this->formPropertyExists($form, 'offer_hints'))
1178 {
1179 $this->testOBJ->setOfferingQuestionHintsEnabled($form->getItemByPostVar('offer_hints')->getChecked());
1180 }
1181
1182 if ($this->formPropertyExists($form, 'instant_feedback'))
1183 {
1184 $this->testOBJ->setScoringFeedbackOptionsByArray($form->getItemByPostVar('instant_feedback')->getValue());
1185 }
1186
1187 if (!$this->testOBJ->participantDataExist() && $this->formPropertyExists($form, 'obligations_enabled'))
1188 {
1189 $this->testOBJ->setObligationsEnabled($form->getItemByPostVar('obligations_enabled')->getChecked());
1190 }
1191
1192 if( $this->isCharSelectorPropertyRequired() )
1193 {
1194 require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php';
1196 $char_selector->addFormProperties($form);
1197 $char_selector->getFormValues($form);
1198 $this->testOBJ->setCharSelectorAvailability($char_selector->getConfig()->getAvailability());
1199 $this->testOBJ->setCharSelectorDefinition($char_selector->getConfig()->getDefinition());
1200 }
1201 }
1202
1207 {
1208 // sequence properties
1209 $seqheader = new ilFormSectionHeaderGUI();
1210 $seqheader->setTitle($this->lng->txt("tst_sequence_properties"));
1211 $form->addItem($seqheader);
1212
1213 // use previous answers
1214 $prevanswers = new ilCheckboxInputGUI($this->lng->txt("tst_use_previous_answers"), "chb_use_previous_answers");
1215 $prevanswers->setValue(1);
1216 $prevanswers->setChecked($this->testOBJ->getUsePreviousAnswers());
1217 $prevanswers->setInfo($this->lng->txt("tst_use_previous_answers_description"));
1218 $form->addItem($prevanswers);
1219
1220 // show suspend test
1221 $cancel = new ilCheckboxInputGUI($this->lng->txt("tst_show_cancel"), "chb_show_cancel");
1222 $cancel->setValue(1);
1223 $cancel->setChecked($this->testOBJ->getShowCancel());
1224 $cancel->setInfo($this->lng->txt("tst_show_cancel_description"));
1225 $form->addItem($cancel);
1226
1227 // postpone questions
1228 $postpone = new ilCheckboxInputGUI($this->lng->txt("tst_postpone"), "chb_postpone");
1229 $postpone->setValue(1);
1230 $postpone->setChecked($this->testOBJ->getSequenceSettings());
1231 $postpone->setInfo($this->lng->txt("tst_postpone_description"));
1232 $form->addItem($postpone);
1233
1234 // show list of questions
1235 $list_of_questions = new ilCheckboxInputGUI($this->lng->txt("tst_show_summary"), "list_of_questions");
1236 //$list_of_questions->setOptionTitle($this->lng->txt("tst_show_summary"));
1237 $list_of_questions->setValue(1);
1238 $list_of_questions->setChecked($this->testOBJ->getListOfQuestions());
1239 $list_of_questions->setInfo($this->lng->txt("tst_show_summary_description"));
1240
1241 $list_of_questions_options = new ilCheckboxGroupInputGUI('', "list_of_questions_options");
1242 $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_start"), 'chb_list_of_questions_start', ''));
1243 $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_end"), 'chb_list_of_questions_end', ''));
1244 $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_with_description"), 'chb_list_of_questions_with_description', ''));
1245 $values = array();
1246 if ($this->testOBJ->getListOfQuestionsStart()) array_push($values, 'chb_list_of_questions_start');
1247 if ($this->testOBJ->getListOfQuestionsEnd()) array_push($values, 'chb_list_of_questions_end');
1248 if ($this->testOBJ->getListOfQuestionsDescription()) array_push($values, 'chb_list_of_questions_with_description');
1249 $list_of_questions_options->setValue($values);
1250
1251 $list_of_questions->addSubItem($list_of_questions_options);
1252 $form->addItem($list_of_questions);
1253
1254 // show question marking
1255 $marking = new ilCheckboxInputGUI($this->lng->txt("question_marking"), "chb_show_marker");
1256 $marking->setValue(1);
1257 $marking->setChecked($this->testOBJ->getShowMarker());
1258 $marking->setInfo($this->lng->txt("question_marking_description"));
1259 $form->addItem($marking);
1260 }
1261
1266 {
1267 if( $this->formPropertyExists($form, 'chb_use_previous_answers') )
1268 {
1269 $this->testOBJ->setUsePreviousAnswers($form->getInput('chb_use_previous_answers'));
1270 }
1271
1272 if( $this->formPropertyExists($form, 'chb_show_cancel') )
1273 {
1274 $this->testOBJ->setShowCancel($form->getItemByPostVar('chb_show_cancel')->getChecked());
1275 }
1276
1277 if( $this->formPropertyExists($form, 'chb_postpone') )
1278 {
1279 $this->testOBJ->setPostponingEnabled($form->getItemByPostVar('chb_postpone')->getChecked());
1280 }
1281
1282 $this->testOBJ->setListOfQuestions($form->getItemByPostVar('list_of_questions')->getChecked());
1283 $listOfQuestionsOptions = $form->getItemByPostVar('list_of_questions_options')->getValue();
1284 if(is_array($listOfQuestionsOptions))
1285 {
1286 $this->testOBJ->setListOfQuestionsStart(in_array('chb_list_of_questions_start', $listOfQuestionsOptions));
1287 $this->testOBJ->setListOfQuestionsEnd(in_array('chb_list_of_questions_end', $listOfQuestionsOptions));
1288 $this->testOBJ->setListOfQuestionsDescription(in_array('chb_list_of_questions_with_description', $listOfQuestionsOptions));
1289 }
1290 else
1291 {
1292 $this->testOBJ->setListOfQuestionsStart(0);
1293 $this->testOBJ->setListOfQuestionsEnd(0);
1294 $this->testOBJ->setListOfQuestionsDescription(0);
1295 }
1296
1297 if( $this->formPropertyExists($form, 'chb_show_marker') )
1298 {
1299 $this->testOBJ->setShowMarker($form->getItemByPostVar('chb_show_marker')->getChecked());
1300 }
1301 }
1302
1307 {
1308 $testFinishHeader = new ilFormSectionHeaderGUI();
1309 $testFinishHeader->setTitle($this->lng->txt("tst_final_information"));
1310 $form->addItem($testFinishHeader);
1311
1312 // examview
1313 $enable_examview = new ilCheckboxInputGUI($this->lng->txt("enable_examview"), 'enable_examview');
1314 $enable_examview->setValue(1);
1315 $enable_examview->setChecked($this->testOBJ->getEnableExamview());
1316 $enable_examview->setInfo($this->lng->txt("enable_examview_desc"));
1317 $show_examview_pdf = new ilCheckboxInputGUI('', 'show_examview_pdf');
1318 $show_examview_pdf->setValue(1);
1319 $show_examview_pdf->setChecked($this->testOBJ->getShowExamviewPdf());
1320 $show_examview_pdf->setOptionTitle($this->lng->txt("show_examview_pdf"));
1321 $enable_examview->addSubItem($show_examview_pdf);
1322 $form->addItem($enable_examview);
1323
1324 // show final statement
1325 $showfinal = new ilCheckboxInputGUI($this->lng->txt("final_statement"), "showfinalstatement");
1326 $showfinal->setChecked($this->testOBJ->getShowFinalStatement());
1327 $showfinal->setInfo($this->lng->txt("final_statement_show_desc"));
1328 $form->addItem($showfinal);
1329 // final statement
1330 $finalstatement = new ilTextAreaInputGUI($this->lng->txt("final_statement"), "finalstatement");
1331 $finalstatement->setRequired(true);
1332 $finalstatement->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getFinalStatement(), false, true));
1333 $finalstatement->setRows(10);
1334 $finalstatement->setCols(80);
1335 $finalstatement->setUseRte(TRUE);
1336 $finalstatement->addPlugin("latex");
1337 $finalstatement->addButton("latex");
1338 $finalstatement->setRTESupport($this->testOBJ->getId(), "tst", "assessment");
1339 $finalstatement->setRteTagSet('full');
1340 $showfinal->addSubItem($finalstatement);
1341
1342 $redirection_mode = $this->testOBJ->getRedirectionMode();
1343 $rm_enabled = new ilCheckboxInputGUI($this->lng->txt('redirect_after_finishing_tst'), 'redirection_enabled');
1344 $rm_enabled->setInfo($this->lng->txt('redirect_after_finishing_tst_desc'));
1345 $rm_enabled->setChecked($redirection_mode == '0' ? false : true);
1346 $radio_rm = new ilRadioGroupInputGUI($this->lng->txt('redirect_after_finishing_rule'), 'redirection_mode');
1347 $always = new ilRadioOption($this->lng->txt('redirect_always'), REDIRECT_ALWAYS);
1348 $radio_rm->addOption($always);
1349 $kiosk = new ilRadioOption($this->lng->txt('redirect_in_kiosk_mode'), REDIRECT_KIOSK);
1350 $radio_rm->addOption($kiosk);
1351 $radio_rm->setValue(in_array($redirection_mode, array(REDIRECT_ALWAYS, REDIRECT_KIOSK)) ? $redirection_mode : REDIRECT_ALWAYS);
1352 $rm_enabled->addSubItem($radio_rm);
1353 $redirection_url = new ilTextInputGUI($this->lng->txt('redirection_url'), 'redirection_url');
1354 $redirection_url->setValue((string)$this->testOBJ->getRedirectionUrl());
1355 $redirection_url->setRequired(true);
1356 $rm_enabled->addSubItem($redirection_url);
1357
1358 $form->addItem($rm_enabled);
1359
1360 // Sign submission
1361 $sign_submission = $this->testOBJ->getSignSubmission();
1362 $sign_submission_enabled = new ilCheckboxInputGUI($this->lng->txt('sign_submission'), 'sign_submission');
1363 $sign_submission_enabled->setChecked($sign_submission);
1364 $sign_submission_enabled->setInfo($this->lng->txt('sign_submission_info'));
1365 $form->addItem($sign_submission_enabled);
1366
1367 // mail notification
1368 $mailnotification = new ilCheckboxInputGUI($this->lng->txt("tst_finish_notification"), "mailnotification");
1369 $mailnotification->setInfo($this->lng->txt("tst_finish_notification_desc"));
1370 $mailnotification->setChecked($this->testOBJ->getMailNotification() > 0);
1371 $form->addItem($mailnotification);
1372
1373 $mailnotificationContent = new ilRadioGroupInputGUI($this->lng->txt("tst_finish_notification_content"), "mailnotification_content");
1374 $mailnotificationContent->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_simple"), 1, ''));
1375 $mailnotificationContent->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_advanced"), 2, ''));
1376 $mailnotificationContent->setValue($this->testOBJ->getMailNotification() ? $this->testOBJ->getMailNotification() : 1);
1377 $mailnotificationContent->setRequired(true);
1378 $mailnotification->addSubItem($mailnotificationContent);
1379
1380 $mailnottype = new ilCheckboxInputGUI('', "mailnottype");
1381 $mailnottype->setValue(1);
1382 $mailnottype->setOptionTitle($this->lng->txt("mailnottype"));
1383 $mailnottype->setChecked($this->testOBJ->getMailNotificationType());
1384 $mailnotification->addSubItem($mailnottype);
1385 }
1386
1391 {
1392 if( $this->formPropertyExists($form, 'enable_examview') )
1393 {
1394 $this->testOBJ->setEnableExamview($form->getItemByPostVar('enable_examview')->getChecked());
1395 $this->testOBJ->setShowExamviewPdf($form->getItemByPostVar('show_examview_pdf')->getChecked());
1396 }
1397
1398 $this->testOBJ->setShowFinalStatement($form->getItemByPostVar('showfinalstatement')->getChecked());
1399 $this->testOBJ->setFinalStatement($form->getItemByPostVar('finalstatement')->getValue(), false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
1400
1401 if( $form->getItemByPostVar('redirection_enabled')->getChecked() )
1402 {
1403 $this->testOBJ->setRedirectionMode($form->getItemByPostVar('redirection_mode')->getValue());
1404 }
1405 else
1406 {
1407 $this->testOBJ->setRedirectionMode(REDIRECT_NONE);
1408 }
1409 if( strlen($form->getItemByPostVar('redirection_url')->getValue()) )
1410 {
1411 $this->testOBJ->setRedirectionUrl($form->getItemByPostVar('redirection_url')->getValue());
1412 }
1413 else
1414 {
1415 $this->testOBJ->setRedirectionUrl(null);
1416 }
1417
1418 if( $this->formPropertyExists($form, 'sign_submission') )
1419 {
1420 $this->testOBJ->setSignSubmission($form->getItemByPostVar('sign_submission')->getChecked());
1421 }
1422
1423 if( $this->formPropertyExists($form, 'mailnotification') && $form->getItemByPostVar('mailnotification')->getChecked() )
1424 {
1425 $this->testOBJ->setMailNotification($form->getItemByPostVar('mailnotification_content')->getValue());
1426 $this->testOBJ->setMailNotificationType($form->getItemByPostVar('mailnottype')->getChecked());
1427 }
1428 else
1429 {
1430 $this->testOBJ->setMailNotification(0);
1431 $this->testOBJ->setMailNotificationType(false);
1432 }
1433 }
1434}
$section
Definition: Utf8Test.php:84
const IL_CAL_TIMESTAMP
const IL_CAL_UNIX
const IL_CAL_DATETIME
Class ilAccessHandler.
This shows a character selector.
This class represents a property in a property form.
This class represents a checkbox property in a property form.
This class represents an option in a checkbox group.
Confirmation screen class.
This class provides processing control methods.
Database Wrapper.
Definition: class.ilDB.php:29
input GUI for a time span (start and end date)
This class represents a date/time property in a property form.
@classDescription Date and time handling
Class ilECSTestSettings.
This class represents a property in a property form.
This class represents a section header in a property form.
dateDB2timestamp($ADatumSQL)
db-datetime to timestamp
language handling
This class represents a number property in a property form.
& _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
Class ilObjTestGUI.
saveQuestionBehaviourProperties(ilPropertyFormGUI $form)
confirmedResetTemplateCmd()
Enable all settings - remove template.
showResetTemplateConfirmationCmd()
Enable all settings - Confirmation.
__construct(ilCtrl $ctrl, ilAccessHandler $access, ilLanguage $lng, ilTemplate $tpl, ilTree $tree, ilDB $db, ilPluginAdmin $pluginAdmin, ilObjUser $activeUser, ilObjTestGUI $testGUI)
Constructor.
isSkillServiceSettingToBeAdjusted(ilPropertyFormGUI $form)
showConfirmation(ilPropertyFormGUI $form, $oldQuestionSetType, $newQuestionSetType, $hasQuestionsWithoutQuestionpool)
addQuestionBehaviourProperties(ilPropertyFormGUI $form)
const QUESTION_SET_TYPE_DYNAMIC
type setting value for dynamic question set (continues testing mode)
const QUESTION_SET_TYPE_RANDOM
type setting value for random question set
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
static isSkillManagementGloballyActivated()
static _getAllReferences($a_id)
get all reference ids of object
Administration class for plugins.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
getItemByPostVar($a_post_var)
Get Item by POST variable.
This class represents a property in a property form.
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR
formPropertyExists(ilPropertyFormGUI $form, $propertyId)
getTemplateSettingValue($settingName)
removeHiddenItems(ilPropertyFormGUI $form)
This class represents a text area property in a property form.
This class represents a text property in a property form.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const REDIRECT_NONE
Redirect after finishing test constants.
const REDIRECT_ALWAYS
const REDIRECT_KIOSK
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
$errors