public function addToForm() { global $lng; if ($this->getForm() instanceof ilPropertyFormGUI) { // :TODO: use DateDurationInputGUI ?! if (!(bool) $this->text_input) { $check = new ilCheckboxInputGUI($this->getTitle(), $this->addToElementId("tgl")); $check->setValue(1); $checked = false; } else { $check = new ilCustomInputGUI($this->getTitle()); } $date_from = new ilDateTimeInputGUI($lng->txt('from'), $this->addToElementId("lower")); $date_from->setShowTime(true); $check->addSubItem($date_from); if ($this->getLowerADT()->getDate() && !$this->getLowerADT()->isNull()) { $date_from->setDate($this->getLowerADT()->getDate()); $checked = true; } $date_until = new ilDateTimeInputGUI($lng->txt('until'), $this->addToElementId("upper")); $date_until->setShowTime(true); $check->addSubItem($date_until); if ($this->getUpperADT()->getDate() && !$this->getUpperADT()->isNull()) { $date_until->setDate($this->getUpperADT()->getDate()); $checked = true; } if (!(bool) $this->text_input) { $check->setChecked($checked); } else { $date_from->setMode(ilDateTimeInputGUI::MODE_INPUT); $date_until->setMode(ilDateTimeInputGUI::MODE_INPUT); } $this->addToParentElement($check); } else { // see ilTable2GUI::addFilterItemByMetaType() include_once "./Services/Form/classes/class.ilCombinationInputGUI.php"; include_once "./Services/Form/classes/class.ilDateTimeInputGUI.php"; $item = new ilCombinationInputGUI($this->getTitle(), $this->getElementId()); $lower = new ilDateTimeInputGUI("", $this->addToElementId("lower")); $lower->setShowTime(true); $item->addCombinationItem("lower", $lower, $lng->txt("from")); if ($this->getLowerADT()->getDate() && !$this->getLowerADT()->isNull()) { $lower->setDate($this->getLowerADT()->getDate()); } $upper = new ilDateTimeInputGUI("", $this->addToElementId("upper")); $upper->setShowTime(true); $item->addCombinationItem("upper", $upper, $lng->txt("to")); if ($this->getUpperADT()->getDate() && !$this->getUpperADT()->isNull()) { $upper->setDate($this->getUpperADT()->getDate()); } $item->setComparisonMode(ilCombinationInputGUI::COMPARISON_ASCENDING); $item->setMode(ilDateTimeInputGUI::MODE_INPUT); $this->addToParentElement($item); } }
private function createAttributeFormItem() { $attributes = $this->bookings->getAllAttributes(); foreach ($attributes as $room_attribute) { // setup an ilCombinationInputGUI for the room attributes $room_attribute_comb = new ilCombinationInputGUI($room_attribute, "attribute_" . $room_attribute); $room_attribute_input = new ilRoomSharingTextInputGUI("", "attribute_" . $room_attribute . "_value"); $room_attribute_input->setMaxLength(14); $room_attribute_input->setSize(14); $room_attribute_comb->addCombinationItem("amount", $room_attribute_input, $this->lng->txt("rep_robj_xrs_value")); $this->addFilterItem($room_attribute_comb); $room_attribute_comb->readFromSession(); $this->filter["attributes"][$room_attribute] = $room_attribute_comb->getValue(); } }
/** * If room attributes are present, display some input fields for the desired * amount of those attributes. */ protected function createRoomAttributeFormItem() { $room_attributes = $this->rooms->getAllAttributes(); foreach ($room_attributes as $room_attribute) { // setup an ilCombinationInputGUI for the room attributes $room_attribute_comb = new ilCombinationInputGUI($room_attribute, "attribute_" . $room_attribute); $room_attribute_input = new ilRoomSharingNumberInputGUI("\r\n\t\t\t", "attribute_" . $room_attribute . "_amount"); $room_attribute_input->setMaxLength(8); $room_attribute_input->setSize(8); $room_attribute_input->setMinValue(0); $max_count = $this->rooms->getMaxCountForAttribute($room_attribute); $max_count_num = isset($max_count) ? $max_count : 0; $room_attribute_input->setMaxValue($max_count_num); $room_attribute_comb->addCombinationItem("amount", $room_attribute_input, $this->lng->txt("rep_robj_xrs_amount")); $this->addFilterItem($room_attribute_comb); $room_attribute_comb->readFromSession(); $this->filter["attributes"][$room_attribute] = $room_attribute_comb->getValue(); $value = $_POST[$room_attribute_input->getPostVar()]; if ($value !== "" && $value > $room_attribute_input->getMaxValue()) { if ($this->message != '') { $this->message = $this->message . ', ' . $room_attribute; } else { $this->message = $room_attribute; } if (!$this->messagePlural && $this->messageNeeded) { $this->messagePlural = true; } $this->messageNeeded = true; } elseif ($value !== "" && $value < 0) { if ($this->messageLowerZero != '') { $this->messageLowerZero = $this->messageLowerZero . ', ' . $room_attribute; } else { $this->messageLowerZero = $room_attribute; } if (!$this->messagePluralLowerZero && $this->messageNeededLowerZero) { $this->messagePluralLowerZero = true; } $this->messageNeededLowerZero = true; } } }
/** * Generate and organize the time range input fields. * * @return \ilCombinationInputGUI */ private function createAndSetTimeRangeInput() { $time_range = new ilCombinationInputGUI($this->lng->txt("assessment_log_datetime"), "time_range"); $from_id = "from"; $to_id = "to"; $from_transl = $this->lng->txt($from_id); $to_transl = $this->lng->txt($to_id); $time_input_from = $this->createAndSetDateTimeInput($from_transl, $from_id, $this->date_from); $time_input_to = $this->createAndSetDateTimeInput($to_transl, $to_id, $this->date_to); $time_range->addCombinationItem($from_id, $time_input_from, $from_transl); $time_range->addCombinationItem($to_id, $time_input_to, $to_transl); return $time_range; }
/** * Role Mapping Tab * @global ilToolbarGUI $ilToolbar */ public function roleMapping() { global $ilToolbar; $this->setSubTabs(); $this->tabs_gui->setSubTabActive('ldap_role_mapping'); $ilToolbar->addButton($this->lng->txt("ldap_new_role_assignment"), $this->ctrl->getLinkTarget($this, 'addRoleMapping')); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; //Set propertyform for synchronization settings include_once "./Services/Form/classes/class.ilCombinationInputGUI.php"; $propertie_form = new ilPropertyFormGUI(); $propertie_form->setTitle($this->lng->txt('ldap_role_settings')); $propertie_form->setFormAction($this->ctrl->getFormAction($this, "saveSyncronizationSettings")); $propertie_form->addCommandButton("saveSyncronizationSettings", $this->lng->txt('save')); $role_active = new ilCheckboxInputGUI($this->lng->txt('ldap_role_active')); $role_active->setPostVar('role_sync_active'); $role_active->setChecked($this->server->enabledRoleSynchronization() ? true : false); $propertie_form->addItem($role_active); $binding = new ilCombinationInputGUI($this->lng->txt('ldap_server_binding')); $binding->setInfo($this->lng->txt('ldap_role_bind_user_info')); $user = new ilTextInputGUI(""); $user->setPostVar("role_bind_user"); $user->setValue($this->server->getRoleBindDN()); $user->setSize(50); $user->setMaxLength(255); $binding->addCombinationItem(0, $user, $this->lng->txt('ldap_role_bind_user')); $pass = new ilPasswordInputGUI(""); $pass->setPostVar("role_bind_pass"); $pass->setValue($this->server->getRoleBindPassword()); $pass->setSize(12); $pass->setMaxLength(36); $pass->setRetype(false); $binding->addCombinationItem(1, $pass, $this->lng->txt('ldap_role_bind_pass')); $propertie_form->addItem($binding); $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ldap_role_mappings.html', 'Services/LDAP'); $this->tpl->setVariable("NEW_ASSIGNMENT_TBL", $propertie_form->getHTML()); //Set Group Assignments Table if mappings exist include_once 'Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php'; $mapping_instance = ilLDAPRoleGroupMappingSettings::_getInstanceByServerId($this->server->getServerId()); $mappings = $mapping_instance->getMappings(); if (count($mappings)) { include_once "./Services/LDAP/classes/class.ilLDAPRoleMappingTableGUI.php"; $table_gui = new ilLDAPRoleMappingTableGUI($this, $this->server->getServerId(), "roleMapping"); $table_gui->setTitle($this->lng->txt('ldap_role_group_assignments')); $table_gui->setData($mappings); $this->tpl->setVariable("RULES_TBL", $table_gui->getHTML()); } }
/** * Add filter by standard type * * @param string $id * @param int $type * @param bool $a_optional * @param string $caption * @return object */ function addFilterItemByMetaType($id, $type = self::FILTER_TEXT, $a_optional = false, $caption = NULL) { global $lng; if (!$caption) { $caption = $lng->txt($id); } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; switch ($type) { case self::FILTER_SELECT: include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $item = new ilSelectInputGUI($caption, $id); break; case self::FILTER_DATE: include_once "./Services/Form/classes/class.ilDateTimeInputGUI.php"; $item = new ilDateTimeInputGUI($caption, $id); $item->setMode(ilDateTimeInputGUI::MODE_INPUT); break; case self::FILTER_TEXT: include_once "./Services/Form/classes/class.ilTextInputGUI.php"; $item = new ilTextInputGUI($caption, $id); $item->setMaxLength(64); $item->setSize(20); // $item->setSubmitFormOnEnter(true); break; case self::FILTER_LANGUAGE: $lng->loadLanguageModule("meta"); include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $item = new ilSelectInputGUI($caption, $id); $options = array("" => $lng->txt("trac_all")); foreach ($lng->getInstalledLanguages() as $lang_key) { $options[$lang_key] = $lng->txt("meta_l_" . $lang_key); } $item->setOptions($options); break; case self::FILTER_NUMBER_RANGE: include_once "./Services/Form/classes/class.ilCombinationInputGUI.php"; include_once "./Services/Form/classes/class.ilNumberInputGUI.php"; $item = new ilCombinationInputGUI($caption, $id); $combi_item = new ilNumberInputGUI("", $id . "_from"); $item->addCombinationItem("from", $combi_item, $lng->txt("from")); $combi_item = new ilNumberInputGUI("", $id . "_to"); $item->addCombinationItem("to", $combi_item, $lng->txt("to")); $item->setComparisonMode(ilCombinationInputGUI::COMPARISON_ASCENDING); $item->setMaxLength(7); $item->setSize(20); break; case self::FILTER_DATE_RANGE: include_once "./Services/Form/classes/class.ilCombinationInputGUI.php"; include_once "./Services/Form/classes/class.ilDateTimeInputGUI.php"; $item = new ilCombinationInputGUI($caption, $id); $combi_item = new ilDateTimeInputGUI("", $id . "_from"); $item->addCombinationItem("from", $combi_item, $lng->txt("from")); $combi_item = new ilDateTimeInputGUI("", $id . "_to"); $item->addCombinationItem("to", $combi_item, $lng->txt("to")); $item->setComparisonMode(ilCombinationInputGUI::COMPARISON_ASCENDING); $item->setMode(ilDateTimeInputGUI::MODE_INPUT); break; case self::FILTER_DATETIME_RANGE: include_once "./Services/Form/classes/class.ilCombinationInputGUI.php"; include_once "./Services/Form/classes/class.ilDateTimeInputGUI.php"; $item = new ilCombinationInputGUI($caption, $id); $combi_item = new ilDateTimeInputGUI("", $id . "_from"); $combi_item->setShowTime(true); $item->addCombinationItem("from", $combi_item, $lng->txt("from")); $combi_item = new ilDateTimeInputGUI("", $id . "_to"); $combi_item->setShowTime(true); $item->addCombinationItem("to", $combi_item, $lng->txt("to")); $item->setComparisonMode(ilCombinationInputGUI::COMPARISON_ASCENDING); $item->setMode(ilDateTimeInputGUI::MODE_INPUT); break; case self::FILTER_DURATION_RANGE: $lng->loadLanguageModule("form"); include_once "./Services/Form/classes/class.ilCombinationInputGUI.php"; include_once "./Services/Form/classes/class.ilDurationInputGUI.php"; $item = new ilCombinationInputGUI($caption, $id); $combi_item = new ilDurationInputGUI("", $id . "_from"); $combi_item->setShowMonths(false); $combi_item->setShowDays(true); $combi_item->setShowSeconds(true); $item->addCombinationItem("from", $combi_item, $lng->txt("from")); $combi_item = new ilDurationInputGUI("", $id . "_to"); $combi_item->setShowMonths(false); $combi_item->setShowDays(true); $combi_item->setShowSeconds(true); $item->addCombinationItem("to", $combi_item, $lng->txt("to")); $item->setComparisonMode(ilCombinationInputGUI::COMPARISON_ASCENDING); break; default: return false; } $this->addFilterItem($item, $a_optional); $item->readFromSession(); return $item; }
/** * Creates the time range form item which consists of an ilCombinationGUI containing two * customized ilDateTimeInputGUIs in the shape of an ilRoomSharingTimeInputGUI. */ private function createTimeRangeFormItem() { global $ilUser; $time_comb = new ilCombinationInputGUI($this->lng->txt("rep_robj_xrs_time_range"), "time"); $time_from = new ilRoomSharingTimeInputGUI("", "time_from"); $time_from->setShowTime(true); $time_from->setShowDate(false); $time_from->setMinuteStepSize(5); $time_from_given = unserialize($_SESSION["form_searchform"]["time_from"]); $time_to_given = unserialize($_SESSION["form_searchform"]["time_to"]); // if (!$this->isNoTimeSet($time_from_given['time'])) { $current_date_time_array = $this->getCurrentTime(); $time_from_given['time'] = $current_date_time_array['time']['from']; $time_to_given['time'] = $current_date_time_array['time']['to']; $time_from_given['date'] = $current_date_time_array['date']['from']; $time_to_given['date'] = $current_date_time_array['date']['to']; // } if (!empty($time_from_given['date']) && !empty($time_from_given['time'])) { $time_from->setDate(new ilDate($time_from_given['date'] . ' ' . $time_from_given['time'], IL_CAL_DATETIME, $ilUser->getTimeZone())); } $time_comb->addCombinationItem("time_from", $time_from, $this->lng->txt("rep_robj_xrs_between")); $time_to = new ilRoomSharingTimeInputGUI("", "time_to"); $time_to->setShowTime(true); $time_to->setShowDate(false); $time_to->setMinuteStepSize(5); if (!empty($time_to_given['date']) && !empty($time_to_given['time'])) { $time_to->setDate(new ilDate($time_to_given['date'] . ' ' . $time_to_given['time'], IL_CAL_DATETIME, $ilUser->getTimeZone())); } $time_comb->addCombinationItem("time_to", $time_to, $this->lng->txt("and")); $time_comb->setComparisonMode(ilCombinationInputGUI::COMPARISON_ASCENDING); $time_comb->setRequired(true); return $time_comb; }