HTML_Progress::sleep

HTML_Progress

Prev |  | Next
HTML_Progress::sleep delays execution of the progress meter ## Synopsis require_once 'HTML/Progress.php'; void HTML_Progress::sleep() ## Description This method is used to delay execution of the progress meter. This is the default user callback called by HTML_Progress::process in the do-while loop of the HTML_Progress::run method. ## Note ( HTML_Progress >= 1.2.0RC3 )
| This function can not be called statically.
| Useful when you want to show some demonstrations. In real world, there is no need to delay execution because the user-task (process) should be long enough to make a smooth animation. If it was not the case, then use the HTML_Progress::setAnimSpeed method.
| The function http://www.php.net/manual/en/function.usleep.php did not work on Windows systems until PHP 5.0.0; For PHP4 on Windows platform, HTML_Progress uses a empty-for loop to delay execution.
## See HTML_Progress::setAnimSpeed, HTML_Progress::process, HTML_Progress::run, HTML_Progress::setProgressHandler ## Example Example below (that requires HTML_Progress >= 1.2.0RC3) demonstrates usage of a simple user callback (lines 10 to 13, and 18), which only wait 1 second (line 16).

    <?php
    require_once 'HTML/Progress.php';

    /*
        user callback: job to do while the progress meter is running

        $obj is an instance of the progress meter object (see line 13)
        $progressValue contains the current value of the progress meter
     */
    function myFunctionHandler($progressValue, &$obj)
    {
        $obj->sleep();  // nothing to do here, except sleep a bit ...
    }

    $progress = new HTML_Progress();
    $progress->setAnimSpeed(1000);    // defines delay of one second
    $progress->setIncrement(10);
    $progress->setProgressHandler('myFunctionHandler');
    ?>
    <html>
    <head>
    <style type="text/css">
    <!--
    <?php echo $progress->getStyle(); ?>
    // -->
    </style>
    <script type="text/javascript">
    <!--
    <?php echo $progress->getScript(); ?>
    //-->
    </script>
    </head>
    <body>

    <?php
    echo $progress->toHtml();
    $progress->run();
    ?>

    </body>
    </html>
Prev | Up | Next
HTML_Progress::toArray | Reference Guide | HTML_Progress::setProgressHandler
Documentation generated on Sun, 12 Sep 2004 20:23:01 +0200 by phpDocumentor 1.3.0RC3