Added tag REL_8.07.26 for changeset d547a1c6762968ada846e9dfad78bf757e598937
[iserv-mod-room-reservation.git] / includes / mod_roomReservationBookingPage.inc
index f17d447..219c7bd 100644 (file)
@@ -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".
This page took 0.024867 seconds and 4 git commands to generate.