Browse Source

Improvement of sidebar blocks in tpl - refs BT#13094

Alex Aragon 7 years ago
parent
commit
e88a642d22
2 changed files with 135 additions and 66 deletions
  1. 23 62
      main/inc/lib/userportal.lib.php
  2. 112 4
      main/template/default/layout/layout_2_col.tpl

+ 23 - 62
main/inc/lib/userportal.lib.php

@@ -321,7 +321,6 @@ class IndexManager
         if (empty($home_notice)) {
             $home_notice = @(string) file_get_contents($this->home.'home_notice.html');
         }
-
         if (!empty($home_notice)) {
             $home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice)));
             $html = self::show_right_block(
@@ -333,7 +332,6 @@ class IndexManager
                 'noticesCollapse'
             );
         }
-
         return $html;
     }
 
@@ -377,31 +375,22 @@ class IndexManager
     public function return_skills_links()
     {
         $items = [];
-        $certificatesItem = [];
+        //$certificatesItem = [];
         if (!api_is_anonymous() && api_get_configuration_value('hide_my_certificate_link') === false) {
-            $certificatesItem = [
+            $items[] = [
                 'icon' => Display::return_icon('graduation.png', get_lang('MyCertificates')),
                 'link' => api_get_path(WEB_CODE_PATH).'gradebook/my_certificates.php',
                 'title' => get_lang('MyCertificates')
             ];
         }
-
-        $searchItem = [];
         if (api_get_setting('allow_public_certificates') == 'true') {
-            $searchItem = [
+            $items[] = [
                 'icon' => Display::return_icon('search_graduation.png', get_lang('Search')),
                 'link' => api_get_path(WEB_CODE_PATH).'gradebook/search.php',
                 'title' => get_lang('Search')
             ];
         }
 
-        if (empty($certificatesItem) && empty($searchItem)) {
-            return '';
-        } else {
-            $items[] = $certificatesItem;
-            $items[] = $searchItem;
-        }
-
         if (api_get_setting('allow_skills_tool') == 'true') {
             $items[] = [
                 'icon' => Display::return_icon('skill-badges.png', get_lang('MySkills')),
@@ -417,15 +406,7 @@ class IndexManager
                 ];
             }
         }
-
-        return self::show_right_block(
-            get_lang("Skills"),
-            self::returnRightBlockItems($items),
-            'skill_block',
-            null,
-            'skills',
-            'skillsCollapse'
-        );
+        return $items;
     }
 
     /**
@@ -982,32 +963,21 @@ class IndexManager
                 'title' => $label
             ];
         }
-
-        $html = self::show_right_block(
-            get_lang('Profile'),
-            self::returnRightBlockItems($items),
-            'profile_block',
-            null,
-            'profile',
-            'profileCollapse'
-        );
-
+        
         $setting = api_get_plugin_setting('bbb', 'enable_global_conference');
         $settingLink = api_get_plugin_setting('bbb', 'enable_global_conference_link');
         if ($setting === 'true' && $settingLink === 'true') {
             $url = api_get_path(WEB_PLUGIN_PATH).'bbb/start.php?global=1';
             $content = Display::url(get_lang('LaunchVideoConferenceRoom'), $url);
-            $html .= self::show_right_block(
-                get_lang('VideoConference'),
-                $content,
-                'videoconference_block',
-                null,
-                'videoconference',
-                'videoconferenceCollapse'
-            );
+            $items[] = [
+                'class' => 'video-conference',
+                'icon' => Display::return_icon('bbb.png', get_lang('VideoConference')),
+                'link' => $content,
+                'title' => get_lang('VideoConference')
+            ];
         }
-
-        return $html;
+        
+        return $items;
     }
 
     /**
@@ -1015,7 +985,7 @@ class IndexManager
      */
     public function return_navigation_links()
     {
-        $html = '';
+        $items = [];
         // Deleting the myprofile link.
         if (api_get_setting('allow_social_tool') == 'true') {
             unset($this->tpl->menu_navigation['myprofile']);
@@ -1029,19 +999,17 @@ class IndexManager
         // Main navigation section.
         // Tabs that are deactivated are added here.
         if (!empty($this->tpl->menu_navigation)) {
-            $content = '<ul class="nav nav-pills nav-stacked">';
+            //$content = '<ul class="nav nav-pills nav-stacked">';
             foreach ($this->tpl->menu_navigation as $section => $navigation_info) {
-                $current = $section == $GLOBALS['this_section'] ? ' id="current"' : '';
-                $content .= '<li'.$current.'>';
-                $content .= '<a href="'.$navigation_info['url'].'" target="_self">'.$navigation_info['title'].'</a>';
-                $content .= '</li>';
+                $items [] = [
+                    'icon' => null,
+                    'link' => $navigation_info['url'],
+                    'title' => $navigation_info['title']
+                ];
             }
-            $content .= '</ul>';
-
-            $html = self::show_right_block(get_lang('MainNavigation'), $content, 'navigation_link_block');
         }
 
-        return $html;
+        return $items;
     }
 
     /**
@@ -1138,15 +1106,8 @@ class IndexManager
                 ];
             }
         }
-
-        return self::show_right_block(
-            get_lang('Courses'),
-            self::returnRightBlockItems($items),
-            'course_block',
-            null,
-            'course',
-            'courseCollapse'
-        );
+        
+        return $items;
     }
 
     /**

+ 112 - 4
main/template/default/layout/layout_2_col.tpl

@@ -78,15 +78,123 @@
                     {{ user_image_block }}
                 {% endif %}
 
-                {{ profile_block }}
-                {{ course_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">
+                            <h4 class="panel-title">
+                                <a role="button" data-toggle="collapse" data-parent="#profile" href="#profileCollapse" aria-expanded="true" aria-controls="profileCollapse">
+                                    {{ 'Profile' | get_lang }}
+                                </a>
+                            </h4>
+                        </div>
+                        <div style="" aria-expanded="true" id="profileCollapse" class="panel-collapse collapse in" role="tabpanel">
+                            <div class="panel-body">
+                                <ul class="list-group">
+                                    {% for item in profile_block %}
+                                    <li class="list-group-item {{ item.class }}">
+                                        <span class="item-icon">
+                                            {{ item.icon }}
+                                        </span>
+                                        <a href="{{ item.link }}">{{ item.title }}</a>
+                                    </li>
+                                    {% endfor %}
+                                </ul>
+                            </div> 
+                        </div> 
+                    </div>
+                </div>
+                <!-- end block profile -->
+                <!-- block course -->
+                <div class="panel-group" id="course" role="tablist" aria-multiselectable="true">
+                    <div class="panel panel-default" id="course_block">
+                        <div class="panel-heading" role="tab">
+                            <h4 class="panel-title">
+                                <a role="button" data-toggle="collapse" data-parent="#course" href="#courseCollapse" aria-expanded="true" aria-controls="courseCollapse">
+                                    {{ 'Courses' | get_lang }}
+                                </a>
+                            </h4>
+                        </div>
+                        <div style="" aria-expanded="true" id="courseCollapse" class="panel-collapse collapse in" role="tabpanel">
+                            <div class="panel-body">
+                                <ul class="list-group">
+                                    {% for item in course_block %}
+                                    <li class="list-group-item {{ item.class }}">
+                                        <span class="item-icon">
+                                            {{ item.icon }}
+                                        </span>
+                                        <a href="{{ item.link }}">{{ item.title }}</a>
+                                    </li>
+                                    {% endfor %}
+                                </ul>
+                            </div> 
+                        </div> 
+                    </div>
+                </div>
+                <!-- end block course -->
+                <!-- block skills -->
+                <div class="panel-group" id="skill" role="tablist" aria-multiselectable="true">
+                    <div class="panel panel-default" id="skill_block">
+                        <div class="panel-heading" role="tab">
+                            <h4 class="panel-title">
+                                <a role="button" data-toggle="collapse" data-parent="#skill" href="#skillCollapse" aria-expanded="true" aria-controls="skillCollapse">
+                                    {{ 'Skills' | get_lang }}
+                                </a>
+                            </h4>
+                        </div>
+                        <div style="" aria-expanded="true" id="skillCollapse" class="panel-collapse collapse in" role="tabpanel">
+                            <div class="panel-body">
+                                <ul class="list-group">
+                                    {% for item in skills_block %}
+                                    <li class="list-group-item {{ item.class }}">
+                                        <span class="item-icon">
+                                            {{ item.icon }}
+                                        </span>
+                                        <a href="{{ item.link }}">{{ item.title }}</a>
+                                    </li>
+                                    {% endfor %}
+                                </ul>
+                            </div> 
+                        </div> 
+                    </div>
+                </div>              
+                <!-- end block skills -->
+                
                 {{ teacher_block }}
-                {{ skills_block }}
+                
                 {{ certificates_search_block }}
+                
                 {{ notice_block }}
+                
                 {{ help_block }}
-                {{ navigation_course_links }}
+                
+                <!-- block navegation -->
+                <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">
+                            <h4 class="panel-title">
+                                <a role="button" data-toggle="collapse" data-parent="#menu" href="#menuCollapse" aria-expanded="true" aria-controls="menuCollapse">
+                                    {{ 'MainNavigation' | get_lang }}
+                                </a>
+                            </h4>
+                        </div>
+                        <div style="" aria-expanded="true" id="menuCollapse" class="panel-collapse collapse in" role="tabpanel">
+                            <div class="panel-body">
+                                <ul class="nav nav-pills nav-stacked">
+                                    {% for item in navigation_course_links %}
+                                    <li>
+                                        <a href="{{ item.link }}">{{ item.title }}</a>
+                                    </li>
+                                    {% endfor %}
+                                </ul>
+                            </div> 
+                        </div> 
+                    </div>
+                </div>              
+                <!-- end block navegation -->
+                
                 {{ search_block }}
+                
                 {{ classes_block }}
 
                 {% if plugin_menu_bottom %}