} else if($event->courseid == SITEID) { // Site event
$event->icon = '<img height="16" width="16" src="'.$CFG->pixpath.'/c/site.gif" alt="" style="vertical-align: middle;" />';
-
+ $event->cssclass = 'event_global';
} else if($event->courseid != 0 && $event->courseid != SITEID && $event->groupid == 0) { // Course event
calendar_get_course_cached($coursecache, $event->courseid);
$event->icon = '<img height="16" width="16" src="'.$CFG->pixpath.'/c/course.gif" alt="" style="vertical-align: middle;" />';
$event->courselink = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$event->courseid.'">'.$coursecache[$event->courseid]->fullname.'</a>';
-
+ $event->cssclass = 'event_course';
} else if ($event->groupid) { // Group event
$event->icon = '<img height="16" width="16" src="'.$CFG->pixpath.'/c/group.gif" alt="" style="vertical-align: middle;" />';
-
+ $event->cssclass = 'event_group';
} else if($event->userid) { // User event
$event->icon = '<img height="16" width="16" src="'.$CFG->pixpath.'/c/user.gif" alt="" style="vertical-align: middle;" />';
+ $event->cssclass = 'event_user';
}
-
return $event;
}
echo '</td></tr>';
echo '<tr><td class="side"> </td>';
- echo '<td class="description">';
+ echo '<td class="description '.$event->cssclass.'">';
echo format_text($event->description, FORMAT_HTML);
if (calendar_edit_event_allowed($event)) {
echo '<div class="commands">';
return (has_capability('moodle/calendar:manageownentries', $sitecontext));
}
} else if ($event->groupid) {
- $group = get_record('groups', 'id', $event->groupid);
- if($group === false) {
+ //TODO:check.
+ if (! groups_group_exists($event->groupid)) {
return false;
}
// to edit group calendar too
// there is no need to check membership, because if you have this capability
// you will have a role in this group context
- return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_GROUP, $group->id));
+ return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_GROUP, $event->groupid));
} else if ($event->courseid) {
return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_COURSE, $event->courseid));
}
echo calendar_overlib_html();
// Layout the whole page as three big columns.
- echo '<table id="calendar">';
+ echo '<table id="calendar" style="height:100%;">';
echo '<tr>';
// START: Main column
echo '<td class="maincalendar">';
+ echo '<div class="heightcontainer">';
switch($view) {
case 'day':
calendar_show_upcoming_events($courses, $groups, $users, get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS), get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS));
break;
}
-
+
//Link to calendar export page
- echo '<p><a href="export.php">' . get_string('exportcalendar', 'calendar') . '</a></p>';
-
+ echo '<div class="bottom">';
+ print_single_button('export.php', false, get_string('exportcalendar', 'calendar'));
+
if (!empty($USER->id)) {
$authtoken = sha1($USER->username . $USER->password);
$usernameencoded = urlencode($USER->username);
- echo "<p><a href=\"export_execute.php?preset_what=all&preset_time=recentupcoming&username=$usernameencoded&authtoken=$authtoken\">" . get_string('quickdownloadcalendar', 'calendar') . '</a></p>';
+
+ echo "<a href=\"export_execute.php?preset_what=all&preset_time=recentupcoming&username=$usernameencoded&authtoken=$authtoken\">"
+ .'<img src="'.$CFG->pixpath.'/i/ical.gif" height="14" width="36" '
+ .'alt="'.get_string('ical', 'calendar').'" '
+ .'title="'.get_string('quickdownloadcalendar', 'calendar').'" />'
+ .'</a>';
}
+ echo '</div>';
+ echo '</div>';
echo '</td>';
// END: Main column