public function run() { $this->controller->pageTitle = 'Book a Workspace'; $now = date('Y-m-d', time()); $date = Yii::app()->request->getParam('date'); $date = $date == '' ? $now : $date; $proxy = new CHub(); $result = $proxy->getHubList(); if (Yii::app()->request->isAjaxRequest) { $id = Yii::app()->request->getParam('id'); $hub = Yii::app()->request->getParam('hub'); $date = Yii::app()->request->getParam('date'); if ($id) { $date = date('Ymd', strtotime($date)); $record = Reservations::model()->findAll('startTime =' . date('Ymd', strtotime($date)) . '100000' . ' and userId=' . Yii::app()->user->id . ' and type=1 and status=1'); $orderid = Order::model()->findAllByAttributes(array('status' => 1, 'userId' => Yii::app()->user->id, 'type' => 1)); if ($orderid) { foreach ($orderid as $list) { $order = OrderProduct::model()->find('endDate>=' . $date . ' and orderId=' . $list['id'] . ' and startDate<=' . $date); if ($order) { break; } } if ($order) { echo CJSON::encode(array('code' => 200, 'data' => array('num' => $order['totalTimes'] - $order['usedTimes'], 'count' => count($record)))); } else { echo CJSON::encode(array('code' => 200, 'data' => array('num' => 0))); } } else { $code = CodeUsed::model()->findAll('userId=' . Yii::app()->user->id); if ($code) { foreach ($code as $list) { $value = Code::model()->find('endDate>=' . $date . ' and id=' . $list['codeId'] . ' and startDate<=' . $date); if ($value) { break; } } if ($value) { echo CJSON::encode(array('code' => 200, 'data' => array('num' => 1, 'count' => count($record)))); } else { echo CJSON::encode(array('code' => 200, 'data' => array('num' => 0))); } } else { echo CJSON::encode(array('code' => 200, 'data' => array('num' => 0))); } } } else { $proxy = new CReservation(); $result = $proxy->getNumber($date); if ($result['code'] == 200) { $data = array('code' => 200, 'data' => $result); echo CJSON::encode($data); } } } else { $this->controller->render('workspacelist', array('data' => $result['data'], 'date' => $date)); } }
public function getNumber($date, $hubId = '') { $date = date('YmdHis', strtotime($date . ' 10:00:00')); $hub = new Hub(); $hublist = $hub->getHUb(); if ($hubId) { $result = Reservations::model()->count('status !=0 and type=1 and startTime=' . $date . ' and hubId=' . $hubId); } else { $result = array(); foreach ($hublist as $key) { $result[] = Reservations::model()->count('status !=0 and type=1 and startTime=' . $date . ' and hubId=' . $key['id']); } } if ($result) { $data = array('code' => 200, 'message' => 'SUCCESS', 'count' => $result); } else { $data = array('code' => 200, 'message' => 'SUCCESS', 'count' => 0); } return $data; }
<?php $reservations = new Reservations(); $list = $reservations->getList()[0]; ?> <table class="table-hovered tableSearch"> <thead> <tr> <th>Nombre</th> <th>Email</th> <th>Teléfono</th> <th>Ciudad</th> <th>Excursión</th> <th width="30px"></th> <th width="30px"></th> </tr> </thead> <tbody> <?php foreach ($list as $key => $value) { if (!empty($value)) { ?> <tr> <td><?php echo $value['holder_name']; ?> </td> <td><?php echo $value['holder_email']; ?> </td>
<?php define('_MEXEC', 'OK'); require_once "../../../system/load.php"; //error_reporting(E_ALL); //Mail Controllers require_once '../../../smtpmailclass/class.phpmailer.php'; require_once '../../../smtpmailclass/class.smtp.php'; // optional, gets called from within class.phpmailer.php if not $hotels = new Hotels(); $session = new Sessions(); $reservations = new Reservations(); $bookingclient = new BookingClient(); $bookingclient = new BookingClient(); $rooms = new HotelRoomType(); $client; $merchantReferenceNo = $_REQUEST['resid']; //$session->getMerchantReferenceNo(); $reservations->setReservationId($merchantReferenceNo); $pay_data = $reservations->getReservationsFromId(); $reservations->extractor($pay_data); $reservation_link_id = $reservations->reservationFromBookingLink(); $reservations_status = $reservations->reservationPaymentStatus(); if ($reservations->reservationFromBookingLink()) { $client = new BookingClient(); $client->setId($reservations->reservationClientId()); $client->extractor($client->getClientsFromId()); $client_name = $client->name(); $client_email = $client->email(); } else { $client = new Clients();
public function mySelect($date, $userId, $roomId, $location) { $criteria = new CDbCriteria(); $criteria->addCondition(array('status=1', 'type=2', 'userId=' . $userId, 'conferenceroomId=' . $roomId, 'hubId=' . $location)); $criteria->addSearchCondition('startTime', $date); $result = Reservations::model()->findAll($criteria); if (!empty($result)) { $arr = array(); foreach ($result as $list) { $start = strtotime($list['startTime']); $end = strtotime($list['endTime']); $length = ($end - $start) / 3600; for ($i = 0; $i < $length * 2; $i++) { array_push($arr, (date('H', $start) - 9 + date('i', $start) / 60) * 2 + $i); } } return $arr; } else { return ''; } }
<?php define('_MEXEC', 'OK'); require_once "../../../system/load.php"; include "../pgconfig.php"; $mainCity = new MainCity(); $SubCity = new SubCity(); $hotels = new Hotels(); $session = new Sessions(); $reservations = new Reservations(); $mainCity_row = $mainCity->getMainCityFromHomePage(); $mainCity_list = $mainCity->getMainCity(); $hotels_row = $hotels->getHotelFromFeaturedStatus(); $hotelsRecently_row = $hotels->getHotelRecentlyAdd(); /*$transactionTypeCode=$_REQUEST["transaction_type_code"]; $installments=$_REQUEST["installments"]; $transactionId=$_REQUEST["transaction_id"]; $amount=$_REQUEST["amount"]; $exponent=$_REQUEST["exponent"]; $currencyCode=$_REQUEST["currency_code"];*/ $merchantReferenceNo = $session->getMerchantReferenceNo(); /*$status=$_REQUEST["status"]; $eci=$_REQUEST["3ds_eci"]; $pgErrorCode=$_REQUEST["pg_error_code"]; $pgErrorDetail=$_REQUEST["pg_error_detail"]; $pgErrorMsg=$_REQUEST["pg_error_msg"]; $messageHash=$_REQUEST["message_hash"];
/** * This is method for delete reservation from list * @param string $id * @return array[] { * 'code':200, * 'message':'SUCCESS' * } */ public function cancelReservation($id) { $result = Reservations::model()->findByAttributes(array('id' => $id)); $result->status = '0'; if ($result->save()) { $data = array('code' => 200, 'message' => 'SUCCESS'); } return $data; }
<?php $reservations = new Reservations(); $list = $reservations->getExcursions()[0]; ?> <form action="{INSERT}" method="POST"> <div> <input type="text" name="holder_name" autofocus="autofocus" placeholder="Nombre completo" /> <input type="text" name="holder_email" placeholder="Correo electrónico" /> <input type="text" name="holder_phone" placeholder="Número telefónico" /> <input type="text" name="city" placeholder="Ciudad" /> <label>Fecha de reservación:</label> <input type="date" name="date_reservation" value="<?php echo date("Y-m-d"); ?> " /> <input type="text" name="num_children" placeholder="Número de niños" /> <input type="text" name="num_adults" placeholder="Número de adultos" /> <select name="id_excursion"> <option value="0">Seleccione una excursion</option> <?php foreach ($list as $key => $value) { if (!empty($value)) { ?> <option value="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </option>
<?php define('_MEXEC', 'OK'); require_once("../system/load.php"); include("../pgconfig.php"); $hotels = new Hotels(); $reservations = new Reservations(); $merchantReferenceNo = $_REQUEST['resid']; $reservations->setReservationId($merchantReferenceNo); $pay_data = $reservations->getReservationsFromId(); $reservations->extractor($pay_data); $reservation_link_id = $reservations->reservationFromBookingLink(); $reservations_status = $reservations->reservationPaymentStatus(); $hotels->setHotelId($reservations->reservationHotelId()); $hotels->extractor($hotels->getHotelFromId()); $hotels_id = $reservations->reservationHotelId(); $bookingclient = new BookingClient(); $bookingclient->setId($reservations->reservationClientId()); $bookingclient->extractor($bookingclient->getClientsFromId()); ?> <!DOCTYPE html> <!--[if lt IE 7]> <html dir="ltr" lang="en-US" class="ie6"> <![endif]--> <!--[if IE 7]> <html dir="ltr" lang="en-US" class="ie7"> <![endif]--> <!--[if IE 8]>
$rows = mysql_num_rows($rs); ?> <?php if($rows>0){ ?> <h1>This book is available to the following member(s)</h1> <div class="contentEm"> <div class="bg1"> <?php while($r = mysql_fetch_assoc($rs)){ ?> <?php echo $r['title'] . " " . $r['firstnames'] . " " . $r['surname'] . " (" . $r['type'] . ")" ?><br> Reserved: <strong><?php echo $r['dt_start']; ?></strong> <?php if(($_SESSION['CurrentUser']['login_type']=="ADMIN") || ($_SESSION['CurrentUser']['login_type']=="LIBSTAFF") || ($_SESSION['CurrentUser']['mid']==$r['mid'])){ ?><a href='reservations_book.php?do=cancel&rid=<?php echo $r['rid']; ?>'>Cancel Reservation</a><?php } ?><br> The book with Access No: <strong><?php echo $r['access_no']; ?></strong> is available. Offer expires on: <strong><?php echo $r['dt_end']; ?></strong><br> <?php } ?> </div> <?php } ?> <?php $re = new Reservations; $rs = $re->GetReservationsBy_bid_status($_REQUEST['ID'],"Active"); $rows = mysql_num_rows($rs); ?> <?php if($rows>0){ ?> <h1>Following <?php echo $rows; ?> member(s) have active reservations for this book</h1> <div class="contentEm"> <div class="bg1"> <?php while($r = mysql_fetch_assoc($rs)){ ?> <strong><?php echo $r['dt_start']; ?></strong> <?php echo $r['title'] . " " . $r['firstnames'] . " " . $r['surname'] . " (" . $r['type'] . ")" ?> <?php if(($_SESSION['CurrentUser']['login_type']=="ADMIN") || ($_SESSION['CurrentUser']['login_type']=="LIBSTAFF") || ($_SESSION['CurrentUser']['mid']==$r['mid'])){ ?><a href='reservations_book.php?do=cancel&rid=<?php echo $r['rid']; ?>'>Cancel</a><?php } ?><br> <?php } ?> </div> <?php } ?> </div>
<?php define('_MEXEC', 'OK'); $dateTime = new DateTime("now", new DateTimeZone('Asia/Colombo')); $submitted_date = $dateTime->format("Y-m-d H:i:s"); $currentDate = date("F j, Y, g:i a"); $mainCity = new MainCity(); $SubCity = new SubCity(); $hotels = new Hotels(); $session = new Sessions(); $reservations = new Reservations(); $client; $client_name = ""; $client_mobile = ""; $client_email = ""; $client_message = ""; $client_city = ""; $client_country = ""; $client_address = ""; $rooms = new HotelRoomType(); $merchantReferenceNo = $merchantReferenceNo; $reservations->setReservationId($merchantReferenceNo); $pay_data = $reservations->getReservationsFromId(); $pay_data = $reservations->getReservationsFromId(); $reservations->extractor($pay_data); $reservation_link_id = $reservations->reservationFromBookingLink(); $reservations_status = $reservations->reservationPaymentStatus(); if ($reservations->reservationFromBookingLink()) { $client = new BookingClient(); $client->setId($reservations->reservationClientId()); $client->extractor($client->getClientsFromId());
exit(); } $row = mysql_fetch_assoc($rs); if( ($_SESSION['CurrentUser']['login_type'] == "ADMIN") || ($_SESSION['CurrentUser']['login_type']=="LIBSTAFF") || ($_SESSION['CurrentUser']['mid']==$row['mid']) ){ // Is this operation allowed $result = $re->CancelReservation($_REQUEST['rid']); header("Location: my_reservations.php"); exit(); } else { $_SESSION['BackLink'] = $_SERVER['PHP_SELF']; trigger_error("You are not allowed to perform this operation.", E_USER_ERROR); exit(); } } $re = new Reservations; $rs = $re->GetReservedBooks_byMID($_SESSION['CurrentUser']['mid']); $rsNo = mysql_num_rows($rs); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Pusthaka: <?php echo $PageTitle; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="css/styles.css" rel="stylesheet" type="text/css"> </head> <body> <?php include("../inc/top.php"); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr>
* * Pusthaka is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Pusthaka. If not, see <http://www.gnu.org/licenses/>. */ $allow = "ADMIN;LIBSTAFF"; $PageTitle = "Reservations"; include('../inc/init.php'); include('../classes/Reservations.php'); $re = new Reservations; $rs = $re->GetReservedBooks(); $rsNo = mysql_num_rows($rs); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Pusthaka: <?php echo $PageTitle; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="css/styles.css" rel="stylesheet" type="text/css"> </head> <body> <?php include("../inc/top.php"); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr>
function ReturnBook($rowCopy, $rowLoan, $rowMember){ // Set date_returned $irDate = $_SESSION['irDate']; unset($_SESSION['irDate']); if(isset($irDate) && $irDate != ""){ $t = @strtotime($irDate); if($t!=-1){ $date_returned = date("Y-m-d G:i:s",$t); } else { $_SESSION['msg'] = 'ERROR issuing book.<br>' . $rowCopy['title'] . " by " . $rowCopy['authors'] . '<br>' . "Please enter a valid date time in the format 'YYYY-MM-DD hh:mm'.<br>". "Or you may leave the Date/Time box blank to use the current time.<br>"; header("Location: ir2.php?mid=" . $rowMember['mid']); exit(); } } else { $date_returned = date("Y-m-d G:i:s"); } $rowLoan['date_returned'] = $date_returned; // Update loan table $fineDetails = CalcFine($rowCopy, $rowLoan, $rowMember); $rowLoan['fine'] = $fineDetails[0]; $rowLoan['date_returned'] = $date_returned; $sql = sprintf("UPDATE loan SET returned=1, date_returned = '%s', fine=%d WHERE lid=%d", $date_returned, $fine,$rowLoan['lid']); $a = executeSqlNonQuery($sql); $rowsUpdated = $a['rows']; if($rowsUpdated != 1){ $_SESSION['msg'] = "An error occured while returning book."; $_SESSION['msgIcon'] = 'ERROR'; header("Location: ir2.php?mid=" . $rowMember['mid']); exit(); } $des = '[' . $rowCopy['access_no'] . ']' . $rowCopy['title'] . ' <== ' . '[' . $rowMember['title'] . ' ' . $rowMember['firstnames'] . ' ' . $rowMember['surname'] . ']'; logEvent('RETURN', $_SESSION['CurrentUser']['mid'], $rowMember['mid'], addslashes($des)); include('../classes/Reservations.php'); $re = new Reservations; if ($re->IsReserved($rowCopy['bid'])){ $reservationsMsg = $re->updateReservations($rowCopy); } // Display Returned Books info if(!isset($_SESSION['Returned'])){ $_SESSION['Returned'][0] = 0; $_SESSION['TotalFine'] = 0; } $_SESSION['Returned'][0] += 1; $n = $_SESSION['Returned'][0]; $_SESSION['Returned'][$n]['copy'] = $rowCopy; $_SESSION['Returned'][$n]['member'] = $rowMember; $_SESSION['Returned'][$n]['loan'] = $rowLoan; $_SESSION['Returned'][$n]['msg'] = $fineDetails[1]; if(!isset($_SESSION['TotalFine'])) $_SESSION['TotalFine']=0; $_SESSION['TotalFine'] = (int)$_SESSION['TotalFine'] + $fineDetails[0]; $_SESSION['msg'] = $_SESSION['msg'] . "Book Returned<br>". $rowCopy['title'] . " by " . $rowCopy['authors'] . '<br>'; $_SESSION['msgIcon'] = 'INFO'; if(isset($reservationsMsg)) $_SESSION['msg'] = $_SESSION['msg'] . "<div class='reservationsMsg'>" . $reservationsMsg . '</div>'; header("Location: ir2.php?mid=" . $rowMember['mid']); exit(); }
function viewTable($data, $count) { $reservation = new Reservations(); $paginations = new Paginations(); $paginations->setLimit(10); $paginations->setPage($_REQUEST['page']); $paginations->setJSCallback("viewReservations"); $paginations->setTotalPages($count); $paginations->makePagination(); ?> <div class="mws-panel-header"> <span class="mws-i-24 i-table-1">View Reservations</span> </div> <div class="mws-panel-body"> <table cellpadding="0" cellspacing="0" border="0" class="mws-datatable-fn mws-table"> <colgroup> <col class="con0"/> <col class="con1"/> </colgroup> <thead> <tr> <th class="head1">Hotel</th> <th class="head0">Client</th> <th class="head0">Room Rate</th> <th class="head1">Total Price</th> </tr> </thead> <tbody> <?php if (count($data) > 0) { ?> <?php for ($i = 0; $i < count($data); $i++) { $reservation->extractor($data, $i); $hotels = new Hotels(); $hotels->setHotelId($reservation->reservationHotelId()); $hotels->extractor($hotels->getHotelFromId()); $clients = new Clients(); $clients->setClientId($reservation->reservationClientId()); $clients->extractor($clients->getClientFromId()); ?> <tr id="row_<?php echo $reservation->reservationId(); ?> "> <td class="con1"><?php echo $hotels->hotelName(); ?> </td> <td class="con0"><?php echo $clients->clientFirstName() . ' - ' . $clients->clientFirstName(); ?> </td> <td class="con0"><?php echo $reservation->reservationRoomRate(); ?> </td> <td class="center"><?php echo $reservation->reservationTotalPrice(); ?> </td> </tr> <?php } ?> <?php } ?> </tbody> </table> </div> <?php $paginations->drawPagination(); }
<?php define('_MEXEC', 'OK'); require_once "../../../../system/load.php"; $reservations = new Reservations(); $merchantReferenceNo = $_REQUEST['resid']; $reservations->setReservationId($merchantReferenceNo); $pay_data = $reservations->getReservationsFromId(); //$pay_data = $reservations->getReservationsFromId(); $reservations->extractor($pay_data); $check_in_date = str_replace("00:00:00", "", $reservations->reservationCheckInDate()); $check_out_date = str_replace("00:00:00", "", $reservations->reservationCheckOutDate()); $url = str_replace('http://', '', HTTP_PATH) . "reservation/"; if ($reservations->reservationFromBookingLink()) { $url = str_replace('http://', '', HTTP_PATH) . "bookings/reservation/"; } else { $url = str_replace('http://', '', HTTP_PATH) . "reservation/"; } $mycode = $url . base64_encode($merchantReferenceNo . "|" . date("d/m/y", strtotime($check_in_date) - 1) . "|" . date("d/m/y", strtotime($check_out_date))) . ""; echo QRCodeGen::getCode($mycode);