Permalink
Browse files

MDL-36621 calendar: Ical event should display source info

  • Loading branch information...
1 parent ca48fe5 commit 8a7326ed4ee589338a2cd6444f681ae7570e9a0d @ankitagarwal ankitagarwal committed Dec 27, 2012
Showing with 13 additions and 1 deletion.
  1. +5 −1 calendar/lib.php
  2. +5 −0 calendar/renderer.php
  3. +1 −0 lang/en/calendar.php
  4. +2 −0 theme/base/style/calendar.css
View
@@ -1895,7 +1895,7 @@ class calendar_event {
* an event
*/
public function __construct($data=null) {
- global $CFG, $USER;
+ global $CFG, $USER, $DB;
// First convert to object if it is not already (should either be object or assoc array)
if (!is_object($data)) {
@@ -1910,6 +1910,10 @@ public function __construct($data=null) {
$data->id = null;
}
+ if (!empty($data->subscriptionid)) {
+ $data->subscription = $DB->get_record('event_subscriptions', array('id' => $data->subscriptionid));
+ }
+
// Default to a user event
if (empty($data->eventtype)) {
$data->eventtype = 'user';
View
@@ -307,6 +307,11 @@ public function event(calendar_event $event, $showactions=true) {
if (!empty($event->courselink)) {
$table->data[0]->cells[1]->text .= html_writer::tag('div', $event->courselink, array('class'=>'course'));
}
+ if (!empty($event->subscription)) {
+ $table->data[0]->cells[1]->text .= html_writer::tag('div',
+ html_writer::link($event->subscription->url, get_string('subsource', 'calendar',
+ $event->subscription)), array('class' => 'subscription'));
+ }
if (!empty($event->time)) {
$table->data[0]->cells[1]->text .= html_writer::tag('span', $event->time, array('class'=>'date'));
} else {
View
@@ -167,6 +167,7 @@
$string['subscriptionname'] = 'Calendar name';
$string['subscriptionremoved'] = 'Calendar subscription {$a} removed';
$string['subscriptionupdated'] = 'Calendar subscription {$a} updated';
+$string['subsource'] = 'Event source: {$a->name}';
$string['sun'] = 'Sun';
$string['sunday'] = 'Sunday';
$string['thu'] = 'Thu';
@@ -32,6 +32,8 @@
.dir-rtl.path-calendar .maincalendar .eventlist .event .topic .name {float:right;}
.path-calendar .maincalendar .eventlist .event .topic .date {float:right;}
.dir-rtl.path-calendar .maincalendar .eventlist .event .topic .date {float:left;}
+.path-calendar .maincalendar .eventlist .event .subscription {float:left;clear:left;}
+.dir-rtl.path-calendar .maincalendar .eventlist .event .subscription {float:right;clear:right;}
.path-calendar .maincalendar .eventlist .event .course {float:left;clear:left;}
.dir-rtl.path-calendar .maincalendar .eventlist .event .course {float:right;clear:right;}
.path-calendar .maincalendar .eventlist .event .side {width:32px;}

0 comments on commit 8a7326e

Please sign in to comment.