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; }
/** * init edit/create category form * * @access protected * @return */ protected function initFormCategory($a_mode) { global $rbacsystem, $ilUser; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; include_once './Services/Calendar/classes/class.ilCalendarCategories.php'; $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo((int) $_GET['category_id']); $this->form = new ilPropertyFormGUI(); #$this->form->setTableWidth('40%'); switch ($a_mode) { case 'edit': $category = new ilCalendarCategory((int) $_GET['category_id']); $this->form->setTitle($this->lng->txt('cal_edit_category')); $this->ctrl->saveParameter($this, array('seed', 'category_id')); $this->form->setFormAction($this->ctrl->getFormAction($this)); if ($this->isEditable()) { $this->form->addCommandButton('update', $this->lng->txt('save')); /* if($cat_info['type'] == ilCalendarCategory::TYPE_USR) { $this->form->addCommandButton('shareSearch',$this->lng->txt('cal_share')); } $this->form->addCommandButton('confirmDelete',$this->lng->txt('delete')); */ $this->form->addCommandButton('manage', $this->lng->txt('cancel')); } break; case 'create': $this->editable = true; $category = new ilCalendarCategory(0); $this->ctrl->saveParameter($this, array('category_id')); $this->form->setFormAction($this->ctrl->getFormAction($this)); $this->form->setTitle($this->lng->txt('cal_add_category')); $this->form->addCommandButton('save', $this->lng->txt('save')); $this->form->addCommandButton('manage', $this->lng->txt('cancel')); break; } // Calendar name $title = new ilTextInputGUI($this->lng->txt('cal_calendar_name'), 'title'); if ($a_mode == 'edit') { $title->setDisabled(!$this->isEditable()); } $title->setRequired(true); $title->setMaxLength(64); $title->setSize(32); $title->setValue($category->getTitle()); $this->form->addItem($title); include_once './Services/Calendar/classes/class.ilCalendarSettings.php'; if ($a_mode == 'create' and $rbacsystem->checkAccess('edit_event', ilCalendarSettings::_getInstance()->getCalendarSettingsId())) { $type = new ilRadioGroupInputGUI($this->lng->txt('cal_cal_type'), 'type'); $type->setValue($category->getType()); $type->setRequired(true); $opt = new ilRadioOption($this->lng->txt('cal_type_personal'), ilCalendarCategory::TYPE_USR); $type->addOption($opt); $opt = new ilRadioOption($this->lng->txt('cal_type_system'), ilCalendarCategory::TYPE_GLOBAL); $type->addOption($opt); $type->setInfo($this->lng->txt('cal_type_info')); $this->form->addItem($type); } $color = new ilColorPickerInputGUI($this->lng->txt('cal_calendar_color'), 'color'); $color->setValue($category->getColor()); if (!$this->isEditable()) { $color->setDisabled(true); } $color->setRequired(true); $this->form->addItem($color); $location = new ilRadioGroupInputGUI($this->lng->txt('cal_type_rl'), 'type_rl'); $location->setDisabled($a_mode == 'edit'); $location_local = new ilRadioOption($this->lng->txt('cal_type_local'), ilCalendarCategory::LTYPE_LOCAL); $location->addOption($location_local); $location_remote = new ilRadioOption($this->lng->txt('cal_type_remote'), ilCalendarCategory::LTYPE_REMOTE); $location->addOption($location_remote); $location->setValue($category->getLocationType()); $url = new ilTextInputGUI($this->lng->txt('cal_remote_url'), 'remote_url'); $url->setDisabled($a_mode == 'edit'); $url->setValue($category->getRemoteUrl()); $url->setMaxLength(500); $url->setSize(60); $url->setRequired(true); $location_remote->addSubItem($url); $user = new ilTextInputGUI($this->lng->txt('username'), 'remote_user'); $user->setDisabled($a_mode == 'edit'); $user->setValue($category->getRemoteUser()); $user->setMaxLength(50); $user->setSize(20); $user->setRequired(false); $location_remote->addSubItem($user); $pass = new ilPasswordInputGUI($this->lng->txt('password'), 'remote_pass'); $pass->setDisabled($a_mode == 'edit'); $pass->setValue($category->getRemotePass()); $pass->setMaxLength(50); $pass->setSize(20); $pass->setRetype(false); $pass->setInfo($this->lng->txt('remote_pass_info')); $location_remote->addSubItem($pass); $this->form->addItem($location); }
/** * Default settings tab for Test & Assessment */ public function defaultsObject() { global $ilAccess, $rbacreview, $lng, $ilCtrl, $tpl, $ilTabs; $ilTabs->activateTab('defaults'); $assessmentSetting = new ilSetting("assessment"); $use_javascript = array_key_exists("use_javascript", $_GET) ? $_GET["use_javascript"] : $assessmentSetting->get("use_javascript"); $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"; } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($lng->txt("assessment_defaults")); // Enable javascript $enable = new ilCheckboxInputGUI($lng->txt("assessment_use_javascript"), "use_javascript"); $enable->setChecked($use_javascript); $enable->setInfo($lng->txt("assessment_use_javascript_desc")); $form->addItem($enable); $linepicker = new ilColorPickerInputGUI($lng->txt("assessment_imap_line_color"), "imap_line_color"); $linepicker->setValue($imap_line_color); $form->addItem($linepicker); if (@file_exists("./Modules/Test/classes/class.ilTestResultsToXML.php")) { global $ilDB; $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); $userCriteria->setValue($isSingleline ? 0 : 1); $manager = $ilDB->db->loadModule('Manager'); $fields = $manager->listTableFields('usr_data'); $usr_fields = array(); foreach ($fields as $field) { $usr_fields[$field] = $field; } $userCriteria->setOptions($usr_fields); $userCriteria->setValue($user_criteria); $form->addItem($userCriteria); } if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) { $form->addCommandButton("saveDefaults", $lng->txt("save")); } $tpl->setVariable("ADM_CONTENT", $form->getHTML()); }