Progress Bar
From MoodleDocs
Progress Bar Lib
There are two Progress Bar libs avaiable in Moodle, the old one and a OOP one.
Old Progress Bar
<syntaxhighlight lang="php"> function print_progress($done, $total, $updatetime=5, $sleeptime=1, $donetext=)
OOP Progress Bar
Usage: <syntaxhighlight lang="php"> set_time_limit(0); $pb = new progressbar('bar', 500); $pb->create(); $num_tasks = 200; // the number of tasks to be completed. for($cur_task = 0; $cur_task <= $num_tasks; $cur_task++) {
for ($i=0; $i<100000; $i++) { ;;; } $pb->update($cur_task, $num_tasks, 'this is'. $cur_task . 'h');
} ?>
<?php $pt = new progressbar('zbar', 900); $pt->create(); $num_tasks = 200; // the number of tasks to be completed. for($cur_task = 0; $cur_task <= $num_tasks; $cur_task++) {
for ($i=0; $i<100000; $i++) { ;;; } $pt->update($cur_task, $num_tasks, 'this is'. $cur_task . 'h');
}