diff --git a/main/calendar/agenda.inc.php b/main/calendar/agenda.inc.php
index e94906fe14..039a5eae83 100755
--- a/main/calendar/agenda.inc.php
+++ b/main/calendar/agenda.inc.php
@@ -3386,13 +3386,14 @@ function get_day_agendaitems($courses_dbs, $month, $year, $day) {
foreach ($courses_dbs as $key => $array_course_info) {
//echo $array_course_info['db'];
//databases of the courses
- $TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA, $array_course_info['db']);
- $TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY, $array_course_info['db']);
+ $TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA, $array_course_info['db_name']);
+ $TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY, $array_course_info['db_name']);
// getting all the groups of the user for the current course
- $group_memberships = GroupManager :: get_group_ids($array_course_info['db'], $_user['user_id']);
+ $group_memberships = GroupManager :: get_group_ids($array_course_info['db_name'], api_get_user_id());
+ $course_user_status = CourseManager::get_user_in_course_status(api_get_user_id(), $array_course_info['code']);
// if the user is administrator of that course we show all the agenda items
- if ($array_course_info['status'] == '1') {
+ if ($course_user_status == '1') {
//echo "course admin";
$sqlquery = "SELECT
DISTINCT agenda.*, item_property.*
@@ -3461,7 +3462,7 @@ function get_day_agendaitems($courses_dbs, $month, $year, $day) {
//$URL = $_configuration['root_web'].$mycours["dir"]."/";
$URL = api_get_path(WEB_PATH).'main/calendar/agenda.php?cidReq='.urlencode($array_course_info["code"])."&day=$day&month=$month&year=$year#$day"; // RH //Patrick Cool: to highlight the relevant agenda item
- $items[$halfhour][] .= "".$hours.":".$minutes." ".$agenda_link." ".$item['title']."
";
+ $items[$halfhour][] .= "".$hours.":".$minutes." ".$agenda_link." ".$item['title']."
";
}
}
@@ -3504,14 +3505,16 @@ function get_week_agendaitems($courses_dbs, $month, $year, $week = '') {
// get agenda-items for every course
foreach ($courses_dbs as $key => $array_course_info) {
//databases of the courses
- $TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA, $array_course_info["db"]);
- $TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY, $array_course_info["db"]);
+ $TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA, $array_course_info["db_name"]);
+ $TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY, $array_course_info["db_name"]);
// getting all the groups of the user for the current course
- $group_memberships = GroupManager :: get_group_ids($array_course_info["db"], $_user['user_id']);
+ $group_memberships = GroupManager :: get_group_ids($array_course_info["db_name"], api_get_user_id());
+
+ $user_course_status = CourseManager::get_user_in_course_status(api_get_user_id(),$array_course_info["code"]);
// if the user is administrator of that course we show all the agenda items
- if ($array_course_info['status'] == '1') {
+ if ($user_course_status == '1') {
//echo "course admin";
$sqlquery = "SELECT
DISTINCT a.*, i.*
@@ -3571,7 +3574,7 @@ function get_week_agendaitems($courses_dbs, $month, $year, $week = '') {
$URL = $_configuration['root_web']."main/calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday"; // RH //Patrick Cool: to highlight the relevant agenda item
//Display the events in agenda
- $items[$agendaday][$item['start_date']] .= "$time ".$agenda_link."";
+ $items[$agendaday][$item['start_date']] .= "$time ".$agenda_link."";
$items[$agendaday][$item['start_date']] .= "
| '.Display::return_icon('action_prev.png',get_lang('Previous')).' | '; echo ''.$monthName." ".$year.' | ';
echo ''.Display::return_icon('action_next.png',get_lang('Next')).' | '; @@ -190,7 +187,7 @@ function display_mymonthcalendar($agendaitems, $month, $year, $weekdaynames=arra $dayheader = "$curday", "".$dayheader; + echo " | ".$dayheader;
if (!empty($agendaitems[$curday])) {
echo "".$agendaitems[$curday]."";
}
@@ -275,7 +272,6 @@ function display_myminimonthcalendar($agendaitems, $month, $year, $monthName) {
*/
function show_new_personal_item_form($id = "") {
global $year, $MonthsLong;
- global $_user;
$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
@@ -297,7 +293,7 @@ function show_new_personal_item_form($id = "") {
}
if ($id != "") {
- $sql = "SELECT date, title, text FROM ".$tbl_personal_agenda." WHERE user='".intval($_user['user_id'])."' AND id='".$id."'";
+ $sql = "SELECT date, title, text FROM ".$tbl_personal_agenda." WHERE user='".intval(api_get_user_id())."' AND id='".$id."'";
$result = Database::query($sql);
$aantal = Database::num_rows($result);
if ($aantal != 0) {
@@ -473,7 +469,6 @@ function show_new_personal_item_form($id = "") {
* @param int is the id this param is optional, but is necessary if the item require be edited
*/
function store_personal_item($day, $month, $year, $hour, $minute, $title, $content, $id = "") {
- global $_user;
$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
@@ -490,11 +485,11 @@ function store_personal_item($day, $month, $year, $hour, $minute, $title, $conte
if ($id != "")
{ // we are updating
- $sql = "UPDATE ".$tbl_personal_agenda." SET user='".$_user['user_id']."', title='".$title."', text='".$content."', date='".$date."' WHERE id='".$id."'";
+ $sql = "UPDATE ".$tbl_personal_agenda." SET user='".api_get_user_id()."', title='".$title."', text='".$content."', date='".$date."' WHERE id='".$id."'";
}
else
{ // we are adding a new item
- $sql = "INSERT INTO $tbl_personal_agenda (user, title, text, date) VALUES ('".$_user['user_id']."','$title', '$content', '$date')";
+ $sql = "INSERT INTO $tbl_personal_agenda (user, title, text, date) VALUES ('".api_get_user_id()."','$title', '$content', '$date')";
}
$result = Database::query($sql);
}
@@ -502,11 +497,10 @@ function store_personal_item($day, $month, $year, $hour, $minute, $title, $conte
* This function finds all the courses (also those of sessions) of the user and returns an array containing the
* database name of the courses.
* Xritten by Noel Dieschburg | ||||
|---|---|---|---|---|---|---|---|---|