本文整理汇总了PHP中Reservation类的典型用法代码示例。如果您正苦于以下问题:PHP Reservation类的具体用法?PHP Reservation怎么用?PHP Reservation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Reservation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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('[email protected]', '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' => "[email protected]", '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
示例16: rejectPayment
public function rejectPayment()
{
$_confirmPay = new Reservation();
$dataId = Input::get('id');
$_confirmPay->rejectReserv($dataId);
$reservation = $_confirmPay->getReserv($dataId);
$users = new User();
$user = $users->getUserDetailById($reservation->created_by);
$data = array('refNumber' => str_pad($dataId, 10, "0", STR_PAD_LEFT), 'package' => $reservation->pack_name, 'amount' => '₱' . number_format($reservation->total_amount, 2), 'paymentMethod' => $reservation->payment_method, 'status' => 4, 'email' => $user->user_email, 'name' => $user->user_fname . ' ' . $user->user_lname);
try {
Mail::send('emails.user.transactionReservation', $data, function ($message) use($data) {
$message->from('[email protected]', 'El Sitio Filipino');
$message->to($data['email'], $data['name'])->subject('El Sitio Filipino Transaction Details');
});
} catch (Exception $ex) {
}
return json_encode(['success' => $_confirmPay]);
}
开发者ID:axisssss,项目名称:ORS,代码行数:18,代码来源:TransactionAdminController.php
示例17: get_reservation_status
public function get_reservation_status($reservation_id)
{
$response_data = $this->core_call("get_reservation_status", array("reservation_id" => array("id" => $reservation_id)));
if (!$response_data['is_exception']) {
return Reservation::create($response_data['result']);
} else {
die("ERROR: " . $response_data['message'] . "\n");
}
}
开发者ID:JamesHyunKim,项目名称:weblabdeusto,代码行数:9,代码来源:weblabdeusto.class.php
示例18: dropdown
public static function dropdown()
{
$properties = Reservation::orderBy('created_at', 'desc')->get();
$nodes = array();
foreach ($properties as $p) {
$nodes[$p->id] = $p->id . ' | ' . $p->firstname . ' ' . $p->lastname;
}
return $nodes;
}
开发者ID:jacobDaeHyung,项目名称:Laravel-Real-Estate-Manager,代码行数:9,代码来源:Reservation.php
示例19: postForm
/**
* this method is used to handle AJAX request for form submit
*/
public function postForm()
{
try {
if (!isset($_POST)) {
throw new Exception('Error request [10]');
}
$name = \Arr::get($_POST, 'name', false);
$sex = \Arr::get($_POST, 'sex', 'female');
$phone = \Arr::get($_POST, 'phone', false);
$email = \Arr::get($_POST, 'email', false);
$note = \Arr::get($_POST, 'note', false);
if (empty($name)) {
throw new Exception('Error request [1100]');
}
if (empty($phone)) {
throw new Exception('Error request [1101]');
}
if (empty($email)) {
throw new Exception('Error request [1110]');
} else {
$reg = '/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})$/';
if (preg_match($reg, $email) == false) {
throw new Exception('Error request [11101]');
}
}
if (empty($note)) {
throw new Exception('Error request [1101]');
}
$model = new \Reservation();
$model->name = $name;
$model->sex = $sex;
$model->phone = $phone;
$model->email = $email;
$model->note = $note;
if (!$model->save()) {
throw new Exception("Error request [110]");
}
return \Response::json(array('status' => 'ok'));
} catch (Exception $e) {
return \Response::json(array('status' => 'error', 'message' => $e->getMessage()));
}
}
开发者ID:kettanyam,项目名称:20141001done,代码行数:45,代码来源:ReservationController.php
示例20: reservation
public static function reservation($id)
{
$user = self::get_user_logged_in();
$service = Service::find_for_user($user, $id);
if ($service == null) {
Redirect::to(\Slim\Slim::getInstance()->urlFor('services_index'), array('message' => 'Palvelua ei löytynyt', 'error' => true));
}
$date_now = new DateTime();
$current_time = new DateTime($service->opens_at);
$end_time = new DateTime($service->closes_at);
$current_time->add(new DateInterval("P1D"));
$end_time->add(new DateInterval("P1D"));
$unit = new DateInterval(sprintf("PT%dM", $service->reservation_unit));
$reservations = array();
$slot = 0;
$future_reservations = Reservation::find_future_reservations($service);
$taken_slots = array();
foreach ($future_reservations as $reservation) {
$taken_slots[$reservation->reserved_from->format('Y-m-d H:i:s')] = true;
}
while (true) {
$current_time->add($unit);
if ($current_time > $end_time) {
break;
} else {
$current_time->sub($unit);
}
$reservations[$slot] = array();
$current_date = new DateTime($current_time->format('Y-m-d H:i:s'));
for ($i = 0; $i < 16; $i++) {
$next_start = new DateTime($current_date->format('Y-m-d H:i:s'));
$next_start->add($unit);
$current_end = new DateTime($current_date->format('Y-m-d H:i:s'));
$current_end->setTime(intval($end_time->format('H')), intval($end_time->format('i')));
if ($next_start <= $current_end) {
$reservation = array();
$reservation['time_slot'] = $current_date->format('H:i') . '-' . $next_start->format('H:i');
$reservation['start'] = new DateTime($current_date->format('Y-m-d H:i:s'));
if (isset($taken_slots[$current_date->format('Y-m-d H:i:s')])) {
$reservation['taken'] = true;
} else {
$reservation['taken'] = false;
}
$diff = $date_now->diff($current_date);
$reservation['unavailable'] = $diff->d < 1;
array_push($reservations[$slot], $reservation);
}
$current_date->add(new DateInterval("P1D"));
}
$current_time->add($unit);
$slot++;
}
View::make('service/reservation.html', array('service' => $service, 'reservations' => $reservations));
}
开发者ID:laazz,项目名称:talpa,代码行数:54,代码来源:service_controller.php
注:本文中的Reservation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论