MDL-36621 calendar: Ical event should display source info

This commit is contained in:
Ankit Agarwal 2012-12-27 15:06:37 +08:00
parent ca48fe5f97
commit 8a7326ed4e
4 changed files with 13 additions and 1 deletions

View File

@ -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 @@ class calendar_event {
$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 File

@ -307,6 +307,11 @@ class core_calendar_renderer extends plugin_renderer_base {
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 File

@ -167,6 +167,7 @@ $string['subscriptions'] = 'Subscriptions';
$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';

View File

@ -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;}