Browse Source

Add option to hide skills title.

jmontoyaa 7 years ago
parent
commit
439c0ce2a3
2 changed files with 23 additions and 18 deletions
  1. 22 16
      main/inc/lib/skill.lib.php
  2. 1 2
      main/inc/lib/social.lib.php

+ 22 - 16
main/inc/lib/skill.lib.php

@@ -1231,10 +1231,10 @@ class Skill extends Model
      * @param int $userId
      * @param int $courseId
      * @param int $sessionId
-     *
+     * @param bool $addTitle
      * @return array
      */
-    public function getUserSkillsTable($userId, $courseId = 0, $sessionId = 0)
+    public function getUserSkillsTable($userId, $courseId = 0, $sessionId = 0, $addTitle = true)
     {
         $skills = $this->getUserSkills($userId, true, $courseId, $sessionId);
 
@@ -1280,15 +1280,18 @@ class Skill extends Model
         }
         $allowLevels = api_get_configuration_value('skill_levels_names');
 
-        $tableResult = '<div class="table-responsive" >
-                <table class="table" >
-                    <thead>
-                        <tr>
-                            <th>'.get_lang('AchievedSkills').'</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                    <tr><td>';
+        $tableResult = '<div class="table-responsive">';
+        if ($addTitle) {
+            $tableResult .= '
+                    <table class="table" >
+                        <thead>
+                            <tr>
+                                <th>'.get_lang('AchievedSkills').'</th>
+                            </tr>
+                        </thead>
+                        <tbody>
+                        <tr><td>';
+        }
 
         if (!empty($skillParents)) {
             if (empty($allowLevels)) {
@@ -1354,11 +1357,14 @@ class Skill extends Model
             $tableResult .= get_lang('WithoutAchievedSkills');
         }
 
-        $tableResult .= '</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </div>';
+        if ($addTitle) {
+            $tableResult .= '</td>
+                            </tr>
+                        </tbody>
+                    </table>
+                ';
+        }
+        $tableResult .= '</div>';
 
 
         return [

+ 1 - 2
main/inc/lib/social.lib.php

@@ -2136,11 +2136,10 @@ class SocialManager extends UserManager
 
         $skill = new Skill();
         $ranking = $skill->getUserSkillRanking($userId);
-        //$skills = $skill->getUserSkills($userId, true);
 
         $template = new Template(null, false, false, false, false, false);
         $template->assign('ranking', $ranking);
-        $template->assign('skills', $skill->getUserSkillsTable($userId)['table']);
+        $template->assign('skills', $skill->getUserSkillsTable($userId, 0, 0, false)['table']);
         $template->assign('user_id', $userId);
         $template->assign(
             'show_skills_report_link',