當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Reservation類代碼示例

本文整理匯總了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);
 }
開發者ID:aliuc,項目名稱:co-transcript,代碼行數:7,代碼來源:reservation.php

示例2: addReservation

 public function addReservation(Reservation $reservation)
 {
     if (!$this->roomIsFree($reservation->getStartDate(), $reservation->getEndDate())) {
         throw new EReservationException();
     }
     $this->reservations[] = $reservation;
 }
開發者ID:reminchev,項目名稱:SoftUni-Projects,代碼行數:7,代碼來源:Room.class.php

示例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);
 }
開發者ID:hugutux,項目名稱:booked,代碼行數:14,代碼來源:ExistingResourceAvailabilityRule.php

示例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;
}
開發者ID:pheze,項目名稱:ydtp2,代碼行數:26,代碼來源:reservation_billet.php

示例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);
     }
 }
開發者ID:axisssss,項目名稱:ORS,代碼行數:58,代碼來源:OrdersController.php

示例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);
         }
     }
 }
開發者ID:simeonemanuilov,項目名稱:OOP,代碼行數:10,代碼來源:Room.class.php

示例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);
 }
開發者ID:jfesquet,項目名稱:tempos,代碼行數:12,代碼來源:ReservationForm.class.php

示例8: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Reservation::create([]);
     }
 }
開發者ID:jonagoldman,項目名稱:channelmanager,代碼行數:7,代碼來源:ReservationsTableSeeder.php

示例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('新增失敗');
     }
 }
開發者ID:kettanyam,項目名稱:20141001done,代碼行數:21,代碼來源:ReservationsController.php

示例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;
 }
開發者ID:bogiesoft,項目名稱:YiiHotelReservation,代碼行數:16,代碼來源:ReservationDetailsTest.php

示例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;
             }
         }
     }
 }
開發者ID:sify21,項目名稱:guahao,代碼行數:25,代碼來源:HomeController.php

示例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;
 }
開發者ID:razagilani,項目名稱:srrs,代碼行數:33,代碼來源:ResDB.class.php

示例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;
}
開發者ID:pheze,項目名稱:ydtp2,代碼行數:32,代碼來源:panier.php

示例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;
 }
開發者ID:pheze,項目名稱:ydtp3,代碼行數:7,代碼來源:match.inc.php

示例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;
 }
開發者ID:ramielrowe,項目名稱:Reservation-System-V2,代碼行數:26,代碼來源:Reservation.php


注:本文中的Reservation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。