MDL-59383 core_calendar: make event summary display on modal
authorSimey Lameze <simey@moodle.com>
Mon, 10 Jul 2017 02:10:54 +0000 (10:10 +0800)
committerSimey Lameze <simey@moodle.com>
Tue, 11 Jul 2017 07:36:29 +0000 (15:36 +0800)
Part of MDL-59333.

calendar/renderer.php
calendar/view.php

index 6711693..ee450e1 100644 (file)
@@ -38,7 +38,7 @@ class core_calendar_renderer extends plugin_renderer_base {
      * @return string
      */
     public function start_layout() {
-        return html_writer::start_tag('div', array('class'=>'maincalendar'));
+        return html_writer::start_tag('div', ['data-region' => 'calendar', 'class' => 'maincalendar']);
     }
 
     /**
@@ -517,7 +517,8 @@ class core_calendar_renderer extends plugin_renderer_base {
                         ];
                         $eventname = get_string('eventnameandcourse', 'calendar', $eventnameparams);
                     }
-                    $link = html_writer::link($dayhref, $eventname);
+                    $link = html_writer::link($dayhref, $eventname, ['data-action' => 'view-event',
+                            'data-event-id' => $events[$eventindex]->id]);
                     $cell->text .= html_writer::tag('li', $link, $attributes);
                 }
                 $cell->text .= html_writer::end_tag('ul');
index 18245a5..f974ba5 100644 (file)
@@ -176,4 +176,5 @@ if (!empty($CFG->enablecalendarexport)) {
 echo $OUTPUT->container_end();
 echo html_writer::end_tag('div');
 echo $renderer->complete_layout();
+$PAGE->requires->js_call_amd('core_calendar/calendar', 'init');
 echo $OUTPUT->footer();