本文整理汇总了PHP中Booking类的典型用法代码示例。如果您正苦于以下问题:PHP Booking类的具体用法?PHP Booking怎么用?PHP Booking使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Booking类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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]);
}
}
示例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('founders@worldburrow.com')->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!");
}
示例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());
}
}
示例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!');
}
示例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";
}
示例6: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Booking::create([]);
}
}
示例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));
}
}
示例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!');
}
示例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;
}
示例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;
}
示例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);
}
示例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');
}
示例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 !*/
}
}
示例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;
}
示例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);
}