From 629114bac56967e53345cfeb31fa7ef9fa98632a Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Thu, 11 Feb 2010 17:50:45 +0000 Subject: [PATCH] Added progress bar class --- JsPHP.php | 110 -------------------------------------- class/PHPProgressBar.php | 91 +++++++++++++++++++++++++++++++ img/progressbarcenter.jpg | Bin 0 -> 657 bytes img/progressbarleft.jpg | Bin 0 -> 676 bytes img/progressbarright.jpg | Bin 0 -> 676 bytes img/progresscenter.jpg | Bin 0 -> 661 bytes img/progressleft.jpg | Bin 0 -> 637 bytes img/progressright.jpg | Bin 0 -> 637 bytes test/phpprogressbar.php | 23 ++++++++ 9 files changed, 114 insertions(+), 110 deletions(-) delete mode 100644 JsPHP.php create mode 100644 class/PHPProgressBar.php create mode 100644 img/progressbarcenter.jpg create mode 100644 img/progressbarleft.jpg create mode 100644 img/progressbarright.jpg create mode 100644 img/progresscenter.jpg create mode 100644 img/progressleft.jpg create mode 100644 img/progressright.jpg create mode 100644 test/phpprogressbar.php diff --git a/JsPHP.php b/JsPHP.php deleted file mode 100644 index 1373e5e..0000000 --- a/JsPHP.php +++ /dev/null @@ -1,110 +0,0 @@ -
"; -progressBarInit(550, 16, "img/bar-grey.gif", "img/bar-life.gif"); -progressBarInit(550, 16, "img/bar-grey.gif", "img/bar-mana.gif"); -progressBarInit(550, 16, "img/bar-grey.gif", "img/bar-life.gif"); -progressBarInit(550, 16, "img/bar-grey.gif", "img/bar-mana.gif"); -for($i=0;$i<=100;$i+=2){ - sleep(1); - progressSetValue($i); - progressSetText($i."%"); - progressSetValue($i/2,1); - progressSetText(($i/2)."%",1); - progressSetValue($i/4,2); - progressSetText(($i/4)."%",2); - progressSetValue($i/3,3); - progressSetText(($i/3)."%",3); - //echo $i."% > "; -} -echo"
"; -redirect("http://google.com"); - -function progressBarInit($width, $height, $imgBar, $imgProggress){ - GLOBAL $progressInit, $progressNextId; - if(!$progressInit){ - echo" - "; - $progressInit = true; - } - $id = $progressNextId; - $progressNextId++; - echo" - -
-
- -
-
- "; - flush(); - return $id; -} -function progressSetValue($value,$id=0){ - echo" - - "; - flush(); -} -function progressSetText($text,$id=0){ - echo" - - "; - flush(); -} - -function redirect($url){ - echo" - - "; - flush(); -} -?> \ No newline at end of file diff --git a/class/PHPProgressBar.php b/class/PHPProgressBar.php new file mode 100644 index 0000000..68115c9 --- /dev/null +++ b/class/PHPProgressBar.php @@ -0,0 +1,91 @@ + + + "; + self::$progressInit = true; + } + $this->id = self::$progressNextId; + self::$progressNextId++; + echo" + +
+
+ +
+
+ "; + flush(); + } + public function setValue($value){ + echo" + + "; + flush(); + } + public function setText($text){ + echo" + + "; + flush(); + } + + public function redirect($url){ + echo" + + "; + flush(); + } +} +?> \ No newline at end of file diff --git a/img/progressbarcenter.jpg b/img/progressbarcenter.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f1dbc7d0c6dcde8fd54ea0b835e66035b0c720cc GIT binary patch literal 657 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3nck{+Ikz SKmMoS`HQZiFXS};-vj_PFyO8L literal 0 HcmV?d00001 diff --git a/img/progressleft.jpg b/img/progressleft.jpg new file mode 100644 index 0000000000000000000000000000000000000000..52fdee294e419ec181909a12dcbbb711d373b953 GIT binary patch literal 637 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<ECr+Na zbot8FYu9hwy!G(W<0ns_J%91?)yGetzkL1n{m0K=Ab&A3Fhjfr_ZgbM1cClyVqsxs zVF&q(k*OSrnFU!`6%E;h90S=C3x$=88aYIqCNA7~kW<+>=!0ld(M2vX6_bamA3
"; +$p1 = new PHPProgressBar(550, 16, "../img/bar-grey.gif", "../img/bar-life.gif"); +$p2 = new PHPProgressBar(550, 16, "../img/bar-grey.gif", "../img/bar-mana.gif"); +$p3 = new PHPProgressBar(550, 16, "../img/bar-grey.gif", "../img/bar-life.gif"); +$p4 = new PHPProgressBar(550, 16, "../img/bar-grey.gif", "../img/bar-mana.gif"); +for($i=0;$i<=100;$i+=2){ + sleep(1); + $p1->setValue($i); + $p1->setText($i."%"); + $p2->setValue($i/2,1); + $p2->setText(($i/2)."%",1); + $p3->setValue($i/4,2); + $p3->setText(($i/4)."%",2); + $p4->setValue($i/3,3); + $p4->setText(($i/3)."%",3); + //echo $i."% > "; +} +echo"
"; +$p1->redirect("http://google.com"); +?> \ No newline at end of file