aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/type
diff options
context:
space:
mode:
authorPim van den Berg2009-12-28 15:47:42 +0100
committerPim van den Berg2009-12-28 15:47:42 +0100
commit5a138d4c0464b591177cf523ebb8e0603e32d650 (patch)
tree31ef3a927d160c6dfab67e689d08bf3b2342e262 /type
parentreplace duplicate code by function plugin_header (diff)
downloadapt-panopticon_cgp-5a138d4c0464b591177cf523ebb8e0603e32d650.zip
apt-panopticon_cgp-5a138d4c0464b591177cf523ebb8e0603e32d650.tar.gz
apt-panopticon_cgp-5a138d4c0464b591177cf523ebb8e0603e32d650.tar.bz2
apt-panopticon_cgp-5a138d4c0464b591177cf523ebb8e0603e32d650.tar.xz
replace duplicate code by function rrd_options
Diffstat (limited to 'type')
-rw-r--r--type/Default.class.php12
-rw-r--r--type/GenericIO.class.php8
-rw-r--r--type/GenericStacked.class.php8
3 files changed, 11 insertions, 17 deletions
diff --git a/type/Default.class.php b/type/Default.class.php
index f40d12d..817521a 100644
--- a/type/Default.class.php
+++ b/type/Default.class.php
@@ -84,9 +84,7 @@ class Type_Default {
84 } 84 }
85 } 85 }
86 86
87 function rrd_gen_graph() { 87 function rrd_options() {
88 $filename = $this->get_filename();
89
90 $rrdgraph[] = '/usr/bin/rrdtool graph - -a PNG'; 88 $rrdgraph[] = '/usr/bin/rrdtool graph - -a PNG';
91 $rrdgraph[] = sprintf('-w %d', is_numeric($this->width) ? $this->width : 400); 89 $rrdgraph[] = sprintf('-w %d', is_numeric($this->width) ? $this->width : 400);
92 $rrdgraph[] = sprintf('-h %d', is_numeric($this->heigth) ? $this->heigth : 175); 90 $rrdgraph[] = sprintf('-h %d', is_numeric($this->heigth) ? $this->heigth : 175);
@@ -95,6 +93,14 @@ class Type_Default {
95 $rrdgraph[] = sprintf('-v "%s"', $this->rrd_vertical); 93 $rrdgraph[] = sprintf('-v "%s"', $this->rrd_vertical);
96 $rrdgraph[] = sprintf('-s -%d', is_numeric($this->seconds) ? $this->seconds : 86400); 94 $rrdgraph[] = sprintf('-s -%d', is_numeric($this->seconds) ? $this->seconds : 86400);
97 95
96 return $rrdgraph;
97 }
98
99 function rrd_gen_graph() {
100 $filename = $this->get_filename();
101
102 $rrdgraph = $this->rrd_options();
103
98 if (is_array($this->args['tinstance'])) 104 if (is_array($this->args['tinstance']))
99 $array = is_array($this->order) ? $this->order : $this->args['tinstance']; 105 $array = is_array($this->order) ? $this->order : $this->args['tinstance'];
100 else 106 else
diff --git a/type/GenericIO.class.php b/type/GenericIO.class.php
index 573abde..e91cb16 100644
--- a/type/GenericIO.class.php
+++ b/type/GenericIO.class.php
@@ -7,13 +7,7 @@ class Type_GenericIO extends Type_Default {
7 function rrd_gen_graph() { 7 function rrd_gen_graph() {
8 $filename = $this->get_filename(); 8 $filename = $this->get_filename();
9 9
10 $rrdgraph[] = '/usr/bin/rrdtool graph - -a PNG'; 10 $rrdgraph = $this->rrd_options();
11 $rrdgraph[] = sprintf('-w %d', is_numeric($this->width) ? $this->width : 400);
12 $rrdgraph[] = sprintf('-h %d', is_numeric($this->heigth) ? $this->heigth : 175);
13 $rrdgraph[] = '-l 0';
14 $rrdgraph[] = sprintf('-t "%s"', $this->rrd_title);
15 $rrdgraph[] = sprintf('-v "%s"', $this->rrd_vertical);
16 $rrdgraph[] = sprintf('-s -%d', is_numeric($this->seconds) ? $this->seconds : 86400);
17 11
18 if ($this->scale) 12 if ($this->scale)
19 $raw = '_raw'; 13 $raw = '_raw';
diff --git a/type/GenericStacked.class.php b/type/GenericStacked.class.php
index 28f0552..f024336 100644
--- a/type/GenericStacked.class.php
+++ b/type/GenericStacked.class.php
@@ -5,13 +5,7 @@ require_once 'Default.class.php';
5class Type_GenericStacked extends Type_Default { 5class Type_GenericStacked extends Type_Default {
6 6
7 function rrd_gen_graph() { 7 function rrd_gen_graph() {
8 $rrdgraph[] = '/usr/bin/rrdtool graph - -a PNG'; 8 $rrdgraph = $this->rrd_options();
9 $rrdgraph[] = sprintf('-w %d', is_numeric($this->width) ? $this->width : 400);
10 $rrdgraph[] = sprintf('-h %d', is_numeric($this->heigth) ? $this->heigth : 175);
11 $rrdgraph[] = '-l 0';
12 $rrdgraph[] = sprintf('-t "%s"', $this->rrd_title);
13 $rrdgraph[] = sprintf('-v "%s"', $this->rrd_vertical);
14 $rrdgraph[] = sprintf('-s -%d', is_numeric($this->seconds) ? $this->seconds : 86400);
15 9
16 if (is_array($this->args['tinstance'])) 10 if (is_array($this->args['tinstance']))
17 if (is_array($this->order)) 11 if (is_array($this->order))