1. Go to this page and download the library: Download lzaplata/booking library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lzaplata / booking example snippets
use LZaplata\Booking\Booking;
use Nette\Application\UI\ITemplateFactory;
/** @var Booking @inject */
public $booking;
/** @var ITemplateFactory @inject */
public $templateFactory;
/**
* @param string $name
*/
public function createComponentParkBookingRoom($name)
{
// create days objects
$monday = new Day(); // creates single day object using LZaplata\Booking\Day
$monday->setDayOfWeek(Day::MONDAY); // sets day of week
$monday->setStartDateTime(new \DateTime()); // sets day start time (you can also use Nette\Utils\DateTime)
$monday->setEndDateTime(new DateTime()); // sets day end time (you can also use Nette\Utils\DateTime)
$monday->addDisabledPeriod(new \DatePeriod()); // you can disable period for lunch
// for other days you can create its own objects or you can clone day object
$tuesday = clone $monday;
$tuesday->setDayOfWeek(Day::TUESDAY); // you must set corresponding day of week
// create booking room
$room = $this->booking->createRoom(string $roomName, string $name); // first parameter is your room name, second is component name
$room->setDays([$monday, $tuesday, $wednesday, $thursday, $friday, $saturday, $sunday]); // sets days as array of objects
$room->setCapacity(int $capacity); // sets capacity of each period
$room->setInterval(new \DateInterval()); // sets booking interval
$room->setDelay(int $hours); // set hours from now you can make booking
$room->setCapacityExceededMessage(string $message); // sets booking form error message if capacity is exceeded
$room->addDisabledPeriod(new \DatePeriod()); // disable year period
$room->setupBookingFormStreetInput(bool $visible, bool $sageTemplate->setFile(string $file);
$bookingCancelMessage = new Message();
$bookingCancelMessage->addTo(string $email);
$bookingCancelMessage->setSubject(string $subject);
$bookingCancelMail = $room->setupBookingCancelMail($bookingCancelMessage);
$bookingCancelMail->setTemplate($bookingCancelMessageTemplate);
// end finally return whole component
return $room;
}
`latte
{$id} {*booking ID*}
{$amount} {*booked capacity*}
{$name}
{$surname}
{$street}
{$street_no}
{$city}
{$zip}
{$mail}
{$phone}
{$text}
{$date} {*you can format it using {$date->format()} or {$date|date:""}*}
{$cancelLink} {*booking cancel link*}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.