function booking_get_coursemodule_info($cm) { global $CFG, $DB; require_once "{$CFG->dirroot}/mod/booking/locallib.php"; $tags = new booking_tags($cm); $info = new cached_cm_info(); $booking = new booking($cm->id); $booking->apply_tags(); $info->name = $booking->booking->name; return $info; }
<table class="table table-striped table-bordered table-hover" id="dataTables-example"> <thead> <tr> <th>No</th> <th>Nama Tamu</th> <th>Nama Resto</th> <th>Tgl booking</th> <th>Jam</th> <th>Tempat</th> <th>Aksi</th> </tr> </thead> <tbody> <?php include_once "../class/booking.php"; $obj = new booking(); $no = 1; $i = 0; foreach ($obj->viewbooking() as $value) { extract($value); ?> <tr <?php if ($i % 2 == 0) { echo "class='odd gradeX'"; } else { echo "class='even gradeC'"; } ?> > <td class="center"><?php echo $i;
<?php require_once '../../config.php'; require_once "{$CFG->dirroot}/mod/booking/locallib.php"; $id = required_param('id', PARAM_INT); $cmid = required_param('cmid', PARAM_INT); // $booking = $DB->get_record("booking", array("id" => $id)); $booking = new booking($cmid); $booking->apply_tags(); $context = context_course::instance($booking->booking->course); if (!($course = $DB->get_record("course", array("id" => $booking->booking->course)))) { print_error('coursemisconf'); } require_login($course->id, false); $PAGE->set_url('/mod/booking/viewpolicy.php', array('id' => $id)); $PAGE->set_title(get_string("bookingpolicy", "booking")); $PAGE->set_heading(get_string("bookingpolicy", "booking")); echo $OUTPUT->header(); echo $OUTPUT->heading(get_string("bookingpolicy", "booking"), 2); echo $OUTPUT->box_start('generalbox', 'tag-blogs'); //could use an id separate from tag-blogs, but would have to copy the css style to make it look the same echo $booking->booking->bookingpolicy; echo $OUTPUT->box_end(); echo $OUTPUT->footer();
public function apply_tags() { parent::apply_tags(); $tags = new booking_tags($this->cm); foreach ($this->options as $key => $value) { $this->options[$key] = $tags->optionReplace($this->options[$key]); } }
public function process() { global $cookie; $iso = Language::getIsoById((int) $cookie->LanguageID); parent::process(); $swhere = parent::getSearchWhere(); if ($swhere == "") { $swhere .= " 1 = 1 "; } if (Tools::getValue("HotelName") != "") { $swhere .= " AND HotelName_" . $iso . " like '" . Tools::getValue("HotelName") . "'"; } $OrderStatusId = Tools::getValue("OrderStatusId"); if (!empty($OrderStatusId)) { if (self::$cookie->RoleID != 1) { if (Tools::getValue("OrderStatusId") == 4) { $swhere .= " AND OrderStatusId in ('4', '10') "; } else { $swhere .= " AND OrderStatusId = '" . Tools::getValue("OrderStatusId") . "'"; } } else { if (Tools::getValue("OrderStatusId") == 3) { $swhere .= " AND OrderStatusId in ('3','4','8','9','10') "; } else { $swhere .= " AND OrderStatusId = '" . Tools::getValue("OrderStatusId") . "'"; } } } if (Tools::getValue("CheckInDate") != "") { $swhere .= " AND CheckInDate = '" . Tools::getValue("CheckInDate") . "'"; } if (Tools::getValue("CheckOutDate") != "") { $swhere .= " AND CheckOutDate <= '" . Tools::getValue("CheckOutDate") . "'"; } if (Tools::getValue("DueDate") != "") { $swhere .= " AND DATE_SUB(CheckOutDate,INTERVAL 5 DAY) = '" . Tools::getValue("DueDate") . "'"; } if (Tools::getValue("CheckInDateFrom") != "") { $CheckInDateFrom = Tools::getValue("CheckInDateFrom"); $swhere .= " AND CheckInDate >= '" . Tools::getValue("CheckInDateFrom") . "'"; } if (Tools::getValue("CheckInDateTo") != "") { $CheckInDateTo = Tools::getValue("CheckInDateTo"); $swhere .= " AND CheckInDate <= '" . Tools::getValue("CheckInDateTo") . "'"; } if ((Tools::getValue("CheckInDateFrom") == "" || Tools::getValue("CheckInDateTo") == "") && self::$cookie->RoleID == 1) { $CheckInDateTo = date("Y-m-d"); $CheckInDateFrom = date("Y-m-d", mktime(0, 0, 0, date("m") - 2, date("d"), date("Y"))); $swhere .= " AND '{$CheckInDateFrom} 00:00:00' <= OrderedDate AND OrderedDate <= '{$CheckInDateTo} 23:59:59'"; } if (self::$cookie->RoleID != 1) { if (Tools::getValue("OrderEndDate") != "") { $OrderEndDate = Tools::getValue("OrderEndDate"); } else { $OrderEndDate = date("Y-m-d"); } if (Tools::getValue("OrderStartDate") != "") { $OrderStartDate = Tools::getValue("OrderStartDate"); } else { $OrderStartDate = date("Y-m-d", mktime(0, 0, 0, date("m") - 2, date("d"), date("Y"))); } //$swhere .= " AND '{$OrderStartDate} 00:00:00' <= OrderedDate AND OrderedDate <= '{$OrderEndDate} 23:59:59'"; } $paymentMethod = 1; if (self::$cookie->RoleID == 3) { $swhere .= " AND HT_Company.CompanyId = " . self::$cookie->CompanyID; $paymentMethod = Member::getPaymentMethod(self::$cookie->CompanyID); } else { if (self::$cookie->RoleID == 2) { $swhere .= " AND OrderUserId = " . self::$cookie->UserID; $paymentMethod = Member::getPaymentMethod(self::$cookie->CompanyID); } else { if (self::$cookie->RoleID == 1) { $swhere .= " AND HT_Hotel.HotelId = " . self::$cookie->HotelID; $paymentMethod = Member::getPaymentMethod(self::$cookie->CompanyID); } } } $settle = Tools::getValue("settle"); if ($settle == 1) { $swhere .= " AND (OrderStatusId = 3 OR OrderStatusId = 4)"; } $bookingCount = Booking::getBookingCount($swhere); $this->pagination($bookingCount); $bookingList = Booking::getBookingList($swhere, $this->p, $this->n); foreach ($bookingList as $key => $value) { if (self::$cookie->RoleID > 3) { if ($value['CheckInDate'] >= date('Y-m-d')) { $bookingList[$key]['isCancell'] = 1; } else { $bookingList[$key]['isCancell'] = 0; } } if ($value['CheckInDate'] < date('Y-m-d')) { $bookingList[$key]['exp'] = 1; } else { $bookingList[$key]['exp'] = 0; } $bookingList[$key]['money'] = $value['TotalPrice'] - $value['otherPrice']; } //get paymentMethod for show pay button self::$smarty->assign("listData", $bookingList); self::$smarty->assign("paymentMethod", $paymentMethod); self::$smarty->assign("statusList", booking::getBookingStatus()); self::$smarty->assign("settle", $settle); self::$smarty->assign("orderStartDate", $OrderStartDate); self::$smarty->assign("orderEndDate", $OrderEndDate); self::$smarty->assign("CheckInDateFrom", $CheckInDateFrom); self::$smarty->assign("CheckInDateTo", $CheckInDateTo); }
$this->verified = false; $strSQL = "SELECT * FROM booking_{$this->room} WHERE timeStart<'{$this->endTime}' AND timeEnd>'{$this->startTime}' ORDER BY timeStart ASC"; $currentBookings = $this->dbh->query($strSQL); $clash = 0; while ($currentBooking = $currentBookings->fetch(PDO::FETCH_ASSOC)) { $clash++; } echo $clash; if (!$clash) { $this->verified = true; $_SESSION['booking'] = array($this->room, $this->name, $this->startTime, $this->endTime, $this->verified); } } public function confirm() { if ($this->verified) { echo "done"; session_destroy(); } else { echo "Please verify booking doesn't clash first"; } } } session_start(); if (empty($_SESSION['booking'])) { $myBooking = new booking($_POST['room'], $_POST['user'], $_POST['startTime'], $_POST['endTime']); $myBooking->verify(); } else { $myBooking = new booking($_SESSION['booking'][0], $_SESSION['booking'][1], $_SESSION['booking'][2], $_SESSION['booking'][3], $_SESSION['booking'][4]); $myBooking->confirm(); }
function getallproviderbookings() { require_once "booking.php"; $providerid = $_REQUEST['providerid']; $obj = new booking(); if ($obj->getbookingsforprovider($providerid)) { $row = $obj->fetch(); echo '{"result":1,"bookings":['; while ($row) { echo json_encode($row); $row = $obj->fetch(); if ($row) { echo ","; } } echo "]}"; } else { echo '{"result":0,"message:"error getting bookings"}'; } }