/** * Init filter */ function initFilter(array $a_filter_pre = null) { if (is_array($a_filter_pre) && isset($a_filter_pre["object"])) { $_SESSION["form_" . $this->getId()]["object"] = serialize($a_filter_pre["object"]); if ($this->has_schedule) { $_SESSION["form_" . $this->getId()]["fromto"] = serialize(array("from" => serialize(new ilDateTime(date("Y-m-d"), IL_CAL_DATE)), "to" => "")); } } $this->objects = array(); include_once "Modules/BookingManager/classes/class.ilBookingObject.php"; foreach (ilBookingObject::getList($this->pool_id) as $item) { $this->objects[$item["booking_object_id"]] = $item["title"]; } $item = $this->addFilterItemByMetaType("object", ilTable2GUI::FILTER_SELECT); $item->setOptions(array("" => $this->lng->txt('book_all')) + $this->objects); $this->filter["object"] = $item->getValue(); if ($this->has_schedule) { if (!$_SESSION["form_" . $this->getId()]["fromto"]) { // default: from today $_SESSION["form_" . $this->getId()]["fromto"] = serialize(array("from" => serialize(new ilDateTime(date("Y-m-d"), IL_CAL_DATE)), "to" => null)); } $item = $this->addFilterItemByMetaType("fromto", ilTable2GUI::FILTER_DATE_RANGE, false, $this->lng->txt('book_fromto')); $this->filter["fromto"] = $item->getDate(); // only needed for full log if ($this->show_all) { // see ilObjBookingPoolGUI::buildDatesBySchedule() $map = array_flip(array('su', 'mo', 'tu', 'we', 'th', 'fr', 'sa')); $options = array("" => $this->lng->txt('book_all')); // schedule to slot require_once "Modules/BookingManager/classes/class.ilBookingSchedule.php"; foreach (ilBookingSchedule::getList($this->pool_id) as $def) { $schedule = new ilBookingSchedule($def["booking_schedule_id"]); foreach ($schedule->getDefinition() as $day => $slots) { $day_caption = ilCalendarUtil::_numericDayToString($map[$day], false); foreach ($slots as $slot) { $idx = $map[$day] . "_" . $slot; $options[$idx] = $day_caption . ", " . $slot; } } } ksort($options); $item = $this->addFilterItemByMetaType("book_schedule_slot", ilTable2GUI::FILTER_SELECT); $item->setOptions($options); $this->filter["slot"] = $item->getValue(); } } // status $valid_status = array(-ilBookingReservation::STATUS_CANCELLED, ilBookingReservation::STATUS_CANCELLED); if (!$this->has_schedule) { $options = array("" => $this->lng->txt('book_all')); } else { $options = array(); } foreach ($valid_status as $loop) { if ($loop > 0) { $options[$loop] = $this->lng->txt('book_reservation_status_' . $loop); } else { $options[$loop] = $this->lng->txt('book_not') . ' ' . $this->lng->txt('book_reservation_status_' . -$loop); } } $item = $this->addFilterItemByMetaType("status", ilTable2GUI::FILTER_SELECT); $item->setOptions($options); $this->filter["status"] = $item->getValue(); // only needed for full log if ($this->show_all) { $options = array("" => $this->lng->txt('book_all')) + ilBookingReservation::getUserFilter(array_keys($this->objects)); $item = $this->addFilterItemByMetaType("user", ilTable2GUI::FILTER_SELECT); $item->setOptions($options); $this->filter["user_id"] = $item->getValue(); } }