oCfg = $oCfg; $this->oRm = $oRm; $this->oBm = $oBm; // create the booking table here, so the CSS is already added /** @todo maybe move it into beforeAddCSS()... ? */ $this->oBt = new mod_roomReservationBookingsTable($this->oCfg, $this->oRm, $this->oBm, "?bookingpage[action]=edit", "?bookingpage[action]=delete"); parent::__construct($oCfg); $this->setTitle(_c("Room Reservation Schedule")); $this->setIcon("mod_room-reservation_index"); } /***************************************************************************/ /** * @} * @name Initialization * @{ */ /** * Process the REQUEST variables and preset the some variables * @return void */ protected function processRequestVariables() { // take all settings from the booking table $this->setRoom($this->oBt->getRoom()); $this->setStart($this->oBt->getDate()); } /***************************************************************************/ /** * @} * @name Access to attributes * @{ */ /** * Set the starting date * @param $ts (timestamp) */ public function setStart($ts) { $this->tsStart = intval($ts); } /** * Set the room to show in the booking table * @param $str (string) Name of the room */ public function setRoom($str) { $this->strRoom = $str; } /** * Get the starting date * @return int */ public function getStart() { return intval($this->tsStart); } /** * Get the name of the room to show in the booking table * @return string */ public function getRoom() { return $this->strRoom; } /***************************************************************************/ /** * @} * @name Output * @{ */ /** * Show the page. * @return void */ public function doShow() { // Protect access if(!$this->oCfg->userCanView()) { echo sprintf("

%s

", MOD_ROOM_RESERVATION_ERROR_ACCESS_DENIED); _PageBlue(); die(); } Title(_c("room-reservation:Book rooms")); // Form for room selection /** @todo checkbox for recurring booking */ echo sprintf("
", $_SERVER["PHP_SELF"]); echo sprintf("\n", $this->getStart()); // 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("  <%s value='%s' />

\n", $GLOBALS["stdbtn"], _("Change")); } else { printf("

%s

\n", _c("room-reservation:No rooms have been ". "configured yet.")); return; } // Print line with next 5 or so weeks $strSep = " | "; $strLink = sprintf("%%s", $_SERVER["PHP_SELF"]); echo "

".sprintf($strLink, time(), qu($this->getRoom()), _c("room-reservation:Current Week")) . $strSep; echo sprintf($strLink, strtotime("1 week ago", $this->getStart()), qu($this->getRoom()), _c("room-reservation:< Back")) . $strSep; echo sprintf("%s", _sprintf_ord(_c("room-reservation:%d# week"), date("W", $this->getStart()))) . $strSep; for($i = 1; $i <= 5; $i++) { $nNextWeek = strtotime("$i week", $this->getStart()); echo sprintf($strLink, $nNextWeek, qu($this->getRoom()), _sprintf_ord( _c("room-reservation:%d# week"), date("W", $nNextWeek))); echo $strSep; } echo sprintf($strLink, strtotime("1 week", $this->getStart()), qu($this->getRoom()), _c("room-reservation:Next >"))."

\n"; $this->oBt->show(); } } ?>