got psql: FATAL: Ident authentication failed for user "root" on install
[iserv-mod-room-reservation.git] / inc / mod_roomReservationBookingsManager.inc
index c91f34a..d05b4c7 100644 (file)
@@ -98,10 +98,13 @@ class mod_roomReservationBookingsManager {
    * Get all bookings in database which overlap with the given booking.
    * @param $ob (mod_roomReservationBooking) New booking that should be tested
    *  if it overlaps
+   * @param $bUnblocks (bool) If true, consider $ob as a unblock of a specific
+   *  booking. In this case, you have to specify the Unique ID of the original
+   *  booking in $ob->
    * @return array with elements of type mod_roomReservationBooking
    */
   public static function getOverlappingBookings(
-    mod_roomReservationBooking $ob) {
+    mod_roomReservationBooking $ob, $bUnblocks = false) {
     // TODO: Test for bookings that only take place every n.th week (modulo n)
     
     // Two bookings overlap, when they are on the same day and if
@@ -246,6 +249,37 @@ class mod_roomReservationBookingsManager {
       return true;
     }
   }
+
+  /**
+   * Unblocks a booking for a specific time. Useful to release a room for a 
+   * specific time if it has been blocked by a recurring booking
+   * @param $nUid Unique ID of the booking to be unblocked
+   * @param $tsStart The timestamp when the unblock starts
+   * @param $tsEnd The timestamp when the unblock ends
+   * @return bool
+   * @todo implement this
+   */
+  function unblock($nUid, $tsStart, $tsEnd) {
+    // unblocking only allowed to owners and admins
+    if(!$this->userIsOwner($nUid) || !$this->cfg->userIsAdmin()) {
+      throw new AccessException(MOD_ROOM_RESERVATION_ERROR_ACCESS_DENIED);
+    }
+    return false;
+  }
+  
+  /**
+   * Re-blocks a booking that has been unblocked by unblock().
+   * @param $nUid Unique ID of the booking to be unblocked
+   * @return bool
+   * @todo implement this
+   */
+  function reblock($nUid, $tsStart, $tsEnd) {
+    // re-blocking only allowed to owners and admins
+    if(!$this->userIsOwner($nUid) || !$this->cfg->userIsAdmin()) {
+      throw new AccessException(MOD_ROOM_RESERVATION_ERROR_ACCESS_DENIED);
+    }
+    return false;
+  }
   
   /**
    * Determine if the current user is the owner of a specified error report.
This page took 0.029065 seconds and 4 git commands to generate.