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();
     }
 }
 /**
  * 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;
 }
 /**
  * Creates a combination input item which allows you to type in a room name.
  */
 protected function createRoomFormItem()
 {
     // Room Name
     $room_comb = new ilCombinationInputGUI($this->lng->txt("rep_robj_xrs_room"), "room");
     $room_name_input = new ilRoomSharingTextInputGUI("", "room_name");
     $room_name_input->setMaxLength(14);
     $room_name_input->setSize(14);
     $room_comb->addCombinationItem("room_name", $room_name_input, $this->lng->txt("rep_robj_xrs_room_name"));
     $this->addFilterItem($room_comb);
     $room_comb->readFromSession();
     // get the value that was submitted
     $this->filter["room"] = $room_comb->getValue();
 }
 /**
  * Creates the input item for the room name input.
  */
 private function createRoomFormItem()
 {
     $room_name_input = new ilRoomSharingTextInputGUI($this->lng->txt("rep_robj_xrs_room"), "room_name");
     $room_name_input->setParent($this->search_form);
     $room_name_input->setMaxLength(14);
     $room_name_input->setSize(14);
     $room_get_value = $_GET["room"];
     //if the user was redirected from the room list, set the value for the room accordingly
     if ($room_get_value) {
         $room_name_input->setValue($room_get_value);
     } else {
         $room_name_input->readFromSession();
     }
     return $room_name_input;
 }