PHP code example of geniv / nette-calendar
1. Go to this page and download the library: Download geniv/nette-calendar 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/ */
geniv / nette-calendar example snippets
onInactiveDate(DateTime $date)
onSelectDate(DateTime $date)
$weekCalendar->setLoadData(array $dates);
$weekCalendar->addVariableTemplate('game', $game);
$weekCalendar->selectDate($date);
protected function createComponentWeekCalendar(WeekCalendar $weekCalendar): WeekCalendar
{
$dates = $this->reservationModel->getList()->where(['active' => true])->fetchPairs('id', 'date');
$weekCalendar->setLoadData($dates);
// setting calendar
$weekCalendar->setFromTime(11);
$weekCalendar->setCountBlock(10);
$weekCalendar->setStepBlock('+2 hour');
// $weekCalendar->setTemplatePath(__DIR__ . '/templates/WeekCalendar.latte');
$weekCalendar->onInactiveDate[] = function (DateTime $date) {
// callback inactive row
};
$weekCalendar->onSelectDate[] = function (DateTime $date) {
$this->template->datum = $date;
$this['reservationForm']->setDefaults([
'date' => $date,
]);
if ($this->isAjax()) {
$this->redrawControl('reservationSnippet');
}
};
return $weekCalendar;
}
json
"php": ">=7.0.0",
"nette/nette": ">=2.4.0",
"geniv/nette-general-form": ">=1.0.0"