From 07c03ff96a3de1b4d296e36b93f0d98c31d3a8d7 Mon Sep 17 00:00:00 2001 From: Ankit Agarwal Date: Thu, 27 Dec 2012 16:05:24 +0800 Subject: [PATCH] MDL-36621 calendar: Display subscription info in calendar event popups --- calendar/lib.php | 11 +++++++++-- lang/en/calendar.php | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index 72f5c60e6bcf2..3a4bc00b7b7f9 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -314,7 +314,7 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y if (!isset($events[$eventid])) { continue; } - $event = $events[$eventid]; + $event = new calendar_event($events[$eventid]); $popupalt = ''; $component = 'moodle'; if(!empty($event->modulename)) { @@ -335,7 +335,14 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y $popupcontent .= html_writer::start_tag('div'); $popupcontent .= $OUTPUT->pix_icon($popupicon, $popupalt, $component); - $popupcontent .= html_writer::link($dayhref, format_string($event->name, true)); + $name = format_string($event->name, true); + if (!empty($event->subscription)) { + $a = new stdClass(); + $a->name = $name; + $a->source = $event->subscription->name; + $name = get_string('namewithsource', 'calendar', $a); + } + $popupcontent .= html_writer::link($dayhref, $name); $popupcontent .= html_writer::end_tag('div'); } diff --git a/lang/en/calendar.php b/lang/en/calendar.php index fc84849a1cfe0..543eea2d3b3f3 100644 --- a/lang/en/calendar.php +++ b/lang/en/calendar.php @@ -125,6 +125,7 @@ $string['monthlyview'] = 'Monthly view'; $string['monthnext'] = 'Next month'; $string['monththis'] = 'This month'; +$string['namewithsource'] = '{$a->name}({$a->source})'; $string['never'] = 'Never'; $string['newevent'] = 'New event'; $string['notitle'] = 'no title';