本文整理汇总了PHP中Booking类的典型用法代码示例。如果您正苦于以下问题:PHP Booking类的具体用法?PHP Booking怎么用?PHP Booking使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Booking类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
/**
* Updates an existing EventEntry model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($ee_id)
{
$eventEntryModel = $this->findModel($ee_id);
$eventModel = Event::findOne($eventEntryModel->event->id);
$bookingModel = new Booking();
$bookingModel->attributes = array_merge($eventEntryModel->attributes, $eventModel->attributes);
if ($bookingModel->load(Yii::$app->request->post()) && $eventEntryModel->save()) {
return $this->redirect(['view', 'id' => $eventEntryModel->id]);
} else {
return $this->render('update', ['eventEntryModel' => $eventEntryModel]);
}
}
开发者ID:spiro-stathakis,项目名称:projects,代码行数:18,代码来源:EventEntryController.php
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store($id)
{
$listing = Listing::where('isPublic', '=', 1)->where('id', '=', $id)->first();
if (!$listing) {
throw new \Symfony\Component\Routing\Exception\ResourceNotFoundException();
}
$input = Input::all();
//return print_r($input,true);
$yesterday = \Carbon\Carbon::now('Australia/Sydney');
$yesterday = $yesterday->format('Y-m-d H:i:s');
// return $yesterday;
$rules = array('comments' => array('required', 'min:3'), 'user_phone' => array('required', 'min:9', 'max:30'), 'request_start_datetime' => array('required', 'date', 'dateformat: Y-m-d H:i:s', 'before: ' . $input['request_end_datetime']), 'request_end_datetime' => array('required', 'date', 'dateformat: Y-m-d H:i:s', 'after: ' . $yesterday));
$validator = Validator::make($input, $rules);
if ($validator->fails()) {
return Redirect::back()->withInput($input)->withErrors($validator);
}
$comments = $this->sanitizeStringAndParseMarkdown($input['comments']);
$authuser = Auth::user();
$name = $authuser->name;
$bookings = new Booking();
$bookings->user_id = $authuser->id;
$bookings->user_name = $name;
$bookings->listing_id = $id;
$bookings->user_phone = $input['user_phone'];
$bookings->request_start_datetime = $input['request_start_datetime'];
$bookings->request_end_datetime = $input['request_end_datetime'];
$bookings->status = "Booking request submitted. Awaiting Open Source Collaborative Consumption Marketplace review.";
$bookings->user_comments = $comments;
$bookings->space_owner_id = $listing->owner_id;
$address = $listing->address1 . ", " . $listing->suburb . ", " . $listing->city . " " . $listing->country;
$data = $input;
$data['address'] = $address;
$data['title'] = $listing->title;
$data['id'] = $id;
$data['type'] = $listing->space_type;
$data['user_name'] = $name;
$data['status'] = $bookings->status;
/* TODO: Make it email the user and space owner */
Mail::send("booking.mail.newbookingfounders", $data, function ($message) {
$message->to('[email protected]')->subject('New booking on Open Source Collaborative Consumption Marketplace');
});
$email = Auth::user()->email;
Mail::send("booking.mail.newbookinguser", $data, function ($message) use($email) {
$message->to($email)->subject('Your new booking on Open Source Collaborative Consumption Marketplace!');
});
$bookings->save();
return Redirect::to('dashboard')->with('flash_message_good', "Your booking has been sent. We'll be in touch soon with confirmation or questions!");
}
开发者ID:s-matic,项目名称:collab-consumption,代码行数:53,代码来源:BookingController.php
示例3: register
public function register($leadership_event_id, $booking_id)
{
$input = Input::all();
$validator = Validator::make($input, Booking::$rules);
if ($validator->passes()) {
$booking = Booking::findOrFail($booking_id);
$booking->registration_date = new Datetime();
$booking->first = Input::get('first');
$booking->last = Input::get('last');
$booking->email = Input::get('email');
$booking->contact_number = Input::get('contact_number');
$booking->church = Input::get('church');
$booking->role = Input::get('role');
$booking->notes = Input::get('notes');
$booking->save();
return Redirect::route('registration', array($leadership_event_id))->with('info', 'Registration complete!');
} else {
$event = LeadershipEvent::find($leadership_event_id);
$bookings = Booking::where('id', $booking_id)->get();
$bookings->each(function ($booking) {
// Should actually only be one...
$booking->first = Input::get('first');
$booking->last = Input::get('last');
$booking->email = Input::get('email');
$booking->contact_number = Input::get('contact_number');
$booking->church = Input::get('church');
$booking->role = Input::get('role');
$booking->notes = Input::get('notes');
});
$this->layout->with('subtitle', $event->name());
$this->layout->withErrors($validator);
$this->layout->content = View::make('registration.index')->with('event', $event)->with('bookings', $bookings)->with('errors', $validator->messages());
}
}
开发者ID:ajwgibson,项目名称:leadership,代码行数:34,代码来源:RegistrationController.php
示例4: unregister
public function unregister($leadership_event_id, $id)
{
$booking = Booking::findOrFail($id);
$booking->registration_date = null;
$booking->save();
return Redirect::route('booking.show', array($leadership_event_id, $id))->with('info', 'Unregistered booking!');
}
开发者ID:ajwgibson,项目名称:leadership,代码行数:7,代码来源:BookingController.php
示例5: destroy
public function destroy($kitTypeID)
{
// This Shall be fun!
// We have to deconstruct the types based on the forign key dependencys
// First iterate all the kits, for each kit remove all contents,
// and then all bookings (and all booking details)
// then finally we can remove the kit type and then all the logs for that
// kit type.
foreach (Kits::where('KitType', '=', $kitTypeID)->get() as $kit) {
foreach (KitContents::where("KitID", '=', $kit->ID)->get() as $content) {
KitContents::destroy($content->ID);
}
foreach (Booking::where("KitID", '=', $kit->ID)->get() as $booking) {
foreach (BookingDetails::where("BookingID", '=', $booking->ID)->get() as $detail) {
BookingDetails::destroy($detail->ID);
}
Booking::destroy($booking->ID);
}
Kits::destroy($kit->ID);
}
KitTypes::destroy($kitTypeID);
// Do the logs last, as all the deletes will log the changes of deleting the bits.
Logs::where('LogKey1', '=', $kitTypeID)->delete();
return "OK";
}
开发者ID:KWinston,项目名称:EPLProject,代码行数:25,代码来源:KitTypesController.php
示例6: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Booking::create([]);
}
}
开发者ID:kenkode,项目名称:umash-1,代码行数:7,代码来源:BookingsTableSeeder.php
示例7: stageEnterCredentials
public function stageEnterCredentials()
{
$valid = true;
$booking = new BookingForm();
if (isset($_POST['BookingForm'])) {
$booking->attributes = $_POST['BookingForm'];
$valid = $booking->validate() && $valid;
} else {
$valid = false;
}
$passport = new AviaPassportForm();
if (isset($_POST['PassportForm'])) {
$passport->attributes = $_POST['PassportForm'];
$valid = $valid && $passport->validate();
}
if ($valid) {
//saving data to objects
$bookingAr = new Booking();
$bookingAr->email = $booking->contactEmail;
$bookingAr->phone = $booking->contactPhone;
if (!Yii::app()->user->isGuest) {
$bookingAr->userId = Yii::app()->user->id;
}
$bookingPassports = array();
$bookingPassport = new BookingPassport();
$bookingPassport->birthday = $passport->birthday;
$bookingPassport->firstName = $passport->firstName;
$bookingPassport->lastName = $passport->lastName;
$bookingPassport->countryId = $passport->countryId;
$bookingPassport->number = $passport->number;
$bookingPassport->series = $passport->series;
$bookingPassport->genderId = $passport->genderId;
$bookingPassport->documentTypeId = $passport->documentTypeId;
$bookingPassports[] = $bookingPassport;
$bookingAr->bookingPassports = $bookingPassports;
$bookingAr->flightId = Yii::app()->flightBooker->current->flightVoyage->flightKey;
if ($bookingAr->save()) {
Yii::app()->flightBooker->current->bookingId = $bookingAr->id;
Yii::app()->flightBooker->status('booking');
$this->refresh();
} else {
$this->render('enterCredentials', array('passport' => $passport, 'booking' => $booking));
}
} else {
$this->render('enterCredentials', array('passport' => $passport, 'booking' => $booking));
}
}
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:47,代码来源:FlightBookerBehavior.php
示例8: register_booking
/**
* Creates a registration record for a booking.
*/
public function register_booking()
{
$booking_id = Input::get('booking_id');
$tickets = Input::get('tickets');
$booking = Booking::findOrFail($booking_id);
$booking->registrations()->save(new Registration(array('tickets' => $tickets)));
return Redirect::route('register')->withInput()->with('info', 'Registration complete!');
}
开发者ID:ajwgibson,项目名称:illuminate,代码行数:11,代码来源:RegistrationController.php
示例9: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer $id the ID of the model to be loaded
* @return Booking the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Booking::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
开发者ID:pmswamy,项目名称:training1demo,代码行数:15,代码来源:BookingController.php
示例10: totalCreditFromAllBookings
public static function totalCreditFromAllBookings()
{
$bookings = Booking::where('user_id', Auth::id())->get();
$total = 0;
foreach ($bookings as $booking) {
$total += Booking::getTotalBookingAmount($booking);
}
return $total;
}
开发者ID:tharindarodrigo,项目名称:agent,代码行数:9,代码来源:Agent.php
示例11: deleteBooking
public function deleteBooking()
{
if (!Request::ajax()) {
return "not a json request";
}
$post = Input::all();
BookingDetails::where('BookingID', '=', $post['BookID'])->delete();
Booking::destroy($post['BookID']);
return Response::json(array('success' => true), 200);
}
开发者ID:KWinston,项目名称:EPLProject,代码行数:10,代码来源:BookKitController.php
示例12: postManage
public function postManage()
{
$booking = Booking::find(Input::get('id'));
if ($booking) {
$booking->status = Input::get('status');
$booking->save();
return Redirect::to('bookings/manage')->with('message', 'Booking Updated');
}
return Redirect::back()->with('message', 'Something went wrong, please try again');
}
开发者ID:madiarsa,项目名称:laravel-4.1-car-rental-site,代码行数:10,代码来源:BookingsController.php
示例13: executeCreateBooking
public function executeCreateBooking(sfWebRequest $request)
{
if ($this->getUser()->isAuthenticated()) {
$app = Doctrine_Core::getTable('Apartment')->find($request->getPostParameter('apid'));
$date_from = $request->getPostParameter('date_from');
$date_to = $request->getPostParameter('date_to');
$pax = $request->getPostParameter('pax');
$booking = new Booking();
$booking->Apartment = $app;
$booking->pax = $pax;
$booking->date_from = $date_from;
$booking->date_to = $date_to;
$booking->DoBooking($this->getUser()->getGuardUser());
$this->success = true;
} else {
return sfView::NONE;
/* Log this !*/
}
}
开发者ID:alifst11,项目名称:symfonybooking,代码行数:19,代码来源:actions.class.php
示例14: update
public function update(Request $request, $id)
{
$booking = Booking::where('id', $id)->first();
$booking->arrive_date = $request->input('arrive_date');
$booking->leave_date = $request->input('leave_date');
$booking->personal_ids = $request->input('personal_ids');
$booking->room_id = $request->input('room_id');
$booking->save();
return $booking;
}
开发者ID:Agufarre,项目名称:php-bootcamp,代码行数:10,代码来源:controller_bookings.php
示例15: cancelAction
function cancelAction()
{
$user = \bootstrap::getInstance()->getUser();
if (!$user['id']) {
return $this->_redirect('/');
}
$db = \Zend_Registry::get('db');
$newValues = array('canceled' => 1);
$condition = 'id=' . (int) $this->params('id');
$appointment_date = $db->select()->from('appointments', array('date'))->where('id=?', $this->params('id'))->query()->fetchColumn();
if ($user['type'] == 'client') {
$booking = new Booking(array('today' => date('Y-m-d'), 'date' => $appointment_date));
if (!$booking->allowCancelByUser()) {
echo 'not allowed to cancel';
exit;
}
$condition .= ' && user_id = ' . (int) $user['id'];
} else {
if ($user['type'] == 'staff') {
$condition .= ' && staff_userid = ' . (int) $user['id'];
} else {
if ($user['type'] !== 'admin') {
return $this->_redirect('/');
}
}
}
$db->update('appointments', $newValues, $condition);
$logMessage = 'Therapist appointment #' . (int) $this->params('id');
$logMessage .= ' cancelled by user #' . $user['id'];
$this->cancelsLogger()->log($logMessage, Zend_Log::INFO);
$this->viewParams['date'] = $appointment_date;
$viewModel = new ViewModel($this->viewParams);
$viewModel->setTemplate('appointments/cancel.phtml');
$htmlOutput = $this->getServiceLocator()->get('viewrenderer')->render($viewModel);
$mail = new Zend_Mail();
$mail->addTo($user['email']);
$mail->setBodyText($htmlOutput);
$this->queueMail($mail);
echo $htmlOutput;
$this->_helper->viewRenderer->setNoRender(true);
}
开发者ID:mustafakarali,项目名称:application,代码行数:41,代码来源:AppointmentsController.php
示例16: actionBookingform
public function actionBookingform($isFancy = 0)
{
Yii::app()->getModule('apartments');
$this->modelName = 'Apartment';
$apartment = $this->loadModel();
$this->modelName = 'Booking';
$booking = new Booking();
$booking->scenario = 'bookingform';
if (isset($_POST['Booking']) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong) && !$apartment->deleted) {
$booking->attributes = $_POST['Booking'];
$booking->apartment_id = $apartment->id;
$booking->user_ip = Yii::app()->controller->currentUserIp;
$booking->user_ip_ip2_long = Yii::app()->controller->currentUserIpLong;
if ($booking->validate()) {
$booking->time_inVal = $this->getI18nTimeIn($booking->time_in);
$booking->time_outVal = $this->getI18nTimeOut($booking->time_out);
if (issetModule('bookingtable')) {
Bookingtable::addRecord($booking);
}
$types = Apartment::getI18nTypesArray();
$booking->type = $types[Apartment::TYPE_RENT];
$ownerApartment = User::model()->findByPk($apartment->owner_id);
$booking->ownerEmail = $ownerApartment->email;
$notifier = new Notifier();
$notifier->raiseEvent('onNewBooking', $booking, array('user' => $ownerApartment));
Yii::app()->user->setFlash('success', tt('Operation successfully complete. Your order will be reviewed by owner.'));
$this->redirect($apartment->getUrl());
}
}
$user = null;
if (!Yii::app()->user->isGuest) {
$user = User::model()->findByPk(Yii::app()->user->getId());
}
if ($isFancy) {
$this->excludeJs();
$this->renderPartial('bookingform', array('apartment' => $apartment, 'model' => $booking, 'isFancy' => true, 'user' => $user), false, true);
} else {
$this->render('bookingform', array('apartment' => $apartment, 'model' => $booking, 'isFancy' => false, 'user' => $user));
}
}
开发者ID:barricade86,项目名称:raui,代码行数:40,代码来源:MainController.php
示例17: myDateValidator
public function myDateValidator($param)
{
$dateStart = CDateTimeParser::parse($this->date_start, Booking::getYiiDateFormat());
// format to unix timestamp
$dateEnd = CDateTimeParser::parse($this->date_end, Booking::getYiiDateFormat());
// format to unix timestamp
if ($param == 'date_start' && $dateStart < CDateTimeParser::parse(date('Y-m-d'), 'yyyy-MM-dd')) {
$this->addError('date_start', tt('Wrong check-in date', 'booking'));
}
if ($param == 'date_end' && $dateEnd <= $dateStart) {
$this->addError('date_end', tt('Wrong check-out date', 'booking'));
}
}
开发者ID:barricade86,项目名称:raui,代码行数:13,代码来源:SimpleformModel.php
示例18: index
public function index()
{
self::authorize_user();
$bookings = Booking::all();
$doctors = User::doctors();
$polyclinics = Polyclinic::all();
$patients = User::patients();
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
$doctor_id = isset($_REQUEST['doctor_id']) ? $_REQUEST['doctor_id'] : null;
$polyclinic_id = isset($_REQUEST['polyclinic_id']) ? $_REQUEST['polyclinic_id'] : null;
$patient_id = isset($_REQUEST['patient_id']) ? $_REQUEST['patient_id'] : null;
// La funcion render esta declarada en la clase padre ApplicationController.
require 'app/views/reports/report.php';
}
开发者ID:santiagodoldan,项目名称:electiva_php_ude_2015,代码行数:14,代码来源:reports_controller.php
示例19: index
public function index()
{
$this->layout->with('subtitle', 'Bookings');
$bookings = Booking::orderBy('last')->orderBy('first');
$filtered = false;
$filter_name = Session::get('bookings_filter_name', '');
$filter_church = Session::get('bookings_filter_church', '');
$filter_eventbrite = Session::get('bookings_filter_eventbrite', '');
$filter_registered = Session::get('bookings_filter_registered', '');
$filter_not_registered = Session::get('bookings_filter_not_registered', '');
$filter_saturday = Session::get('bookings_filter_saturday', '');
$filter_not_saturday = Session::get('bookings_filter_not_saturday', '');
if (!empty($filter_name)) {
$bookings = $bookings->where(function ($query) use($filter_name) {
$query->where('bookings.first', 'LIKE', "%{$filter_name}%")->orWhere('bookings.last', 'LIKE', "%{$filter_name}%");
});
$filtered = true;
}
if (!empty($filter_church)) {
$bookings = $bookings->where('source', 'Church');
$filtered = true;
}
if (!empty($filter_eventbrite)) {
$bookings = $bookings->where('source', 'EventBrite');
$filtered = true;
}
if (($filter_registered || $filter_not_registered) && !($filter_registered && $filter_not_registered)) {
if ($filter_registered) {
$ids = DB::table('booking_registration_counts')->whereRaw('tickets <= registrations')->lists('id');
if ($ids) {
$bookings = $bookings->whereIn('id', $ids);
}
} else {
$ids = DB::table('booking_registration_counts')->whereRaw('tickets > registrations')->lists('id');
if ($ids) {
$bookings = $bookings->whereIn('id', $ids);
}
}
}
if (($filter_saturday || $filter_not_saturday) && !($filter_saturday && $filter_not_saturday)) {
if ($filter_saturday) {
$bookings = $bookings->where('saturday', true);
} else {
$bookings = $bookings->where('saturday', false);
}
$filtered = true;
}
$bookings = $bookings->paginate(25);
$this->layout->content = View::make('bookings.index')->with('bookings', $bookings)->with('filtered', $filtered)->with('filter_name', $filter_name)->with('filter_church', $filter_church)->with('filter_eventbrite', $filter_eventbrite)->with('filter_registered', $filter_registered)->with('filter_not_registered', $filter_not_registered)->with('filter_saturday', $filter_saturday)->with('filter_not_saturday', $filter_not_saturday);
}
开发者ID:ajwgibson,项目名称:illuminate,代码行数:50,代码来源:BookingController.php
示例20: amendInvoice
public static function amendInvoice($booking)
{
$total = Booking::getTotalBookingAmount($booking);
$invoice = Invoice::where('booking_id', $booking->id)->first();
if ($invoice) {
$invoice->count = ++$invoice->count;
$invoice->amount = $total;
$invoice->save();
return true;
} else {
$invoiceData = array('amount' => $total, 'booking_id' => $booking->id);
Invoice::create($invoiceData);
return false;
}
}
开发者ID:tharindarodrigo,项目名称:agent,代码行数:15,代码来源:Invoice.php
注:本文中的Booking类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论