private function buildSettingsForm() { /** * @var $ilAccess ilAccessHandler */ global $ilAccess; include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTableWidth("100%"); $form->setId("settings"); $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt('settings')); $form->addItem($header); // question process locking behaviour (e.g. on saving users working data) $chb = new ilCheckboxInputGUI($this->lng->txt('ass_process_lock'), 'ass_process_lock'); $chb->setChecked($this->object->getAssessmentProcessLockMode() != ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE); $chb->setInfo($this->lng->txt('ass_process_lock_desc')); $form->addItem($chb); $rg = new ilRadioGroupInputGUI($this->lng->txt('ass_process_lock_mode'), 'ass_process_lock_mode'); $rg->setRequired(true); $opt = new ilRadioOption($this->lng->txt('ass_process_lock_mode_file'), ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_FILE); $opt->setInfo($this->lng->txt('ass_process_lock_mode_file_desc')); $rg->addOption($opt); $opt = new ilRadioOption($this->lng->txt('ass_process_lock_mode_db'), ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_DB); $opt->setInfo($this->lng->txt('ass_process_lock_mode_db_desc')); $rg->addOption($opt); if ($this->object->getAssessmentProcessLockMode() != ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE) { $rg->setValue($this->object->getAssessmentProcessLockMode()); } $chb->addSubItem($rg); $assessmentSetting = new ilSetting('assessment'); $imap_line_color = array_key_exists('imap_line_color', $_GET) ? $_GET['imap_line_color'] : $assessmentSetting->get('imap_line_color'); if (strlen($imap_line_color) == 0) { $imap_line_color = 'FF0000'; } $linepicker = new ilColorPickerInputGUI($this->lng->txt('assessment_imap_line_color'), 'imap_line_color'); $linepicker->setValue($imap_line_color); $form->addItem($linepicker); $user_criteria = array_key_exists('user_criteria', $_GET) ? $_GET['user_criteria'] : $assessmentSetting->get('user_criteria'); $userCriteria = new ilSelectInputGUI($this->lng->txt('user_criteria'), 'user_criteria'); $userCriteria->setInfo($this->lng->txt('user_criteria_desc')); $userCriteria->setRequired(true); $fields = array('usr_id', 'login', 'email', 'matriculation', 'ext_account'); $usr_fields = array(); foreach ($fields as $field) { $usr_fields[$field] = $field; } $userCriteria->setOptions($usr_fields); $userCriteria->setValue($user_criteria); $form->addItem($userCriteria); // question settings $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("assf_questiontypes")); $form->addItem($header); // available question types $allowed = new ilCheckboxGroupInputGUI($this->lng->txt('assf_allowed_questiontypes'), "chb_allowed_questiontypes"); $questiontypes =& ilObjQuestionPool::_getQuestionTypes(TRUE); $forbidden_types = $this->object->_getForbiddenQuestionTypes(); $allowedtypes = array(); foreach ($questiontypes as $qt) { if (!in_array($qt['question_type_id'], $forbidden_types)) { array_push($allowedtypes, $qt['question_type_id']); } } $allowed->setValue($allowedtypes); foreach ($questiontypes as $type_name => $qtype) { $allowed->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"])); } $allowed->setInfo($this->lng->txt('assf_allowed_questiontypes_desc')); $form->addItem($allowed); // manual scoring $manual = new ilCheckboxGroupInputGUI($this->lng->txt('assessment_log_manual_scoring_activate'), "chb_manual_scoring"); $manscoring = $this->object->_getManualScoring(); $manual->setValue($manscoring); foreach ($questiontypes as $type_name => $qtype) { $manual->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"])); } $manual->setInfo($this->lng->txt('assessment_log_manual_scoring_desc')); $form->addItem($manual); // scoring adjustment active $scoring_activation = new ilCheckboxInputGUI($this->lng->txt('assessment_scoring_adjust'), 'chb_scoring_adjust'); $scoring_activation->setChecked($this->object->getScoringAdjustmentEnabled()); $scoring_activation->setInfo($this->lng->txt('assessment_scoring_adjust_desc')); $form->addItem($scoring_activation); // scoring adjustment $scoring = new ilCheckboxGroupInputGUI($this->lng->txt('assessment_log_scoring_adjustment_activate'), "chb_scoring_adjustment"); $scoring_active = $this->object->getScoringAdjustableQuestions(); $scoring->setValue($scoring_active); foreach ($questiontypes as $type_name => $qtype) { $scoring->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"])); } $scoring->setInfo($this->lng->txt('assessment_log_scoring_adjustment_desc')); $form->addItem($scoring); if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) { $form->addCommandButton("saveSettings", $this->lng->txt("save")); } return $form; }
private function buildForm() { require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt("save")); $form->setTableWidth("100%"); $form->setId("test_properties"); if (!$this->settingsTemplate || $this->formShowGeneralSection($this->settingsTemplate->getSettings())) { // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_general_properties")); $form->addItem($header); } // title & description (meta data) include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj = new ilMD($this->testOBJ->getId(), 0, "tst"); $md_section = $md_obj->getGeneral(); $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setRequired(true); $title->setValue($md_section->getTitle()); $form->addItem($title); $ids = $md_section->getDescriptionIds(); if ($ids) { $desc_obj = $md_section->getDescription(array_pop($ids)); $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description"); $desc->setCols(50); $desc->setRows(4); $desc->setValue($desc_obj->getDescription()); $form->addItem($desc); } // anonymity $anonymity = new ilRadioGroupInputGUI($this->lng->txt('tst_anonymity'), 'anonymity'); if ($this->testOBJ->participantDataExist()) { $anonymity->setDisabled(true); } $rb = new ilRadioOption($this->lng->txt('tst_anonymity_no_anonymization'), 0); $anonymity->addOption($rb); $rb = new ilRadioOption($this->lng->txt('tst_anonymity_anonymous_test'), 1); $anonymity->addOption($rb); $anonymity->setValue((int) $this->testOBJ->getAnonymity()); $form->addItem($anonymity); // test mode (question set type) $questSetType = new ilRadioGroupInputGUI($this->lng->txt("tst_question_set_type"), 'question_set_type'); $questSetTypeFixed = new ilRadioOption($this->lng->txt("tst_question_set_type_fixed"), ilObjTest::QUESTION_SET_TYPE_FIXED, $this->lng->txt("tst_question_set_type_fixed_desc")); $questSetType->addOption($questSetTypeFixed); $questSetTypeRandom = new ilRadioOption($this->lng->txt("tst_question_set_type_random"), ilObjTest::QUESTION_SET_TYPE_RANDOM, $this->lng->txt("tst_question_set_type_random_desc")); $questSetType->addOption($questSetTypeRandom); $questSetTypeContinues = new ilRadioOption($this->lng->txt("tst_question_set_type_dynamic"), ilObjTest::QUESTION_SET_TYPE_DYNAMIC, $this->lng->txt("tst_question_set_type_dynamic_desc")); $questSetType->addOption($questSetTypeContinues); $questSetType->setValue($this->testOBJ->getQuestionSetType()); if ($this->testOBJ->participantDataExist()) { $questSetType->setDisabled(true); } $form->addItem($questSetType); // pool usage $pool_usage = new ilCheckboxInputGUI($this->lng->txt("test_question_pool_usage"), "use_pool"); $pool_usage->setValue(1); $pool_usage->setChecked($this->testOBJ->getPoolUsage()); $form->addItem($pool_usage); // enable_archiving $enable_archiving = new ilCheckboxInputGUI($this->lng->txt('test_enable_archiving'), 'enable_archiving'); $enable_archiving->setValue(1); $enable_archiving->setChecked($this->testOBJ->getEnableArchiving()); $form->addItem($enable_archiving); // activation/availability (no template support yet) include_once "Services/Object/classes/class.ilObjectActivation.php"; $this->lng->loadLanguageModule('rep'); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('rep_activation_availability')); $form->addItem($section); // additional info only with multiple references $act_obj_info = $act_ref_info = ""; if (sizeof(ilObject::_getAllReferences($this->testOBJ->getId())) > 1) { $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info'); $act_ref_info = $this->lng->txt('rep_activation_access_ref_info'); } $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online'); $online->setChecked($this->testOBJ->isOnline()); $online->setInfo($this->lng->txt('tst_activation_online_info') . $act_obj_info); $form->addItem($online); $act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'activation_type'); $act_type->setInfo($act_ref_info); $act_type->setValue($this->testOBJ->isActivationLimited() ? ilObjectActivation::TIMINGS_ACTIVATION : ilObjectActivation::TIMINGS_DEACTIVATED); $opt = new ilRadioOption($this->lng->txt('rep_visibility_limitless'), ilObjectActivation::TIMINGS_DEACTIVATED); $opt->setInfo($this->lng->txt('tst_availability_limitless_info')); $act_type->addOption($opt); $opt = new ilRadioOption($this->lng->txt('rep_visibility_until'), ilObjectActivation::TIMINGS_ACTIVATION); $opt->setInfo($this->lng->txt('tst_availability_until_info')); $this->tpl->addJavaScript('./Services/Form/js/date_duration.js'); include_once "Services/Form/classes/class.ilDateDurationInputGUI.php"; $dur = new ilDateDurationInputGUI("", "access_period"); $dur->setShowTime(true); $date = $this->testOBJ->getActivationStartingTime(); $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $dur->setStartText($this->lng->txt('rep_activation_limited_start')); $date = $this->testOBJ->getActivationEndingTime(); $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $dur->setEndText($this->lng->txt('rep_activation_limited_end')); $opt->addSubItem($dur); $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'activation_visibility'); $visible->setInfo($this->lng->txt('tst_activation_limited_visibility_info')); $visible->setChecked($this->testOBJ->getActivationVisibility()); $opt->addSubItem($visible); $act_type->addOption($opt); $form->addItem($act_type); if (!$this->settingsTemplate || $this->formShowBeginningEndingInformation($this->settingsTemplate->getSettings())) { // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_beginning_ending_information")); $form->addItem($header); } // introduction $intro = new ilTextAreaInputGUI($this->lng->txt("tst_introduction"), "introduction"); $intro->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getIntroduction())); $intro->setRows(10); $intro->setCols(80); $intro->setUseRte(TRUE); $intro->addPlugin("latex"); $intro->addButton("latex"); $intro->setRTESupport($this->testOBJ->getId(), "tst", "assessment"); $intro->setRteTagSet('full'); $intro->setInfo($this->lng->txt('intro_desc')); // showinfo $showinfo = new ilCheckboxInputGUI('', "showinfo"); $showinfo->setValue(1); $showinfo->setChecked($this->testOBJ->getShowInfo()); $showinfo->setOptionTitle($this->lng->txt("showinfo")); $showinfo->setInfo($this->lng->txt("showinfo_desc")); $intro->addSubItem($showinfo); $form->addItem($intro); // final statement $finalstatement = new ilTextAreaInputGUI($this->lng->txt("final_statement"), "finalstatement"); $finalstatement->setValue($this->testOBJ->prepareTextareaOutput($this->testOBJ->getFinalStatement())); $finalstatement->setRows(10); $finalstatement->setCols(80); $finalstatement->setUseRte(TRUE); $finalstatement->addPlugin("latex"); $finalstatement->addButton("latex"); $finalstatement->setRTESupport($this->testOBJ->getId(), "tst", "assessment"); $finalstatement->setRteTagSet('full'); // show final statement $showfinal = new ilCheckboxInputGUI('', "showfinalstatement"); $showfinal->setValue(1); $showfinal->setChecked($this->testOBJ->getShowFinalStatement()); $showfinal->setOptionTitle($this->lng->txt("final_statement_show")); $showfinal->setInfo($this->lng->txt("final_statement_show_desc")); $finalstatement->addSubItem($showfinal); $form->addItem($finalstatement); // examview $enable_examview = new ilCheckboxInputGUI($this->lng->txt("enable_examview"), 'enable_examview'); $enable_examview->setValue(1); $enable_examview->setChecked($this->testOBJ->getEnableExamview()); $enable_examview->setInfo($this->lng->txt("enable_examview_desc")); $show_examview_html = new ilCheckboxInputGUI('', 'show_examview_html'); $show_examview_html->setValue(1); $show_examview_html->setChecked($this->testOBJ->getShowExamviewHtml()); $show_examview_html->setOptionTitle($this->lng->txt("show_examview_html")); $show_examview_html->setInfo($this->lng->txt("show_examview_html_desc")); $enable_examview->addSubItem($show_examview_html); $show_examview_pdf = new ilCheckboxInputGUI('', 'show_examview_pdf'); $show_examview_pdf->setValue(1); $show_examview_pdf->setChecked($this->testOBJ->getShowExamviewPdf()); $show_examview_pdf->setOptionTitle($this->lng->txt("show_examview_pdf")); $show_examview_pdf->setInfo($this->lng->txt("show_examview_pdf_desc")); $enable_examview->addSubItem($show_examview_pdf); $form->addItem($enable_examview); if (!$this->settingsTemplate || $this->formShowSessionSection($this->settingsTemplate->getSettings())) { // session properties $sessionheader = new ilFormSectionHeaderGUI(); $sessionheader->setTitle($this->lng->txt("tst_session_settings")); $form->addItem($sessionheader); } // max. number of passes $nr_of_tries = new ilTextInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries"); $nr_of_tries->setSize(3); $nr_of_tries->setValue($this->testOBJ->getNrOfTries()); $nr_of_tries->setRequired(true); $nr_of_tries->setSuffix($this->lng->txt("0_unlimited")); $total = $this->testOBJ->evalTotalPersons(); if ($total) { $nr_of_tries->setDisabled(true); } $form->addItem($nr_of_tries); // enable max. processing time $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time"); $processing->setValue(1); //$processing->setOptionTitle($this->lng->txt("enabled")); if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_processing_time')) { $processing->setChecked(true); } else { $processing->setChecked($this->testOBJ->getEnableProcessingTime()); } // max. processing time $processingtime = new ilDurationInputGUI('', 'processing_time'); $ptime = $this->testOBJ->getProcessingTimeAsArray(); $processingtime->setHours($ptime['hh']); $processingtime->setMinutes($ptime['mm']); $processingtime->setSeconds($ptime['ss']); $processingtime->setShowMonths(false); $processingtime->setShowDays(false); $processingtime->setShowHours(true); $processingtime->setShowMinutes(true); $processingtime->setShowSeconds(true); $processingtime->setInfo($this->lng->txt("tst_processing_time_desc")); $processing->addSubItem($processingtime); // reset max. processing time $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time"); $resetprocessing->setValue(1); $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time")); $resetprocessing->setChecked($this->testOBJ->getResetProcessingTime()); $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc")); $processing->addSubItem($resetprocessing); $form->addItem($processing); // enable starting time $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("tst_starting_time"), "chb_starting_time"); $enablestartingtime->setValue(1); //$enablestartingtime->setOptionTitle($this->lng->txt("enabled")); if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_starting_time')) { $enablestartingtime->setChecked(true); } else { $enablestartingtime->setChecked(strlen($this->testOBJ->getStartingTime())); } // starting time $startingtime = new ilDateTimeInputGUI('', 'starting_time'); $startingtime->setShowDate(true); $startingtime->setShowTime(true); if (strlen($this->testOBJ->getStartingTime())) { $startingtime->setDate(new ilDateTime($this->testOBJ->getStartingTime(), IL_CAL_TIMESTAMP)); } else { $startingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $enablestartingtime->addSubItem($startingtime); $form->addItem($enablestartingtime); if ($this->testOBJ->participantDataExist()) { $enablestartingtime->setDisabled(true); $startingtime->setDisabled(true); } // enable ending time $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("tst_ending_time"), "chb_ending_time"); $enableendingtime->setValue(1); //$enableendingtime->setOptionTitle($this->lng->txt("enabled")); if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_ending_time')) { $enableendingtime->setChecked(true); } else { $enableendingtime->setChecked(strlen($this->testOBJ->getEndingTime())); } // ending time $endingtime = new ilDateTimeInputGUI('', 'ending_time'); $endingtime->setShowDate(true); $endingtime->setShowTime(true); if (strlen($this->testOBJ->getEndingTime())) { $endingtime->setDate(new ilDateTime($this->testOBJ->getEndingTime(), IL_CAL_TIMESTAMP)); } else { $endingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $enableendingtime->addSubItem($endingtime); $form->addItem($enableendingtime); // test password $password = new ilTextInputGUI($this->lng->txt("tst_password"), "password"); $password->setSize(20); $password->setValue($this->testOBJ->getPassword()); $password->setInfo($this->lng->txt("tst_password_details")); $form->addItem($password); if (!$this->settingsTemplate || $this->formShowPresentationSection($this->settingsTemplate->getSettings())) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_presentation_properties")); $form->addItem($seqheader); } // use previous answers $prevanswers = new ilCheckboxInputGUI($this->lng->txt("tst_use_previous_answers"), "chb_use_previous_answers"); $prevanswers->setValue(1); $prevanswers->setChecked($this->testOBJ->getUsePreviousAnswers()); $prevanswers->setInfo($this->lng->txt("tst_use_previous_answers_description")); $form->addItem($prevanswers); // force js $forcejs = new ilCheckboxInputGUI($this->lng->txt("forcejs_short"), "forcejs"); $forcejs->setValue(1); $forcejs->setChecked($this->testOBJ->getForceJS()); $forcejs->setOptionTitle($this->lng->txt("forcejs")); $forcejs->setInfo($this->lng->txt("forcejs_desc")); $form->addItem($forcejs); // question title output $title_output = new ilRadioGroupInputGUI($this->lng->txt("tst_title_output"), "title_output"); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_full"), 0, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_hide_points"), 1, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_no_title"), 2, '')); $title_output->setValue($this->testOBJ->getTitleOutput()); $title_output->setInfo($this->lng->txt("tst_title_output_description")); $form->addItem($title_output); // selector for unicode characters global $ilSetting; if ($ilSetting->get('char_selector_availability') > 0) { require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php'; $char_selector = new ilCharSelectorGUI(ilCharSelectorConfig::CONTEXT_TEST); $char_selector->getConfig()->setAvailability($this->testOBJ->getCharSelectorAvailability()); $char_selector->getConfig()->setDefinition($this->testOBJ->getCharSelectorDefinition()); $char_selector->addFormProperties($form); $char_selector->setFormValues($form); } // Autosave $autosave_output = new ilCheckboxInputGUI($this->lng->txt('autosave'), 'autosave'); $autosave_output->setValue(1); $autosave_output->setChecked($this->testOBJ->getAutosave()); $autosave_output->setInfo($this->lng->txt('autosave_info')); $autosave_interval = new ilTextInputGUI($this->lng->txt('autosave_ival'), 'autosave_ival'); $autosave_interval->setSize(10); $autosave_interval->setValue($this->testOBJ->getAutosaveIval() / 1000); $autosave_interval->setInfo($this->lng->txt('autosave_ival_info')); $autosave_output->addSubItem($autosave_interval); $form->addItem($autosave_output); if (!$this->settingsTemplate || $this->formShowSequenceSection($this->settingsTemplate->getSettings())) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_sequence_properties")); $form->addItem($seqheader); } // postpone questions $postpone = new ilCheckboxInputGUI($this->lng->txt("tst_postpone"), "chb_postpone"); $postpone->setValue(1); $postpone->setChecked($this->testOBJ->getSequenceSettings()); $postpone->setInfo($this->lng->txt("tst_postpone_description")); $form->addItem($postpone); // shuffle questions $shuffle = new ilCheckboxInputGUI($this->lng->txt("tst_shuffle_questions"), "chb_shuffle_questions"); $shuffle->setValue(1); $shuffle->setChecked($this->testOBJ->getShuffleQuestions()); $shuffle->setInfo($this->lng->txt("tst_shuffle_questions_description")); $form->addItem($shuffle); // show list of questions $list_of_questions = new ilCheckboxInputGUI($this->lng->txt("tst_show_summary"), "list_of_questions"); //$list_of_questions->setOptionTitle($this->lng->txt("tst_show_summary")); $list_of_questions->setValue(1); $list_of_questions->setChecked($this->testOBJ->getListOfQuestions()); $list_of_questions->setInfo($this->lng->txt("tst_show_summary_description")); $list_of_questions_options = new ilCheckboxGroupInputGUI('', "list_of_questions_options"); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_start"), 'chb_list_of_questions_start', '')); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_end"), 'chb_list_of_questions_end', '')); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_with_description"), 'chb_list_of_questions_with_description', '')); $values = array(); if ($this->testOBJ->getListOfQuestionsStart()) { array_push($values, 'chb_list_of_questions_start'); } if ($this->testOBJ->getListOfQuestionsEnd()) { array_push($values, 'chb_list_of_questions_end'); } if ($this->testOBJ->getListOfQuestionsDescription()) { array_push($values, 'chb_list_of_questions_with_description'); } $list_of_questions_options->setValue($values); $list_of_questions->addSubItem($list_of_questions_options); $form->addItem($list_of_questions); // show question marking $marking = new ilCheckboxInputGUI($this->lng->txt("question_marking"), "chb_show_marker"); $marking->setValue(1); $marking->setChecked($this->testOBJ->getShowMarker()); $marking->setInfo($this->lng->txt("question_marking_description")); $form->addItem($marking); // show suspend test $cancel = new ilCheckboxInputGUI($this->lng->txt("tst_show_cancel"), "chb_show_cancel"); $cancel->setValue(1); $cancel->setChecked($this->testOBJ->getShowCancel()); $cancel->setInfo($this->lng->txt("tst_show_cancel_description")); $form->addItem($cancel); if (!$this->settingsTemplate || $this->formShowNotificationSection($this->settingsTemplate->getSettings())) { // notifications $notifications = new ilFormSectionHeaderGUI(); $notifications->setTitle($this->lng->txt("tst_mail_notification")); $form->addItem($notifications); } // mail notification $mailnotification = new ilRadioGroupInputGUI($this->lng->txt("tst_finish_notification"), "mailnotification"); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_no"), 0, '')); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_simple"), 1, '')); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_advanced"), 2, '')); $mailnotification->setValue($this->testOBJ->getMailNotification()); $form->addItem($mailnotification); $mailnottype = new ilCheckboxInputGUI('', "mailnottype"); $mailnottype->setValue(1); $mailnottype->setOptionTitle($this->lng->txt("mailnottype")); $mailnottype->setChecked($this->testOBJ->getMailNotificationType()); $form->addItem($mailnottype); /* This options always active (?) */ $highscore_head = new ilFormSectionHeaderGUI(); $highscore_head->setTitle($this->lng->txt("tst_highscore_options")); $form->addItem($highscore_head); $highscore = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_enabled"), "highscore_enabled"); $highscore->setValue(1); $highscore->setChecked($this->testOBJ->getHighscoreEnabled()); $highscore->setInfo($this->lng->txt("tst_highscore_description")); $form->addItem($highscore); $highscore_anon = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_anon"), "highscore_anon"); $highscore_anon->setValue(1); $highscore_anon->setChecked($this->testOBJ->getHighscoreAnon()); $highscore_anon->setInfo($this->lng->txt("tst_highscore_anon_description")); $highscore->addSubItem($highscore_anon); $highscore_achieved_ts = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_achieved_ts"), "highscore_achieved_ts"); $highscore_achieved_ts->setValue(1); $highscore_achieved_ts->setChecked($this->testOBJ->getHighscoreAchievedTS()); $highscore_achieved_ts->setInfo($this->lng->txt("tst_highscore_achieved_ts_description")); $highscore->addSubItem($highscore_achieved_ts); $highscore_score = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_score"), "highscore_score"); $highscore_score->setValue(1); $highscore_score->setChecked($this->testOBJ->getHighscoreScore()); $highscore_score->setInfo($this->lng->txt("tst_highscore_score_description")); $highscore->addSubItem($highscore_score); $highscore_percentage = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_percentage"), "highscore_percentage"); $highscore_percentage->setValue(1); $highscore_percentage->setChecked($this->testOBJ->getHighscorePercentage()); $highscore_percentage->setInfo($this->lng->txt("tst_highscore_percentage_description")); $highscore->addSubItem($highscore_percentage); $highscore_hints = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_hints"), "highscore_hints"); $highscore_hints->setValue(1); $highscore_hints->setChecked($this->testOBJ->getHighscoreHints()); $highscore_hints->setInfo($this->lng->txt("tst_highscore_hints_description")); $highscore->addSubItem($highscore_hints); $highscore_wtime = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_wtime"), "highscore_wtime"); $highscore_wtime->setValue(1); $highscore_wtime->setChecked($this->testOBJ->getHighscoreWTime()); $highscore_wtime->setInfo($this->lng->txt("tst_highscore_wtime_description")); $highscore->addSubItem($highscore_wtime); $highscore_own_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_own_table"), "highscore_own_table"); $highscore_own_table->setValue(1); $highscore_own_table->setChecked($this->testOBJ->getHighscoreOwnTable()); $highscore_own_table->setInfo($this->lng->txt("tst_highscore_own_table_description")); $highscore->addSubItem($highscore_own_table); $highscore_top_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_top_table"), "highscore_top_table"); $highscore_top_table->setValue(1); $highscore_top_table->setChecked($this->testOBJ->getHighscoreTopTable()); $highscore_top_table->setInfo($this->lng->txt("tst_highscore_top_table_description")); $highscore->addSubItem($highscore_top_table); $highscore_top_num = new ilTextInputGUI($this->lng->txt("tst_highscore_top_num"), "highscore_top_num"); $highscore_top_num->setSize(4); $highscore_top_num->setSuffix($this->lng->txt("tst_highscore_top_num_unit")); $highscore_top_num->setValue($this->testOBJ->getHighscoreTopNum()); $highscore_top_num->setInfo($this->lng->txt("tst_highscore_top_num_description")); $highscore->addSubItem($highscore_top_num); if (!$this->settingsTemplate || $this->formShowTestExecutionSection($this->settingsTemplate->getSettings())) { $testExecution = new ilFormSectionHeaderGUI(); $testExecution->setTitle($this->lng->txt("tst_test_execution")); $form->addItem($testExecution); } // kiosk mode $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk"); $kiosk->setValue(1); $kiosk->setChecked($this->testOBJ->getKioskMode()); $kiosk->setInfo($this->lng->txt("kiosk_description")); // kiosk mode options $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options"); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', '')); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', '')); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt('examid_in_kiosk'), 'examid_in_kiosk')); $values = array(); if ($this->testOBJ->getShowKioskModeTitle()) { array_push($values, 'kiosk_title'); } if ($this->testOBJ->getShowKioskModeParticipant()) { array_push($values, 'kiosk_participant'); } if ($this->testOBJ->getExamidInKiosk()) { array_push($values, 'examid_in_kiosk'); } $kiosktitle->setValue($values); $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc")); $kiosk->addSubItem($kiosktitle); $form->addItem($kiosk); $redirection_mode = $this->testOBJ->getRedirectionMode(); $rm_enabled = new ilCheckboxInputGUI($this->lng->txt('redirect_after_finishing_tst'), 'redirection_enabled'); $rm_enabled->setChecked($redirection_mode == '0' ? false : true); $radio_rm = new ilRadioGroupInputGUI($this->lng->txt('redirect_after_finishing_tst'), 'redirection_mode'); $always = new ilRadioOption($this->lng->txt('tst_results_access_always'), REDIRECT_ALWAYS); $radio_rm->addOption($always); $kiosk = new ilRadioOption($this->lng->txt('redirect_in_kiosk_mode'), REDIRECT_KIOSK); $radio_rm->addOption($kiosk); $radio_rm->setValue(in_array($redirection_mode, array(REDIRECT_ALWAYS, REDIRECT_KIOSK)) ? $redirection_mode : REDIRECT_ALWAYS); $rm_enabled->addSubItem($radio_rm); $redirection_url = new ilTextInputGUI($this->lng->txt('redirection_url'), 'redirection_url'); $redirection_url->setValue((string) $this->testOBJ->getRedirectionUrl()); $redirection_url->setRequired(true); $rm_enabled->addSubItem($redirection_url); $form->addItem($rm_enabled); // Sign submission $sign_submission = $this->testOBJ->getSignSubmission(); $sign_submission_enabled = new ilCheckboxInputGUI($this->lng->txt('sign_submission'), 'sign_submission'); $sign_submission_enabled->setChecked($sign_submission); $sign_submission_enabled->setInfo($this->lng->txt('sign_submission_info')); $form->addItem($sign_submission_enabled); if (!$this->settingsTemplate || $this->formShowParticipantSection($this->settingsTemplate->getSettings())) { // participants properties $restrictions = new ilFormSectionHeaderGUI(); $restrictions->setTitle($this->lng->txt("tst_max_allowed_users")); $form->addItem($restrictions); } $fixedparticipants = new ilCheckboxInputGUI($this->lng->txt('participants_invitation'), "fixedparticipants"); $fixedparticipants->setValue(1); $fixedparticipants->setChecked($this->testOBJ->getFixedParticipants()); $fixedparticipants->setOptionTitle($this->lng->txt("tst_allow_fixed_participants")); $fixedparticipants->setInfo($this->lng->txt("participants_invitation_description")); $invited_users = $this->testOBJ->getInvitedUsers(); if ($total && count($invited_users) == 0) { $fixedparticipants->setDisabled(true); } $form->addItem($fixedparticipants); // simultaneous users $simul = new ilTextInputGUI($this->lng->txt("tst_allowed_users"), "allowedUsers"); $simul->setSize(3); $simul->setValue($this->testOBJ->getAllowedUsers() ? $this->testOBJ->getAllowedUsers() : ''); $form->addItem($simul); // idle time $idle = new ilTextInputGUI($this->lng->txt("tst_allowed_users_time_gap"), "allowedUsersTimeGap"); $idle->setSize(4); $idle->setSuffix($this->lng->txt("seconds")); $idle->setValue($this->testOBJ->getAllowedUsersTimeGap() ? $this->testOBJ->getAllowedUsersTimeGap() : ''); $form->addItem($idle); // Edit ecs export settings include_once 'Modules/Test/classes/class.ilECSTestSettings.php'; $ecs = new ilECSTestSettings($this->testOBJ); $ecs->addSettingsToForm($form, 'tst'); // remove items when using template if ($this->settingsTemplate) { foreach ($this->settingsTemplate->getSettings() as $id => $item) { if ($item["hide"]) { $form->removeItemByPostVar($id); } } } return $form; }
protected function initCollectionManualForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this, "updatemanual")); $form->setTitle($lng->txt("learning_progress")); $form->setDescription($lng->txt("trac_collection_manual_learner_info")); $coll_items = array(); include_once './Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($this->getObjId()); $collection = $olp->getCollectionInstance(); if ($collection) { $coll_items = $collection->getItems(); $possible_items = $collection->getPossibleItems($this->getRefId()); // for titles switch (ilObject::_lookupType($this->getObjId())) { case "lm": $subitem_title = $lng->txt("objs_st"); $subitem_info = $lng->txt("trac_collection_manual_learner_lm_info"); break; } } include_once "Services/Tracking/classes/class.ilLPStatusFactory.php"; $class = ilLPStatusFactory::_getClassById($this->getObjId(), ilLPObjSettings::LP_MODE_COLLECTION_MANUAL); $lp_data = $class::_getObjectStatus($this->getObjId(), $this->usr_id); $grp = new ilCheckboxGroupInputGUI($subitem_title, "sids"); $grp->setInfo($subitem_info); $form->addItem($grp); // #14994 - using possible items for proper sorting $completed = array(); foreach (array_keys($possible_items) as $item_id) { if (!in_array($item_id, $coll_items)) { continue; } $info = null; $status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM; if (isset($lp_data[$item_id])) { $changed = new ilDateTime($lp_data[$item_id][1], IL_CAL_UNIX); $info = $lng->txt("trac_collection_manual_learner_changed_ts") . ": " . ilDatePresentation::formatDate($changed); if ($lp_data[$item_id][0]) { $status = ilLPStatus::LP_STATUS_COMPLETED_NUM; $completed[] = $item_id; } } $path = ilLearningProgressBaseGUI::_getImagePathForStatus($status); $text = ilLearningProgressBaseGUI::_getStatusText($status); $icon = ilUtil::img($path, $text); $opt = new ilCheckboxOption($icon . " " . $possible_items[$item_id]["title"], $item_id); if ($info) { $opt->setInfo($info); } $grp->addOption($opt); } if ($completed) { $grp->setValue($completed); } $form->addCommandButton("updatemanual", $lng->txt("save")); return $form; }
protected function initCreatePortfolioFromTemplateForm($a_prtt_id, $a_title) { global $ilSetting, $ilUser; if ((int) $_REQUEST["exc_id"]) { $this->ctrl->setParameter($this, "exc_id", (int) $_REQUEST["exc_id"]); $this->ctrl->setParameter($this, "ass_id", (int) $_REQUEST["ass_id"]); } include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $tmpl = new ilNonEditableValueGUI($this->lng->txt("obj_prtt")); $tmpl->setValue(ilObject::_lookupTitle($a_prtt_id)); $form->addItem($tmpl); $title = new ilNonEditableValueGUI($this->lng->txt("title"), "pt"); $title->setValue($a_title); $form->addItem($title); // gather user blogs if (!$ilSetting->get('disable_wsp_blogs')) { $blog_options = array(); include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $tree = new ilWorkspaceTree($this->user_id); $root = $tree->readRootId(); if ($root) { $root = $tree->getNodeData($root); foreach ($tree->getSubTree($root, true, "blog") as $node) { $blog_options[$node["obj_id"]] = $node["title"]; } asort($blog_options); } } $has_form_content = false; include_once "Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php"; $check_quota = ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive(); $quota_sum = 0; include_once "Services/Skill/classes/class.ilPersonalSkill.php"; $pskills = array_keys(ilPersonalSkill::getSelectedUserSkills($ilUser->getId())); $skill_ids = array(); include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php"; foreach (ilPortfolioTemplatePage::getAllPages($a_prtt_id) as $page) { switch ($page["type"]) { case ilPortfolioTemplatePage::TYPE_PAGE: // skills $source_page = new ilPortfolioTemplatePage($page["id"]); $source_page->buildDom(true); $dom = $source_page->getDom(); if ($dom instanceof php4DOMDocument) { $dom = $dom->myDOMDocument; } $xpath = new DOMXPath($dom); $nodes = $xpath->query("//PageContent/Skills"); foreach ($nodes as $node) { $skill_id = $node->getAttribute("Id"); if (!in_array($skill_id, $pskills)) { $skill_ids[] = $skill_id; } } unset($nodes); unset($xpath); unset($dom); if ($check_quota) { $quota_sum += $source_page->getPageDiskSize(); } if (sizeof($skill_ids)) { $has_form_content = true; } break; case ilPortfolioTemplatePage::TYPE_BLOG_TEMPLATE: if (!$ilSetting->get('disable_wsp_blogs')) { $has_form_content = true; $field_id = "blog_" . $page["id"]; $blog = new ilRadioGroupInputGUI($this->lng->txt("obj_blog") . ": " . $page["title"], $field_id); $blog->setRequired(true); $blog->setValue("blog_create"); $form->addItem($blog); $new_blog = new ilRadioOption($this->lng->txt("prtf_template_import_blog_create"), "blog_create"); $blog->addOption($new_blog); $title = new ilTextInputGUI($this->lng->txt("title"), $field_id . "_create_title"); $title->setRequired(true); $new_blog->addSubItem($title); if (sizeof($blog_options)) { $reuse_blog = new ilRadioOption($this->lng->txt("prtf_template_import_blog_reuse"), "blog_resuse"); $blog->addOption($reuse_blog); $obj = new ilSelectInputGUI($this->lng->txt("obj_blog"), $field_id . "_reuse_blog"); $obj->setRequired(true); $obj->setOptions(array("" => $this->lng->txt("please_select")) + $blog_options); $reuse_blog->addSubItem($obj); } $blog->addOption(new ilRadioOption($this->lng->txt("prtf_template_import_blog_ignore"), "blog_ignore")); } break; } } if ($skill_ids) { include_once "Services/Skill/classes/class.ilSkillTreeNode.php"; $skills = new ilCheckboxGroupInputGUI($this->lng->txt("skills"), "skill_ids"); $skills->setInfo($this->lng->txt("prtf_template_import_new_skills")); $skills->setValue($skill_ids); foreach ($skill_ids as $skill_id) { $skills->addOption(new ilCheckboxOption(ilSkillTreeNode::_lookupTitle($skill_id), $skill_id)); } $form->addItem($skills); } if ($quota_sum) { include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; if (!ilDiskQuotaHandler::isUploadPossible($quota_sum)) { ilUtil::sendFailure($this->lng->txt("prtf_template_import_quota_failure"), true); $this->ctrl->redirect($this, "create"); } } // no dialog needed, go ahead if (!$has_form_content) { return; } $form->setTitle($this->lng->txt("prtf_creation_mode") . ": " . $this->lng->txt("prtf_creation_mode_template")); $form->addCommandButton("createPortfolioFromTemplateProcess", $this->lng->txt("continue")); $form->addCommandButton("toRepository", $this->lng->txt("cancel")); return $form; }
/** * display assessment folder settings form */ public function settingsObject() { global $ilAccess; global $ilTabs; $ilTabs->setTabActive('settings'); include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTableWidth("100%"); $form->setId("settings"); // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("assessment_log_logging")); $form->addItem($header); // assessment logging $logging = new ilCheckboxInputGUI('', "chb_assessment_logging"); $logging->setValue(1); $logging->setChecked($this->object->_enabledAssessmentLogging()); $logging->setOptionTitle($this->lng->txt("activate_assessment_logging")); $form->addItem($logging); // reporting language $reporting = new ilSelectInputGUI($this->lng->txt('assessment_settings_reporting_language'), "reporting_language"); $languages = $this->lng->getInstalledLanguages(); $this->lng->loadLanguageModule("meta"); $options = array(); foreach ($languages as $lang) { $options[$lang] = $this->lng->txt("meta_l_" . $lang); } $reporting->setOptions($options); $reporting->setValue($this->object->_getLogLanguage()); $form->addItem($reporting); // question settings $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("assf_questiontypes")); $form->addItem($header); // available question types $allowed = new ilCheckboxGroupInputGUI($this->lng->txt('assf_allowed_questiontypes'), "chb_allowed_questiontypes"); $questiontypes =& ilObjQuestionPool::_getQuestionTypes(TRUE); $forbidden_types = $this->object->_getForbiddenQuestionTypes(); $allowedtypes = array(); foreach ($questiontypes as $qt) { if (!in_array($qt['question_type_id'], $forbidden_types)) { array_push($allowedtypes, $qt['question_type_id']); } } $allowed->setValue($allowedtypes); foreach ($questiontypes as $type_name => $qtype) { $allowed->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"])); } $allowed->setInfo($this->lng->txt('assf_allowed_questiontypes_desc')); $form->addItem($allowed); // manual scoring $manual = new ilCheckboxGroupInputGUI($this->lng->txt('assessment_log_manual_scoring_activate'), "chb_manual_scoring"); $manscoring = $this->object->_getManualScoring(); $manual->setValue($manscoring); foreach ($questiontypes as $type_name => $qtype) { $manual->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"])); } $manual->setInfo($this->lng->txt('assessment_log_manual_scoring_desc')); $form->addItem($manual); if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) { $form->addCommandButton("saveSettings", $this->lng->txt("save")); } $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); }
/** * @param ilPropertyFormGUI $form */ private function addTestRunProperties(ilPropertyFormGUI $form) { // section header test run $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_settings_header_test_run")); $form->addItem($header); // max. number of passes $limitPasses = new ilCheckboxInputGUI($this->lng->txt("tst_limit_nr_of_tries"), 'limitPasses'); $limitPasses->setInfo($this->lng->txt("tst_nr_of_tries_desc")); $limitPasses->setChecked($this->testOBJ->getNrOfTries() > 0); $nr_of_tries = new ilNumberInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries"); $nr_of_tries->setSize(3); $nr_of_tries->allowDecimals(false); $nr_of_tries->setMinValue(1); $nr_of_tries->setMinvalueShouldBeGreater(false); $nr_of_tries->setValue($this->testOBJ->getNrOfTries() ? $this->testOBJ->getNrOfTries() : 1); $nr_of_tries->setRequired(true); if ($this->testOBJ->participantDataExist()) { $limitPasses->setDisabled(true); $nr_of_tries->setDisabled(true); } $limitPasses->addSubItem($nr_of_tries); $form->addItem($limitPasses); // enable max. processing time $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time"); $processing->setInfo($this->lng->txt("tst_processing_time_desc")); $processing->setValue(1); if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_processing_time')) { $processing->setChecked(true); } else { $processing->setChecked($this->testOBJ->getEnableProcessingTime()); } // max. processing time $processingtime = new ilNumberInputGUI($this->lng->txt("tst_processing_time_duration"), 'processing_time'); $processingtime->allowDecimals(false); $processingtime->setMinValue(1); $processingtime->setMinvalueShouldBeGreater(false); $processingtime->setValue($this->testOBJ->getProcessingTimeAsMinutes()); $processingtime->setSize(5); $processingtime->setSuffix($this->lng->txt('minutes')); $processingtime->setInfo($this->lng->txt("tst_processing_time_duration_desc")); $processing->addSubItem($processingtime); // reset max. processing time $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time"); $resetprocessing->setValue(1); $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time")); $resetprocessing->setChecked($this->testOBJ->getResetProcessingTime()); $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc")); $processing->addSubItem($resetprocessing); $form->addItem($processing); // kiosk mode $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk"); $kiosk->setValue(1); $kiosk->setChecked($this->testOBJ->getKioskMode()); $kiosk->setInfo($this->lng->txt("kiosk_description")); // kiosk mode options $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options"); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', '')); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', '')); $values = array(); if ($this->testOBJ->getShowKioskModeTitle()) { array_push($values, 'kiosk_title'); } if ($this->testOBJ->getShowKioskModeParticipant()) { array_push($values, 'kiosk_participant'); } $kiosktitle->setValue($values); $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc")); $kiosk->addSubItem($kiosktitle); $form->addItem($kiosk); $examIdInPass = new ilCheckboxInputGUI($this->lng->txt('examid_in_test_pass'), 'examid_in_test_pass'); $examIdInPass->setInfo($this->lng->txt('examid_in_test_pass_desc')); $examIdInPass->setChecked($this->testOBJ->isShowExamIdInTestPassEnabled()); $form->addItem($examIdInPass); }
/** * Display and fill the properties form of the test * * @access public */ function propertiesObject($checkonly = FALSE) { global $ilAccess; if (!$ilAccess->checkAccess("write", "", $this->ref_id)) { // allow only write access ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true); $this->ctrl->redirect($this, "infoScreen"); } // using template? $template_settings = null; $template = $this->object->getTemplate(); if ($template) { include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $template = new ilSettingsTemplate($template, ilObjAssessmentFolderGUI::getSettingsTemplateConfig()); $template_settings = $template->getSettings(); $hide_rte_switch = $template_settings["rte_switch"]["hide"]; } $save = strcmp($this->ctrl->getCmd(), "saveProperties") == 0 ? TRUE : FALSE; $total = $this->object->evalTotalPersons(); $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js"); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTableWidth("100%"); $form->setId("test_properties"); if (!$template || $template && $this->formShowGeneralSection($template_settings)) { // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_general_properties")); $form->addItem($header); } // title & description (meta data) include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj = new ilMD($this->object->getId(), 0, "tst"); $md_section = $md_obj->getGeneral(); $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setRequired(true); $title->setValue($md_section->getTitle()); $form->addItem($title); $ids = $md_section->getDescriptionIds(); if ($ids) { $desc_obj = $md_section->getDescription(array_pop($ids)); $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description"); $desc->setCols(50); $desc->setRows(4); $desc->setValue($desc_obj->getDescription()); $form->addItem($desc); } // anonymity $anonymity = new ilRadioGroupInputGUI($this->lng->txt('tst_anonymity'), 'anonymity'); if ($total) { $anonymity->setDisabled(true); } $rb = new ilRadioOption($this->lng->txt('tst_anonymity_no_anonymization'), 0); $anonymity->addOption($rb); $rb = new ilRadioOption($this->lng->txt('tst_anonymity_anonymous_test'), 1); $anonymity->addOption($rb); $anonymity->setValue((int) $this->object->getAnonymity()); $form->addItem($anonymity); // random selection of questions $random = new ilCheckboxInputGUI($this->lng->txt("tst_random_selection"), "random_test"); $random->setValue(1); if ($total) { $random->setDisabled(true); } $random->setChecked($this->object->isRandomTest()); $info = $this->lng->txt("tst_random_test_description"); if ($this->object->hasQuestionsWithoutQuestionpool()) { $info .= $this->lng->txt("tst_random_test_description_warning"); } $random->setInfo($info); $form->addItem($random); // pool usage $pool_usage = new ilCheckboxInputGUI($this->lng->txt("test_question_pool_usage"), "use_pool"); $pool_usage->setValue(1); $pool_usage->setChecked($this->object->getPoolUsage()); $form->addItem($pool_usage); // activation/availability (no template support yet) include_once "Services/Object/classes/class.ilObjectActivation.php"; $this->lng->loadLanguageModule('rep'); $section = new ilFormSectionHeaderGUI(); $section->setTitle($this->lng->txt('rep_activation_availability')); $form->addItem($section); // additional info only with multiple references $act_obj_info = $act_ref_info = ""; if (sizeof(ilObject::_getAllReferences($this->object->getId())) > 1) { $act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info'); $act_ref_info = $this->lng->txt('rep_activation_access_ref_info'); } $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online'); $online->setChecked($this->object->isOnline()); $online->setInfo($this->lng->txt('tst_activation_online_info') . $act_obj_info); $form->addItem($online); $act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'activation_type'); $act_type->setInfo($act_ref_info); $act_type->setValue($this->object->isActivationLimited() ? ilObjectActivation::TIMINGS_ACTIVATION : ilObjectActivation::TIMINGS_DEACTIVATED); $opt = new ilRadioOption($this->lng->txt('rep_visibility_limitless'), ilObjectActivation::TIMINGS_DEACTIVATED); $opt->setInfo($this->lng->txt('tst_availability_limitless_info')); $act_type->addOption($opt); $opt = new ilRadioOption($this->lng->txt('rep_visibility_until'), ilObjectActivation::TIMINGS_ACTIVATION); $opt->setInfo($this->lng->txt('tst_availability_until_info')); $date = $this->object->getActivationStartingTime(); $start = new ilDateTimeInputGUI($this->lng->txt('rep_activation_limited_start'), 'act_starting_time'); #$start->setMode(ilDateTimeInputGUI::MODE_INPUT); $start->setShowTime(true); $start->setDate(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $opt->addSubItem($start); $date = $this->object->getActivationEndingTime(); $end = new ilDateTimeInputGUI($this->lng->txt('rep_activation_limited_end'), 'act_ending_time'); #$end->setMode(ilDateTimeInputGUI::MODE_INPUT); $end->setShowTime(true); $end->setDate(new ilDateTime($date ? $date : time(), IL_CAL_UNIX)); $opt->addSubItem($end); $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'activation_visibility'); $visible->setInfo($this->lng->txt('tst_activation_limited_visibility_info')); $visible->setChecked($this->object->getActivationVisibility()); $opt->addSubItem($visible); $act_type->addOption($opt); $form->addItem($act_type); if (!$template || $template && $this->formShowBeginningEndingInformation($template_settings)) { // general properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("tst_beginning_ending_information")); $form->addItem($header); } // introduction $intro = new ilTextAreaInputGUI($this->lng->txt("tst_introduction"), "introduction"); $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction())); $intro->setRows(10); $intro->setCols(80); $intro->setUseRte(TRUE); $intro->addPlugin("latex"); $intro->addButton("latex"); $intro->setRTESupport($this->object->getId(), "tst", 'assessment', null, false, '3.4.7'); $intro->setRteTagSet('full'); $intro->setInfo($this->lng->txt('intro_desc')); // showinfo $showinfo = new ilCheckboxInputGUI('', "showinfo"); $showinfo->setValue(1); $showinfo->setChecked($this->object->getShowInfo()); $showinfo->setOptionTitle($this->lng->txt("showinfo")); $showinfo->setInfo($this->lng->txt("showinfo_desc")); $intro->addSubItem($showinfo); $form->addItem($intro); // final statement $finalstatement = new ilTextAreaInputGUI($this->lng->txt("final_statement"), "finalstatement"); $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getFinalStatement())); $finalstatement->setRows(10); $finalstatement->setCols(80); $finalstatement->setUseRte(TRUE); $finalstatement->addPlugin("latex"); $finalstatement->addButton("latex"); $finalstatement->setRTESupport($this->object->getId(), "tst", "assessment", null, false, '3.4.7'); $finalstatement->setRteTagSet('full'); // show final statement $showfinal = new ilCheckboxInputGUI('', "showfinalstatement"); $showfinal->setValue(1); $showfinal->setChecked($this->object->getShowFinalStatement()); $showfinal->setOptionTitle($this->lng->txt("final_statement_show")); $showfinal->setInfo($this->lng->txt("final_statement_show_desc")); $finalstatement->addSubItem($showfinal); $form->addItem($finalstatement); if (!$template || $template && $this->formShowSessionSection($template_settings)) { // session properties $sessionheader = new ilFormSectionHeaderGUI(); $sessionheader->setTitle($this->lng->txt("tst_session_settings")); $form->addItem($sessionheader); } // max. number of passes $nr_of_tries = new ilTextInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries"); $nr_of_tries->setSize(3); $nr_of_tries->setValue($this->object->getNrOfTries()); $nr_of_tries->setRequired(true); $nr_of_tries->setSuffix($this->lng->txt("0_unlimited")); if ($total) { $nr_of_tries->setDisabled(true); } $form->addItem($nr_of_tries); // enable max. processing time $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time"); $processing->setValue(1); //$processing->setOptionTitle($this->lng->txt("enabled")); if ($template_settings && $template_settings['chb_processing_time'] && $template_settings['chb_processing_time']['value']) { $processing->setChecked(true); } else { $processing->setChecked($this->object->getEnableProcessingTime()); } // max. processing time $processingtime = new ilDurationInputGUI('', 'processing_time'); $ptime = $this->object->getProcessingTimeAsArray(); $processingtime->setHours($ptime['hh']); $processingtime->setMinutes($ptime['mm']); $processingtime->setSeconds($ptime['ss']); $processingtime->setShowMonths(false); $processingtime->setShowDays(false); $processingtime->setShowHours(true); $processingtime->setShowMinutes(true); $processingtime->setShowSeconds(true); $processingtime->setInfo($this->lng->txt("tst_processing_time_desc")); $processing->addSubItem($processingtime); // reset max. processing time $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time"); $resetprocessing->setValue(1); $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time")); $resetprocessing->setChecked($this->object->getResetProcessingTime()); $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc")); $processing->addSubItem($resetprocessing); $form->addItem($processing); // enable starting time $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("tst_starting_time"), "chb_starting_time"); $enablestartingtime->setValue(1); //$enablestartingtime->setOptionTitle($this->lng->txt("enabled")); if ($template_settings && $template_settings['chb_starting_time'] && $template_settings['chb_starting_time']['value']) { $enablestartingtime->setChecked(true); } else { $enablestartingtime->setChecked(strlen($this->object->getStartingTime())); } // starting time $startingtime = new ilDateTimeInputGUI('', 'starting_time'); $startingtime->setShowDate(true); $startingtime->setShowTime(true); if (strlen($this->object->getStartingTime())) { $startingtime->setDate(new ilDateTime($this->object->getStartingTime(), IL_CAL_TIMESTAMP)); } else { $startingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $enablestartingtime->addSubItem($startingtime); if ($total) { $enablestartingtime->setDisabled(true); } if ($total) { $startingtime->setDisabled(true); } $form->addItem($enablestartingtime); // enable ending time $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("tst_ending_time"), "chb_ending_time"); $enableendingtime->setValue(1); //$enableendingtime->setOptionTitle($this->lng->txt("enabled")); if ($template_settings && $template_settings['chb_ending_time'] && $template_settings['chb_ending_time']['value']) { $enableendingtime->setChecked(true); } else { $enableendingtime->setChecked(strlen($this->object->getEndingTime())); } // ending time $endingtime = new ilDateTimeInputGUI('', 'ending_time'); $endingtime->setShowDate(true); $endingtime->setShowTime(true); if (strlen($this->object->getEndingTime())) { $endingtime->setDate(new ilDateTime($this->object->getEndingTime(), IL_CAL_TIMESTAMP)); } else { $endingtime->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $enableendingtime->addSubItem($endingtime); $form->addItem($enableendingtime); // test password $password = new ilTextInputGUI($this->lng->txt("tst_password"), "password"); $password->setSize(20); $password->setValue($this->object->getPassword()); $password->setInfo($this->lng->txt("tst_password_details")); $form->addItem($password); if (!$template || $template && $this->formShowPresentationSection($template_settings)) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_presentation_properties")); $form->addItem($seqheader); } // use previous answers $prevanswers = new ilCheckboxInputGUI($this->lng->txt("tst_use_previous_answers"), "chb_use_previous_answers"); $prevanswers->setValue(1); $prevanswers->setChecked($this->object->getUsePreviousAnswers()); $prevanswers->setInfo($this->lng->txt("tst_use_previous_answers_description")); $form->addItem($prevanswers); // force js $forcejs = new ilCheckboxInputGUI($this->lng->txt("forcejs_short"), "forcejs"); $forcejs->setValue(1); $forcejs->setChecked($this->object->getForceJS()); $forcejs->setOptionTitle($this->lng->txt("forcejs")); $forcejs->setInfo($this->lng->txt("forcejs_desc")); $form->addItem($forcejs); // question title output $title_output = new ilRadioGroupInputGUI($this->lng->txt("tst_title_output"), "title_output"); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_full"), 0, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_hide_points"), 1, '')); $title_output->addOption(new ilRadioOption($this->lng->txt("tst_title_output_no_title"), 2, '')); $title_output->setValue($this->object->getTitleOutput()); $title_output->setInfo($this->lng->txt("tst_title_output_description")); $form->addItem($title_output); // Autosave $autosave_output = new ilCheckboxInputGUI($this->lng->txt('autosave'), 'autosave'); $autosave_output->setValue(1); $autosave_output->setChecked($this->object->getAutosave()); $autosave_output->setInfo($this->lng->txt('autosave_info')); $autosave_interval = new ilTextInputGUI($this->lng->txt('autosave_ival'), 'autosave_ival'); $autosave_interval->setSize(10); $autosave_interval->setValue($this->object->getAutosaveIval()); $autosave_interval->setInfo($this->lng->txt('autosave_ival_info')); $autosave_output->addSubItem($autosave_interval); $form->addItem($autosave_output); if (!$template || $template && $this->formShowSequenceSection($template_settings)) { // sequence properties $seqheader = new ilFormSectionHeaderGUI(); $seqheader->setTitle($this->lng->txt("tst_sequence_properties")); $form->addItem($seqheader); } // postpone questions $postpone = new ilCheckboxInputGUI($this->lng->txt("tst_postpone"), "chb_postpone"); $postpone->setValue(1); $postpone->setChecked($this->object->getSequenceSettings()); $postpone->setInfo($this->lng->txt("tst_postpone_description")); $form->addItem($postpone); // shuffle questions $shuffle = new ilCheckboxInputGUI($this->lng->txt("tst_shuffle_questions"), "chb_shuffle_questions"); $shuffle->setValue(1); $shuffle->setChecked($this->object->getShuffleQuestions()); $shuffle->setInfo($this->lng->txt("tst_shuffle_questions_description")); $form->addItem($shuffle); // show list of questions $list_of_questions = new ilCheckboxInputGUI($this->lng->txt("tst_show_summary"), "list_of_questions"); //$list_of_questions->setOptionTitle($this->lng->txt("tst_show_summary")); $list_of_questions->setValue(1); $list_of_questions->setChecked($this->object->getListOfQuestions()); $list_of_questions->setInfo($this->lng->txt("tst_show_summary_description")); $list_of_questions_options = new ilCheckboxGroupInputGUI('', "list_of_questions_options"); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_start"), 'chb_list_of_questions_start', '')); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_end"), 'chb_list_of_questions_end', '')); $list_of_questions_options->addOption(new ilCheckboxOption($this->lng->txt("tst_list_of_questions_with_description"), 'chb_list_of_questions_with_description', '')); $values = array(); if ($this->object->getListOfQuestionsStart()) { array_push($values, 'chb_list_of_questions_start'); } if ($this->object->getListOfQuestionsEnd()) { array_push($values, 'chb_list_of_questions_end'); } if ($this->object->getListOfQuestionsDescription()) { array_push($values, 'chb_list_of_questions_with_description'); } $list_of_questions_options->setValue($values); $list_of_questions->addSubItem($list_of_questions_options); $form->addItem($list_of_questions); // show question marking $marking = new ilCheckboxInputGUI($this->lng->txt("question_marking"), "chb_show_marker"); $marking->setValue(1); $marking->setChecked($this->object->getShowMarker()); $marking->setInfo($this->lng->txt("question_marking_description")); $form->addItem($marking); // show suspend test $cancel = new ilCheckboxInputGUI($this->lng->txt("tst_show_cancel"), "chb_show_cancel"); $cancel->setValue(1); $cancel->setChecked($this->object->getShowCancel()); $cancel->setInfo($this->lng->txt("tst_show_cancel_description")); $form->addItem($cancel); if (!$template || $template && $this->formShowNotificationSection($template_settings)) { // notifications $notifications = new ilFormSectionHeaderGUI(); $notifications->setTitle($this->lng->txt("tst_mail_notification")); $form->addItem($notifications); } // mail notification $mailnotification = new ilRadioGroupInputGUI($this->lng->txt("tst_finish_notification"), "mailnotification"); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_no"), 0, '')); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_simple"), 1, '')); $mailnotification->addOption(new ilRadioOption($this->lng->txt("tst_finish_notification_advanced"), 2, '')); $mailnotification->setValue($this->object->getMailNotification()); $form->addItem($mailnotification); $mailnottype = new ilCheckboxInputGUI('', "mailnottype"); $mailnottype->setValue(1); $mailnottype->setOptionTitle($this->lng->txt("mailnottype")); $mailnottype->setChecked($this->object->getMailNotificationType()); $form->addItem($mailnottype); /* This options always active (?) */ $highscore_head = new ilFormSectionHeaderGUI(); $highscore_head->setTitle($this->lng->txt("tst_highscore_options")); $form->addItem($highscore_head); $highscore = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_enabled"), "highscore_enabled"); $highscore->setValue(1); $highscore->setChecked($this->object->getHighscoreEnabled()); $highscore->setInfo($this->lng->txt("tst_highscore_description")); $form->addItem($highscore); $highscore_anon = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_anon"), "highscore_anon"); $highscore_anon->setValue(1); $highscore_anon->setChecked($this->object->getHighscoreAnon()); $highscore_anon->setInfo($this->lng->txt("tst_highscore_anon_description")); $highscore->addSubItem($highscore_anon); $highscore_achieved_ts = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_achieved_ts"), "highscore_achieved_ts"); $highscore_achieved_ts->setValue(1); $highscore_achieved_ts->setChecked($this->object->getHighscoreAchievedTS()); $highscore_achieved_ts->setInfo($this->lng->txt("tst_highscore_achieved_ts_description")); $highscore->addSubItem($highscore_achieved_ts); $highscore_score = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_score"), "highscore_score"); $highscore_score->setValue(1); $highscore_score->setChecked($this->object->getHighscoreScore()); $highscore_score->setInfo($this->lng->txt("tst_highscore_score_description")); $highscore->addSubItem($highscore_score); $highscore_percentage = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_percentage"), "highscore_percentage"); $highscore_percentage->setValue(1); $highscore_percentage->setChecked($this->object->getHighscorePercentage()); $highscore_percentage->setInfo($this->lng->txt("tst_highscore_percentage_description")); $highscore->addSubItem($highscore_percentage); $highscore_hints = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_hints"), "highscore_hints"); $highscore_hints->setValue(1); $highscore_hints->setChecked($this->object->getHighscoreHints()); $highscore_hints->setInfo($this->lng->txt("tst_highscore_hints_description")); $highscore->addSubItem($highscore_hints); $highscore_wtime = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_wtime"), "highscore_wtime"); $highscore_wtime->setValue(1); $highscore_wtime->setChecked($this->object->getHighscoreWTime()); $highscore_wtime->setInfo($this->lng->txt("tst_highscore_wtime_description")); $highscore->addSubItem($highscore_wtime); $highscore_own_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_own_table"), "highscore_own_table"); $highscore_own_table->setValue(1); $highscore_own_table->setChecked($this->object->getHighscoreOwnTable()); $highscore_own_table->setInfo($this->lng->txt("tst_highscore_own_table_description")); $highscore->addSubItem($highscore_own_table); $highscore_top_table = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_top_table"), "highscore_top_table"); $highscore_top_table->setValue(1); $highscore_top_table->setChecked($this->object->getHighscoreTopTable()); $highscore_top_table->setInfo($this->lng->txt("tst_highscore_top_table_description")); $highscore->addSubItem($highscore_top_table); $highscore_top_num = new ilTextInputGUI($this->lng->txt("tst_highscore_top_num"), "highscore_top_num"); $highscore_top_num->setSize(4); $highscore_top_num->setSuffix($this->lng->txt("tst_highscore_top_num_unit")); $highscore_top_num->setValue($this->object->getHighscoreTopNum()); $highscore_top_table->setInfo($this->lng->txt("tst_highscore_top_num_description")); $highscore->addSubItem($highscore_top_num); if (!$template || $template && $this->formShowKioskSection($template_settings)) { // kiosk mode properties $kioskheader = new ilFormSectionHeaderGUI(); $kioskheader->setTitle($this->lng->txt("kiosk")); $form->addItem($kioskheader); } // kiosk mode $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk"); $kiosk->setValue(1); $kiosk->setChecked($this->object->getKioskMode()); $kiosk->setInfo($this->lng->txt("kiosk_description")); // kiosk mode options $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options"); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', '')); $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', '')); $values = array(); if ($this->object->getShowKioskModeTitle()) { array_push($values, 'kiosk_title'); } if ($this->object->getShowKioskModeParticipant()) { array_push($values, 'kiosk_participant'); } $kiosktitle->setValue($values); $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc")); $kiosk->addSubItem($kiosktitle); $form->addItem($kiosk); if (!$template || $template && $this->formShowParticipantSection($template_settings)) { // participants properties $restrictions = new ilFormSectionHeaderGUI(); $restrictions->setTitle($this->lng->txt("tst_max_allowed_users")); $form->addItem($restrictions); } $fixedparticipants = new ilCheckboxInputGUI($this->lng->txt('participants_invitation'), "fixedparticipants"); $fixedparticipants->setValue(1); $fixedparticipants->setChecked($this->object->getFixedParticipants()); $fixedparticipants->setOptionTitle($this->lng->txt("tst_allow_fixed_participants")); $fixedparticipants->setInfo($this->lng->txt("participants_invitation_description")); $invited_users = $this->object->getInvitedUsers(); if ($total && count($invited_users) == 0) { $fixedparticipants->setDisabled(true); } $form->addItem($fixedparticipants); // simultaneous users $simul = new ilTextInputGUI($this->lng->txt("tst_allowed_users"), "allowedUsers"); $simul->setSize(3); $simul->setValue($this->object->getAllowedUsers() ? $this->object->getAllowedUsers() : ''); $form->addItem($simul); // idle time $idle = new ilTextInputGUI($this->lng->txt("tst_allowed_users_time_gap"), "allowedUsersTimeGap"); $idle->setSize(4); $idle->setSuffix($this->lng->txt("seconds")); $idle->setValue($this->object->getAllowedUsersTimeGap() ? $this->object->getAllowedUsersTimeGap() : ''); $form->addItem($idle); // Edit ecs export settings include_once 'Modules/Test/classes/class.ilECSTestSettings.php'; $ecs = new ilECSTestSettings($this->object); $ecs->addSettingsToForm($form, 'tst'); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { $form->addCommandButton("saveProperties", $this->lng->txt("save")); } // remove items when using template if ($template_settings) { foreach ($template_settings as $id => $item) { if ($item["hide"]) { $form->removeItemByPostVar($id); } } } $errors = false; if ($save) { $errors = !$form->checkInput(); $form->setValuesByPost(); if ($online->getChecked() && !$this->object->isComplete()) { $online->setAlert($this->lng->txt("cannot_switch_to_online_no_questions_andor_no_mark_steps")); ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); $errors = true; } if ($errors) { $checkonly = false; } } if (!$checkonly) { // using template? $message = ""; if ($template) { global $tpl; $link = $this->ctrl->getLinkTarget($this, "confirmResetTemplate"); $link = "<a href=\"" . $link . "\">" . $this->lng->txt("test_using_template_link") . "</a>"; $message = "<div style=\"margin-top:10px\">" . $tpl->getMessageHTML(sprintf($this->lng->txt("test_using_template"), $template->getTitle(), $link), "info") . "</div>"; } $this->tpl->setVariable("ADM_CONTENT", $form->getHTML() . $message); } return $errors; }
/** * Display and fill the scoring settings form of the test * * @access public */ function scoringObject($checkonly = FALSE) { global $ilAccess; if (!$ilAccess->checkAccess("write", "", $this->ref_id)) { // allow only write access ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true); $this->ctrl->redirect($this, "infoScreen"); } // using template? $template_settings = null; $template = $this->object->getTemplate(); if ($template) { include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; include_once "Modules/Test/classes/class.ilObjAssessmentFolderGUI.php"; $template = new ilSettingsTemplate($template, ilObjAssessmentFolderGUI::getSettingsTemplateConfig()); $template_settings = $template->getSettings(); } $save = strcmp($this->ctrl->getCmd(), "saveScoring") == 0 ? TRUE : FALSE; $total = $this->object->evalTotalPersons(); $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js"); // Determine settings availability $setting_available = true; // In general, the scoring settings are available. if ($total != 0) { $setting_available = false; // Unless there are results from users. } if ($this->object->getScoreReporting() == 4) { $setting_available = true; // But if the results are not public since they will never be } if ($this->object->getScoreReporting() == 3 && $this->object->getReportingDate() > time()) { $setting_available = true; // or the presentation date is not reached, then we can still edit them. } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTableWidth("100%"); $form->setId("test_properties_scoring"); // scoring properties $header = new ilFormSectionHeaderGUI(); $header->setTitle($this->lng->txt("test_scoring")); $form->addItem($header); // scoring system $count_system = new ilRadioGroupInputGUI($this->lng->txt("tst_text_count_system"), "count_system"); $count_system->addOption(new ilRadioOption($this->lng->txt("tst_count_partial_solutions"), 0, '')); $count_system->addOption(new ilRadioOption($this->lng->txt("tst_count_correct_solutions"), 1, '')); $count_system->setValue($this->object->getCountSystem()); $count_system->setInfo($this->lng->txt("tst_count_system_description")); $count_system->setDisabled(!$setting_available); $form->addItem($count_system); // mc questions $mc_scoring = new ilRadioGroupInputGUI($this->lng->txt("tst_score_mcmr_questions"), "mc_scoring"); $mc_scoring->addOption(new ilRadioOption($this->lng->txt("tst_score_mcmr_zero_points_when_unanswered"), 0, '')); $mc_scoring->addOption(new ilRadioOption($this->lng->txt("tst_score_mcmr_use_scoring_system"), 1, '')); $mc_scoring->setValue($this->object->getMCScoring()); $mc_scoring->setInfo($this->lng->txt("tst_score_mcmr_questions_description")); $mc_scoring->setDisabled(!$setting_available); $form->addItem($mc_scoring); // score cutting $score_cutting = new ilRadioGroupInputGUI($this->lng->txt("tst_score_cutting"), "score_cutting"); $score_cutting->addOption(new ilRadioOption($this->lng->txt("tst_score_cut_question"), 0, '')); $score_cutting->addOption(new ilRadioOption($this->lng->txt("tst_score_cut_test"), 1, '')); $score_cutting->setValue($this->object->getScoreCutting()); $score_cutting->setInfo($this->lng->txt("tst_score_cutting_description")); $score_cutting->setDisabled(!$setting_available); $form->addItem($score_cutting); // pass scoring $pass_scoring = new ilRadioGroupInputGUI($this->lng->txt("tst_pass_scoring"), "pass_scoring"); $pass_scoring->addOption(new ilRadioOption($this->lng->txt("tst_pass_last_pass"), 0, '')); $pass_scoring->addOption(new ilRadioOption($this->lng->txt("tst_pass_best_pass"), 1, '')); $pass_scoring->setValue($this->object->getPassScoring()); $pass_scoring->setInfo($this->lng->txt("tst_pass_scoring_description")); $pass_scoring->setDisabled(!$setting_available); $form->addItem($pass_scoring); // test presentation $header_tp = new ilFormSectionHeaderGUI(); $header_tp->setTitle($this->lng->txt("test_presentation")); $form->addItem($header_tp); // enable obligations $checkBoxEnableObligations = new ilCheckboxInputGUI($this->lng->txt("tst_setting_enable_obligations_label"), "obligations_enabled"); $checkBoxEnableObligations->setChecked($this->object->areObligationsEnabled()); $checkBoxEnableObligations->setInfo($this->lng->txt("tst_setting_enable_obligations_info")); if ($total) { $checkBoxEnableObligations->setDisabled(true); } $form->addItem($checkBoxEnableObligations); // offer hints $checkBoxOfferHints = new ilCheckboxInputGUI($this->lng->txt("tst_setting_offer_hints_label"), "offer_hints"); $checkBoxOfferHints->setChecked($this->object->isOfferingQuestionHintsEnabled()); $checkBoxOfferHints->setInfo($this->lng->txt("tst_setting_offer_hints_info")); if ($total) { $checkBoxOfferHints->setDisabled(true); } $form->addItem($checkBoxOfferHints); // instant feedback $instant_feedback = new ilCheckboxGroupInputGUI($this->lng->txt("tst_instant_feedback"), "instant_feedback"); $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_answer_specific"), 'instant_feedback_specific', '')); $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_answer_generic"), 'instant_feedback_generic', '')); $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_results"), 'instant_feedback_points', '')); $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_solution"), 'instant_feedback_solution', '')); $values = array(); if ($this->object->getSpecificAnswerFeedback()) { array_push($values, 'instant_feedback_specific'); } if ($this->object->getGenericAnswerFeedback()) { array_push($values, 'instant_feedback_generic'); } if ($this->object->getAnswerFeedbackPoints()) { array_push($values, 'instant_feedback_points'); } if ($this->object->getInstantFeedbackSolution()) { array_push($values, 'instant_feedback_solution'); } $instant_feedback->setValue($values); $instant_feedback->setInfo($this->lng->txt("tst_instant_feedback_description")); $form->addItem($instant_feedback); // scoring properties $header_tr = new ilFormSectionHeaderGUI(); $header_tr->setTitle($this->lng->txt("test_results")); $form->addItem($header_tr); // access to test results $results_access = new ilRadioGroupInputGUI($this->lng->txt("tst_results_access"), "results_access"); $results_access->addOption(new ilRadioOption($this->lng->txt("tst_results_access_always"), 2, '')); $results_access->addOption(new ilRadioOption($this->lng->txt("tst_results_access_finished"), 1, '')); $results_access_date_limitation = new ilRadioOption($this->lng->txt("tst_results_access_date"), 3, ''); $results_access->addOption($results_access_date_limitation); $results_access->addOption(new ilRadioOption($this->lng->txt("tst_results_access_never"), 4, '')); $results_access->setValue($this->object->getScoreReporting()); $results_access->setInfo($this->lng->txt("tst_results_access_description")); // access date $reporting_date = new ilDateTimeInputGUI('', 'reporting_date'); $reporting_date->setShowDate(true); $reporting_date->setShowTime(true); if (strlen($this->object->getReportingDate())) { $reporting_date->setDate(new ilDateTime($this->object->getReportingDate(), IL_CAL_TIMESTAMP)); } else { $reporting_date->setDate(new ilDateTime(time(), IL_CAL_UNIX)); } $results_access_date_limitation->addSubItem($reporting_date); $form->addItem($results_access); $results_print_best_solution = new ilCheckboxInputGUI($this->lng->txt("tst_results_print_best_solution"), "print_bs_with_res"); $results_print_best_solution->setInfo($this->lng->txt('tst_results_print_best_solution_info')); $results_print_best_solution->setValue(1); $results_print_best_solution->setChecked((bool) $this->object->isBestSolutionPrintedWithResult()); $form->addItem($results_print_best_solution); // results presentation $results_presentation = new ilCheckboxGroupInputGUI($this->lng->txt("tst_results_presentation"), "results_presentation"); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_pass_details"), 'pass_details', '')); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_details"), 'solution_details', '')); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_printview"), 'solution_printview', '')); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_compare"), 'solution_compare', '')); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_feedback"), 'solution_feedback', '')); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_answers_only"), 'solution_answers_only', '')); $signatureOption = new ilCheckboxOption($this->lng->txt("tst_show_solution_signature"), 'solution_signature', ''); $results_presentation->addOption($signatureOption); $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_suggested"), 'solution_suggested', '')); $values = array(); if ($this->object->getShowPassDetails()) { array_push($values, 'pass_details'); } if ($this->object->getShowSolutionDetails()) { array_push($values, 'solution_details'); } if ($this->object->getShowSolutionPrintview()) { array_push($values, 'solution_printview'); } if ($this->object->getShowSolutionFeedback()) { array_push($values, 'solution_feedback'); } if ($this->object->getShowSolutionAnswersOnly()) { array_push($values, 'solution_answers_only'); } if ($this->object->getShowSolutionSignature()) { array_push($values, 'solution_signature'); } if ($this->object->getShowSolutionSuggested()) { array_push($values, 'solution_suggested'); } if ($this->object->getShowSolutionListComparison()) { array_push($values, 'solution_compare'); } $results_presentation->setValue($values); $results_presentation->setInfo($this->lng->txt("tst_results_presentation_description")); if ($this->object->getAnonymity()) { $signatureOption->setDisabled(true); } $form->addItem($results_presentation); // misc properties $header_misc = new ilFormSectionHeaderGUI(); $header_misc->setTitle($this->lng->txt("misc")); $form->addItem($header_misc); // deletion of test results $passDeletion = new ilRadioGroupInputGUI($this->lng->txt("tst_pass_deletion"), "pass_deletion_allowed"); $passDeletion->addOption(new ilRadioOption($this->lng->txt("tst_pass_deletion_not_allowed"), 0, '')); $passDeletion->addOption(new ilRadioOption($this->lng->txt("tst_pass_deletion_allowed"), 1, '')); $passDeletion->setValue($this->object->isPassDeletionAllowed()); $form->addItem($passDeletion); // export settings $export_settings = new ilCheckboxGroupInputGUI($this->lng->txt("tst_export_settings"), "export_settings"); $export_settings->addOption(new ilCheckboxOption($this->lng->txt("tst_exp_sc_short"), 'exp_sc_short', '')); $values = array(); if ($this->object->getExportSettingsSingleChoiceShort()) { array_push($values, 'exp_sc_short'); } $export_settings->setValue($values); $form->addItem($export_settings); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && $total == 0) { $form->addCommandButton("saveScoring", $this->lng->txt("save")); } if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && $total != 0) { $form->addCommandButton("confirmScoring", $this->lng->txt("save")); } // remove items when using template if ($template_settings) { foreach ($template_settings as $id => $item) { if ($item["hide"]) { $form->removeItemByPostVar($id); } } } $errors = false; if ($save) { $errors = !$form->checkInput(); $form->setValuesByPost(); if ($errors) { $checkonly = false; } } if (!$checkonly) { $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); } return $errors; }
public function initIliasSettingsForm() { /** * @var $ilCtrl ilCtrl */ global $lng, $ilCtrl; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($ilCtrl->getFormAction($this, 'saveIliasSettings')); $this->form->setTitle($this->getPluginObject()->txt('general_settings')); $this->form->addCommandButton('saveIliasSettings', $lng->txt('save')); $this->form->addCommandButton('cancelIliasSettings', $lng->txt('cancel')); $cb_group = new ilCheckboxGroupInputGUI($this->pluginObj->txt('object_creation_settings'), 'obj_creation_settings'); include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $templates = ilSettingsTemplate::getAllSettingsTemplates("xavc"); if ($templates) { foreach ($templates as $item) { $cb_simple = new ilCheckboxOption($this->pluginObj->txt($item["title"]), $item["id"]); $cb_group->addOption($cb_simple); } } $cb_group->setInfo($this->pluginObj->txt('template_info')); $this->form->addItem($cb_group); $obj_title_suffix = new ilCheckboxInputGUI($this->pluginObj->txt('obj_title_suffix'), 'obj_title_suffix'); $obj_title_suffix->setInfo($this->pluginObj->txt('obj_title_suffix_info')); $this->form->addItem($obj_title_suffix); $crs_grp_trigger = new ilCheckboxInputGUI($this->pluginObj->txt('allow_crs_grp_trigger'), 'allow_crs_grp_trigger'); $crs_grp_trigger->setInfo($this->pluginObj->txt('allow_crs_grp_trigger_info')); $this->form->addItem($crs_grp_trigger); $show_free_slots = new ilCheckboxInputGUI($this->pluginObj->txt('show_free_slots'), 'show_free_slots'); $show_free_slots->setInfo($this->pluginObj->txt('show_free_slots_info')); $this->form->addItem($show_free_slots); $enable_perm_room = new ilCheckboxInputGUI($this->pluginObj->txt('enable_perm_room'), 'enable_perm_room'); $enable_perm_room->setInfo($this->pluginObj->txt('enable_perm_room_info')); $default_perm_room = new ilCheckboxInputGUI($this->pluginObj->txt('default_perm_room'), 'default_perm_room'); $default_perm_room->setInfo($this->pluginObj->txt('default_perm_room_info')); $enable_perm_room->addSubItem($default_perm_room); $this->form->addItem($enable_perm_room); $add_to_desktop = new ilCheckboxInputGUI($this->pluginObj->txt('add_to_desktop'), 'add_to_desktop'); $add_to_desktop->setInfo($this->pluginObj->txt('add_to_desktop_info')); $this->form->addItem($add_to_desktop); $content_file_types = new ilTextInputGUI($this->pluginObj->txt('content_file_types'), 'content_file_types'); $content_file_types->setRequired(true); $content_file_types->setInfo($this->pluginObj->txt('content_file_types_info')); $this->form->addItem($content_file_types); $user_folders = new ilCheckboxInputGUI($this->pluginObj->txt('use_user_folders'), 'use_user_folders'); $user_folders->setInfo($this->pluginObj->txt('use_user_folders_info')); if (ilAdobeConnectServer::getSetting('user_assignment_mode') == ilAdobeConnectServer::ASSIGN_USER_DFN_EMAIL) { $user_folders->setDisabled(true); } $this->form->addItem($user_folders); $xavc_options = array("host" => $this->pluginObj->txt("presenter"), "mini-host" => $this->pluginObj->txt("moderator"), "view" => $this->pluginObj->txt("participant"), "denied" => $this->pluginObj->txt('denied')); $mapping_crs = new ilNonEditableValueGUI($this->pluginObj->txt('default_crs_mapping'), 'default_crs_mapping'); // $crs_owner = new ilSelectInputGUI($lng->txt('owner'), 'crs_owner'); // $crs_owner->setOptions($xavc_options); // $mapping_crs->addSubItem($crs_owner); $crs_admin = new ilSelectInputGUI($lng->txt('il_crs_admin'), 'crs_admin'); $crs_admin->setOptions($xavc_options); $mapping_crs->addSubItem($crs_admin); $crs_tutor = new ilSelectInputGUI($lng->txt('il_crs_tutor'), 'crs_tutor'); $crs_tutor->setOptions($xavc_options); $mapping_crs->addSubItem($crs_tutor); $crs_member = new ilSelectInputGUI($lng->txt('il_crs_member'), 'crs_member'); $crs_member->setOptions($xavc_options); $mapping_crs->addSubItem($crs_member); $this->form->addItem($mapping_crs); $mapping_grp = new ilNonEditableValueGUI($this->pluginObj->txt('default_grp_mapping'), 'default_grp_mapping'); // $grp_owner = new ilSelectInputGUI($lng->txt('owner'), 'grp_owner'); // $grp_owner->setOptions($xavc_options); // $mapping_grp->addSubItem($grp_owner); $grp_admin = new ilSelectInputGUI($lng->txt('il_grp_admin'), 'grp_admin'); $grp_admin->setOptions($xavc_options); $mapping_grp->addSubItem($grp_admin); $grp_member = new ilSelectInputGUI($lng->txt('il_grp_member'), 'grp_member'); $grp_member->setOptions($xavc_options); $mapping_grp->addSubItem($grp_member); $this->form->addItem($mapping_grp); $ac_permissions = ilXAVCPermissions::getPermissionsArray(); //@todo nahmad: in Template auslagern! $tbl = "<table width='100%' >\n\t\t<tr>\n\t\t<td> </td> \n\t\t<td>" . $this->pluginObj->txt('presenter') . "</td>\n\t\t<td>" . $this->pluginObj->txt('moderator') . "</td>\n\t\t<td>" . $this->pluginObj->txt('participant') . "</td>\n\t\t<td>" . $this->pluginObj->txt('denied') . "</td>\n\t\t\n\t\t</tr>"; foreach ($ac_permissions as $ac_permission => $ac_roles) { $tbl .= "<tr> <td>" . $this->pluginObj->txt($ac_permission) . "</td>"; foreach ($ac_roles as $ac_role => $ac_access) { $tbl .= "<td>"; $tbl .= ilUtil::formCheckbox((bool) $ac_access, 'permissions[' . $ac_permission . '][' . $ac_role . ']', $ac_role, false); $tbl .= "</td>"; } $tbl .= "</tr>"; } $tbl .= "</table>"; $matrix = new ilCustomInputGUI($this->pluginObj->txt('ac_permissions'), ''); $matrix->setHtml($tbl); $this->form->addItem($matrix); }