|
|
<?php
|
|
|
|
|
|
// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
|
|
|
//
|
|
|
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
|
|
|
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
|
|
|
// $Id$
|
|
|
|
|
|
/* length: length in pixels of the bar (default 50)
|
|
|
value: length in pixels to display at the left in red (if not set all length is display in red)
|
|
|
*/
|
|
|
function smarty_function_quotabar($params, $smarty)
|
|
|
{
|
|
|
extract($params, EXTR_SKIP);
|
|
|
if (! isset($length)) {
|
|
|
$length = 100;
|
|
|
}
|
|
|
if (! isset($value)) {
|
|
|
$value = $length;
|
|
|
}
|
|
|
if (empty($value)) {
|
|
|
$ret = "<img src='img/leftbarlight.gif' alt='<' /><img alt='-' src='img/mainbarlight.gif' height='14' width='$length' /><img src='img/rightbarlight.gif' alt='>' />";
|
|
|
} elseif ($value >= $length) {
|
|
|
$ret = "<img src='img/leftbar.gif' alt='<' /><img alt='-' src='img/mainbar.gif' height='14' width='$length' /><img src='img/rightbar.gif' alt='>' />";
|
|
|
} else {
|
|
|
$left = $length - $value;
|
|
|
$ret = "<img src='img/leftbar.gif' alt='<' /><img alt='-' src='img/mainbar.gif' height='14' width='$value' /><img alt='-' src='img/mainbarlight.gif' height='14' width='$left' /><img src='img/rightbarlight.gif' alt='>' />";
|
|
|
}
|
|
|
return $ret;
|
|
|
}
|