PHP code example of occ2 / progress-bar

1. Go to this page and download the library: Download occ2/progress-bar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

occ2 / progress-bar example snippets


public function createComponentProgressBar(){
        $m=$this->model;
        $callback = function() use($m){
            return $m->getValue(); //change what you need .. must return integer !!
        };
        $config = [
            "title"=>"BAR TITLE", // bar title
            "minValue"=>0, // minimul value
            "maxValue"=>100,// maximum value
            "valuePrefix"=>"", // text before shown value
            "valueSuffix"=>"%", // text after shown value
            "showValue"=>true, // show value in progress bar?
            "strippedStyle"=>true, // use stripped style
            "animatedStyle"=>true, // use animated bar
            "colorStyle"=>"success" // color style (available info/warning/success/danger)
            "warningThreshold"=>null, // switch to warning style (if null nothing switched)
            "dangerThreshold"=>null // switch to danger style (if null nothing switched)
            ];
        $refreshTime = 3; // time to automatic AJAX refresh (set null if autorefresh disabled)
        return new \OCC2\ProgressBar\ProgressBar("cpuLoad", $callback, $config, $refreshTime);
}