$count)
//L'échelle de valeur est de 0 à $count
//Le pourcentage est de $nb_progress_call/$count
//L'affichage est rafraichi tous les $pas appels
//Constructeur. $text
function progress_bar($text='',$count=0,$pas=1) {
$this->html_id = self::$nb_instance;
self::$nb_instance++;
$this->show();
if($text)$this->set_text($text);
$this->count=$count;
$this->pas=$pas;
$this->nb_progress_call=0;
$this->finish=0;
}
function show(){
print "
";
ob_flush();
flush();
}
function init() {
print "";
ob_flush();
flush();
}
function set_percent($percent) {
// on envoit des espaces en plus pour que flush() vide bien le buffer (>256)
print "
";
ob_flush();
flush();
}
function progress() {
if($this->finish) return;
$this->nb_progress_call++;
$percent=intval(100*($this->nb_progress_call/$this->count));
if($percent>=100){
$this->set_percent(100);
$this->finish=1;
}
if(!($this->nb_progress_call%$this->pas)){
$this->set_percent($percent);
}
}
function set_text($text){
global $charset;
print "";
ob_flush();
flush();
}
function hide(){
print "";
ob_flush();
flush();
}
}
?>