ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
statistics.tpl.php
Go to the documentation of this file.
1 <?php
2 $this->data['header'] = 'SimpleSAMLphp Statistics';
3 
4 $this->data['jquery'] = array('core' => true, 'ui' => true, 'css' => true);
5 
6 $this->data['head'] = '<link rel="stylesheet" type="text/css" href="' . SimpleSAML\Module::getModuleURL("statistics/style.css") . '" />' . "\n";
7 $this->data['head'] .= '<script type="text/javascript" src="' . SimpleSAML\Module::getModuleURL("statistics/javascript.js") . '"></script>' . "\n";
8 
9 $this->includeAtTemplateBase('includes/header.php');
10 
11 echo '<h1>'. $this->data['available.rules'][$this->data['selected.rule']]['name'] . '</h1>';
12 echo '<p>' . $this->data['available.rules'][$this->data['selected.rule']]['descr'] . '</p>';
13 
14 // Report settings
15 echo '<table class="selecttime">';
16 echo '<tr><td class="selecttime_icon"><img src="' . SimpleSAML\Utils\HTTP::getBaseUrl() . 'resources/icons/crystal_project/kchart.32x32.png" alt="Report settings" /></td>';
17 
18 // Select report
19 echo '<td>';
20 echo '<form action="#">';
21 echo $this->data['post_rule'];
22 if (!empty($this->data['available.rules'])) {
23  echo '<select onchange="submit();" name="rule">';
24  foreach ($this->data['available.rules'] as $key => $rule) {
25  if ($key === $this->data['selected.rule']) {
26  echo '<option selected="selected" value="' . $key . '">' . $rule['name'] . '</option>';
27  } else {
28  echo '<option value="' . $key . '">' . $rule['name'] . '</option>';
29  }
30  }
31  echo '</select>';
32 }
33 echo '</form></td>';
34 
35 // Select delimiter
36 echo '<td class="td_right">';
37 echo '<form action="#">';
38 echo $this->data['post_d'];
39 if(!empty($this->data['availdelimiters'])) {
40  echo '<select onchange="submit();" name="d">';
41  foreach ($this->data['availdelimiters'] as $key => $delim) {
42  $delimName = $delim;
43  if (array_key_exists($delim, $this->data['delimiterPresentation'])) {
44  $delimName = $this->data['delimiterPresentation'][$delim];
45  }
46 
47  if ($key == '_') {
48  echo '<option value="_">Total</option>';
49  } elseif (isset($_REQUEST['d']) && $delim == $_REQUEST['d']) {
50  echo '<option selected="selected" value="' . htmlspecialchars($delim) . '">' . htmlspecialchars($delimName) . '</option>';
51  } else {
52  echo '<option value="' . htmlspecialchars($delim) . '">' . htmlspecialchars($delimName) . '</option>';
53  }
54  }
55  echo '</select>';
56 }
57 echo '</form></td></tr>';
58 
59 echo '</table>';
60 
61 // End report settings
62 
63 
64 // Select time and date
65 echo '<table class="selecttime">';
66 echo '<tr><td class="selecttime_icon"><img src="' . SimpleSAML\Utils\HTTP::getBaseUrl() . 'resources/icons/crystal_project/date.32x32.png" alt="Select date and time" /></td>';
67 
68 if (isset($this->data['available.times.prev'])) {
69  echo '<td><a href="' . $this->data['get_times_prev'] . '">« Previous</a></td>';
70 } else {
71  echo '<td class="selecttime_link_grey">« Previous</td>';
72 }
73 
74 echo '<td class="td_right">';
75 echo '<form action="#">';
76 echo $this->data['post_res'];
77 if (!empty($this->data['available.timeres'])) {
78  echo '<select onchange="submit();" name="res">';
79  foreach ($this->data['available.timeres'] as $key => $timeresname) {
80  if ($key == $this->data['selected.timeres']) {
81  echo '<option selected="selected" value="' . $key . '">' . $timeresname . '</option>';
82  } else {
83  echo '<option value="' . $key . '">' . $timeresname . '</option>';
84  }
85  }
86  echo '</select>';
87 }
88 echo '</form></td>';
89 
90 echo '<td class="td_left">';
91 echo '<form action="#">';
92 echo $this->data['post_time'];
93 if (!empty($this->data['available.times'])) {
94  echo '<select onchange="submit();" name="time">';
95  foreach ($this->data['available.times'] as $key => $timedescr) {
96  if ($key == $this->data['selected.time']) {
97  echo '<option selected="selected" value="' . $key . '">' . $timedescr . '</option>';
98  } else {
99  echo '<option value="' . $key . '">' . $timedescr . '</option>';
100  }
101  }
102  echo '</select>';
103 }
104 echo '</form></td>';
105 
106 if (isset($this->data['available.times.next'])) {
107  echo '<td class="td_right td_next_right"><a href="' . $this->data['get_times_next'] . '">Next »</a></td>';
108 } else {
109  echo '<td class="td_right selecttime_link_grey td_next_right">Next »</td>';
110 }
111 
112 echo '</tr></table>';
113 echo '<div id="tabdiv">';
114 if (!empty($this->data['results'])){
115  echo '<ul class="tabset_tabs">
116  <li><a href="#graph">Graph</a></li>
117  <li><a href="#table">Summary table</a></li>
118  <li><a href="#debug">Time serie</a></li>
119  </ul>';
120  echo '
121 
122  <div id="graph" class="tabset_content">';
123 
124  echo '<img src="' . htmlspecialchars($this->data['imgurl']) . '" alt="Graph" />';
125 
126  echo '<form action="#">';
127  echo '<p class="p_right">Compare with total from this dataset ';
128  echo $this->data['post_rule2'];
129  echo '<select onchange="submit();" name="rule2">';
130  echo ' <option value="_">None</option>';
131  foreach ($this->data['available.rules'] as $key => $rule) {
132  if ($key === $this->data['selected.rule2']) {
133  echo '<option selected="selected" value="' . $key . '">' . $rule['name'] . '</option>';
134  } else {
135  echo '<option value="' . $key . '">' . $rule['name'] . '</option>';
136  }
137  }
138  echo '</select></p></form>';
139 
140  echo '</div>'; // end graph content.
141 
145  $classint = array('odd', 'even'); $i = 0;
146  echo '<div id="table" class="tabset_content">';
147 
148  if (isset($this->data['pieimgurl'])) {
149  echo '<img src="' . $this->data['pieimgurl'] . '" alt="Pie chart" />';
150  }
151  echo '<table class="tableview"><tr><th class="value">Value</th><th class="category">Data range</th></tr>';
152 
153  foreach ($this->data['summaryDataset'] as $key => $value) {
154  $clint = $classint[$i++ % 2];
155 
156  $keyName = $key;
157  if (array_key_exists($key, $this->data['delimiterPresentation'])) {
158  $keyName = $this->data['delimiterPresentation'][$key];
159  }
160 
161  if ($key === '_') {
162  echo '<tr class="total ' . $clint . '"><td class="value">' . $value . '</td><td class="category">' . $keyName . '</td></tr>';
163  } else {
164  echo '<tr class="' . $clint . '"><td class="value">' . $value . '</td><td class="category">' . $keyName . '</td></tr>';
165  }
166  }
167 
168  echo '</table></div>';
169  // - - - - - - - End table view - - - - - - -
170 
171  echo '<div id="debug" >';
172  echo '<table class="timeseries">';
173  echo '<tr><th>Time</th><th>Total</th>';
174  foreach ($this->data['topdelimiters'] as $key) {
175  $keyName = $key;
176  if (array_key_exists($key, $this->data['delimiterPresentation'])) {
177  $keyName = $this->data['delimiterPresentation'][$key];
178  }
179  echo'<th>' . $keyName . '</th>';
180  }
181  echo '</tr>';
182 
183  $i = 0;
184  foreach ($this->data['debugdata'] as $slot => $dd) {
185  echo '<tr class="' . ((++$i % 2) == 0 ? 'odd' : 'even') . '">';
186  echo '<td>' . $dd[0] . '</td>';
187  echo '<td class="datacontent">' . $dd[1] . '</td>';
188 
189  foreach ($this->data['topdelimiters'] as $key) {
190  echo '<td class="datacontent">' . (array_key_exists($key, $this->data['results'][$slot]) ?
191  $this->data['results'][$slot][$key] : '&nbsp;') . '</td>';
192  }
193  echo '</tr>';
194  }
195  echo '</table>';
196 
197 
198  echo '</div>'; // End debug tab content
199 } else {
200  echo '<h4 align="center">'.$this->data['error'].'</h4>';
201  echo '<p align="center"><a href="showstats.php">Clear selection</a></p>';
202 }
203 echo '</div>'; // End tab div
204 
205 $this->includeAtTemplateBase('includes/footer.php');
$this data['header']
static getModuleURL($resource, array $parameters=array())
Get absolute URL to a specified module resource.
Definition: Module.php:220
$rule
Definition: showstats.php:43
$i
Definition: disco.tpl.php:19
$key
Definition: croninfo.php:18