function opigno_moxtra_ical_prepare in Opigno Moxtra 3.x
Same name and namespace in other branches
- 8 opigno_moxtra.module \opigno_moxtra_ical_prepare()
Helper function to prepare iCal file for Live Meetings.
2 calls to opigno_moxtra_ical_prepare()
- MeetingForm::save in src/
Form/ MeetingForm.php - Form submission handler for the 'save' action.
- opigno_moxtra_cronjob_meeting_notification in ./
opigno_moxtra.module - Cron job callback for opigno_moxtra_meeting_notification.
File
- ./
opigno_moxtra.module, line 903 - Contains opigno_moxtra.module.
Code
function opigno_moxtra_ical_prepare($meeting) {
$startDate = new DateTime($meeting
->getStartDate());
$endDate = new DateTime($meeting
->getEndDate());
$iCal = \Drupal::service('opigno_calendar_event.iCal')
->buildICalEvent([
'summary' => $meeting
->getTitle(),
'start' => $startDate
->setTimezone(new DateTimeZone("UTC")),
'end' => $endDate
->setTimezone(new DateTimeZone("UTC")),
'description' => t('The Live Meeting %meeting starts in less than 24 hours', [
'%meeting' => $meeting
->getTitle(),
]),
'url' => $meeting
->toUrl('canonical', [
'absolute' => TRUE,
])
->setAbsolute()
->toString(),
'org' => \Drupal::config('system.site')
->get('name'),
]);
$attachments = [
'filecontent' => $iCal,
'filename' => $meeting
->getTitle() . '.ical',
'filemime' => 'text/calendar',
];
return $attachments;
}