diff options
author | Pim van den Berg | 2009-10-11 19:23:26 +0200 |
---|---|---|
committer | Pim van den Berg | 2009-10-11 19:23:26 +0200 |
commit | 62dd9a10226dbea561c19829f9a75e31472909fc (patch) | |
tree | a169fc3bb473b1c2746411ad79393c356e0c4de8 /inc | |
parent | some styling modifications (diff) | |
download | apt-panopticon_cgp-62dd9a10226dbea561c19829f9a75e31472909fc.zip apt-panopticon_cgp-62dd9a10226dbea561c19829f9a75e31472909fc.tar.gz apt-panopticon_cgp-62dd9a10226dbea561c19829f9a75e31472909fc.tar.bz2 apt-panopticon_cgp-62dd9a10226dbea561c19829f9a75e31472909fc.tar.xz |
remove code duplication from function graphs_from_plugin
Diffstat (limited to 'inc')
-rw-r--r-- | inc/collectd.inc.php | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php index 306086a..525b931 100644 --- a/inc/collectd.inc.php +++ b/inc/collectd.inc.php | |||
@@ -110,16 +110,18 @@ function graphs_from_plugin($host, $plugin) { | |||
110 | $ts = collectd_plugindetail($host, $plugin, 't'); | 110 | $ts = collectd_plugindetail($host, $plugin, 't'); |
111 | $tis = collectd_plugindetail($host, $plugin, 'ti'); | 111 | $tis = collectd_plugindetail($host, $plugin, 'ti'); |
112 | if (!$pis) $pis = array('NULL'); | 112 | if (!$pis) $pis = array('NULL'); |
113 | if (!$tis) $tis = array('NULL'); | 113 | if (!$tis || $CONFIG['groupby'][$plugin] == 'type') |
114 | $tis = array('NULL'); | ||
114 | 115 | ||
115 | foreach($pis as $pi) { | 116 | foreach($pis as $pi) { |
116 | if ($CONFIG['groupby'][$plugin] == 'type') { | 117 | foreach ($tis as $ti) { |
117 | foreach ($ts as $t) { | 118 | foreach ($ts as $t) { |
118 | $items = array( | 119 | $items = array( |
119 | 'h' => $host, | 120 | 'h' => $host, |
120 | 'p' => $plugin, | 121 | 'p' => $plugin, |
121 | 'pi' => $pi, | 122 | 'pi' => $pi, |
122 | 't' => $t | 123 | 't' => $t, |
124 | 'ti' => $ti | ||
123 | ); | 125 | ); |
124 | printf('<a href="%s/%s"><img src="%s/%s"></a>'."\n", | 126 | printf('<a href="%s/%s"><img src="%s/%s"></a>'."\n", |
125 | $CONFIG['weburl'], | 127 | $CONFIG['weburl'], |
@@ -128,24 +130,6 @@ function graphs_from_plugin($host, $plugin) { | |||
128 | build_url('graph.php', $items) | 130 | build_url('graph.php', $items) |
129 | ); | 131 | ); |
130 | } | 132 | } |
131 | } else { | ||
132 | foreach ($tis as $ti) { | ||
133 | foreach ($ts as $t) { | ||
134 | $items = array( | ||
135 | 'h' => $host, | ||
136 | 'p' => $plugin, | ||
137 | 'pi' => $pi, | ||
138 | 't' => $t, | ||
139 | 'ti' => $ti | ||
140 | ); | ||
141 | printf('<a href="%s/%s"><img src="%s/%s"></a>'."\n", | ||
142 | $CONFIG['weburl'], | ||
143 | build_url('detail.php', $items), | ||
144 | $CONFIG['weburl'], | ||
145 | build_url('graph.php', $items) | ||
146 | ); | ||
147 | } | ||
148 | } | ||
149 | } | 133 | } |
150 | } | 134 | } |
151 | } | 135 | } |