コード例 #1
0
 /**
  * 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;
         }
     }
 }
コード例 #2
0
 /**
  * If room attributes are present, create the input items for the those attributes.
  */
 private function createRoomAttributeFormItems()
 {
     $room_attribute_items = array();
     $room_attributes = $this->rooms->getAllAttributes();
     foreach ($room_attributes as $room_attribute) {
         // setup an ilRoomSharingNumberInputGUI for the room attributes
         $room_attribute_title = $room_attribute . " (" . $this->lng->txt("rep_robj_xrs_amount") . ")";
         $room_attribute_postvar = "attribute_" . $room_attribute . "_amount";
         $room_attribute_input = new ilRoomSharingNumberInputGUI($room_attribute_title, $room_attribute_postvar);
         $room_attribute_input->setParent($this->search_form);
         $room_attribute_input->setMaxLength(8);
         $room_attribute_input->setSize(8);
         $room_attribute_input->setMinValue(0);
         $max = $this->rooms->getMaxCountForAttribute($room_attribute);
         $max_num = isset($max) ? $max : 0;
         $room_attribute_input->setMaxValue($max_num);
         $room_attribute_input->readFromSession();
         $room_attribute_items[] = $room_attribute_input;
     }
     return $room_attribute_items;
 }