Browse Source

Fix skills new ordered table UI see BT#13587

Julio 7 years ago
parent
commit
d477669ebd
1 changed files with 19 additions and 12 deletions
  1. 19 12
      main/social/my_skills_report.php

+ 19 - 12
main/social/my_skills_report.php

@@ -38,13 +38,15 @@ if ($isStudent) {
     $skillParents = [];
     foreach ($skills as $resultData) {
         $parents = $objSkill->get_parents($resultData['id']);
+
         foreach ($parents as $parentData) {
             if ($parentData['id'] == 1 || $parentData['parent_id'] == 1) {
                 continue;
             }
-
+            $skillParents[$parentData['id']]['passed'] = in_array($parentData['id'], array_keys($skills));
             $skillParents[$parentData['id']][] = $resultData;
         }
+
         $courseId = $resultData['course_id'];
         if (!empty($courseId)) {
             if (isset($courseTempList[$courseId])) {
@@ -80,25 +82,30 @@ if ($isStudent) {
                 continue;
             }
             $parentInfo = $objSkill->getSkillInfo($parentId);
-            $table->setHeaderContents(0, $column, $parentInfo['name']);
-            $column++;
-
+            $parentName = '';
+            if ($data['passed']) {
+                $parentName = $parentInfo['name'];
+            }
+            $table->setHeaderContents(0, $column, $parentName);
             $row = 1;
+            $skillsToShow = [];
             foreach ($data as $skillData) {
+                if ($skillData['id'] == $parentId) {
+                    continue;
+                }
                 $skillAdded[] = $skillData['id'];
-                $table->setCellContents(
-                    $row,
-                    0,
-                    $skillData['name']
-                );
+                $skillsToShow[] = $skillData['name'];
             }
+            $table->setCellContents(
+                $row,
+                $column,
+                implode(' ', $skillsToShow)
+            );
             $row++;
+            $column++;
         }
     }
-
     $tpl->assign('skill_table', $table->toHtml());
-
-
     $tplPath = 'skill/student_report.tpl';
 } elseif ($isStudentBoss) {
     $selectedStudent = isset($_REQUEST['student']) ? intval($_REQUEST['student']) : 0;