From c9ec505b9ea93be017a4e7df9acb17e9f9eee5e7 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Wed, 8 Apr 2009 11:46:19 +0000 Subject: [PATCH] weblib progress_bar: Add a comment and fix some coding style. --- lib/weblib.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index eb6adeaef6..aa704f6937 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -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 -- 2.39.5