Browse Source

Fixing PHP notices

Julio Montoya 12 years ago
parent
commit
6268143ed1
2 changed files with 6 additions and 5 deletions
  1. 3 2
      main/inc/lib/course_home.lib.php
  2. 3 3
      main/inc/lib/main_api.lib.php

+ 3 - 2
main/inc/lib/course_home.lib.php

@@ -578,7 +578,6 @@ class CourseHome {
      * @return void
      */
     public static function show_tools_category($all_tools_list, $rows = false) {
-        global $_user;
         $theme = api_get_setting('homepage_view');
         if ($theme == 'vertical_activity') {
             //ordering by get_lang name
@@ -742,9 +741,11 @@ class CourseHome {
                 }
 
                 $icon = Display::return_icon($tool['image'], $tool_name, array('class' => 'tool-icon', 'id' => 'toolimage_'.$tool['id']), ICON_SIZE_BIG, false);
+                $userInfo = api_get_user_info();
+                $userStatus = isset($userInfo['status']) ? $userInfo['status'] : null;
 
                 // Validation when belongs to a session
-                $session_img = api_get_session_image($tool['session_id'], $_user['status']);
+                $session_img = api_get_session_image($tool['session_id'], $userStatus);
                 $item['url_params'] = $tool_link_params;
                 $item['icon']       = Display::url($icon, $tool_link_params['href'], $tool_link_params);
                 $item['tool']       = $tool;

+ 3 - 3
main/inc/lib/main_api.lib.php

@@ -23,14 +23,14 @@ define('REQUIRED_MIN_POST_MAX_SIZE',        '10');
 use \ChamiloSession as Session;
 
 // USER STATUS CONSTANTS
-/** global status of a user: student */
-define('STUDENT', 5);
 /** global status of a user: course manager */
 define('COURSEMANAGER', 1);
 /** global status of a user: session admin */
 define('SESSIONADMIN', 3);
 /** global status of a user: human ressource manager */
 define('DRH', 4);
+/** global status of a user: student */
+define('STUDENT', 5);
 /** global status of a user: human ressource manager */
 define('ANONYMOUS', 6);
 /** global status of a user: low security, necessary for inserting data from
@@ -2017,7 +2017,7 @@ function api_get_session_visibility($session_id, $course_code = null, $ignore_vi
 function api_get_session_image($session_id, $status_id) {
     $session_id = (int)$session_id;
     $session_img = '';
-    if ((int)$status_id != 5) { //check whether is not a student
+    if ((int)$status_id != STUDENT) { //check whether is not a student
         if ($session_id > 0) {
             $session_img = "  ".Display::return_icon('star.png', get_lang('SessionSpecificResource'), array('align' => 'absmiddle'), ICON_SIZE_SMALL);
         }