1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Administration/classes/class.ilSettingsTemplateConfig.php';
5require_once 'Modules/Test/classes/inc.AssessmentConstants.php';
6require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php';
7
8/**
9 * @author		Björn Heyser <bheyser@databay.de>
10 * @version		$Id$
11 *
12 * @package     Modules/Test
13 */
14class ilTestSettingsTemplateConfig extends ilSettingsTemplateConfig
15{
16    /**
17     * @var ilLanguage
18     */
19    protected $lng;
20
21    /**
22     * @param ilLanguage $lng
23     */
24    public function __construct(ilLanguage $lng)
25    {
26        $this->lng = $lng;
27        parent::__construct('tst');
28    }
29
30    public function init()
31    {
32        $this->initLanguage();
33        $this->initHidableTabs();
34        $this->initSettings();
35    }
36
37    private function initLanguage()
38    {
39        $this->lng->loadLanguageModule("tst");
40        $this->lng->loadLanguageModule("assessment");
41    }
42
43    private function initHidableTabs()
44    {
45        $this->addHidableTab("questions", $this->lng->txt('assQuestions') . ' - ' . $this->lng->txt('edit_test_questions'));
46        $this->addHidableTab("mark_schema", $this->lng->txt('settings') . ' - ' . $this->lng->txt("mark_schema"));
47        $this->addHidableTab("certificate", $this->lng->txt('settings') . ' - ' . $this->lng->txt("certificate"));
48        $this->addHidableTab("defaults", $this->lng->txt('settings') . ' - ' . $this->lng->txt("tst_default_settings"));
49
50        $this->addHidableTab("learning_progress", $this->lng->txt("learning_progress"));
51        $this->addHidableTab("manscoring", $this->lng->txt("manscoring"));
52        $this->addHidableTab("statistics", $this->lng->txt("statistics"));
53        $this->addHidableTab("history", $this->lng->txt("history"));
54        $this->addHidableTab("meta_data", $this->lng->txt("meta_data"));
55        $this->addHidableTab("export", $this->lng->txt("export"));
56        $this->addHidableTab("permissions", $this->lng->txt("permission"));
57    }
58
59    private function initSettings()
60    {
61        $this->addGeneralPropertySettings();
62        $this->addTestIntroProperties();
63        $this->addTestAccessProperties();
64        $this->addTestRunProperties();
65        $this->addQuestionBehaviourProperties();
66        $this->addTestSequenceProperties();
67        $this->addTestFinishProperties();
68        $this->addScoringOptionsProperties();
69        $this->addResultSummaryProperties();
70        $this->addResultDetailsProperties();
71        $this->addResultMiscOptionsProperties();
72    }
73
74    private function addGeneralPropertySettings()
75    {
76        $this->addSetting(
77            "use_pool",
78            ilSettingsTemplateConfig::SELECT,
79            $this->lng->txt("test_question_pool_usage"),
80            true,
81            0,
82            array(
83                1 => $this->lng->txt('test_question_pool_usage_optional'),
84                0 => $this->lng->txt('test_question_pool_usage_tst_directly')
85            )
86        );
87
88        $this->addSetting(
89            "question_set_type",
90            ilSettingsTemplateConfig::SELECT,
91            $this->lng->txt("tst_question_set_type"),
92            true,
93            0,
94            array(
95                ilObjTest::QUESTION_SET_TYPE_FIXED => $this->lng->txt("tst_question_set_type_fixed"),
96                ilObjTest::QUESTION_SET_TYPE_RANDOM => $this->lng->txt("tst_question_set_type_random"),
97                ilObjTest::QUESTION_SET_TYPE_DYNAMIC => $this->lng->txt("tst_question_set_type_dynamic"),
98            )
99        );
100    }
101
102    private function addTestIntroProperties()
103    {
104        // Test Introduction
105        $this->addSetting(
106            "intro_enabled",
107            ilSettingsTemplateConfig::BOOL,
108            $this->lng->txt("tst_introduction"),
109            false
110        );
111
112        // All Details on Info Screen
113        $this->addSetting(
114            "showinfo",
115            ilSettingsTemplateConfig::BOOL,
116            $this->lng->txt("showinfo"),
117            true
118        );
119    }
120
121    private function addTestAccessProperties()
122    {
123        $this->addSetting(
124            "chb_starting_time",
125            ilSettingsTemplateConfig::BOOL,
126            $this->lng->txt("tst_starting_time"),
127            false
128        );
129
130        $this->addSetting(
131            "chb_ending_time",
132            ilSettingsTemplateConfig::BOOL,
133            $this->lng->txt("tst_ending_time"),
134            false
135        );
136
137        $this->addSetting(
138            "password_enabled",
139            ilSettingsTemplateConfig::BOOL,
140            $this->lng->txt("tst_password"),
141            false
142        );
143
144        $this->addSetting(
145            "fixedparticipants",
146            ilSettingsTemplateConfig::BOOL,
147            $this->lng->txt("participants_invitation"),
148            true
149        );
150
151        $this->addSetting(
152            "limitUsers",
153            ilSettingsTemplateConfig::BOOL,
154            $this->lng->txt("tst_allowed_users"),
155            false
156        );
157    }
158
159    private function addTestRunProperties()
160    {
161        $this->addSetting(
162            "nr_of_tries",
163            ilSettingsTemplateConfig::TEXT,
164            $this->lng->txt("tst_nr_of_tries"),
165            false,
166            3
167        );
168
169        $this->addSetting(
170            "chb_processing_time",
171            ilSettingsTemplateConfig::BOOL,
172            $this->lng->txt("tst_processing_time"),
173            false
174        );
175
176        $this->addSetting(
177            "kiosk",
178            ilSettingsTemplateConfig::BOOL,
179            $this->lng->txt("kiosk"),
180            false
181        );
182
183        $this->addSetting(
184            "examid_in_test_pass",
185            ilSettingsTemplateConfig::BOOL,
186            $this->lng->txt("examid_in_test_pass"),
187            false
188        );
189    }
190
191    private function addQuestionBehaviourProperties()
192    {
193        $this->addSetting(
194            "title_output",
195            ilSettingsTemplateConfig::SELECT,
196            $this->lng->txt("tst_title_output"),
197            true,
198            0,
199            array(
200                '0' => $this->lng->txt("tst_title_output_full"),
201                '1' => $this->lng->txt("tst_title_output_hide_points"),
202                '2' => $this->lng->txt("tst_title_output_no_title"),
203            )
204        );
205
206        $this->addSetting(
207            "autosave",
208            ilSettingsTemplateConfig::TEXT,
209            $this->lng->txt("autosave"),
210            true,
211            5
212        );
213
214        $this->addSetting(
215            "chb_shuffle_questions",
216            ilSettingsTemplateConfig::BOOL,
217            $this->lng->txt("tst_shuffle_questions"),
218            true
219        );
220
221        $this->addSetting(
222            "offer_hints",
223            ilSettingsTemplateConfig::BOOL,
224            $this->lng->txt("tst_setting_offer_hints_label"),
225            true
226        );
227
228        $this->addSetting(
229            "instant_feedback_contents",
230            ilSettingsTemplateConfig::CHECKBOX,
231            $this->lng->txt("tst_instant_feedback"),
232            true,
233            0,
234            array(
235                'instant_feedback_points' => $this->lng->txt("tst_instant_feedback_results"),
236                'instant_feedback_generic' => $this->lng->txt("tst_instant_feedback_answer_generic"),
237                'instant_feedback_specific' => $this->lng->txt("tst_instant_feedback_answer_specific"),
238                'instant_feedback_solution' => $this->lng->txt("tst_instant_feedback_solution")
239            )
240        );
241
242        $this->addSetting(
243            "instant_feedback_trigger",
244            ilSettingsTemplateConfig::SELECT,
245            $this->lng->txt("tst_instant_feedback_trigger"),
246            true,
247            0,
248            array(
249                ilObjTestSettingsGeneralGUI::INSTANT_FEEDBACK_TRIGGER_MANUAL => $this->lng->txt("tst_instant_feedback_trigger_manual"),
250                ilObjTestSettingsGeneralGUI::INSTANT_FEEDBACK_TRIGGER_FORCED => $this->lng->txt("tst_instant_feedback_trigger_forced")
251            )
252        );
253
254        $this->addSetting(
255            'answer_fixation_handling',
256            ilSettingsTemplateConfig::SELECT,
257            $this->lng->txt('tst_answer_fixation_handling'),
258            true,
259            0,
260            array(
261                ilObjTestSettingsGeneralGUI::ANSWER_FIXATION_NONE => $this->lng->txt('tst_answer_fixation_none'),
262                ilObjTestSettingsGeneralGUI::ANSWER_FIXATION_ON_INSTANT_FEEDBACK => $this->lng->txt('tst_answer_fixation_on_instant_feedback'),
263                ilObjTestSettingsGeneralGUI::ANSWER_FIXATION_ON_FOLLOWUP_QUESTION => $this->lng->txt('tst_answer_fixation_on_followup_question'),
264                ilObjTestSettingsGeneralGUI::ANSWER_FIXATION_ON_IFB_OR_FUQST => $this->lng->txt('tst_answer_fixation_on_instantfb_or_followupqst')
265            )
266        );
267
268        $this->addSetting(
269            "obligations_enabled",
270            ilSettingsTemplateConfig::BOOL,
271            $this->lng->txt("tst_setting_enable_obligations_label"),
272            true
273        );
274    }
275
276    private function addTestSequenceProperties()
277    {
278        $this->addSetting(
279            "chb_use_previous_answers",
280            ilSettingsTemplateConfig::BOOL,
281            $this->lng->txt("tst_use_previous_answers"),
282            true
283        );
284
285        $this->addSetting(
286            "chb_show_cancel",
287            ilSettingsTemplateConfig::BOOL,
288            $this->lng->txt("tst_show_cancel"),
289            true
290        );
291
292        $this->addSetting(
293            "chb_postpone",
294            ilSettingsTemplateConfig::BOOL,
295            $this->lng->txt("tst_postpone"),
296            true
297        );
298
299        $this->addSetting(
300            "list_of_questions",
301            ilSettingsTemplateConfig::BOOL,
302            $this->lng->txt("tst_show_summary"),
303            false
304        );
305
306        $this->addSetting(
307            "chb_show_marker",
308            ilSettingsTemplateConfig::BOOL,
309            $this->lng->txt("question_marking"),
310            true
311        );
312    }
313
314    private function addTestFinishProperties()
315    {
316        $this->addSetting(
317            "enable_examview",
318            ilSettingsTemplateConfig::BOOL,
319            $this->lng->txt("enable_examview"),
320            false
321        );
322
323        $this->addSetting(
324            "showfinalstatement",
325            ilSettingsTemplateConfig::BOOL,
326            $this->lng->txt("final_statement"),
327            false
328        );
329
330        /* $this->addSetting(
331            "redirection_enabled",
332            ilSettingsTemplateConfig::SELECT,
333            $this->lng->txt("redirect_after_finishing_tst"),
334            false,
335            0,
336            array(
337                REDIRECT_NONE => $this->lng->txt("redirect_none"),
338                REDIRECT_ALWAYS => $this->lng->txt("redirect_always"),
339                REDIRECT_KIOSK => $this->lng->txt("redirect_in_kiosk_mode"),
340            )
341        ); */
342        $this->addSetting(
343            "redirection_enabled",
344            ilSettingsTemplateConfig::TEXT,
345            $this->lng->txt("redirect_after_finishing_tst"),
346            false
347        );
348
349        $this->addSetting(
350            "sign_submission",
351            ilSettingsTemplateConfig::BOOL,
352            $this->lng->txt("sign_submission"),
353            true
354        );
355
356        $this->addSetting(
357            "mailnotification",
358            ilSettingsTemplateConfig::SELECT,
359            $this->lng->txt("tst_finish_notification"),
360            false,
361            0,
362            array(
363                '0' => $this->lng->txt("tst_finish_notification_no"),
364                '1' => $this->lng->txt("tst_finish_notification_simple"),
365                '2' => $this->lng->txt("tst_finish_notification_advanced"),
366            )
367        );
368    }
369
370    private function addScoringOptionsProperties()
371    {
372        $this->addSetting(
373            "count_system",
374            ilSettingsTemplateConfig::SELECT,
375            $this->lng->txt("tst_text_count_system"),
376            true,
377            0,
378            array(
379                '0' => $this->lng->txt("tst_count_partial_solutions"),
380                '1' => $this->lng->txt("tst_count_correct_solutions")
381            )
382        );
383
384        $this->addSetting(
385            "mc_scoring",
386            ilSettingsTemplateConfig::SELECT,
387            $this->lng->txt("tst_score_mcmr_questions"),
388            true,
389            0,
390            array(
391                '0' => $this->lng->txt("tst_score_mcmr_zero_points_when_unanswered"),
392                '1' => $this->lng->txt("tst_score_mcmr_use_scoring_system")
393            )
394        );
395
396        $this->addSetting(
397            "score_cutting",
398            ilSettingsTemplateConfig::SELECT,
399            $this->lng->txt("tst_score_cutting"),
400            true,
401            0,
402            array(
403                '0' => $this->lng->txt("tst_score_cut_question"),
404                '1' => $this->lng->txt("tst_score_cut_test")
405            )
406        );
407
408        $this->addSetting(
409            "pass_scoring",
410            ilSettingsTemplateConfig::SELECT,
411            $this->lng->txt("tst_pass_scoring"),
412            true,
413            0,
414            array(
415                '0' => $this->lng->txt("tst_pass_last_pass"),
416                '1' => $this->lng->txt("tst_pass_best_pass")
417            )
418        );
419
420        $this->addSetting(
421            "pass_deletion_allowed",
422            ilSettingsTemplateConfig::SELECT,
423            $this->lng->txt("tst_pass_deletion"),
424            true,
425            0,
426            array(
427                '0' => $this->lng->txt("tst_pass_deletion_not_allowed"),
428                '1' => $this->lng->txt("tst_pass_deletion_allowed")
429            )
430        );
431    }
432
433    private function addResultSummaryProperties()
434    {
435        $this->addSetting(
436            "results_access_enabled",
437            ilSettingsTemplateConfig::SELECT,
438            $this->lng->txt("tst_results_access_enabled"),
439            false,
440            0,
441            array(
442                '0' => $this->lng->txt("tst_results_access_never"),
443                '2' => $this->lng->txt("tst_results_access_always"),
444                '1' => $this->lng->txt("tst_results_access_finished"),
445                '3' => $this->lng->txt("tst_results_access_date")
446            )
447        );
448
449        $this->addSetting(
450            "grading_status",
451            ilSettingsTemplateConfig::BOOL,
452            $this->lng->txt("tst_results_grading_opt_show_status"),
453            true
454        );
455
456        $this->addSetting(
457            "grading_mark",
458            ilSettingsTemplateConfig::BOOL,
459            $this->lng->txt("tst_results_grading_opt_show_mark"),
460            true
461        );
462    }
463
464    private function addResultDetailsProperties()
465    {
466        $this->addSetting(
467            "solution_details",
468            ilSettingsTemplateConfig::BOOL,
469            $this->lng->txt("tst_show_solution_details"),
470            false
471        );
472
473        $this->addSetting(
474            "solution_feedback",
475            ilSettingsTemplateConfig::BOOL,
476            $this->lng->txt("tst_show_solution_feedback"),
477            true
478        );
479
480        $this->addSetting(
481            "solution_suggested",
482            ilSettingsTemplateConfig::BOOL,
483            $this->lng->txt("tst_show_solution_suggested"),
484            true
485        );
486
487        $this->addSetting(
488            "solution_printview",
489            ilSettingsTemplateConfig::BOOL,
490            $this->lng->txt("tst_show_solution_printview"),
491            false
492        );
493
494        $this->addSetting(
495            "highscore_enabled",
496            ilSettingsTemplateConfig::BOOL,
497            $this->lng->txt("tst_highscore_enabled"),
498            false
499        );
500
501        $this->addSetting(
502            "solution_signature",
503            ilSettingsTemplateConfig::BOOL,
504            $this->lng->txt("tst_show_solution_signature"),
505            true
506        );
507
508        $this->addSetting(
509            "examid_in_test_res",
510            ilSettingsTemplateConfig::BOOL,
511            $this->lng->txt("examid_in_test_res"),
512            true
513        );
514
515        $this->addSetting(
516            "exp_sc_short",
517            ilSettingsTemplateConfig::BOOL,
518            $this->lng->txt("tst_exp_sc_short"),
519            true
520        );
521    }
522
523    private function addResultMiscOptionsProperties()
524    {
525        $this->addSetting(
526            "anonymity",
527            ilSettingsTemplateConfig::SELECT,
528            $this->lng->txt("tst_anonymity"),
529            true,
530            0,
531            array(
532                '0' => $this->lng->txt("tst_anonymity_no_anonymization"),
533                '1' => $this->lng->txt("tst_anonymity_anonymous_test"),
534            )
535        );
536
537        $this->addSetting(
538            "enable_archiving",
539            ilSettingsTemplateConfig::BOOL,
540            $this->lng->txt("test_enable_archiving"),
541            true
542        );
543    }
544}
545