root/dev/common/includes/class.graph.php @ 190

Revision 190, 0.8 KB (checked in by exi, 16 years ago)

This is a big update...
Moved all admin scripts to common/admin.
Moved all includes and classes to common/includes.
Edited all include-paths to reflect the movement.
Fixed a bug with the session system allowing every registered user to access admin pages.
Replaced calls to date() to use a wrapper so gmdate can be used.
Replaced some calls to $config with calls to the static object.
Fixed a big which caused the portrait_grab to not download a new picute.
Added a classified-state to kills.
Removed the sync_server server script in this tree.
Added code to help modules find the includes to index.php.

Line 
1<?php
2
3class BarGraph
4{
5    function BarGraph($value = 0, $max = 100, $width = 75, $text = "")
6    {
7        $this->value_ = $value;
8        $this->width_ = $width;
9        $this->text_ = $text;
10        $this->max_ = $max;
11
12        $this->class_ = "bar";
13    }
14
15    function generate()
16    {
17        if ($this->text_ == "") $this->text_ = "&nbsp;";
18        if ($this->value_)
19            $width = $this->width_ / ($this->max_ / $this->value_);
20        else
21            $width = 0;
22        $html = "<div class=".$this->class_." style=\"width: ".$width."px;\">".$this->text_."</div>";
23        return $html;
24    }
25
26    function setLow($low, $class)
27    {
28        if ($this->value_ <= $low)
29            $this->class_ = "bar-".$class;
30    }
31}
32?>
Note: See TracBrowser for help on using the browser.