/** * @brief Calculates the values for the booked, prebooked and free slots. */ public function calc_slots() { $this->prebooked_slots = btb_get_time_prebooked_slots($this->ID); $this->booked_slots = btb_get_time_booked_slots($this->ID); $this->free_slots = $this->slots - $this->prebooked_slots - $this->booked_slots; }
/** * @brief Returns an array with a summary of slots of a BTB_Time. * * @par Exmaple output * @verbatim Array( [free] => 5 [prebooked] => 1 [booked] => 4 [total] => 10 )@endverbatim * * @param int $time_id BTB_Time ID. * @return array Associative array containing summary about slots. */ function btb_get_time_slots_summary($time_id) { $prebooked_slots = btb_get_time_prebooked_slots($time_id); $booked_slots = btb_get_time_booked_slots($time_id); $total_slots = btb_get_time_total_slots($time_id); $slots = array(); $slots["free"] = $total_slots - $prebooked_slots - $booked_slots; $slots["prebooked"] = $prebooked_slots; $slots["booked"] = $booked_slots; $slots["total"] = $total_slots; return $slots; }