public function getFilteredData(array $filter)
 {
     $freq = unserialize($filter['recurrence']["frequence"]);
     switch ($freq) {
         case "DAILY":
             $repeat_amount = unserialize($filter['recurrence']["repeat_amount"]);
             $repeat_type = unserialize($filter['recurrence']["repeat_type"]);
             $repeat_until = unserialize($filter['recurrence']["repeat_until"]);
             $filter['datetimes'] = seqUtils::getDailyFilteredData($filter['date'], $repeat_type, $repeat_amount, $repeat_until, $filter['time_from'], $filter['time_to']);
             break;
         case "WEEKLY":
             $repeat_amount = unserialize($filter['recurrence']["repeat_amount"]);
             $repeat_type = unserialize($filter['recurrence']["repeat_type"]);
             $repeat_until = unserialize($filter['recurrence']["repeat_until"]);
             $weekdays = unserialize($filter["recurrence"]["weekdays"]);
             $filter['datetimes'] = seqUtils::getWeeklyFilteredData($filter['date'], $repeat_type, $repeat_amount, $repeat_until, $weekdays, $filter['time_from'], $filter['time_to']);
             break;
         case "MONTHLY":
             $repeat_amount = unserialize($filter['recurrence']["repeat_amount"]);
             $repeat_type = unserialize($filter['recurrence']["repeat_type"]);
             $repeat_until = unserialize($filter['recurrence']["repeat_until"]);
             $start_type = unserialize($filter['recurrence']["start_type"]);
             if ($start_type == "weekday") {
                 $w1 = unserialize($filter['recurrence']["weekday_1"]);
                 $w2 = unserialize($filter['recurrence']["weekday_2"]);
                 $filter['datetimes'] = seqUtils::getMonthlyFilteredData($filter['date'], $repeat_type, $repeat_amount, $repeat_until, $start_type, NULL, $w1, $w2, $filter['time_from'], $filter['time_to']);
             } elseif ($start_type == "monthday") {
                 $md = unserialize($filter['recurrence']["monthday"]);
                 $filter['datetimes'] = seqUtils::getMonthlyFilteredData($filter['date'], $repeat_type, $repeat_amount, $repeat_until, $start_type, $md, NULL, NULL, $filter['time_from'], $filter['time_to']);
             }
             break;
         default:
             $filter['datetimes']['from'] = array();
             $filter['datetimes']['from'][] = $filter['date'] . " " . $filter['time_from'];
             $filter['datetimes']['to'] = array();
             $filter['datetimes']['to'][] = $filter['date'] . " " . $filter['time_to'];
             break;
     }
     $data = $this->rooms->getList($filter);
     return $data;
 }
 /**
  * Generates datetimes for the (recurrence) booking
  *
  * @return array ("from" => array(DATETIMES_FROM...),
  *                  "to" => array(DATETIMES_TO...))
  */
 private function generateDatetimesForBooking()
 {
     $time_from = date('H:i:s', strtotime($this->date_from));
     $time_to = date('H:i:s', strtotime($this->date_to));
     $date_from = date('Y-m-d', strtotime($this->date_from));
     $date_to = date('Y-m-d', strtotime($this->date_to));
     if ($date_from != $date_to) {
         $date1 = strtotime($date_from);
         $date2 = strtotime($date_to);
         $day_difference = ceil(abs($date1 - $date2) / 86400);
     } else {
         $day_difference = NULL;
     }
     $datetimes_from = array();
     $datetimes_to = array();
     switch ($this->recurrence['frequence']) {
         case "DAILY":
             $days = seqUtils::getDailyFilteredData($date_from, $this->recurrence['repeat_type'], $this->recurrence['repeat_amount'], $this->recurrence['repeat_until'], $time_from, $time_to, $day_difference);
             $datetimes_from = $days['from'];
             $datetimes_to = $days['to'];
             break;
         case "WEEKLY":
             if (empty($this->recurrence['weekdays'])) {
                 $datetimes_from = array($this->date_from);
                 $datetimes_to = array($this->date_to);
                 throw new ilRoomSharingBookException($this->lng->txt("rep_robj_xrs_error_in_selected_sequencebooking"));
             }
             $days = seqUtils::getWeeklyFilteredData($date_from, $this->recurrence['repeat_type'], $this->recurrence['repeat_amount'], $this->recurrence['repeat_until'], $this->recurrence['weekdays'], $time_from, $time_to, $day_difference);
             $datetimes_from = $days['from'];
             $datetimes_to = $days['to'];
             break;
         case "MONTHLY":
             if (empty($this->recurrence['repeat_type']) || empty($this->recurrence['start_type'])) {
                 $datetimes_from = array($this->date_from);
                 $datetimes_to = array($this->date_to);
                 throw new ilRoomSharingBookException($this->lng->txt("rep_robj_xrs_error_in_selected_sequencebooking"));
             }
             $days = seqUtils::getMonthlyFilteredData($date_from, $this->recurrence['repeat_type'], $this->recurrence['repeat_amount'], $this->recurrence['repeat_until'], $this->recurrence['start_type'], $this->recurrence['monthday'], $this->recurrence['weekday_1'], $this->recurrence['weekday_2'], $time_from, $time_to, $day_difference);
             $datetimes_from = $days['from'];
             $datetimes_to = $days['to'];
             break;
         default:
             $datetimes_from[] = $date_from . " " . $time_from;
             $datetimes_to[] = $date_to . " " . $time_to;
             break;
     }
     return array("from" => $datetimes_from, "to" => $datetimes_to);
 }