diff --git a/main/inc/lib/TeacherTimeReport.php b/main/inc/lib/TeacherTimeReport.php index 9662575914..f312d49175 100644 --- a/main/inc/lib/TeacherTimeReport.php +++ b/main/inc/lib/TeacherTimeReport.php @@ -9,7 +9,6 @@ */ class TeacherTimeReport { - /** * The report data * @var array @@ -18,9 +17,9 @@ class TeacherTimeReport /** * Callback for compare sessions names - * @param array $dataA The datab A + * @param array $dataA The data A * @param array $dataB The data B - * @return int returns -1 if dataA is less than dataB, 1 if dataA is greater than dataB, and 0 if they are equal + * @return int returns -1 if dataA is less than dataB, 1 if dataA is greater than dataB, and 0 if they are equal */ public function compareSessions($dataA, $dataB) { @@ -31,7 +30,7 @@ class TeacherTimeReport * Callback for compare courses names * @param array $dataA The datab A * @param array $dataB The data B - * @return int returns -1 if dataA is less than dataB, 1 if dataA is greater than dataB, and 0 if they are equal + * @return int returns -1 if dataA is less than dataB, 1 if dataA is greater than dataB, and 0 if they are equal */ public function compareCourses($dataA, $dataB) { @@ -42,7 +41,7 @@ class TeacherTimeReport * Callback for compare coaches names * @param array $dataA The datab A * @param array $dataB The data B - * @return int returns -1 if dataA is less than dataB, 1 if dataA is greater than dataB, and 0 if they are equal + * @return int returns -1 if dataA is less than dataB, 1 if dataA is greater than dataB, and 0 if they are equal */ public function compareCoaches($dataA, $dataB) { @@ -63,6 +62,10 @@ class TeacherTimeReport uasort($this->data, array($this, 'compareCoaches')); } + /** + * @param bool|false $withFilter + * @return array + */ public function prepareDataToExport($withFilter = false) { $dataToExport = array(); diff --git a/main/inc/lib/VideoChat.php b/main/inc/lib/VideoChat.php index 8c5e0c9a0a..0b38ff9279 100644 --- a/main/inc/lib/VideoChat.php +++ b/main/inc/lib/VideoChat.php @@ -1,8 +1,9 @@ @@ -43,6 +44,7 @@ class VideoChat * @param string $name The video chat name * @param int $fromUser The sender user * @param int $toUser The receiver user + * * @return int The created video chat id. Otherwise return false */ public static function createRoom($name, $fromUser, $toUser) @@ -61,6 +63,7 @@ class VideoChat /** * Check if the video chat exists by its room name * @param string $name The video chat name + * * @return boolean */ public static function nameExists($name) @@ -84,6 +87,7 @@ class VideoChat /** * Get the video chat info by its room name * @param string $name The video chat name + * * @return array The video chat info. Otherwise return false */ public static function getChatRoomByName($name) diff --git a/main/inc/lib/plugin.class.php b/main/inc/lib/plugin.class.php index 841eb2d5a5..61227433e6 100755 --- a/main/inc/lib/plugin.class.php +++ b/main/inc/lib/plugin.class.php @@ -70,13 +70,13 @@ class Plugin public function get_info() { $result = array(); - $result['title'] = $this->get_title(); - $result['comment'] = $this->get_comment(); - $result['version'] = $this->get_version(); - $result['author'] = $this->get_author(); - $result['plugin_class'] = get_class($this); + $result['title'] = $this->get_title(); + $result['comment'] = $this->get_comment(); + $result['version'] = $this->get_version(); + $result['author'] = $this->get_author(); + $result['plugin_class'] = get_class($this); $result['is_course_plugin'] = $this->isCoursePlugin; - $result['is_mail_plugin'] = $this->isMailPlugin; + $result['is_mail_plugin'] = $this->isMailPlugin; if ($form = $this->get_settings_form()) { $result['settings_form'] = $form; @@ -88,6 +88,7 @@ class Plugin $result[$name] = $value; } } + return $result; } @@ -489,6 +490,7 @@ class Plugin * Delete the fields added to the course settings page and the link to the * tool on the course's homepage * @param int $courseId + * * @return void */ public function uninstall_course_fields($courseId) @@ -598,9 +600,9 @@ class Plugin public function addTab($tabName, $url) { $sql = "SELECT * FROM settings_current - WHERE - variable = 'show_tabs' AND - subkey like 'custom_tab_%'"; + WHERE + variable = 'show_tabs' AND + subkey LIKE 'custom_tab_%'"; $result = Database::query($sql); $customTabsNum = Database::num_rows($result); @@ -714,8 +716,8 @@ class Plugin /** * This method shows or hides plugin's tab - * @param boolean Shows or hides the main menu plugin tab - * @param string Plugin starter file path + * @param boolean $showTab Shows or hides the main menu plugin tab + * @param string $filePath Plugin starter file path */ public function manageTab($showTab, $filePath = 'index.php') { diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index 4d75b48064..1965485d2f 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -221,9 +221,9 @@ class SocialManager extends UserManager return true; } else { // invitation already exist - $sql_if_exist = 'SELECT COUNT(*) AS count, id FROM '.$tbl_message.' - WHERE user_sender_id='.$user_id.' AND user_receiver_id='.$friend_id.' AND msg_status = 7'; - $res_if_exist = Database::query($sql_if_exist); + $sql = 'SELECT COUNT(*) AS count, id FROM '.$tbl_message.' + WHERE user_sender_id='.$user_id.' AND user_receiver_id='.$friend_id.' AND msg_status = 7'; + $res_if_exist = Database::query($sql); $row_if_exist = Database::fetch_array($res_if_exist, 'ASSOC'); if ($row_if_exist['count'] == 1) { $sql = 'UPDATE '.$tbl_message.' SET @@ -296,6 +296,7 @@ class SocialManager extends UserManager while ($row = Database::fetch_array($res, 'ASSOC')) { $list_friend_invitation[$row['user_receiver_id']] = $row; } + return $list_friend_invitation; } @@ -1134,14 +1135,8 @@ class SocialManager extends UserManager 'content' => $cleanMessageContent, 'parent_id' => $messageId ); - return Database::insert($tblMessage, $attributes); - - /* Deprecated since 2014-10-29 - $senderInfo = api_get_user_info($userId); - $notification = new Notification(); - $notification->save_notification(Notification::NOTIFICATION_TYPE_WALL_MESSAGE, array($friendId), '', $messageContent, $senderInfo); - */ + return Database::insert($tblMessage, $attributes); } /** @@ -1155,7 +1150,6 @@ class SocialManager extends UserManager */ public static function sendWallMessageAttachmentFile($userId, $fileAttach, $messageId, $fileComment = '') { - $flag = false; $tbl_message_attach = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT); // create directory @@ -1222,15 +1216,15 @@ class SocialManager extends UserManager } $tblMessage = Database::get_main_table(TABLE_MESSAGE); - $tblMessageAttachement = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT); + $tblMessageAttachment = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT); $userId = intval($userId); $start = Database::escape_string($start); $limit = intval($limit); $sql = "SELECT id, user_sender_id,user_receiver_id, send_date, content, parent_id, - (SELECT ma.path FROM $tblMessageAttachement ma WHERE ma.message_id = tm.id ) as path, - (SELECT ma.filename FROM $tblMessageAttachement ma WHERE ma.message_id = tm.id ) as filename + (SELECT ma.path FROM $tblMessageAttachment ma WHERE ma.message_id = tm.id ) as path, + (SELECT ma.filename FROM $tblMessageAttachment ma WHERE ma.message_id = tm.id ) as filename FROM $tblMessage tm WHERE user_receiver_id = $userId AND send_date > '$start' "; @@ -1518,6 +1512,7 @@ class SocialManager extends UserManager $tblMessage = Database::get_main_table(TABLE_MESSAGE); $statusMessage = MESSAGE_STATUS_WALL_DELETE; $sql = "UPDATE $tblMessage SET msg_status = '$statusMessage' WHERE id = '{$id}' "; + return Database::query($sql); } @@ -1563,12 +1558,10 @@ class SocialManager extends UserManager $template->assign('gamification_points', $gamificationPoints); } $chatEnabled = api_is_global_chat_enabled(); - $templateName = $template->assign('chat_enabled', $chatEnabled); - + $template->assign('chat_enabled', $chatEnabled); $templateName = $template->get_template('social/user_block.tpl'); if (in_array($groupBlock, ['groups', 'group_edit', 'member_list'])) { - $templateName = $template->get_template('social/group_block.tpl'); } @@ -1770,5 +1763,4 @@ class SocialManager extends UserManager return $template->fetch($skillBlock); } - } diff --git a/main/inc/lib/table_sort.class.php b/main/inc/lib/table_sort.class.php index a205f9a5ae..06ba2e785c 100755 --- a/main/inc/lib/table_sort.class.php +++ b/main/inc/lib/table_sort.class.php @@ -5,9 +5,7 @@ * * @package chamilo.library */ -/** - * Code - */ + define('SORT_DATE', 3); define('SORT_IMAGE', 4); diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index 50183b08da..93d678018b 100755 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -886,9 +886,7 @@ class Template $menu = return_menu(); $this->assign('menu', $menu); - //Setting notifications - - + // Setting notifications $count_unread_message = 0; if (api_get_setting('allow_message_tool') == 'true') { // get count unread message and total invitations diff --git a/main/inc/lib/thematic.lib.php b/main/inc/lib/thematic.lib.php index 087d7167af..90f8844be7 100755 --- a/main/inc/lib/thematic.lib.php +++ b/main/inc/lib/thematic.lib.php @@ -260,12 +260,10 @@ class Thematic } $data = array(); - $condition = ''; if (isset($thematic_id)) { $thematic_id = intval($thematic_id); $condition = " WHERE id = $thematic_id AND active = 1 "; } else { - $condition_session = ''; if (empty($session_id)) { $condition_session = api_get_session_condition(0); } else { @@ -356,7 +354,6 @@ class Thematic "ThematicUpdated", $user_id ); - } return $last_id; @@ -420,7 +417,12 @@ class Thematic { $thematic = self::get_thematic_list($thematic_id, api_get_course_id(), 0); $thematic_copy = new Thematic(); - $thematic_copy->set_thematic_attributes('', $thematic['title'].' - '.get_lang('Copy'), $thematic['content'], api_get_session_id()); + $thematic_copy->set_thematic_attributes( + '', + $thematic['title'].' - '.get_lang('Copy'), + $thematic['content'], + api_get_session_id() + ); $new_thematic_id = $thematic_copy->thematic_save(); if (!empty($new_thematic_id)) { @@ -504,7 +506,11 @@ class Thematic ORDER BY col$column $direction LIMIT $from,$number_of_items "; - $list = api_get_item_property_by_tool('thematic_advance', api_get_course_id(), api_get_session_id()); + $list = api_get_item_property_by_tool( + 'thematic_advance', + api_get_course_id(), + api_get_session_id() + ); $elements = array(); foreach ($list as $value) { @@ -706,7 +712,6 @@ class Thematic $data[$row['thematic_id']][$row['id']] = $row; } } - } } } @@ -831,7 +836,7 @@ class Thematic { // definition database table $tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN); - $tbl_thematic = Database::get_course_table(TABLE_THEMATIC); + $tbl_thematic = Database::get_course_table(TABLE_THEMATIC); $course_id = api_get_course_int_id(); @@ -1029,8 +1034,8 @@ class Thematic /** * delete a thematic plan description - * @param int Thematic id - * @param int Description type + * @param int $thematic_id Thematic id + * @param int $description_type Description type * @return int Affected rows */ public function thematic_plan_destroy($thematic_id, $description_type) diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index b3e1c19ead..b309c151c5 100755 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -7001,16 +7001,16 @@ class TrackingUserLogCSV $title[1] = get_lang('ExercicesDetails'); $line = ''; $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) - FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te - WHERE te.c_id = $courseId - AND te.exe_user_id = $userId - AND te.exe_exo_id = ce.id - ORDER BY ce.title ASC, te.exe_date ASC"; + FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te + WHERE te.c_id = $courseId + AND te.exe_user_id = $userId + AND te.exe_exo_id = ce.id + ORDER BY ce.title ASC, te.exe_date ASC"; $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) - FROM $TABLETRACK_HOTPOTATOES AS te - WHERE te.exe_user_id = '$userId' AND te.c_id = $courseId - ORDER BY te.c_id ASC, te.exe_date ASC"; + FROM $TABLETRACK_HOTPOTATOES AS te + WHERE te.exe_user_id = '$userId' AND te.c_id = $courseId + ORDER BY te.c_id ASC, te.exe_date ASC"; $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); @@ -7062,7 +7062,8 @@ class TrackingUserLogCSV */ public function display_student_publications_tracking_info($view, $user_id, $course_id) { - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK, $dateTimeFormatLong, $_course; + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; + $_course = api_get_course_info(); $user_id = intval($user_id); $course_id = intval($course_id); diff --git a/main/inc/lib/urlmanager.lib.php b/main/inc/lib/urlmanager.lib.php index bd4fa133ac..b1aac8584b 100755 --- a/main/inc/lib/urlmanager.lib.php +++ b/main/inc/lib/urlmanager.lib.php @@ -23,8 +23,8 @@ class UrlManager public static function add($url, $description, $active) { $tms = time(); - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); - $sql = "INSERT INTO $table_access_url + $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); + $sql = "INSERT INTO $table SET url = '".Database::escape_string($url)."', description = '".Database::escape_string($description)."', active = '".intval($active)."', @@ -46,9 +46,9 @@ class UrlManager public static function update($url_id, $url, $description, $active) { $url_id = intval($url_id); - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); $tms = time(); - $sql = "UPDATE $table_access_url + $sql = "UPDATE $table SET url = '".Database::escape_string($url)."', description = '".Database::escape_string($description)."', active = '".intval($active)."', @@ -56,6 +56,7 @@ class UrlManager tms = FROM_UNIXTIME(".$tms.") WHERE id = '$url_id'"; $result = Database::query($sql); + return $result; } @@ -68,9 +69,10 @@ class UrlManager public static function delete($id) { $id = intval($id); - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); - $sql= "DELETE FROM $table_access_url WHERE id = ".$id; + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); + $sql= "DELETE FROM $table WHERE id = ".$id; $result = Database::query($sql); + return $result; } @@ -80,10 +82,11 @@ class UrlManager */ public static function url_exist($url) { - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); - $sql = "SELECT id FROM $table_access_url WHERE url = '".Database::escape_string($url)."' "; + $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); + $sql = "SELECT id FROM $table WHERE url = '".Database::escape_string($url)."' "; $res = Database::query($sql); $num = Database::num_rows($res); + return $num; } @@ -94,10 +97,11 @@ class UrlManager public static function url_id_exist($url) { if (empty($url)) { return false; } - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); - $sql = "SELECT id FROM $table_access_url WHERE id = ".intval($url).""; + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); + $sql = "SELECT id FROM $table WHERE id = ".intval($url).""; $res = Database::query($sql); $num = Database::num_rows($res); + return $num; } @@ -113,6 +117,7 @@ class UrlManager $res = Database::query($sql); $url = Database::fetch_array($res,'ASSOC'); $result = $url['count_result']; + return $result; } @@ -123,8 +128,8 @@ class UrlManager * */ public static function get_url_data() { - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); - $sql = "SELECT id, url, description, active FROM $table_access_url ORDER BY id"; + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); + $sql = "SELECT id, url, description, active FROM $table ORDER BY id"; $res = Database::query($sql); $urls = array (); while ($url = Database::fetch_array($res)) { @@ -142,8 +147,8 @@ class UrlManager * */ public static function get_url_data_from_id($url_id) { - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); - $sql = "SELECT id, url, description, active FROM $table_access_url WHERE id = ".intval($url_id); + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); + $sql = "SELECT id, url, description, active FROM $table WHERE id = ".intval($url_id); $res = Database::query($sql); $row = Database::fetch_array($res); return $row; @@ -158,7 +163,7 @@ class UrlManager **/ public static function get_url_rel_user_data($access_url_id = null, $order_by = null) { - $where = ''; + $where = ''; $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); if (!empty($access_url_id)) { @@ -171,10 +176,10 @@ class UrlManager $order_clause = $order_by; } $sql = "SELECT u.user_id, lastname, firstname, username, official_code, access_url_id - FROM $tbl_user u - INNER JOIN $table_url_rel_user - ON $table_url_rel_user.user_id = u.user_id - $where $order_clause"; + FROM $tbl_user u + INNER JOIN $table_url_rel_user + ON $table_url_rel_user.user_id = u.user_id + $where $order_clause"; $result = Database::query($sql); $users = Database::store_result($result); @@ -239,13 +244,13 @@ class UrlManager public static function get_url_rel_session_data($access_url_id = null) { $where =''; - $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); - $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); + $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); + $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); if (!empty($access_url_id)) $where ="WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); - $sql="SELECT id, name, access_url_id + $sql = "SELECT id, name, access_url_id FROM $tbl_session u INNER JOIN $table_url_rel_session ON $table_url_rel_session.session_id = id @@ -306,11 +311,11 @@ class UrlManager $where .= " AND (parent_id IS NULL) "; $sql = "SELECT id, name, access_url_id - FROM $table u - INNER JOIN $table_url_rel - ON $table_url_rel.course_category_id = u.id - $where - ORDER BY name"; + FROM $table u + INNER JOIN $table_url_rel + ON $table_url_rel.course_category_id = u.id + $where + ORDER BY name"; $result = Database::query($sql); $courses = Database::store_result($result, 'ASSOC'); @@ -332,11 +337,10 @@ class UrlManager if ($status == 'unlock') { $status_db = '1'; } - if (($status_db == '1' OR $status_db == '0') AND is_numeric($url_id)) { - $sql = "UPDATE $url_table SET active='".intval( - $status_db - )."' WHERE id='".intval($url_id)."'"; - $result = Database::query($sql); + if (($status_db == '1' || $status_db == '0') && is_numeric($url_id)) { + $sql = "UPDATE $url_table SET active='".intval($status_db)."' + WHERE id='".intval($url_id)."'"; + Database::query($sql); } } @@ -349,9 +353,9 @@ class UrlManager * */ public static function relation_url_user_exist($user_id, $url_id) { - $table_url_rel_user= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); - $sql= "SELECT user_id FROM $table_url_rel_user - WHERE access_url_id = ".intval($url_id)." AND user_id = ".intval($user_id)." "; + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); + $sql= "SELECT user_id FROM $table + WHERE access_url_id = ".intval($url_id)." AND user_id = ".intval($user_id)." "; $result = Database::query($sql); $num = Database::num_rows($result); diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index e2d63e8f52..639aed32e8 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -362,13 +362,23 @@ class UserManager } if (!empty($email) && $send_mail) { - $recipient_name = api_get_person_name($firstName, $lastName, null, PERSON_NAME_EMAIL_ADDRESS); + $recipient_name = api_get_person_name( + $firstName, + $lastName, + null, + PERSON_NAME_EMAIL_ADDRESS + ); $tplSubject = new Template(null, false, false, false, false, false); $layoutSubject = $tplSubject->get_template( 'mail/subject_registration_platform.tpl' ); $emailSubject = $tplSubject->fetch($layoutSubject); - $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); + $sender_name = api_get_person_name( + api_get_setting('administratorName'), + api_get_setting('administratorSurname'), + null, + PERSON_NAME_EMAIL_ADDRESS + ); $email_admin = api_get_setting('emailAdministrator'); if (api_is_multiple_url_enabled()) { @@ -667,6 +677,7 @@ class UserManager $deleted = self::delete_user($id); $result = $deleted || $result; } + return $result; } @@ -955,6 +966,7 @@ class UserManager if ($r !== false) { Event::addEvent($ev, LOG_USER_ID, $user_id); } + return $r; } @@ -1437,7 +1449,6 @@ class UserManager $userPath = api_get_path(REL_UPLOAD_PATH).$userPath; break; case 'last': // Only the last part starting with users/ - $userPath = $userPath; break; } @@ -1702,6 +1713,7 @@ class UserManager * * @param int $user_id User id * @param $force Optional parameter to force building after a removal request + * * @return A string containing the XHTML code to dipslay the production list, or FALSE */ public static function build_production_list($user_id, $force = false, $showdelete = false) @@ -1773,8 +1785,8 @@ class UserManager /** * Remove a user production. * - * @param $user_id User id - * @param $production The production to remove + * @param int $user_id User id + * @param string $production The production to remove */ public static function remove_user_production($user_id, $production) { @@ -1963,6 +1975,7 @@ class UserManager $files[] = $path.$extra_files; } } + return $files; // can be an empty array } @@ -2114,6 +2127,7 @@ class UserManager } } } + return $extra_data; } @@ -2141,7 +2155,8 @@ class UserManager $t_ufv = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); $user_id = intval($user_id); - $sql = "SELECT f.id as id, f.variable as fvar, f.field_type as type FROM $t_uf f + $sql = "SELECT f.id as id, f.variable as fvar, f.field_type as type + FROM $t_uf f WHERE f.variable = '$field_variable' "; if (!$all_visibility) { diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index f723373f5a..cb64dadc19 100755 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -45,10 +45,13 @@ class IndexManager $exercise_list = array(); if (!empty($personal_course_list)) { foreach($personal_course_list as $course_item) { - $course_code = $course_item['c']; - $session_id = $course_item['id_session']; + $course_code = $course_item['c']; + $session_id = $course_item['id_session']; - $exercises = ExerciseLib::get_exercises_to_be_taken($course_code, $session_id); + $exercises = ExerciseLib::get_exercises_to_be_taken( + $course_code, + $session_id + ); foreach($exercises as $exercise_item) { $exercise_item['course_code'] = $course_code; @@ -68,7 +71,8 @@ class IndexManager } } - function return_announcements($show_slide = true) { + function return_announcements($show_slide = true) + { //// Display System announcements $hideAnnouncements = api_get_setting('hide_global_announcements_when_not_connected'); if ($hideAnnouncements == 'true' && empty($userId)) { @@ -80,17 +84,30 @@ class IndexManager if (!api_is_anonymous() && $this->user_id) { $visibility = api_is_allowed_to_create_course() ? SystemAnnouncementManager::VISIBLE_TEACHER : SystemAnnouncementManager::VISIBLE_STUDENT; if ($show_slide) { - $announcements = SystemAnnouncementManager :: display_announcements_slider($visibility, $announcement); + $announcements = SystemAnnouncementManager:: display_announcements_slider( + $visibility, + $announcement + ); } else { - $announcements = SystemAnnouncementManager :: display_all_announcements($visibility, $announcement); + $announcements = SystemAnnouncementManager:: display_all_announcements( + $visibility, + $announcement + ); } } else { if ($show_slide) { - $announcements = SystemAnnouncementManager :: display_announcements_slider(SystemAnnouncementManager::VISIBLE_GUEST, $announcement); + $announcements = SystemAnnouncementManager:: display_announcements_slider( + SystemAnnouncementManager::VISIBLE_GUEST, + $announcement + ); } else { - $announcements = SystemAnnouncementManager :: display_all_announcements(SystemAnnouncementManager::VISIBLE_GUEST, $announcement); + $announcements = SystemAnnouncementManager:: display_all_announcements( + SystemAnnouncementManager::VISIBLE_GUEST, + $announcement + ); } } + return $announcements; } @@ -98,7 +115,8 @@ class IndexManager * Alias for the online_logout() function * @param bool $redirect Whether to ask online_logout to redirect to index.php or not */ - function logout($redirect = true) { + function logout($redirect = true) + { online_logout($this->user_id, true); } @@ -108,7 +126,8 @@ class IndexManager * @param string $category * @return boolean */ - function category_has_open_courses($category) { + function category_has_open_courses($category) + { $setting_show_also_closed_courses = api_get_setting('show_closed_courses') == 'true'; $main_course_table = Database :: get_main_table(TABLE_MAIN_COURSE); $category = Database::escape_string($category); @@ -125,6 +144,7 @@ class IndexManager } } } + return false; } @@ -136,7 +156,8 @@ class IndexManager * @version 1.0.1 * @todo does $_plugins need to be global? */ - function display_anonymous_right_menu() { + function display_anonymous_right_menu() + { global $loginFailed, $_user; $display_add_course_link = api_is_allowed_to_create_course() && ($_SESSION['studentview'] != 'studentenview'); $current_user_id = api_get_user_id(); @@ -207,7 +228,6 @@ class IndexManager public function return_home_page() { $userId = api_get_user_id(); - global $_configuration; // Including the page for the news $html = ''; @@ -257,7 +277,8 @@ class IndexManager return $html; } - function return_notice() { + function return_notice() + { $sys_path = api_get_path(SYS_PATH); $user_selected_language = api_get_interface_language(); @@ -276,7 +297,8 @@ class IndexManager return $html; } - function return_help() { + function return_help() + { $user_selected_language = api_get_interface_language(); $sys_path = api_get_path(SYS_PATH); $platformLanguage = api_get_setting('platformLanguage'); @@ -299,8 +321,8 @@ class IndexManager return $html; } - function return_skills_links() { - $html = ''; + function return_skills_links() + { $content = ''; $content .= ''; - $html = self::show_right_block(get_lang("Skills"), $content, 'skill_block',null, 'skills', 'skillsCollapse'); + $html = self::show_right_block( + get_lang("Skills"), + $content, + 'skill_block', + null, + 'skills', + 'skillsCollapse' + ); + return $html; } @@ -394,7 +424,6 @@ class IndexManager ORDER BY title, UPPER(visual_code)"; // Showing only the courses of the current access_url_id. - global $_configuration; if (api_is_multiple_url_enabled()) { $url_access_id = api_get_current_access_url_id(); if ($url_access_id != -1) { @@ -692,7 +721,7 @@ class IndexManager $html .= '
' . PHP_EOL; $html .= '
'.$content.'
' . PHP_EOL; $html .= '
' . PHP_EOL; - + } else { if (!empty($id)) { $params['id'] = $id;