Tuesday, August 17, 2010

A php progress bar

From several days I was trying to add a progress bar to the FIT4D's acquiring disk image front end. Even though I couldn't finish it, I thought to write a note about the things I learned from it. I found a php progress bar from here http://webscripts.softpedia.com/script/PHP-Clases/PHP-Progressbar-25825.html. Then I included the following code in a php file and opened it with browser.

require_once 'ProgressBar.class.php';
$bar = new ProgressBar();
$elements = 1000000; //total number of elements to process
$bar->initialize($elements); //print the empty bar
for($i=0;$i<$elements;$i++){ //do something here... $bar->increase(); //calls the bar with every processed element

Then it worked as the developer of it mentioned. Now the hard part. I wanted to include it in our front end. But even though I included the above code segment inside the create_img2Main.php file in the lib directory of the FIT4D source, it doesn't show the dynamic progress bar. Instead, it suddenly shows the final state of the progress bar which is 100% filled.
According to my understanding, I think this is because the file create_img2Main.php is loaded using an ajax request from create_imgMain.php through functions in global.js file. I hope to discuss about the issue with Yasantha akka tomorrow.

No comments:

Post a Comment