function room_plugin_setting_page() { global $myUser, $_; if (isset($_['section']) && $_['section'] == 'room') { if ($myUser != false) { $roomManager = new Room(); $rooms = $roomManager->populate(); //Gestion des modifications if (isset($_['id'])) { $id_mod = $_['id']; $selected = $roomManager->getById($id_mod); $description = $selected->GetName(); $button = "Modifier"; } else { $description = "Ajout d'une pièce"; $button = "Ajouter"; } ?> <div class="span9 userBloc"> <h1>Pièces</h1> <p>Gestion des pièces</p> <form action="action.php?action=room_add_room" method="POST"> <fieldset> <legend><?php echo $description; ?> </legend> <div class="left"> <label for="nameRoom">Nom</label> <?php if (isset($selected)) { echo '<input type="hidden" name="id" value="' . $id_mod . '">'; } ?> <input type="text" value="<?php if (isset($selected)) { echo $selected->getName(); } ?> " id="nameRoom" name="nameRoom" placeholder="Cuisine,salon…"/> <label for="descriptionRoom">Description</label> <input type="text" value="<?php if (isset($selected)) { echo $selected->getDescription(); } ?> " name="descriptionRoom" id="descriptionRoom" /> </div> <div class="clear"></div> <br/><button type="submit" class="btn"><?php echo $button; ?> </button> </fieldset> <br/> </form> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Nom</th> <th>Description</th> <th></th> </tr> </thead> <?php foreach ($rooms as $room) { ?> <tr> <td><?php echo $room->getName(); ?> </td> <td><?php echo $room->getDescription(); ?> </td> <td><a class="btn" href="action.php?action=room_delete_room&id=<?php echo $room->getId(); ?> "><i class="fa fa-times"></i></a> <a class="btn" href="setting.php?section=room&id=<?php echo $room->getId(); ?> "><i class="fa fa-pencil"></i></a></td> </tr> <?php } ?> </table> </div> <?php } else { ?> <div id="main" class="wrapper clearfix"> <article> <h3>Vous devez être connecté</h3> </article> </div> <?php } } }
public function getRoom() { return Room::getById($this->room); }
public function showCal() { $this->mBasePage = "cal.tpl"; global $cWebPath; $startdate = new DateTime(WebRequest::post("qbCheckin")); $enddate = new DateTime(WebRequest::post("qbCheckout")); $idlist = Room::getIdList(); $dates = array(); for ($date = $startdate; $date < $enddate; $date->modify("+1 day")) { $dates[] = clone $date; } $availabilityMatrix = array(); $roomlist = array(); foreach ($idlist as $id) { $r = Room::getById($id); $roomlist[$id] = $r; $availabilityMatrix[$id] = array(); foreach ($dates as $d) { $availabilityMatrix[$id][array_search($d, $dates)] = !$r->isAvailable($d); } } $this->mSmarty->assign("availmatrix", $availabilityMatrix); $this->mSmarty->assign("datelist", $dates); $this->mSmarty->assign("roomlist", $roomlist); $this->mSmarty->assign("valQbCheckin", WebRequest::postString("qbCheckin")); $this->mSmarty->assign("valQbCheckout", WebRequest::postString("qbCheckout")); $this->mSmarty->assign("valQbAdults", WebRequest::postInt("qbAdults")); $this->mSmarty->assign("valQbChildren", WebRequest::postInt("qbChildren")); $this->mSmarty->assign("valQbPromoCode", WebRequest::postString("qbPromoCode")); $this->mSmarty->assign("valQbTitle", WebRequest::post("qbTitle")); $this->mSmarty->assign("valQbFirstname", WebRequest::post("qbFirstname")); $this->mSmarty->assign("valQbLastname", WebRequest::post("qbLastname")); $this->mSmarty->assign("valQbAddress", WebRequest::post("qbAddress")); $this->mSmarty->assign("valQbCity", WebRequest::post("qbCity")); $this->mSmarty->assign("valQbPostcode", WebRequest::post("qbPostcode")); $this->mSmarty->assign("valQbCountry", WebRequest::post("qbCountry")); $this->mSmarty->assign("valQbEmail", WebRequest::post("qbEmail")); }
private function doDeleteRoomAction() { $rid = WebRequest::getInt("id"); if ($rid < 1) { throw new Exception("RoomId too small"); } if (Room::getById($rid) == null) { throw new Exception("Room does not exist"); } Room::getById($rid)->delete(); global $cScriptPath; $this->mHeaders[] = "Location: {$cScriptPath}/Rooms"; }