'; // start of content for logged in users
-
// Plugins for the my courses main area
api_plugin('mycourses_main');
-
/*
-----------------------------------------------------------------------------
System Announcements
@@ -788,13 +702,10 @@ $announcement = isset($_GET['announcement']) ? $_GET['announcement'] : -1;
$visibility = api_is_allowed_to_create_course() ? VISIBLE_TEACHER : VISIBLE_STUDENT;
SystemAnnouncementManager :: display_announcements($visibility, $announcement);
-if (!empty ($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/',$_GET['include']))
-{
+if (!empty ($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/',$_GET['include'])) {
include ('./home/'.$_GET['include']);
$pageIncluded = true;
-}
-else
-{
+} else {
/*--------------------------------------
DISPLAY COURSES
--------------------------------------*/
@@ -803,8 +714,7 @@ else
$personal_course_list = UserManager::get_personal_session_course_list($_user['user_id']);
- foreach ($personal_course_list as $my_course)
- {
+ foreach ($personal_course_list as $my_course) {
$thisCourseDbName = $my_course['db'];
$thisCourseSysCode = $my_course['k'];
$thisCoursePublicCode = $my_course['c'];
@@ -814,10 +724,10 @@ else
$status[$dbname] = $my_course['s'];
$nbDigestEntries = 0; // number of entries already collected
- if ($maxCourse < $maxValvas)
+ if ($maxCourse < $maxValvas) {
$maxValvas = $maxCourse;
- if ($maxCourse > 0)
- {
+ }
+ if ($maxCourse > 0) {
$courses[$thisCourseSysCode]['coursePath'] = $thisCoursePath;
$courses[$thisCourseSysCode]['courseCode'] = $thisCoursePublicCode;
}
@@ -831,15 +741,13 @@ else
$query = "SELECT visibility FROM $course_tool_table WHERE link = 'announcements/announcements.php' AND visibility = 1";
$result = api_sql_query($query);
// collect from announcements, but only if tool is visible for the course
- if ($result && $maxValvas > 0 && mysql_num_rows($result) > 0)
- {
+ if ($result && $maxValvas > 0 && Database::num_rows($result) > 0) {
//Search announcements table
//Take the entries listed at the top of advalvas/announcements tool
$course_announcement_table = Database::get_course_table(TABLE_ANNOUNCEMENT);
$sqlGetLastAnnouncements = "SELECT end_date publicationDate, content
FROM ".$course_announcement_table;
- switch (CONFVAL_limitPreviewTo)
- {
+ switch (CONFVAL_limitPreviewTo) {
case SCRIPTVAL_NewEntriesOfTheDay :
$sqlGetLastAnnouncements .= "WHERE DATE_FORMAT(end_date,'%Y %m %d') >= '".date("Y m d")."'";
break;
@@ -852,10 +760,8 @@ else
$sqlGetLastAnnouncements .= "ORDER BY end_date DESC
LIMIT ".$maxValvas;
$resGetLastAnnouncements = api_sql_query($sqlGetLastAnnouncements, __FILE__, __LINE__);
- if ($resGetLastAnnouncements)
- {
- while ($annoncement = mysql_fetch_array($resGetLastAnnouncements))
- {
+ if ($resGetLastAnnouncements) {
+ while ($annoncement = Database::fetch_array($resGetLastAnnouncements)) {
$keyTools = "valvas";
$keyTime = $annoncement['publicationDate'];
$keyCourse = $thisCourseSysCode;
@@ -874,11 +780,11 @@ else
$query = "SELECT visibility FROM $course_tool_table WHERE link = 'calendar/agenda.php' AND visibility = 1";
$result = api_sql_query($query);
$thisAgenda = $maxCourse - $nbDigestEntries; // new max entries for agenda
- if ($maxAgenda < $thisAgenda)
+ if ($maxAgenda < $thisAgenda) {
$thisAgenda = $maxAgenda;
+ }
// collect from agenda, but only if tool is visible for the course
- if ($result && $thisAgenda > 0 && mysql_num_rows($result) > 0)
- {
+ if ($result && $thisAgenda > 0 && Database::num_rows($result) > 0) {
$tableCal = $courseTablePrefix.$thisCourseDbName.$_configuration['db_glue']."calendar_event";
$sqlGetNextAgendaEvent = "SELECT start_date , title content, start_time
FROM $tableCal
@@ -886,10 +792,8 @@ else
ORDER BY start_date, start_time
LIMIT $maxAgenda";
$resGetNextAgendaEvent = api_sql_query($sqlGetNextAgendaEvent, __FILE__, __LINE__);
- if ($resGetNextAgendaEvent)
- {
- while ($agendaEvent = mysql_fetch_array($resGetNextAgendaEvent))
- {
+ if ($resGetNextAgendaEvent) {
+ while ($agendaEvent = Database::fetch_array($resGetNextAgendaEvent)) {
$keyTools = 'agenda';
$keyTime = $agendaEvent['start_date'];
$keyCourse = $thisCourseSysCode;
@@ -918,15 +822,12 @@ if ( is_array($list) ) {
echo '
';
- if ($old_user_category<>$value[0])
- {
- if ($key<>0 OR $value[0]<>0) // there are courses in the previous category
- {
+ if ($old_user_category<>$value[0]) {
+ if ($key<>0 OR $value[0]<>0) {// there are courses in the previous category
echo "\n
";
}
echo "\n\n\t
- ".$userdefined_categories[$value[0]]."
\n";
- if ($key<>0 OR $value[0]<>0) // there are courses in the previous category
- {
+ if ($key<>0 OR $value[0]<>0){ // there are courses in the previous category
echo "
";
}
$old_user_category=$value[0];
@@ -952,8 +853,7 @@ if ( is_array($list) ) {
if(count($listActives)>0 && $display_actives){
echo "\n";
- foreach ($listActives as $key => $value)
- {
+ foreach ($listActives as $key => $value) {
if (!empty($value[2])) {
if ((isset($old_session) && $old_session != $value[2]) or ((!isset($old_session)) && isset($value[2]))) {
$old_session = $value[2];
@@ -978,15 +878,14 @@ if ( is_array($list) ) {
}
- if(count($listInactives)>0 && !$display_actives){
+ if (count($listInactives)>0 && !$display_actives) {
echo '';
- foreach ($listInactives as $key => $value)
- {
- if(!empty($value[2])){
- if($old_session != $value[2]){
+ foreach ($listInactives as $key => $value) {
+ if (!empty($value[2])) {
+ if ($old_session != $value[2]) {
$old_session = $value[2];
- if($key != 0){
+ if ($key != 0) {
echo '
';
}
echo '' .
@@ -1020,13 +919,11 @@ api_session_register('status');
echo ' '; // end of menu
-
//footer
-Display :: display_footer();
-?>
+Display :: display_footer();
\ No newline at end of file