本文整理汇总了PHP中Reservation类的典型用法代码示例。如果您正苦于以下问题:PHP Reservation类的具体用法?PHP Reservation怎么用?PHP Reservation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Reservation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetAuthor
function testGetAuthor()
{
$doc = $date = $duration = 0;
$author = 'John Cena';
$res = new Reservation($doc, $author, $date, $duration);
$this->assertIdentical($res->getAuthor(), $author);
}
示例2: addReservation
public function addReservation(Reservation $reservation)
{
if (!$this->roomIsFree($reservation->getStartDate(), $reservation->getEndDate())) {
throw new EReservationException();
}
$this->reservations[] = $reservation;
}
示例3: IsInConflict
/**
* @param Reservation $instance
* @param ReservationSeries $series
* @param IReservedItemView $existingItem
* @param BookableResource[] $keyedResources
* @return bool
*/
protected function IsInConflict(Reservation $instance, ReservationSeries $series, IReservedItemView $existingItem, $keyedResources)
{
if ($existingItem->GetId() == $instance->ReservationId() || $series->IsMarkedForDelete($existingItem->GetId()) || $series->IsMarkedForUpdate($existingItem->GetId())) {
return false;
}
return parent::IsInConflict($instance, $series, $existingItem, $keyedResources);
}
示例4: generate_vars
function generate_vars($section, &$vars)
{
$vars['ok'] = false;
$vars['full'] = false;
if (!isset($_GET['match_id']) || !isset($_GET['nombre_billet'])) {
return;
}
$nombre_billet = $_GET['nombre_billet'];
$match = Match::get($_GET['match_id']);
if ($match == null || $nombre_billet <= 0) {
return;
}
if ($match->places < $nombre_billet) {
$vars['full'] = true;
return;
}
$match->places = $match->places - $nombre_billet;
$match->save();
$reservation = new Reservation();
$reservation->utilisateur = $vars['userid'];
$reservation->match_id = $match->id;
$reservation->qte = $nombre_billet;
$reservation->expiration = 'now()';
$reservation->save();
$vars['ok'] = true;
}
示例5: uploadBankReceipt
public function uploadBankReceipt()
{
if (Input::hasFile('uploadReceipt')) {
$data = array();
if (is_array(Input::get('room_id'))) {
foreach (Input::get('room_id') as $key => $val) {
$data[$key] = array('am_id' => Input::get('am_id.' . $key), 'rooms' => $val);
}
}
$data2 = array();
if (is_array(Input::get('add_Am'))) {
foreach (Input::get('add_Am') as $key => $val) {
$data2[$key] = array('am_id' => Input::get('am_id.' . $key), 'rooms' => $val);
}
}
$name = Input::get('packname');
$price = Input::get('amount');
$input_dFrom = Input::get('package_datefrom');
$input_dTo = Input::get('package_dateto');
$input_nPax = Input::get('num_pax');
$input_fName = Input::get('fullN');
$postData = new Reservation();
$postData->dataInsertPost($name, $price, $input_dFrom, $input_dTo, $input_nPax, $input_fName, json_encode($data), 'Bank', json_encode($data2));
$lastInsert = DB::getPdo()->lastInsertId();
$files = Input::file('uploadReceipt');
$i = 1;
foreach ($files as $file) {
try {
$path = public_path() . '\\uploads\\bank_deposit\\';
$extension = $file->getClientOriginalExtension();
$filename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
$dateNow = date('Ymd_His');
$new_filename = Auth::user()->id . '_' . $filename . '_' . $i . '.' . $extension;
$upload_success = $file->move($path, $new_filename);
} catch (Exception $ex) {
$path = public_path() . '/uploads/bank_deposit/';
$extension = $file->getClientOriginalExtension();
$filename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
$dateNow = date('Ymd_His');
$new_filename = Auth::user()->id . '_' . $filename . '_' . $i . '.' . $extension;
$upload_success = $file->move($path, $new_filename);
}
$insertVal = array('image_fieldvalue' => $lastInsert, 'image_name' => $new_filename);
$this->GlobalModel->insertModel('tbl_images', $insertVal);
$i++;
}
$data = array('refNumber' => str_pad($lastInsert, 10, "0", STR_PAD_LEFT), 'package' => $name, 'amount' => '₱' . number_format($price, 2), 'paymentMethod' => 'Bank Deposit', 'status' => 1);
try {
Mail::send('emails.user.transactionReservation', $data, function ($message) use($data) {
$message->from('no-reply@reservation.com', 'El Sitio Filipino');
$message->to(Auth::user()->user_email, Auth::user()->user_fname . ' ' . Auth::user()->user_lname)->subject('El Sitio Filipino Transaction Details');
});
} catch (Exception $ex) {
dd($ex->getMessage());
}
return Response::json($data);
}
}
示例6: checkForValidReservation
public function checkForValidReservation(Reservation $reservation)
{
foreach ($this->reservations as $existingReservation) {
if ($reservation->getStartDate() >= $existingReservation->getStartDate() && $reservation->getStartDate() <= $existingReservation->getEndDate()) {
throw new EReservationException($this->roomNumber, $reservation);
} elseif ($reservation->getEndDate() >= $existingReservation->getStartDate() && $reservation->getEndDate() <= $existingReservation->getEndDate()) {
throw new EReservationException($this->roomNumber, $reservation);
}
}
}
示例7: bindObject
public function bindObject(Reservation $reservation)
{
$taintedValues = $reservation->toArray(BasePeer::TYPE_FIELDNAME);
$taintedFiles = array();
foreach ($taintedValues as $key => $value) {
if (!isset($this->widgetSchema[$key])) {
unset($taintedValues[$key]);
}
}
$taintedValues[self::$CSRFFieldName] = $this->getCSRFToken(self::$CSRFSecret);
$this->bind($taintedValues, $taintedFiles);
}
示例8: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Reservation::create([]);
}
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
//
try {
$reservation = new Reservation();
$reservation->name = Input::get('name');
$reservation->sex = Input::get('sex');
$reservation->phone = Input::get('phone');
$reservation->email = Input::get('email');
$reservation->note = Input::get('note');
$reservation->save();
return View::make('aesthetics.reservations.ok');
} catch (Exception $e) {
return Redirect::back()->withInput()->withErrors('新增失敗');
}
}
示例10: testCreate
public function testCreate()
{
$connection = Yii::app()->db;
$sql = "delete from reservation";
$command = $connection->createCommand($sql);
$command->execute();
$dateOverlapFromObj = new DateTime();
$dateOverlapFrom = $dateOverlapFromObj->format('Y-m-d');
$reservation = new Reservation();
$reservation->setAttributes(array('roomid' => 1, 'datefrom' => $dateOverlapFrom, 'numberofnights' => 10, 'confirmreservation' => true));
$id = $reservation->save();
$reservationdetails = new Reservationdetails();
$reservationdetails->setAttributes(array('reservationid' => $reservation->getAttribute('id'), 'title' => "Mr", 'firstname' => "John", 'lastname' => "Smith", 'contactnumber' => "0123456789", 'emailaddress' => "john.smith@blankemailaddress.blanky.co.uk", 'city' => "City", 'county' => "County", 'country' => "UK", 'postcode' => "ab12 4cd", 'postaddress' => 'Test postal address', 'otherinfo' => "Test"));
$this->assertTrue($reservationdetails->save());
return $reservationdetails;
}
示例11: deleteAction
public function deleteAction()
{
$this->view->disable();
$this->response->setContentType('text/plain', 'UTF-8');
$Reservationid = $this->request->get('reservationid', 'string');
$reservation = Reservation::findFirst(array('coditions' => 'id=?1', 'bind' => array(1 => $reservationid)));
if ($reservation != null) {
$available = $reservation->Available;
if ($available->date == date('Y-m-d', strtotime('now'))) {
$this->response->setContent('对不起,该预约单已经超过可取消日期');
$this->response->send();
return;
} else {
if ($reservation->delete() == false) {
$this->response->setContent('对不起,现在无法取消预约单');
$this->response->send();
return;
} else {
$this->response->setContent('预约单取消成功');
$this->response->send();
return;
}
}
}
}
示例12: checkAdditionalResources
/**
* Checks to see if any of the additional resources conflict
* @param Reservation $res the reservation object to validate
* @return An array of available_number and names of any conflicting resources
*/
function checkAdditionalResources($res, $resources_to_add)
{
$return = array();
$t = new Timer('get_additional_resource_count()');
$t->start();
// $query = 'SELECT ar.resourceid, ar.name, ar.number_available '
// . ' FROM ' . $this->get_table(TBL_ADDITIONAL_RESOURCES) . ' ar'
// . ' WHERE resourceid IN (' . . ') AND ar.number_available = 0';
$values = array($res->get_start_date(), $res->get_start_date(), $res->get_start(), $res->get_end_date(), $res->get_end_date(), $res->get_end(), $res->get_start_date(), $res->get_start_date(), $res->get_start(), $res->get_end_date(), $res->get_end_date(), $res->get_end(), $res->get_start_date(), $res->get_start_date(), $res->get_start(), $res->get_start_date(), $res->get_start_date(), $res->get_start(), $res->get_end_date(), $res->get_end_date(), $res->get_end(), $res->get_end_date(), $res->get_end_date(), $res->get_end());
$resourceids = $this->make_del_list($resources_to_add);
$id = $res->get_id();
$and = '';
if (!empty($id)) {
$and = ' AND rr.resid <> ?';
// Modifying this reservation
array_unshift($values, $id);
}
$query = 'SELECT ar.resourceid, ar.name, ar.number_available, COUNT(*) AS total' . ' FROM ' . $this->get_table(TBL_RESERVATION_RESOURCES) . ' rr' . ' INNER JOIN ' . $this->get_table(TBL_ADDITIONAL_RESOURCES) . ' ar ON rr.resourceid = ar.resourceid' . ' INNER JOIN ' . $this->get_table(TBL_RESERVATIONS) . ' r ON r.resid = rr.resid' . ' WHERE rr.resourceid IN (' . $resourceids . ')' . ' AND ar.number_available <> -1 AND ar.number_available IS NOT NULL' . $and . ' AND (' . ' ( (start_date > ? OR (start_date = ? AND starttime > ?)) AND ( end_date < ? OR (end_date = ? AND endtime < ?)) )' . ' OR ( (start_date < ? OR (start_date = ? AND starttime < ?)) AND (end_date > ? OR (end_date = ? AND endtime > ?)) )' . ' OR ( (start_date < ? OR (start_date = ? AND starttime <= ?)) AND (end_date > ? OR (end_date = ? AND endtime > ?)) ) ' . ' OR ( (start_date < ? OR (start_date = ? AND starttime < ?)) AND (end_date > ? OR (end_date = ? AND endtime >= ?)) )' . ' )' . ' GROUP BY ar.resourceid, ar.name, ar.number_available' . ' HAVING COUNT(*) >= ar.number_available' . ' UNION ' . ' SELECT ar.resourceid, ar.name, ar.number_available, 0 AS total' . ' FROM ' . $this->get_table(TBL_ADDITIONAL_RESOURCES) . ' ar' . ' WHERE resourceid IN (' . $resourceids . ') AND ar.number_available = 0';
$result = $this->db->query($query, $values);
// Check if error
$this->check_for_error($result);
while ($rs = $result->fetchRow()) {
$return[] = array('name' => $rs['name'], 'number_available' => $rs['number_available']);
}
$t->stop();
$t->print_comment();
return $return;
}
示例13: generate_vars
function generate_vars($section, &$vars)
{
if (!$vars['is_logged']) {
return;
}
if (isset($_GET['reservation_id'])) {
$reservation = Reservation::get($_GET['reservation_id']);
if ($reservation != null) {
$match = $reservation->get_match();
$match->places += $reservation->qte;
$match->save();
$reservation->delete();
}
} else {
if (isset($_GET['tout_effacer'])) {
$reservations = Reservation::filter_by_user($vars['userid']);
foreach ($reservations as $reservation) {
$match = $reservation->get_match();
$match->places += $reservation->qte;
$match->save();
$reservation->delete();
}
}
}
$reservations = Reservation::filter_by_user($vars['userid']);
$vars['reservations'] = $reservations;
$cout_total = 0;
foreach ($reservations as $reservation) {
$cout_total += $reservation->get_match()->prix;
}
$vars['cout_total'] = $cout_total;
}
示例14: freePlaces
public function freePlaces()
{
$reservation = count(Reservation::filter_by_match($this->id));
$achat = count(Achat::filter_by_match($this->id));
$arena = $this->getArena();
return $arena->largeur * $arena->profondeur - $reservation - $achat;
}
示例15: getColoredModStatusString
public function getColoredModStatusString()
{
$statusString = Reservation::modStatusToString($this->modStatus);
if ($this->modStatus == RES_STATUS_CONFIRMED) {
$status = "<font color=\"#005500\">" . $statusString . "</font>";
} else {
if ($this->modStatus == RES_STATUS_CHECKED_OUT) {
$status = "<font color=\"#005500\">" . $statusString . "</font>";
} else {
if ($this->modStatus == RES_STATUS_CHECKED_IN) {
$status = "<font color=\"#005500\">" . $statusString . "</font>";
} else {
if ($this->modStatus == RES_STATUS_PENDING) {
$status = $statusString;
} else {
if ($this->modStatus == RES_STATUS_DENIED) {
$status = "<font color=\"#FF0000\">" . $statusString . "</font>";
} else {
$status = "<font color=\"#FF0000\">" . $statusString . "</font>";
}
}
}
}
}
return $status;
}