mod_roomReservationRoomsManager: added getRoomByName() and getRoomByOid()
authorrohieb <devnull@localhost>
Sat, 26 Jul 2008 00:13:35 +0000 (02:13 +0200)
committerrohieb <devnull@localhost>
Sat, 26 Jul 2008 00:13:35 +0000 (02:13 +0200)
includes/mod_roomReservationRoomsManager.inc [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 732b3dc..edce221
@@ -113,6 +113,40 @@ class mod_roomReservationRoomsManager {
   }
 */
 
+  /**
+   * Get a room by its OID. Returns <tt>null</tt> if the room was not found.
+   * @param $nOid (integer) The OID of the room
+   * @return mod_roomReservationRoom
+   */
+  static function getRoomByOid($nOid) {
+    $o = null;
+    $h = db_query("SELECT * FROM rooms WHERE oid = $1;", $nOid);
+    if(pg_num_rows($h) > 0) {
+      $arResult = pg_fetch_array($h);
+      $o = new mod_roomReservationRoom($arResult["name"], 
+        $arResult["room_no"], $arResult["floor"], $arResult["building"],
+        $arResult["location"]);
+    }
+    return $o;
+  }
+  
+  /**
+   * Get a room by its name. Returns <tt>null</tt> if the room was not found.
+   * @param $sName (string) The name of the room
+   * @return mod_roomReservationRoom
+   */
+  static function getRoomByName($sName) {
+    $o = null;
+    $h = db_query("SELECT * FROM rooms WHERE name = $1;", $sName);
+    if(pg_num_rows($h) > 0) {
+      $arResult = pg_fetch_array($h);
+      $o = new mod_roomReservationRoom($arResult["name"], 
+        $arResult["room_no"], $arResult["floor"], $arResult["building"],
+        $arResult["location"]);
+    }
+    return $o;
+  }
+  
   /**
    * Get all rooms from the database
    * @return array of mod_roomReservationRoom
This page took 0.026752 seconds and 4 git commands to generate.