debian/changelog: forgot debian version number
[iserv-mod-room-reservation.git] / includes / mod_roomReservationBookingPage.inc
old mode 100755 (executable)
new mode 100644 (file)
index f01423c..219c7bd
@@ -156,13 +156,6 @@ class mod_roomReservationBookingPage extends mod_roomReservationPage {
       die();
     }
     
-    if($this->oRm->getRooms() == array()) {
-      echo sprintf("<p>%s</p>\n", _c("room-reservation:No rooms have been ".
-       "configured yet."));
-      _PageBlue();
-      die();
-    }
-
     Title(_c("room-reservation:Book rooms"));
     
     // Form for room selection
@@ -171,19 +164,31 @@ class mod_roomReservationBookingPage extends mod_roomReservationPage {
       $_SERVER["PHP_SELF"]);
     echo sprintf("<input type='hidden' name='mod_roomReservationBookingTable".
       "[date]' value='%d' />\n", $this->getStart());
-    echo _c("room-reservation:Room:") . sprintf(" <select onchange=".
-      "'document.forms[\"room\"].submit()' width='250' ".
-       "name='mod_roomReservationBookingTable[room]'>\n", $this->getStart());
-    $aor = $this->oRm->getRooms();
-    foreach($aor as $or) {
-      // note to myself: no qu() here, seems this is being done automagically
-      echo sprintf("<option value='%s'%s>%s</option>\n", $or->getName(),
-        ($or->getName() == $this->getRoom()) ? " selected='selected'" : "",
-        $or->getName());
-    }
-    echo sprintf("</select>&nbsp;<%s value='%s' /></form><p />\n",
-      $GLOBALS["stdbtn"], _("Change"));
     
+    // Show rooms only if it is whitelisted
+    try {
+      $aor = $this->oCfg->getWhitelistedRooms();
+    } catch(SQLException $e) {
+      trigger_error($e->getMessage());
+    }
+    if(count($aor) > 0) {
+      echo _c("room-reservation:Room:") . sprintf(" <select onchange=".
+        "'document.forms[\"room\"].submit()' width='250' ".
+       "name='mod_roomReservationBookingTable[room]'>\n", $this->getStart());
+      foreach($aor as $or) {
+        // note to myself: no qu() here, seems this is being done automagically
+        echo sprintf("<option value='%s'%s>%s</option>\n", $or->getName(),
+          ($or->getName() == $this->getRoom()) ? " selected='selected'" : "",
+          $or->getName());
+      }
+      echo sprintf("</select>&nbsp;<%s value='%s' /></form><p />\n",
+        $GLOBALS["stdbtn"], _("Change"));
+    } else {
+      printf("<p>%s</p>\n", _c("room-reservation:No rooms have been ".
+       "configured yet."));
+      return;
+    }
+        
     // Print line with next 5 or so weeks
     $strSep = "&nbsp;| ";
     $strLink = sprintf("<a href='%s?mod_roomReservationBookingTable[date]=%%d".
@@ -205,8 +210,6 @@ class mod_roomReservationBookingPage extends mod_roomReservationPage {
       qu($this->getRoom()), _c("room-reservation:Next &gt;"))."</p>\n";
     
     $this->oBt->show();
-    
-    parent::endShow();
   }
 }
 ?>
This page took 0.023134 seconds and 4 git commands to generate.