]> git.mjollnir.org Git - moodle.git/commitdiff
weblib progress_bar: Add a comment and fix some coding style.
authortjhunt <tjhunt>
Wed, 8 Apr 2009 11:46:19 +0000 (11:46 +0000)
committertjhunt <tjhunt>
Wed, 8 Apr 2009 11:46:19 +0000 (11:46 +0000)
lib/weblib.php

index eb6adeaef64393a2fbf6a75604dfa233c98a1beb..aa704f693735313e399403776495cf79cc3ffcf0 100644 (file)
@@ -7186,7 +7186,13 @@ function console_write_error($identifier, $module='install', $use_string_lib=tru
     die; die; die;
 }
 
-
+/**
+ * To use this class.
+ * - construct
+ * - call create (or use the 3rd param to the constructor)
+ * - call update or update_full repeatedly
+ * - 
+ */
 class progress_bar {
     private $html_id;
     private $percent;
@@ -7305,14 +7311,16 @@ EOT;
         $one = $curtime - $this->lastcall->time;
         $this->percent = $pt;
         $percent = $pt - $this->lastcall->pt;
-        if($percent != 0)
+        if ($percent != 0) {
             $left = ($one / $percent) - $consume;
-        else
+        } else {
             return null;
-        if($left < 0)
+        }
+        if($left < 0) {
             return 0;
-        else
+        } else {
             return $left;
+        }
     }
     /**
       * Update progress bar according percent