adding some strings
[moodle-linuxchix.git] / calendar / export.php
blobc267eb6a0109b8b2c19d6a60e593d8184c693bdb
1 <?php // $Id$
3 require_once('../config.php');
4 require_once($CFG->dirroot.'/course/lib.php');
5 require_once($CFG->dirroot.'/calendar/lib.php');
6 //require_once($CFG->libdir.'/bennu/bennu.inc.php');
8 $action = optional_param('action', '', PARAM_ALPHA);
9 $course = optional_param('course', 0);
10 $day = optional_param('cal_d', 0, PARAM_INT);
11 $mon = optional_param('cal_m', 0, PARAM_INT);
12 $yr = optional_param('cal_y', 0, PARAM_INT);
14 require_login();
16 if(!$site = get_site()) {
17 redirect($CFG->wwwroot.'/'.$CFG->admin.'/index.php');
20 // Initialize the session variables
21 calendar_session_vars();
23 $pagetitle = get_string('export', 'calendar');
24 $now = usergetdate(time());
25 $nav = calendar_get_link_tag(get_string('calendar', 'calendar'), CALENDAR_URL.'view.php?view=upcoming&amp;course='.$course.'&amp;', $now['mday'], $now['mon'], $now['year']).' -> '.$pagetitle;
27 if(!checkdate($mon, $day, $yr)) {
28 $day = intval($now['mday']);
29 $mon = intval($now['mon']);
30 $yr = intval($now['year']);
32 $time = make_timestamp($yr, $mon, $day);
34 $SESSION->cal_courses_shown = calendar_get_default_courses(true);
35 calendar_set_referring_course(0);
37 if (empty($USER->id) or isguest()) {
38 $defaultcourses = calendar_get_default_courses();
39 calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
41 } else {
42 calendar_set_filters($courses, $groups, $users);
45 $strcalendar = get_string('calendar', 'calendar');
46 $prefsbutton = calendar_preferences_button();
48 // Print title and header
49 print_header("$site->shortname: $strcalendar: $pagetitle", $strcalendar, $nav,
50 '', '', true, $prefsbutton, user_login_string($site));
52 echo calendar_overlib_html();
54 // Layout the whole page as three big columns.
55 echo '<table id="calendar">';
56 echo '<tr>';
58 // START: Main column
60 echo '<td class="maincalendar">';
62 $username = $USER->username;
63 $usernameencoded = urlencode($USER->username);
64 $authtoken = sha1($USER->username . $USER->password);
66 switch($action) {
67 case 'advanced':
68 break;
69 case '':
70 default:
71 // Let's populate some vars to let "common tasks" be somewhat smart...
72 // If today it's weekend, give the "next week" option
73 $allownextweek = CALENDAR_WEEKEND & (1 << $now['wday']);
74 // If it's the last week of the month, give the "next month" option
75 $allownextmonth = calendar_days_in_month($now['mon'], $now['year']) - $now['mday'] < 7;
76 // If today it's weekend but tomorrow it isn't, do NOT give the "this week" option
77 $allowthisweek = !((CALENDAR_WEEKEND & (1 << $now['wday'])) && !(CALENDAR_WEEKEND & (1 << (($now['wday'] + 1) % 7))));
78 echo '<div class="header">' . get_string('export', 'calendar') . '</div>';
79 include('export_basic.html');
84 echo '</td>';
86 // END: Main column
88 // START: Last column (3-month display)
89 echo '<td class="sidecalendar">';
90 echo '<div class="header">'.get_string('monthlyview', 'calendar').'</div>';
92 list($prevmon, $prevyr) = calendar_sub_month($mon, $yr);
93 list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
94 $getvars = 'cal_d='.$day.'&amp;cal_m='.$mon.'&amp;cal_y='.$yr; // For filtering
96 echo '<div class="minicalendarblock">';
97 echo calendar_top_controls('display', array('id' => $course, 'm' => $prevmon, 'y' => $prevyr));
98 echo calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr);
99 echo '</div><div class="minicalendarblock">';
100 echo calendar_top_controls('display', array('id' => $course, 'm' => $mon, 'y' => $yr));
101 echo calendar_get_mini($courses, $groups, $users, $mon, $yr);
102 echo '</div><div class="minicalendarblock">';
103 echo calendar_top_controls('display', array('id' => $course, 'm' => $nextmon, 'y' => $nextyr));
104 echo calendar_get_mini($courses, $groups, $users, $nextmon, $nextyr);
105 echo '</div>';
107 echo '</td>';
109 echo '</tr></table>';
111 print_footer();