- $url = new moodle_url('/calendar/view.php', [
- 'view' => 'day',
- 'time' => $timestamp,
- ]);
-
- if ($this->calendar->course && SITEID !== $this->calendar->course->id) {
- $url->param('course', $this->calendar->course->id);
- } else if ($this->calendar->categoryid) {
- $url->param('category', $this->calendar->categoryid);
- }
-
- $return['viewdaylink'] = $url->out(false);
-
- if ($popovertitle = $this->get_popover_title()) {
- $return['popovertitle'] = $popovertitle;
- }
- $cache = $this->related['cache'];
- $eventexporters = array_map(function($event) use ($cache, $output, $url) {
- $context = $cache->get_context($event);
- $course = $cache->get_course($event);
- $exporter = new calendar_event_exporter($event, [
- 'context' => $context,
- 'course' => $course,
- 'daylink' => $url,
- 'type' => $this->related['type'],
- 'today' => $this->data[0],
- ]);
-
- return $exporter;
- }, $this->related['events']);
-
- $return['events'] = array_map(function($exporter) use ($output) {
- return $exporter->export($output);
- }, $eventexporters);
-