Browse Source

Fix progress bar

Julio Montoya 10 years ago
parent
commit
50ba38ae21
1 changed files with 27 additions and 9 deletions
  1. 27 9
      main/inc/lib/display.lib.php

+ 27 - 9
main/inc/lib/display.lib.php

@@ -59,6 +59,7 @@ class Display
         if (isset($origin) && $origin == 'learnpath') {
             $showHeader = false;
         }
+
         self::$global_template = new Template($tool_name, $showHeader, $showHeader);
 
         // Fixing tools with any help it takes xxx part of main/xxx/index.php
@@ -88,6 +89,7 @@ class Display
         if (!empty($page_header)) {
             self::$global_template->assign('header', $page_header);
         }
+
         echo self::$global_template->show_header_template();
     }
 
@@ -98,7 +100,7 @@ class Display
     {
         global $show_learnpath, $tool_name;
         self::$global_template = new Template($tool_name, false, false, $show_learnpath);
-        echo self::$global_template ->show_header_template();
+        echo self::$global_template->show_header_template();
     }
 
     public static function display_no_header()
@@ -112,7 +114,8 @@ class Display
     /**
      * Displays the reduced page header (without banner)
      */
-    public static function set_header() {
+    public static function set_header()
+    {
         global $show_learnpath;
         self::$global_template = new Template($tool_name, false, false, $show_learnpath);
     }
@@ -120,8 +123,9 @@ class Display
     /**
      * Display the page footer
      */
-    public static function display_footer() {
-        echo self::$global_template ->show_footer_template();
+    public static function display_footer()
+    {
+        echo self::$global_template->show_footer_template();
     }
 
     public static function page()
@@ -1696,19 +1700,33 @@ class Display
         return $html;
     }
 
+    /**
+     * @param $percentage
+     * @param bool $show_percentage
+     * @param null $extra_info
+     * @return string
+     */
     public static function bar_progress($percentage, $show_percentage = true, $extra_info = null)
     {
         $percentage = intval($percentage);
-        $div = '<div class="progress progress-striped">
-                    <div class="bar" style="width: '.$percentage.'%;"></div>
-                </div>';
+        $div = '<div class="progress">
+                <div
+                    class="progress-bar progress-bar-striped"
+                    role="progressbar"
+                    aria-valuenow="'.$percentage.'"
+                    aria-valuemin="0"
+                    aria-valuemax="100"
+                    style="width: '.$percentage.'%;"
+                >';
         if ($show_percentage) {
-            $div .= '<div class="progresstext">'.$percentage.'%</div>';
+            $div .= $percentage.'%';
         } else {
             if (!empty($extra_info)) {
-                $div .= '<div class="progresstext">'.$extra_info.'</div>';
+                $div .= $extra_info;
             }
         }
+        $div .= '</div>';
+
         return $div;
     }