diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-04-28 10:03:56 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-04-28 10:03:56 +0000 |
| commit | 55d8804ff83518a46e6742ebd0ba6e0fa6df2d8b (patch) | |
| tree | 497b1375f551fd74294265a401b95a2c093d297b /frontends/php/include/classes | |
| parent | 55963f6c918d2503019875cac9307091b908eaaa (diff) | |
| download | zabbix-55d8804ff83518a46e6742ebd0ba6e0fa6df2d8b.tar.gz zabbix-55d8804ff83518a46e6742ebd0ba6e0fa6df2d8b.tar.xz zabbix-55d8804ff83518a46e6742ebd0ba6e0fa6df2d8b.zip | |
- improved graphs, added 'Working time' displaying (Eugene)
- added 'Working time' configuration (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2786 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/classes')
| -rw-r--r-- | frontends/php/include/classes/graph.inc.php | 70 |
1 files changed, 69 insertions, 1 deletions
diff --git a/frontends/php/include/classes/graph.inc.php b/frontends/php/include/classes/graph.inc.php index 583152f8..da894065 100644 --- a/frontends/php/include/classes/graph.inc.php +++ b/frontends/php/include/classes/graph.inc.php @@ -31,6 +31,8 @@ var $shiftY; var $border; + var $m_showWorkPeriod; + var $yaxistype; var $yaxismin; var $yaxismax; @@ -132,6 +134,8 @@ $this->yaxistype=GRAPH_YAXIS_TYPE_CALCULATED; $this->yaxisright=0; $this->yaxisleft=0; + + $this->m_showWorkPeriod = 1; $this->count=array(); $this->min=array(); @@ -153,6 +157,11 @@ } + function ShowWorkPeriod($value) + { + $this->m_showWorkPeriod = $value; + } + function addItem($itemid, $axis) { $this->items[$this->num]=get_item_by_itemid($itemid); @@ -341,6 +350,62 @@ } } + function drawWorkPeriod() + { + if($this->m_showWorkPeriod != 1) return; + if($this->period > 2678400) return; // > 31*24*3600 (month) + + $workPeriodColor = ImageColorAllocate($this->im,230,230,230); + + $db_work_period = DBselect("select work_period from config"); + $work_period = DBfetch($db_work_period); + if(!$work_period) + return; + + $periods = parse_period($work_period['work_period']); + if(!$periods) + return; + + $now = time(); + if(isset($this->stime)) + { +# $this->to_time=$this->stime+24*3600; +# $this->from_time=$this->stime; + $this->from_time=$this->stime; + $this->to_time=$this->stime+$this->period; + } + else + { + $this->to_time=$now-3600*$this->from; + $this->from_time=$this->to_time-$this->period; + } + $from = $this->from_time; + $max_time = $this->to_time; + + $start = find_period_start($periods,$from); + $end = -1; + + while($start < $max_time && $start > 0) + { + $end = find_period_end($periods,$start); + if($end >= ($max_time) || $end < 0) $end = $max_time; + + $x1 = round((($start-$from)*$this->sizeX)/$this->period) + $this->shiftXleft; + $x2 = round((($end-$from)*$this->sizeX)/$this->period) + $this->shiftXleft; + + //draw rectangle + ImageFilledRectangle( + $this->im, + $x1, + $this->shiftY, + $x2, + $this->sizeY+$this->shiftY, + $workPeriodColor); + + $start = find_period_start($periods,$end+60); + } + } + function checkPermissions() { if(!check_right("Item","R",$this->items[0]["itemid"])) @@ -624,9 +689,11 @@ // $this->im = imagecreate($this->sizeX+$this->shiftX+61,$this->sizeY+2*$this->shiftY+40); -// Header( "Content-type: text/html"); + Header( "Content-type: text/html"); +/* Header( "Content-type: image/png"); Header( "Expires: Mon, 17 Aug 1998 12:51:50 GMT"); +/**/ check_authorisation(); @@ -654,6 +721,7 @@ $this->selectData(); + $this->drawWorkPeriod(); $this->drawGrid(); // ImageString($this->im, 0, 100, 100, $this->shiftXright, $this->colors["Red"]); |
