Ejemplo n.º 1
0
// Print title and header
$navigation = build_navigation($navlinks);
print_header("{$site->shortname}: {$strcalendar}: {$pagetitle}", $strcalendar, $navigation, '', '', true, $prefsbutton, user_login_string($site));
echo calendar_overlib_html();
// Layout the whole page as three big columns.
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_day($day, $mon, $yr, $courses, $groups, $users, $courseid);
        break;
    case 'month':
        calendar_show_month_detailed($mon, $yr, $courses, $groups, $users, $courseid);
        break;
    case 'upcoming':
        calendar_show_upcoming_events($courses, $groups, $users, get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS), get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS), $courseid);
        break;
}
//Link to calendar export page
echo '<div class="bottom">';
if (!empty($CFG->enablecalendarexport)) {
    print_single_button('export.php', array('course' => $courseid), get_string('exportcalendar', 'calendar'));
    if (!empty($USER->id)) {
        $authtoken = sha1($USER->username . $USER->password . $CFG->calendar_exportsalt);
        $usernameencoded = urlencode($USER->username);
        echo "<a href=\"export_execute.php?preset_what=all&amp;preset_time=recentupcoming&amp;username={$usernameencoded}&amp;authtoken={$authtoken}\">" . '<img src="' . $CFG->pixpath . '/i/ical.gif" height="14" width="36" ' . 'alt="' . get_string('ical', 'calendar') . '" ' . 'title="' . get_string('quickdownloadcalendar', 'calendar') . '" />' . '</a>';
    }
}
    // For the front page
    $calendar .= calendar_overlib_html();
    $calendar .= calendar_top_controls('frontpage', array('id' => $courseshown, 'm' => $cal_m, 'y' => $cal_y));
    $calendar .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
    // No filters for now
} else {
    // For any other course
    //echo '<div id="topcalendar"><div id="calendarview">'.calendar_overlib_html();
    //echo calendar_top_controls('course', array('id' => $courseshown, 'm' => $cal_m, 'y' => $cal_y));
    // Layout the whole page as three big columns.
    echo '<table id="calendartable" style="height:100%;">';
    echo '<tr>';
    // START: Main column
    echo '<td class="maincalendar">';
    //$calendar .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y).'</div>';
    echo calendar_show_month_detailed($cal_m, $cal_y, $courses, $group, $user, $courseshown);
    //$calendar .= '<div id="calendarfilters"><h3 class="eventskey">'.get_string('eventskey', 'calendar').'</h3>';
    //$calendar .= '<div class="filters">'.calendar_filter_controls('course', '', $COURSE).'</div></div></div>';
    //$calendar .= "<div id='newevent'><a href='$CFG->wwwroot/calendar/event.php?action=new&course=2&cal_m=".date('n')."&cal_y=".date('Y')."'>".get_string('newevent','calendar')."</a></div>";
    echo '</td>';
    echo '</tr></table>';
}
// MDL-9059, unset this so that it doesn't stay in session
if (!empty($courseset)) {
    unset($SESSION->cal_courses_shown[$COURSE->id]);
}
echo $calendar;
// move styles to a separate file (nadavkav)
echo '<style>
            #calendarview {float:right; width:70%;}
            #calendarfilters {float:left; width:25%;}