Code

new progressbar function
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 13 Jun 2005 10:56:35 +0000 (10:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 13 Jun 2005 10:56:35 +0000 (10:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@691 594d385d-05f5-0310-b6e9-bd551577e9d8

include/functions.inc
include/functions_helpviewer.inc

index ecf5bd2db242088eddff3fa1797415bfcb7cdf82..4fc438f06114844ecf3882cdff85f6255704af03 100644 (file)
@@ -1718,5 +1718,47 @@ function compare_revision($revision_file, $revision)
   return $result;
 }
 
+function progressbar($percentage,$width=100,$height=15,$showvalue=false)
+  {
+  $str = ""; // Our return value will be saved in this var
+
+  $color  = dechex($percentage+150);
+  $color2 = dechex(150 - $percentage);
+
+  $progress = (int)(($percentage /100)*$width);
+
+  /* Abort printing out percentage, if divs are to small */
+
+
+  /* If theres a better solution for this, use it... */
+  $str = "
+  <div style=\" width:".($width)."px; 
+                height:".($height)."px;
+                background-color:#000000;
+                padding:1px;\">
+
+          <div style=\" border-style: solid;
+                        border-width: 0pt;
+                        width:".($width)."px;
+                        background-color:#DDDDDD;
+                        height:".($height)."px;\">
+
+                <div style=\" width:".$progress."px;
+                              height:".$height."px;
+                              background-color:#".$color2.$color2.$color."; \">";
+
+
+    if($height >10){
+      $str.=                 "<font style=\"font-size:".($height-2)."px;color:#FF5555;align:middle;padding-left:".((int)(($width*0.7)/2))."px;\">
+                               <b>".$percentage."%</b>
+                             </font>";
+   }
+
+  $str.= "</div></div></div>";
+
+  return($str);
+  }
+
+
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 9c122f8b1af5b589193aaf93e9aa8dc4e7a425ce..d1a3f69e81b36f4004fedc65474f3cf01ff748a4 100644 (file)
@@ -327,12 +327,7 @@ function createResultEntry($entry,$res,$name,$max)
               <td height=15>
                 <b>".$entry['headline']."</b> -".htmlentities( substr(strip_tags($entry['content']),0,120))."...
               </td>
-              <td width=50 valign=\"top\">
-                <div style=\"width:50px;background-color:#DDDDDD;\">
-                  <div style=\"width:".((int)($percentage/2))."px; height:8px; background-color:#".$color2.$color2.$color."; \">
-                  </div>
-                </div>
-              </td>
+              <td width=50 valign=\"top\">".progressbar($percentage,50,8)."</td>
              </tr>
              <tr>
               <td colspan=2>