Location: PHPKode > scripts > PogProgressBar > ExtendsPogProgressBar.php
<?php

# ExtendsPogProgressBar.php

require_once( 'PogProgressBar.php' );

class ExtendsPogProgressBar extends PogProgressBar
{

	protected $strJsClass = 'MyJsProgressBarClass';

	protected function drawJsClass()
	{
		?>
		<script type="text/javascript">
			// class MyJsProgressBarClass //
			function MyJsProgressBarClass( strSufix )
			{

				this.construct = function construct( strSufix )
				{
					this.objBar = document.getElementById( 'pbBar' + strSufix );
					this.objContainer = document.getElementById( 'pbContainer' + strSufix );
					this.intPercent = 0;
					this.red = 100;
					this.green = 100;
					this.blue = 255;
				}

				this.refresh = function refresh( fltPercent )
				{
					this.fltPercent = parseFloat( fltPercent );
					this.objBar.innerHTML = this.fltPercent.toFixed(  ) + ' %';
					this.objBar.style.width = ( ( this.fltPercent / 100 ) * ( this.objContainer.offsetWidth - 2 ) ) + 'px';
					this.fltRgbValue = ( this.fltPercent / 100 );
					this.objBar.style.backgroundColor = 'rgb( ' + parseInt( this.red * this.fltRgbValue ) + ', ' + parseInt( this.green * this.fltRgbValue ) + ', ' +  parseInt( this.blue * this.fltRgbValue ) + ' )';
				}

				this.construct( strSufix );

			}
		</script>
	<?php
	}

}

$objBar = new ExtendsPogProgressBar( 'pb' );
$objBar->setTheme( 'blue' );

?>
<html>
	<head>
		<title>PogProgressBar - Extends</title>
	</head>
	<body>
		<table align="center" cellpadding="0" cellspacing="20" border="0">
			<tr><td>PogProgressBar - Extends</td></tr>
			<tr><td><? $objBar->draw(); ?></td></tr>
		</table>
	</body>
<html>
<?php

$intMax = 1000;
$intCount = 0;
while ( $objBar->getProgress() < 100 )
{
	$objBar->setProgress( $intCount++ * 100 / $intMax );
	usleep( 100 );
}

?>
Return current item: PogProgressBar