[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/calendar/ -> export.php (source)

   1  <?php // $Id: export.php,v 1.7.2.3 2007/10/15 04:46:05 toyomoyo Exp $
   2  
   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');
   7  
   8  $action = optional_param('action', '', PARAM_ALPHA);
   9  $day  = optional_param('cal_d', 0, PARAM_INT);
  10  $mon  = optional_param('cal_m', 0, PARAM_INT);
  11  $yr   = optional_param('cal_y', 0, PARAM_INT);
  12  if ($courseid = optional_param('course', 0, PARAM_INT)) {
  13      $course = get_record('course', 'id', $courseid); 
  14  }
  15  
  16  require_login();
  17  
  18  if(!$site = get_site()) {
  19      redirect($CFG->wwwroot.'/'.$CFG->admin.'/index.php');
  20  }
  21  
  22  // Initialize the session variables
  23  calendar_session_vars();
  24  
  25  $pagetitle = get_string('export', 'calendar');
  26  $navlinks = array();
  27  $now = usergetdate(time());
  28  
  29  if ($course->id != SITEID) {
  30      $navlinks[] = array('name' => $course->shortname,
  31                          'link' => "$CFG->wwwroot/course/view.php?id=$course->id",
  32                          'type' => 'misc');
  33  }
  34  $navlinks[] = array('name' => get_string('calendar', 'calendar'),
  35                      'link' =>calendar_get_link_href(CALENDAR_URL.'view.php?view=upcoming&amp;course='.$courseid.'&amp;',
  36                                                      $now['mday'], $now['mon'], $now['year']),
  37                      'type' => 'misc');
  38  $navlinks[] = array('name' => $pagetitle, 'link' => null, 'type' => 'misc');
  39  
  40  $navigation = build_navigation($navlinks);
  41  
  42  if(!checkdate($mon, $day, $yr)) {
  43      $day = intval($now['mday']);
  44      $mon = intval($now['mon']);
  45      $yr = intval($now['year']);
  46  }
  47  $time = make_timestamp($yr, $mon, $day);
  48  
  49  if (empty($USER->id) or isguest()) {
  50      $defaultcourses = calendar_get_default_courses();
  51      calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
  52  } else {
  53      calendar_set_filters($courses, $groups, $users);
  54  }
  55  
  56  if (empty($USER->id) or isguest()) {
  57      $defaultcourses = calendar_get_default_courses();
  58      calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
  59  
  60  } else {
  61      calendar_set_filters($courses, $groups, $users);
  62  }
  63  
  64  $strcalendar = get_string('calendar', 'calendar');
  65  $prefsbutton = calendar_preferences_button();
  66  
  67  // Print title and header
  68  print_header("$site->shortname: $strcalendar: $pagetitle", $strcalendar, $navigation,
  69               '', '', true, $prefsbutton, user_login_string($site));
  70  
  71  echo calendar_overlib_html();
  72  
  73  // Layout the whole page as three big columns.
  74  echo '<table id="calendar">';
  75  echo '<tr>';
  76  
  77  // START: Main column
  78  
  79  echo '<td class="maincalendar">';
  80  
  81  $username = $USER->username;
  82  $usernameencoded = urlencode($USER->username);
  83  $authtoken = sha1($USER->username . $USER->password);
  84  
  85  switch($action) {
  86      case 'advanced':
  87      break;
  88      case '':
  89      default:
  90          // Let's populate some vars to let "common tasks" be somewhat smart...
  91          // If today it's weekend, give the "next week" option
  92          $allownextweek  = CALENDAR_WEEKEND & (1 << $now['wday']);
  93          // If it's the last week of the month, give the "next month" option
  94          $allownextmonth = calendar_days_in_month($now['mon'], $now['year']) - $now['mday'] < 7;
  95          // If today it's weekend but tomorrow it isn't, do NOT give the "this week" option
  96          $allowthisweek  = !((CALENDAR_WEEKEND & (1 << $now['wday'])) && !(CALENDAR_WEEKEND & (1 << (($now['wday'] + 1) % 7))));
  97          echo '<div class="header">' . get_string('export', 'calendar') . '</div>';
  98          include ('export_basic.html');
  99  }
 100  
 101  
 102  
 103  echo '</td>';
 104  
 105  // END: Main column
 106  
 107  // START: Last column (3-month display)
 108  echo '<td class="sidecalendar">';
 109  echo '<div class="header">'.get_string('monthlyview', 'calendar').'</div>';
 110  
 111  list($prevmon, $prevyr) = calendar_sub_month($mon, $yr);
 112  list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
 113  $getvars = 'cal_d='.$day.'&amp;cal_m='.$mon.'&amp;cal_y='.$yr; // For filtering
 114  
 115  echo '<div class="minicalendarblock">';
 116  echo calendar_top_controls('display', array('id' => $courseid, 'm' => $prevmon, 'y' => $prevyr));
 117  echo calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr);
 118  echo '</div><div class="minicalendarblock">';
 119  echo calendar_top_controls('display', array('id' => $courseid, 'm' => $mon, 'y' => $yr));
 120  echo calendar_get_mini($courses, $groups, $users, $mon, $yr);
 121  echo '</div><div class="minicalendarblock">';
 122  echo calendar_top_controls('display', array('id' => $courseid, 'm' => $nextmon, 'y' => $nextyr));
 123  echo calendar_get_mini($courses, $groups, $users, $nextmon, $nextyr);
 124  echo '</div>';
 125  
 126  echo '</td>';
 127  
 128  echo '</tr></table>';
 129  
 130  print_footer();
 131  
 132  
 133  
 134  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7