[svn r11168] Improved filtering of coursePath, as extension of previous work (http://projects.dokeos.com/?do=details&id=1163). However, coursePath doesn't really seem to be used in this context (out of a course), so it should probably be removed in the long run

skala
Yannick Warnier 18 years ago
parent 08926b864b
commit a2e09679e9
  1. 29
      main/calendar/myagenda.php

@ -74,9 +74,10 @@ $nameTools = get_lang('MyAgenda');
// if we come from inside a course and click on the 'My Agenda' link we show a link back to the course
// in the breadcrumbs
if (!empty ($_GET['coursePath']))
$course_path = htmlentities(strip_tags($_GET['coursePath']));
if (!empty ($course_path))
{
$interbreadcrumb[] = array ('url' => api_get_path(WEB_COURSE_PATH).urlencode($_GET['coursePath']).'/index.php', 'name' => $_GET['courseCode']);
$interbreadcrumb[] = array ('url' => api_get_path(WEB_COURSE_PATH).urlencode($course_path).'/index.php', 'name' => $_GET['courseCode']);
}
// this loads the javascript that is needed for the date popup selection
$htmlHeadXtra[] = "<script src=\"tbl_change.js\" type=\"text/javascript\" language=\"javascript\"></script>";
@ -408,7 +409,7 @@ function get_agendaitems($courses_dbs, $month, $year)
// show the monthcalender of the given month
function display_monthcalendar($agendaitems, $month, $year, $weekdaynames, $monthName)
{
global $DaysShort;
global $DaysShort,$course_path;
//Handle leap year
$numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
@ -417,8 +418,8 @@ function display_monthcalendar($agendaitems, $month, $year, $weekdaynames, $mont
$dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
//Start the week on monday
$startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6;
$backwardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($_GET['coursePath'])."&amp;courseCode=".htmlentities($_GET['courseCode'])."&amp;action=view&amp;view=month&amp;month=". ($month == 1 ? 12 : $month -1)."&amp;year=". ($month == 1 ? $year -1 : $year);
$forewardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($_GET['coursePath'])."&amp;courseCode=".htmlentities($_GET['courseCode'])."&amp;action=view&amp;view=month&amp;month=". ($month == 12 ? 1 : $month +1)."&amp;year=". ($month == 12 ? $year +1 : $year);
$backwardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($course_path)."&amp;courseCode=".htmlentities($_GET['courseCode'])."&amp;action=view&amp;view=month&amp;month=". ($month == 1 ? 12 : $month -1)."&amp;year=". ($month == 1 ? $year -1 : $year);
$forewardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($course_path)."&amp;courseCode=".htmlentities($_GET['courseCode'])."&amp;action=view&amp;view=month&amp;month=". ($month == 12 ? 1 : $month +1)."&amp;year=". ($month == 12 ? $year +1 : $year);
echo "<table id=\"agenda_list\">\n", "<tr class=\"title\">\n", "<td width=\"10%\"><a href=\"", $backwardsURL, "\">«</a></td>\n", "<td width=\"80%\" colspan=\"5\">", $monthName, " ", $year, "</td>\n", "<td width=\"10%\"><a href=\"", $forewardsURL, "\">»</a></td>\n", "</tr>\n";
@ -471,7 +472,7 @@ function display_monthcalendar($agendaitems, $month, $year, $weekdaynames, $mont
// show the mini calender of the given month
function display_minimonthcalendar($agendaitems, $month, $year, $monthName)
{
global $DaysShort;
global $DaysShort,$course_path;
//Handle leap year
$numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
@ -480,8 +481,8 @@ function display_minimonthcalendar($agendaitems, $month, $year, $monthName)
$dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
//Start the week on monday
$startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6;
$backwardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($_GET['coursePath'])."&amp;courseCode=".$_GET['courseCode']."&amp;month=". ($month == 1 ? 12 : $month -1)."&amp;year=". ($month == 1 ? $year -1 : $year);
$forewardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($_GET['coursePath'])."&amp;courseCode=".$_GET['courseCode']."&amp;month=". ($month == 12 ? 1 : $month +1)."&amp;year=". ($month == 12 ? $year +1 : $year);
$backwardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($course_path)."&amp;courseCode=".$_GET['courseCode']."&amp;month=". ($month == 1 ? 12 : $month -1)."&amp;year=". ($month == 1 ? $year -1 : $year);
$forewardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($course_path)."&amp;courseCode=".$_GET['courseCode']."&amp;month=". ($month == 12 ? 1 : $month +1)."&amp;year=". ($month == 12 ? $year +1 : $year);
echo "<table id=\"smallcalendar\">\n", "<tr class=\"title\">\n", "<td width=\"10%\"><a href=\"", $backwardsURL, "\">«</a></td>\n", "<td width=\"80%\" colspan=\"5\">", $monthName, " ", $year, "</td>\n", "<td width=\"10%\"><a href=\"", $forewardsURL, "\">»</a></td>\n", "</tr>\n";
@ -538,7 +539,7 @@ function display_minimonthcalendar($agendaitems, $month, $year, $monthName)
============================================================================*/
function display_weekcalendar($agendaitems, $month, $year, $weekdaynames, $monthName)
{
global $DaysShort;
global $DaysShort,$course_path;
global $MonthsLong;
// timestamp of today
$today = mktime();
@ -561,8 +562,8 @@ function display_weekcalendar($agendaitems, $month, $year, $weekdaynames, $month
$day_of_the_week = date("w", $today); // Numeric representation of the day of the week 0 (for Sunday) through 6 (for Saturday) of today
$timestamp_first_date_of_week = $today - (($day_of_the_week -1) * 24 * 60 * 60); // timestamp of the monday of this week
$timestamp_last_date_of_week = $today + ((7 - $day_of_the_week) * 24 * 60 * 60); // timestamp of the sunday of this week
$backwardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($_GET['coursePath'])."&amp;courseCode=".$_GET['courseCode']."&amp;action=view&amp;view=week&amp;week=". ($week_number -1);
$forewardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($_GET['coursePath'])."&amp;courseCode=".$_GET['courseCode']."&amp;action=view&amp;view=week&amp;week=". ($week_number +1);
$backwardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($course_path)."&amp;courseCode=".$_GET['courseCode']."&amp;action=view&amp;view=week&amp;week=". ($week_number -1);
$forewardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($course_path)."&amp;courseCode=".$_GET['courseCode']."&amp;action=view&amp;view=week&amp;week=". ($week_number +1);
echo "<table id=\"agenda_list\">\n";
// The title row containing the the week information (week of the year (startdate of week - enddate of week)
echo "<tr class=\"title\">\n";
@ -625,7 +626,7 @@ function display_weekcalendar($agendaitems, $month, $year, $weekdaynames, $month
// show the mini calender of the given month
function display_daycalendar($agendaitems, $day, $month, $year, $weekdaynames, $monthName)
{
global $DaysShort, $DaysLong;
global $DaysShort, $DaysLong, $course_path;
global $MonthsLong;
global $query;
@ -653,8 +654,8 @@ function display_daycalendar($agendaitems, $day, $month, $year, $weekdaynames, $
// we are loading all the calendar items of all the courses for today
echo "<table id=\"agenda_list\">\n";
// the forward and backwards url
$backwardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($_GET['coursePath'])."&amp;courseCode=".$_GET['courseCode']."&amp;action=view&amp;view=day&amp;day=".date("j", $previousday)."&amp;month=".date("n", $previousday)."&amp;year=".date("Y", $previousday);
$forewardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($_GET['coursePath'])."&amp;courseCode=".$_GET['courseCode']."&amp;action=view&amp;view=day&amp;day=".date("j", $nextday)."&amp;month=".date("n", $nextday)."&amp;year=".date("Y", $nextday);
$backwardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($course_path)."&amp;courseCode=".$_GET['courseCode']."&amp;action=view&amp;view=day&amp;day=".date("j", $previousday)."&amp;month=".date("n", $previousday)."&amp;year=".date("Y", $previousday);
$forewardsURL = $_SERVER['PHP_SELF']."?coursePath=".urlencode($course_path)."&amp;courseCode=".$_GET['courseCode']."&amp;action=view&amp;view=day&amp;day=".date("j", $nextday)."&amp;month=".date("n", $nextday)."&amp;year=".date("Y", $nextday);
// The title row containing the day
echo "<tr class=\"title\">\n", "<td width=\"10%\"><a href=\"", $backwardsURL, "\">«</a></td>\n", "<td>";
echo $DaysLong[$day_of_the_week]." ".date("j", $today)." ".$MonthsLong[date("n", $today) - 1]." ".date("Y", $today);

Loading…
Cancel
Save