/** * Creates a form for the davinci import * * @return \ilPropertyFormGUI the creation form */ protected function initImportForm() { $import_form = new ilPropertyFormGUI(); $import_form->setTitle($this->lng->txt("rep_robj_xrs_daVinci_import_title")); $file = $this->createFileInputFormItem(); $import_form->addItem($file); $importOption1field = new ilCheckboxInputGUI($this->lng->txt("rep_robj_xrs_daVinci_import_bookings"), 'import_bookings'); $import_form->addItem($importOption1field); $importOption2field = new ilCheckboxInputGUI($this->lng->txt("rep_robj_xrs_daVinci_import_rooms"), 'import_rooms'); $import_form->addItem($importOption2field); $default_cap = new ilRoomSharingNumberInputGUI($this->lng->txt("rep_robj_xrs_daVinci_import_default_cap"), "default_cap"); $default_cap->setDisabled(false); $default_cap->setMinValue(1); $default_cap->setValue("20"); $import_form->addItem($default_cap); $import_form->addCommandButton($this->lng->txt("rep_robj_xrs_daVinci_import_button"), $this->lng->txt("import")); return $import_form; }
/** * Initializes a form for either displaying a room, adding a new room or editing an existing * room. The difference between those three forms is subtle but important: the form for * displaying rooms displays the information of the room without the ability of editing them. * The form for creating a room allows the input of values but contains no values initially. The * form for editing a room contains information that have been set before. * The creation of either those forms is determined by the mode parameter. * * @param string $a_mode the mode this form is centered around * * @return ilPropertyFormGUI the form with the given mode */ private function initForm($a_mode = "show") { $form_gui =& new ilPropertyFormGUI(); $form_gui->setMultipart(true); $form_gui->setTitle($this->lng->txt("rep_robj_xrs_room_properties")); $form_gui->setDescription($this->lng->txt("rep_robj_xrs_room_prop_description")); $name = new ilRoomSharingTextInputGUI($this->lng->txt("rep_robj_xrs_room_name"), "name"); $name->setDisabled(true); $form_gui->addItem($name); $type = new ilRoomSharingTextInputGUI($this->lng->txt("rep_robj_xrs_room_type"), "type"); $type->setDisabled(true); $form_gui->addItem($type); $min_alloc = new ilRoomSharingNumberInputGUI($this->lng->txt("rep_robj_xrs_room_min_alloc"), "min_alloc"); $min_alloc->setDisabled(true); $form_gui->addItem($min_alloc); $max_alloc = new ilRoomSharingNumberInputGUI($this->lng->txt("rep_robj_xrs_room_max_alloc"), "max_alloc"); $max_alloc->setDisabled(true); $form_gui->addItem($max_alloc); $floor_plan = new ilSelectInputGUI($this->lng->txt("rep_robj_xrs_room_floor_plans"), "file_id"); $floor_plan->setOptions($this->room_obj->getAllFloorplans()); $floor_plan->setDisabled(true); $form_gui->addItem($floor_plan); if (count($this->room_obj->getAllAvailableAttributes())) { $defined_attributes = $this->room_obj->getAttributes(); $show_mode_with_exist_attrs = $a_mode == "show" && count($defined_attributes) > 0; if ($a_mode == "edit" || $a_mode == "create" || $show_mode_with_exist_attrs) { $attributes_header = new ilFormSectionHeaderGUI(); $attribute_header_text = $this->createAttributeHeaderText(); $attributes_header->setTitle($this->lng->txt("rep_robj_xrs_room_attributes") . $attribute_header_text); $form_gui->addItem($attributes_header); } foreach ($this->room_obj->getAllAvailableAttributes() as $attr) { $attribute_amount_by_id = $this->room_obj->getAttributeAmountById($attr['id']); $amount_not_given = !ilRoomSharingNumericUtils::isPositiveNumber($attribute_amount_by_id, true); if ($a_mode == "show" && $amount_not_given) { continue; } else { $attr_field = new ilRoomSharingNumberInputGUI($attr['name'], self::ATTRIBUTE_ID_PREFIX . $attr['id']); $attr_field->setValue($attribute_amount_by_id); $attr_field->setMinValue(0); $attr_field->setDisabled($a_mode == "show"); $form_gui->addItem($attr_field); } } } if ($a_mode == "edit" || $a_mode == "create") { $name->setDisabled(false); $name->setRequired(true); $type->setDisabled(false); $min_alloc->setDisabled(false); $min_alloc->setMinValue(0); $max_alloc->setDisabled(false); $max_alloc->setRequired(true); $max_alloc->setMinValue(0); $floor_plan->setDisabled(false); if ($a_mode == "create") { $min_alloc->setValue("0"); $form_gui->addCommandButton($this->ctrl->getLinkTarget($this, "addRoom"), $this->lng->txt("rep_robj_xrs_add_room")); } else { $form_gui->addCommandButton("saveRoom", $this->lng->txt("save")); } } if ($a_mode == "edit" || $a_mode == "show") { $name->setValue($this->room_obj->getName()); $type->setValue($this->room_obj->getType()); $min_alloc->setValue($this->room_obj->getMinAlloc()); $max_alloc->setValue($this->room_obj->getMaxAlloc()); $floor_plan->setValue($this->room_obj->getFileId()); if ($a_mode == "show") { $floor_plan->setDisabled(true); $mobj = new ilObjMediaObject($this->room_obj->getFileId()); $mitems = $mobj->getMediaItems(); if (!empty($mitems)) { $med = $mobj->getMediaItem("Standard"); $target = $med->getThumbnailTarget(); $image_with_link = "<br><a target='_blank' href='" . $mobj->getDataDirectory() . "/" . $med->getLocation() . "'>" . ilUtil::img($target) . "</a>"; $floor_plan->setInfo($image_with_link); } } } $form_gui->setFormAction($this->ctrl->getFormAction($this)); return $form_gui; }