/** * Init blog posting form * * @param int $a_blog_id * @param bool $a_insert * @return ilPropertyFormGUI */ protected function initPostingForm($a_blog_id, $a_insert = false) { global $ilCtrl, $ilUser; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); if ($a_insert) { $form->setTitle($this->lng->txt("cont_insert_blog")); } else { $form->setTitle($this->lng->txt("cont_update_blog")); } $options = array(); include_once "Modules/Blog/classes/class.ilBlogPosting.php"; $postings = ilBlogPosting::getAllPostings($a_blog_id); if ($postings) { foreach ($postings as $post) { // could be posting from someone else if ($post["author"] == $ilUser->getId()) { $date = new ilDateTime($post["date"], IL_CAL_DATETIME); $title = $post["title"] . " - " . ilDatePresentation::formatDate($date); $cbox = new ilCheckboxInputGUI($title, "posting"); $cbox->setValue($post["id"]); $options[] = $cbox; } } } asort($options); $obj = new ilCheckboxGroupInputGUI($this->lng->txt("cont_pc_blog_posting"), "posting"); $obj->setRequired(true); $obj->setOptions($options); $form->addItem($obj); $blog_id = new ilHiddenInputGUI("blog_id"); $blog_id->setValue($a_blog_id); $form->addItem($blog_id); if ($a_insert) { $form->addCommandButton("create_blog", $this->lng->txt("save")); $form->addCommandButton("cancelCreate", $this->lng->txt("cancel")); } else { $obj->setValue($this->content_obj->getPostings()); $form->addCommandButton("update", $this->lng->txt("save")); $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel")); } return $form; }
function initAddCodesForm() { global $rbacreview, $ilObjDataCache, $lng; include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'createCodes')); $this->form_gui->setTitle($this->lng->txt('registration_codes_edit_header')); $count = new ilNumberInputGUI($this->lng->txt('registration_codes_number'), 'reg_codes_number'); $count->setSize(4); $count->setMaxLength(4); $count->setMinValue(1); $count->setMaxValue(1000); $count->setRequired(true); $this->form_gui->addItem($count); // type $code_type = new ilCheckboxGroupInputGUI($this->lng->txt('registration_codes_type'), 'code_type'); $code_type->setRequired(TRUE); $code_type->addOption(new ilCheckboxOption($this->lng->txt('registration_codes_type_reg'), self::CODE_TYPE_REGISTRATION, $this->lng->txt('registration_codes_type_reg_info'))); $code_type->addOption(new ilCheckboxOption($this->lng->txt('registration_codes_type_ext'), self::CODE_TYPE_EXTENSION, $this->lng->txt('registration_codes_type_ext_info'))); $this->form_gui->addItem($code_type); $sec = new ilFormSectionHeaderGUI(); $sec->setTitle($this->lng->txt('registration_codes_roles_title')); $this->form_gui->addItem($sec); include_once './Services/AccessControl/classes/class.ilObjRole.php'; $options = array("" => $this->lng->txt('registration_codes_no_assigned_role')); foreach ($rbacreview->getGlobalRoles() as $role_id) { if (!in_array($role_id, array(SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID))) { $options[$role_id] = $ilObjDataCache->lookupTitle($role_id); } } $roles = new ilSelectInputGUI($this->lng->txt("registration_codes_roles"), "reg_codes_role"); $roles->setInfo($this->lng->txt("registration_codes_override_info")); $roles->setOptions($options); $this->form_gui->addItem($roles); $local = new ilTextInputGUI($this->lng->txt("registration_codes_roles_local"), "reg_codes_local"); $local->setMulti(true); $local->setDataSource($this->ctrl->getLinkTarget($this, "getLocalRoleAutoComplete", "", true)); $this->form_gui->addItem($local); $sec = new ilFormSectionHeaderGUI(); $sec->setTitle($this->lng->txt('reg_access_limitations')); $this->form_gui->addItem($sec); $limit = new ilRadioGroupInputGUI($this->lng->txt("reg_access_limitation_mode"), "reg_limit"); $limit->setInfo($this->lng->txt("registration_codes_override_info")); $this->form_gui->addItem($limit); $opt = new ilRadioOption($this->lng->txt("registration_codes_roles_limitation_none"), "none"); $limit->addOption($opt); $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_none"), "unlimited"); $limit->addOption($opt); $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_absolute"), "absolute"); $limit->addOption($opt); $dt = new ilDateTimeInputGUI($this->lng->txt("reg_access_limitation_mode_absolute_target"), "abs_date"); $dt->setRequired(true); $opt->addSubItem($dt); $opt = new ilRadioOption($this->lng->txt("reg_access_limitation_mode_relative"), "relative"); $limit->addOption($opt); $days = new ilTextInputGUI("", "rel_date[d]"); $days->setSize(5); $days->setSuffix($this->lng->txt("days")); $mon = new ilTextInputGUI("", "rel_date[m]"); $mon->setSize(5); $mon->setSuffix($this->lng->txt("months")); $yr = new ilTextInputGUI("", "rel_date[y]"); $yr->setSize(5); $yr->setSuffix($this->lng->txt("years")); // custom input won't reload if (is_array($_POST["rel_date"])) { $days->setValue($_POST["rel_date"]["d"]); $mon->setValue($_POST["rel_date"]["m"]); $yr->setValue($_POST["rel_date"]["y"]); } $dur = new ilCustomInputGUI($this->lng->txt("reg_access_limitation_mode_relative_target")); $dur->setRequired(true); $dur->setHTML($days->getToolbarHTML() . " " . $mon->getToolbarHTML() . " " . $yr->getToolbarHTML()); $opt->addSubItem($dur); $this->form_gui->addCommandButton('createCodes', $this->lng->txt('create')); $this->form_gui->addCommandButton('listCodes', $this->lng->txt('cancel')); }
/** * Init consultation hours form * * @param bool $a_insert * @return ilPropertyFormGUI */ protected function initForm($a_insert = false) { global $ilCtrl, $ilUser, $lng; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); if ($a_insert) { $form->setTitle($this->lng->txt("cont_insert_consultation_hours")); } else { $form->setTitle($this->lng->txt("cont_update_consultation_hours")); } $mode = new ilRadioGroupInputGUI($this->lng->txt("cont_cach_mode"), "mode"); $mode->setRequired(true); $form->addItem($mode); $opt_auto = new ilRadioOption($this->lng->txt("cont_cach_mode_automatic"), "auto"); $opt_auto->setInfo($this->lng->txt("cont_cach_mode_automatic_info")); $mode->addOption($opt_auto); $opt_manual = new ilRadioOption($this->lng->txt("cont_cach_mode_manual"), "manual"); $opt_manual->setInfo($this->lng->txt("cont_cach_mode_manual_info")); $mode->addOption($opt_manual); if (!$this->getPageConfig()->getEnablePCType("PlaceHolder")) { include_once "Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php"; $grp_ids = ilConsultationHourGroups::getGroupsOfUser($ilUser->getId()); if (sizeof($grp_ids)) { $this->lng->loadLanguageModule("dateplaner"); $groups = new ilCheckboxGroupInputGUI($this->lng->txt("cal_ch_app_grp"), "grp"); $groups->setRequired(true); $opt_manual->addSubItem($groups); foreach ($grp_ids as $grp_obj) { $groups->addOption(new ilCheckboxOption($grp_obj->getTitle(), $grp_obj->getGroupId())); } } else { $opt_manual->setDisabled(true); } } else { $opt_manual->setDisabled(true); } if ($a_insert) { $mode->setValue("auto"); $form->addCommandButton("create_consultation_hours", $this->lng->txt("select")); $form->addCommandButton("cancelCreate", $this->lng->txt("cancel")); } else { // set values $grp_ids = $this->content_obj->getGroupIds(); if (sizeof($grp_ids)) { $mode->setValue("manual"); $groups->setValue($grp_ids); } else { $mode->setValue("auto"); } $form->addCommandButton("update", $this->lng->txt("select")); $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel")); } return $form; }
/** * Init settings form */ protected function initSettingsForm() { include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('crs_loc_settings_tbl')); $type = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_settings_type'), 'type'); $type->setRequired(true); $type->setValue(ilLOSettings::getInstanceByObjId($this->getParentObject()->getId())->getType()); $type_1 = new ilRadioOption($this->lng->txt('crs_loc_type_initial_all'), ilLOSettings::LOC_INITIAL_ALL); $type_1->setInfo($this->lng->txt('crs_loc_type_initial_all_info')); $type->addOption($type_1); $type_2 = new ilRadioOption($this->lng->txt('crs_loc_type_initial_sel'), ilLOSettings::LOC_INITIAL_SEL); #$type->addOption($type_2); $type_3 = new ilRadioOption($this->lng->txt('crs_loc_type_qualified'), ilLOSettings::LOC_QUALIFIED); $type_3->setInfo($this->lng->txt('crs_loc_type_qualified_info')); $type->addOption($type_3); $type_4 = new ilRadioOption($this->lng->txt('crs_loc_type_practise'), ilLOSettings::LOC_PRACTISE); $type_4->setInfo($this->lng->txt('crs_loc_type_practise_info')); $type->addOption($type_4); $form->addItem($type); $form->addCommandButton('saveSettings', $this->lng->txt('save')); // qualified test visibility $qtv = new ilCheckboxGroupInputGUI($this->lng->txt('crs_loc_qt_visibility'), 'qtv'); $qtv_values = array(); if ($this->getSettings()->isGeneralQualifiedTestVisible()) { $qtv_values[] = ilLOSettings::QT_VISIBLE_ALL; } if ($this->getSettings()->isQualifiedTestPerObjectiveVisible()) { $qtv_values[] = ilLOSettings::QT_VISIBLE_OBJECTIVE; } $qtv->setValue($qtv_values); $qtv->setRequired(true); $qtv->addOption(new ilCheckboxOption($this->lng->txt('crs_loc_qt_visibility_all'), ilLOSettings::QT_VISIBLE_ALL)); $qtv->addOption(new ilCheckboxOption($this->lng->txt('crs_loc_qt_visibility_lo'), ilLOSettings::QT_VISIBLE_OBJECTIVE)); #$form->addItem($qtv); // reset results $reset = new ilCheckboxInputGUI($this->lng->txt('crs_loc_settings_reset'), 'reset'); $reset->setValue(1); $reset->setChecked($this->getSettings()->isResetResultsEnabled()); $reset->setOptionTitle($this->lng->txt('crs_loc_settings_reset_enable')); $reset->setInfo($this->lng->txt('crs_loc_settings_reset_enable_info')); $form->addItem($reset); return $form; }