diff --git a/main/calendar/myagenda.inc.php b/main/calendar/myagenda.inc.php index 558201e0d7..d5883fd457 100755 --- a/main/calendar/myagenda.inc.php +++ b/main/calendar/myagenda.inc.php @@ -46,13 +46,11 @@ $setting_agenda_link = 'coursecode'; // valid values are coursecode and icon /** * This function retrieves all the agenda items of all the courses the user is subscribed to */ -function get_myagendaitems($courses_dbs, $month, $year) -{ +function get_myagendaitems($courses_dbs, $month, $year) { global $_user; global $_configuration; global $setting_agenda_link; - $items = array (); // get agenda-items for every course foreach ($courses_dbs as $key => $array_course_info) { @@ -62,8 +60,7 @@ function get_myagendaitems($courses_dbs, $month, $year) $group_memberships = GroupManager :: get_group_ids($array_course_info["db"], $_user['user_id']); // if the user is administrator of that course we show all the agenda items - if ($array_course_info['status'] == '1') - { + if ($array_course_info['status'] == '1') { //echo "course admin"; $sqlquery = "SELECT DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref FROM ".$TABLEAGENDA." agenda, @@ -77,11 +74,9 @@ function get_myagendaitems($courses_dbs, $month, $year) ORDER BY start_date "; } // if the user is not an administrator of that course - else - { + else { //echo "GEEN course admin"; - if (is_array($group_memberships) && count($group_memberships)>0) - { + if (is_array($group_memberships) && count($group_memberships)>0) { $sqlquery = "SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEMPROPERTY." ip @@ -92,9 +87,7 @@ function get_myagendaitems($courses_dbs, $month, $year) AND ( ip.to_user_id='".$_user['user_id']."' OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") ) AND ip.visibility='1' ORDER BY start_date "; - } - else - { + } else { $sqlquery = "SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEMPROPERTY." ip @@ -105,24 +98,24 @@ function get_myagendaitems($courses_dbs, $month, $year) AND ( ip.to_user_id='".$_user['user_id']."' OR ip.to_group_id='0') AND ip.visibility='1' ORDER BY start_date "; - } + } } $result = Database::query($sqlquery); while ($item = Database::fetch_array($result)) { $agendaday = date("j",strtotime($item['start_date'])); - if(!isset($items[$agendaday])){$items[$agendaday]=array();} - + if(!isset($items[$agendaday])) { + $items[$agendaday]=array(); + } $time = api_convert_and_format_date($item['start_date'], TIME_NO_SEC_FORMAT, date_default_timezone_get()); $end_time = api_convert_and_format_date($item['end_date'], TIME_NO_SEC_FORMAT, date_default_timezone_get()); $URL = api_get_path(WEB_PATH)."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 if ($setting_agenda_link == 'coursecode') { $title=$array_course_info['title']; $agenda_link = api_substr($title, 0, 14); - } - else { + } else { $agenda_link = Display::return_icon('course_home.gif'); - } + } if(!isset($items[$agendaday][$item['start_date']])) { $items[$agendaday][$item['start_date']] = ''; } @@ -155,8 +148,7 @@ function get_myagendaitems($courses_dbs, $month, $year) * @param string The month name * @return void Direct output */ -function display_mymonthcalendar($agendaitems, $month, $year, $weekdaynames=array(), $monthName) -{ +function display_mymonthcalendar($agendaitems, $month, $year, $weekdaynames=array(), $monthName) { global $DaysShort,$course_path; //Handle leap year $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); @@ -210,8 +202,7 @@ function display_mymonthcalendar($agendaitems, $month, $year, $weekdaynames=arra /** * Show the mini calender of the given month */ -function display_myminimonthcalendar($agendaitems, $month, $year, $monthName) -{ +function display_myminimonthcalendar($agendaitems, $month, $year, $monthName) { global $DaysShort,$course_path; //Handle leap year $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); @@ -238,8 +229,7 @@ function display_myminimonthcalendar($agendaitems, $month, $year, $monthName) while ($curday <= $numberofdays[$month]) { echo "