Browse Source

Fix namespace, fix PHP warning

jmontoyaa 8 years ago
parent
commit
4c4b847174

+ 3 - 3
main/auth/profile.php

@@ -1,6 +1,9 @@
 <?php
 /* For licensing terms, see /license.txt */
 
+use Chamilo\UserBundle\Entity\User;
+use ChamiloSession as Session;
+
 /**
 * This file displays the user's profile,
 * optionally it allows users to modify their profile as well.
@@ -10,9 +13,6 @@
 * @package chamilo.auth
 */
 
-use Chamilo\UserBundle\Entity\User;
-use ChamiloSession as Session;
-
 $cidReset = true;
 require_once '../inc/global.inc.php';
 

+ 5 - 4
main/inc/lib/message.lib.php

@@ -2,6 +2,7 @@
 /* For licensing terms, see /license.txt */
 
 use ChamiloSession as Session;
+use Chamilo\UserBundle\Entity\User;
 
 /**
  * Class MessageManager
@@ -1388,7 +1389,7 @@ class MessageManager
                 $html_items .=  '<div class="message">' . Security::remove_XSS($topic['content'], STUDENT, true) . '</div>' . $attachment . '</div>';
                 $html_items .= '</div>';
                 $html_items .= '</div>';
-                
+
                 $base_padding = 20;
 
                 if ($topic['indent_cnt'] == 0) {
@@ -1824,10 +1825,10 @@ class MessageManager
     }
 
     /**
-     * Send a notification to all amdinistrators when a new user is registered
-     * @param \Chamilo\UserBundle\Entity\User $user
+     * Send a notification to all admins when a new user is registered
+     * @param User $user
      */
-    public static function sendNotificationByRegisteredUser(\Chamilo\UserBundle\Entity\User $user)
+    public static function sendNotificationByRegisteredUser(User $user)
     {
         $tplMailBody = new Template(null, false, false, false, false, false, false);
         $tplMailBody->assign('user', $user);

+ 14 - 3
main/inc/lib/skill.lib.php

@@ -1,6 +1,8 @@
 <?php
 /* For licensing terms, see /license.txt */
 
+use Chamilo\UserBundle\Entity\User;
+
 /**
  * Class SkillProfile
  * @package chamilo.library
@@ -1097,9 +1099,13 @@ class Skill extends Model
         $simple_tree = array();
         if (!empty($tree['children'])) {
             foreach ($tree['children'] as $element) {
+                $children = [];
+                if (isset($element['children'])) {
+                    $children = $this->get_skill_json($element['children'], 1, $main_depth);
+                }
                 $simple_tree[] = array(
                     'name' => $element['name'],
-                    'children' => $this->get_skill_json($element['children'], 1, $main_depth)
+                    'children' => $children
                 );
             }
         }
@@ -1130,6 +1136,7 @@ class Skill extends Model
                 } else {
                     //$tmp['colour'] = $this->colours[$depth][rand(0,3)];
                 }
+
                 if ($depth > $max_depth) {
                     continue;
                 }
@@ -1218,6 +1225,7 @@ class Skill extends Model
 
             return $result[0];
         }
+
         return 0;
     }
 
@@ -1294,6 +1302,7 @@ class Skill extends Model
 
         if ($result != false) {
             if ($result['qty'] > 0) {
+
                 return true;
             }
         }
@@ -1311,6 +1320,7 @@ class Skill extends Model
         $id = intval($id);
 
         if (empty($id)) {
+
             return false;
         }
 
@@ -1393,6 +1403,7 @@ class Skill extends Model
         $skillId = intval($skillId);
 
         if ($skillId == 0) {
+
             return array();
         }
 
@@ -1450,8 +1461,8 @@ class Skill extends Model
 
     /**
      * Check if the $fromUser can comment the $toUser skill issue
-     * @param Chamilo\UserBundle\Entity\User $fromUser
-     * @param Chamilo\UserBundle\Entity\User $toUser
+     * @param User $fromUser
+     * @param User $toUser
      * @return boolean
      */
     public static function userCanAddFeedbackToUser($fromUser, $toUser)

+ 5 - 2
main/inc/lib/webservices/MessagesWebService.class.php

@@ -1,6 +1,8 @@
 <?php
 /* For licensing terms, see /license.txt */
 
+use Chamilo\UserBundle\Entity\User;
+
 /**
  * Class for manage the messages web service
  * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
@@ -149,11 +151,12 @@ class MessagesWebService extends WebService
 
     /**
      * Register the Registration ID (token) obtained from Google Cloud Messaging for a user
-     * @param Chamilo\UserBundle\Entity\User $user The user
+     * @param User $user The user
      * @param string $registrationId The token registration id from Google Cloud Messaging
+     *
      * @return int The id after insert or the number of affected rows after update. Otherwhise return false
      */
-    public static function setGcmRegistrationId(Chamilo\UserBundle\Entity\User $user, $registrationId)
+    public static function setGcmRegistrationId(User $user, $registrationId)
     {
         $registrationId = Security::remove_XSS($registrationId);
         $extraFieldValue = new ExtraFieldValue('user');