Merged from MOODLE_14_STABLE

This commit is contained in:
defacer 2004-08-30 11:46:08 +00:00
parent a2c3373f00
commit e749554efa
2 changed files with 15 additions and 9 deletions

View File

@ -44,8 +44,9 @@ class CourseBlock_calendar_upcoming extends MoodleBlock {
// Correct formatting is [courseid] => 1 to be concise with moodlelib.php functions.
calendar_set_filters($courses, $group, $user, $filtercourse, $filtercourse, false);
$events = calendar_get_upcoming($courses, $group, $user, get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS), get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS));
$this->content->text = calendar_get_sideblock_upcoming($courses, $group, $user, get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS), get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS));
$this->content->text = calendar_get_sideblock_upcoming($events, 'view.php?view=day&course='.$this->course->id.'&');
if(empty($this->content->text)) {
$this->content->text = '<div style="font-size: 0.8em; text-align: center;">'.get_string('noupcomingevents', 'calendar').'</div>';

View File

@ -122,7 +122,7 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
$morehref = '';
if(!empty($courses)) {
$courses = array_diff($courses, array(1));
$courses = array_diff($courses, array(SITEID));
if(count($courses) == 1) {
$morehref = '&amp;course='.reset($courses);
}
@ -308,7 +308,7 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
$morehref = '';
if(!empty($courses)) {
$courses = array_diff($courses, array(1));
$courses = array_diff($courses, array(SITEID));
if(count($courses) == 1) {
$morehref = '&amp;course='.reset($courses);
}
@ -727,9 +727,7 @@ function calendar_days_in_month($month, $year) {
return intval(date('t', mktime(0, 0, 0, $month, 1, $year)));
}
function calendar_get_sideblock_upcoming($courses, $groups, $users, $daysinfuture, $maxevents) {
$events = calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxevents);
function calendar_get_sideblock_upcoming($events, $linkhref = NULL) {
$content = '';
$lines = count($events);
if (!$lines) {
@ -742,7 +740,14 @@ function calendar_get_sideblock_upcoming($courses, $groups, $users, $daysinfutur
// That's an activity event, so let's provide the hyperlink
$content .= $events[$i]->referer;
} else {
$content .= $events[$i]->name;
if(!empty($linkhref)) {
$ed = usergetdate($events[$i]->timestart);
$href = calendar_get_link_href(CALENDAR_URL.$linkhref, $ed['mday'], $ed['mon'], $ed['year']);
$content .= '<a href="'.$href.'">'.$events[$i]->name.'</a>';
}
else {
$content .= $events[$i]->name;
}
}
$events[$i]->time = str_replace('->', '<br />->', $events[$i]->time);
$content .= '</div><div class="cal_event_date" style="text-align:right;">'.$events[$i]->time.'</div>';
@ -941,10 +946,10 @@ function calendar_set_filters(&$courses, &$group, &$user, $courseeventsfrom = NU
else if(is_array($courseeventsfrom)) {
$courses = array_keys($courseeventsfrom);
}
$courses = array_diff($courses, array(1));
$courses = array_diff($courses, array(SITEID));
}
else if($SESSION->cal_show_global) {
$courses = array(1);
$courses = array(SITEID);
}
else {
$courses = false;