Added progress bar class
This commit is contained in:
parent
a988babb77
commit
629114bac5
9 changed files with 114 additions and 110 deletions
91
class/PHPProgressBar.php
Normal file
91
class/PHPProgressBar.php
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
//created by Ziver koc. Nice hu
|
||||
// Too make this work you must have echoed out html and the body tags
|
||||
class PHPProgressBar{
|
||||
//********* STATIC **********************
|
||||
public static $progressInit = false;
|
||||
public static $progressNextId = 0;
|
||||
//**************************************
|
||||
private $id;
|
||||
|
||||
public function __construct($width, $height, $imgBar, $imgProggress){
|
||||
if(!self::$progressInit){
|
||||
echo"
|
||||
<script type='text/javascript'>
|
||||
<!--
|
||||
function setValue(id,value){
|
||||
document.getElementById('progressValue'+id).style.width = value+'%';
|
||||
}
|
||||
function setText(id,text){
|
||||
document.getElementById('progressText'+id).innerHTML = text;
|
||||
}
|
||||
//-->
|
||||
</script>";
|
||||
self::$progressInit = true;
|
||||
}
|
||||
$this->id = self::$progressNextId;
|
||||
self::$progressNextId++;
|
||||
echo"
|
||||
<style type='text/css'>
|
||||
.progress".$this->id."{
|
||||
background: transparent url(".$imgBar.") repeat-x scroll 0%;
|
||||
border: 1px solid black;
|
||||
color: white;
|
||||
height: ".$height."px;
|
||||
margin: 5pt;
|
||||
padding: 0pt;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
width: ".$width."px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
#progressValue".$this->id."{
|
||||
background: transparent url(".$imgProggress.") repeat-x scroll 0%;
|
||||
float: left;
|
||||
height: ".$height."px;
|
||||
margin: 0pt;
|
||||
padding: 0pt;
|
||||
font-size: 11px;
|
||||
}
|
||||
</style>
|
||||
<div class='progress".$this->id."'>
|
||||
<div id='progressValue".$this->id."' style='width: 0%' >
|
||||
<span id='progressText".$this->id."'></span>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
flush();
|
||||
}
|
||||
public function setValue($value){
|
||||
echo"
|
||||
<script type='text/javascript'>
|
||||
<!--
|
||||
setValue(".$this->id.",".$value.");
|
||||
//-->
|
||||
</script>
|
||||
";
|
||||
flush();
|
||||
}
|
||||
public function setText($text){
|
||||
echo"
|
||||
<script type='text/javascript'>
|
||||
<!--
|
||||
setText(".$this->id.",'".$text."');
|
||||
//-->
|
||||
</script>
|
||||
";
|
||||
flush();
|
||||
}
|
||||
|
||||
public function redirect($url){
|
||||
echo"
|
||||
<script type='text/javascript'>
|
||||
<!--
|
||||
window.location = '".$url."';
|
||||
//-->
|
||||
</script>
|
||||
";
|
||||
flush();
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue