protected function FullCalendarController::calculateEndDateFromDuration in Smart Date 3.x
Same name and namespace in other branches
- 8.2 src/Controller/FullCalendarController.php \Drupal\smart_date\Controller\FullCalendarController::calculateEndDateFromDuration()
- 3.0.x src/Controller/FullCalendarController.php \Drupal\smart_date\Controller\FullCalendarController::calculateEndDateFromDuration()
- 3.1.x src/Controller/FullCalendarController.php \Drupal\smart_date\Controller\FullCalendarController::calculateEndDateFromDuration()
- 3.2.x src/Controller/FullCalendarController.php \Drupal\smart_date\Controller\FullCalendarController::calculateEndDateFromDuration()
- 3.3.x src/Controller/FullCalendarController.php \Drupal\smart_date\Controller\FullCalendarController::calculateEndDateFromDuration()
- 3.4.x src/Controller/FullCalendarController.php \Drupal\smart_date\Controller\FullCalendarController::calculateEndDateFromDuration()
Calculating for switch between all day and regular events.
Parameters
int $duration: Duration in minutes.
timestamp $endDate: End value to populate.
timestamp $startDate: Start value of the date.
1 call to FullCalendarController::calculateEndDateFromDuration()
- FullCalendarController::updateEvent in src/
Controller/ FullCalendarController.php
File
- src/
Controller/ FullCalendarController.php, line 158
Class
- FullCalendarController
- Calendar Event Controller, overridden to handle Smart Date events.
Namespace
Drupal\smart_date\ControllerCode
protected function calculateEndDateFromDuration(&$duration, &$endDate, $startDate) {
if ($duration % 1440 == '1439') {
// This means an allday event is to become a regular event.
if (empty($endDate)) {
$endDate = strtotime($startDate) + $this->defaultTimedEventDuration;
$duration = $this->defaultTimedEventDuration / 60;
}
else {
$endDate = strtotime($endDate) + 1439 * 60;
}
}
else {
// This means an regular event is to become an allday event.
if (empty($endDate)) {
// This is assuming that https://fullcalendar.io/docs/defaultAllDayEventDuration setting is 1 day.
$endDate = strtotime($startDate) + 1439 * 60;
$duration = 1439;
}
else {
$endDate = strtotime($endDate);
}
}
}