Browse Source

Minor - format code, fix php warning

Julio Montoya 10 years ago
parent
commit
e157494e46
3 changed files with 18 additions and 9 deletions
  1. 3 1
      main/inc/ajax/model.ajax.php
  2. 15 7
      main/inc/lib/skill.lib.php
  3. 0 1
      main/inc/lib/usermanager.lib.php

+ 3 - 1
main/inc/ajax/model.ajax.php

@@ -1205,8 +1205,10 @@ switch ($action) {
                 $item['certificates'] = Display::return_icon('warning.png', get_lang('NoCertificate'), array(), ICON_SIZE_SMALL);
                 $item['has_certificates'] = '0';
             }
+
             if (!empty($skills)) {
-                foreach($skills as $skill) {
+                $item['skills'] = '';
+                foreach ($skills as $skill) {
                     $item['skills'] .= Display::span($skill['name'], array('class' => 'label_tag skill'));
                 }
             }

+ 15 - 7
main/inc/lib/skill.lib.php

@@ -911,7 +911,11 @@ class Skill extends Model
             if ($add_root) {
                 if (!empty($skill_id)) {
                     // Default root node
-                    $skills[1] = array('id' => '1', 'name' => get_lang('Root'), 'parent_id' => '0');
+                    $skills[1] = array(
+                        'id' => '1',
+                        'name' => get_lang('Root'),
+                        'parent_id' => '0'
+                    );
                     $skill_info = $this->get_skill_info($skill_id);
 
                     // 2nd node
@@ -945,11 +949,10 @@ class Skill extends Model
                     $skill['data']['name'] = $skill['short_code'];
                 }
 
-                //In order to paint all members of a family with the same color
+                // In order to paint all members of a family with the same color
                 if (empty($skill_id)) {
                     if ($skill['parent_id'] == 1) {
                         $family[$skill['id']] = $this->get_all_children($skill['id']);
-
                     }
                 } else {
                     if ($skill['parent_id'] == $skill_id) {
@@ -1189,7 +1192,7 @@ class Skill extends Model
      * @param int $skill_id
      * @return array
      */
-    function get_courses_by_skill($skill_id)
+    public function get_courses_by_skill($skill_id)
     {
         $skill_id = intval($skill_id);
         $sql = "SELECT c.title, c.code
@@ -1227,15 +1230,20 @@ class Skill extends Model
             $whereConditions['AND session_id = ? '] = $sessionId;
         }
 
-        $result = Database::select('COUNT(1) AS qty', $this->table_skill_rel_user, array(
-            'where' => $whereConditions
-        ), 'first');
+        $result = Database::select(
+            'COUNT(1) AS qty',
+            $this->table_skill_rel_user, array(
+                'where' => $whereConditions
+            ),
+            'first'
+        );
 
         if ($result != false) {
             if ($result['qty'] > 0) {
                 return true;
             }
         }
+
         return false;
     }
 

+ 0 - 1
main/inc/lib/usermanager.lib.php

@@ -682,7 +682,6 @@ class UserManager
             $expiration_date = api_get_utc_datetime($expiration_date);
             $expiration_date = new \DateTime($expiration_date);
         }
-
         $user
             ->setLastname($lastname)
             ->setFirstname($firstname)