ソースを参照

Fix userportal after merge see BT#13094 #2093

jmontoyaa 7 年 前
コミット
4613fd116b
4 ファイル変更42 行追加38 行削除
  1. 1 1
      index.php
  2. 13 16
      main/inc/lib/userportal.lib.php
  3. 26 20
      main/template/default/layout/layout_2_col.tpl
  4. 2 1
      user_portal.php

+ 1 - 1
index.php

@@ -155,7 +155,7 @@ $controller->tpl->assign('notice_block', $controller->return_notice());
 $controller->tpl->assign('help_block', $controller->return_help());
 
 if (api_is_platform_admin() || api_is_drh()) {
-    $controller->tpl->assign('skills_block', $controller->return_skills_links());
+    $controller->tpl->assign('skills_block', $controller->returnSkillLinks());
 }
 
 if (api_is_anonymous()) {

+ 13 - 16
main/inc/lib/userportal.lib.php

@@ -370,13 +370,15 @@ class IndexManager
 
     /**
      * Generate the block for show a panel with links to My Certificates and Certificates Search pages
-     * @return string The HTML code for the panel
+     * @return array The HTML code for the panel
      */
-    public function return_skills_links()
+    public function returnSkillLinks()
     {
         $items = [];
-        //$certificatesItem = [];
-        if (!api_is_anonymous() && api_get_configuration_value('hide_my_certificate_link') === false) {
+
+        if (!api_is_anonymous() &&
+            api_get_configuration_value('hide_my_certificate_link') === false
+        ) {
             $items[] = [
                 'icon' => Display::return_icon('graduation.png', get_lang('MyCertificates')),
                 'link' => api_get_path(WEB_CODE_PATH).'gradebook/my_certificates.php',
@@ -391,13 +393,6 @@ class IndexManager
             ];
         }
 
-        if (empty($certificatesItem) && empty($searchItem)) {
-            return '';
-        } else {
-            $items[] = $certificatesItem;
-            $items[] = $searchItem;
-        }
-
         if (Skill::isAllow(0, false)) {
             $items[] = [
                 'icon' => Display::return_icon('skill-badges.png', get_lang('MySkills')),
@@ -413,6 +408,8 @@ class IndexManager
                 ];
             }
         }
+
+        return $items;
     }
 
     /**
@@ -882,7 +879,7 @@ class IndexManager
     }
 
     /**
-     * @return null|string|void
+     * @return array
      */
     public function return_profile_block()
     {
@@ -969,7 +966,7 @@ class IndexManager
                 'title' => $label
             ];
         }
-        
+
         $setting = api_get_plugin_setting('bbb', 'enable_global_conference');
         $settingLink = api_get_plugin_setting('bbb', 'enable_global_conference_link');
         if ($setting === 'true' && $settingLink === 'true') {
@@ -982,12 +979,12 @@ class IndexManager
                 'title' => get_lang('VideoConference')
             ];
         }
-        
+
         return $items;
     }
 
     /**
-     * @return null|string
+     * @return array
      */
     public function return_navigation_links()
     {
@@ -1112,7 +1109,7 @@ class IndexManager
                 ];
             }
         }
-        
+
         return $items;
     }
 

+ 26 - 20
main/template/default/layout/layout_2_col.tpl

@@ -78,7 +78,8 @@
                     {{ user_image_block }}
                 {% endif %}
 
-                                <!-- block profile -->
+                {% if profile_block %}
+                <!-- block profile -->
                 <div class="panel-group" id="profile" role="tablist" aria-multiselectable="true">
                     <div class="panel panel-default" id="profile_block">
                         <div class="panel-heading" role="tab">
@@ -100,11 +101,14 @@
                                     </li>
                                     {% endfor %}
                                 </ul>
-                            </div> 
-                        </div> 
+                            </div>
+                        </div>
                     </div>
                 </div>
                 <!-- end block profile -->
+                {% endif %}
+
+                {% if course_block %}
                 <!-- block course -->
                 <div class="panel-group" id="course" role="tablist" aria-multiselectable="true">
                     <div class="panel panel-default" id="course_block">
@@ -127,11 +131,14 @@
                                     </li>
                                     {% endfor %}
                                 </ul>
-                            </div> 
-                        </div> 
+                            </div>
+                        </div>
                     </div>
                 </div>
                 <!-- end block course -->
+                {% endif %}
+
+                {% if skills_block %}
                 <!-- block skills -->
                 <div class="panel-group" id="skill" role="tablist" aria-multiselectable="true">
                     <div class="panel panel-default" id="skill_block">
@@ -154,21 +161,20 @@
                                     </li>
                                     {% endfor %}
                                 </ul>
-                            </div> 
-                        </div> 
+                            </div>
+                        </div>
                     </div>
-                </div>              
+                </div>
                 <!-- end block skills -->
-                
+                {% endif %}
+
                 {{ teacher_block }}
-                
                 {{ certificates_search_block }}
-                
                 {{ notice_block }}
-                
                 {{ help_block }}
-                
-                <!-- block navegation -->
+
+                <!-- block navigation -->
+                {% if navigation_course_links %}
                 <div class="panel-group" id="menu" role="tablist" aria-multiselectable="true">
                     <div class="panel panel-default" id="menu_block">
                         <div class="panel-heading" role="tab">
@@ -187,14 +193,14 @@
                                     </li>
                                     {% endfor %}
                                 </ul>
-                            </div> 
-                        </div> 
+                            </div>
+                        </div>
                     </div>
-                </div>              
-                <!-- end block navegation -->
-                
+                </div>
+                {% endif %}
+                <!-- end block navigation -->
+
                 {{ search_block }}
-                
                 {{ classes_block }}
 
                 {% if plugin_menu_bottom %}

+ 2 - 1
user_portal.php

@@ -266,7 +266,8 @@ $controller->tpl->assign('course_block', $controller->return_course_block());
 $controller->tpl->assign('navigation_course_links', $controller->return_navigation_links());
 $controller->tpl->assign('search_block', $controller->return_search_block());
 $controller->tpl->assign('classes_block', $controller->return_classes_block());
-$controller->tpl->assign('skills_block', $controller->return_skills_links());
+$controller->tpl->assign('skills_block', $controller->returnSkillLinks());
+
 $historyClass = '';
 if (!empty($_GET['history'])) {
     $historyClass = 'courses-history';