ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
RatioDataset.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Andreas Åkre Solberg <andreas.solberg@uninett.no>
4  * @package SimpleSAMLphp
5  */
7 {
8  public function aggregateSummary()
9  {
13  $this->summary = array();
14  $noofvalues = array();
15  foreach ($this->results as $slot => $res) {
16  foreach ($res AS $key => $value) {
17  if (array_key_exists($key, $this->summary)) {
18  $this->summary[$key] += $value;
19  if ($value > 0) {
20  $noofvalues[$key]++;
21  }
22  } else {
23  $this->summary[$key] = $value;
24  if ($value > 0) {
25  $noofvalues[$key] = 1;
26  } else {
27  $noofvalues[$key] = 0;
28  }
29  }
30  }
31  }
32 
33  foreach ($this->summary as $key => $val) {
34  $this->summary[$key] = $this->divide($this->summary[$key], $noofvalues[$key]);
35  }
36 
37  asort($this->summary);
38  $this->summary = array_reverse($this->summary, true);
39  }
40 
41  private function ag($k, $a)
42  {
43  if (array_key_exists($k, $a)) {
44  return $a[$k];
45  }
46  return 0;
47  }
48 
49  private function divide($v1, $v2)
50  {
51  if ($v2 == 0) {
52  return 0;
53  }
54  return ($v1 / $v2);
55  }
56 
57  public function combine($result1, $result2)
58  {
59  $combined = array();
60 
61  foreach ($result2 as $tick => $val) {
62  $combined[$tick] = array();
63  foreach ($val as $index => $num) {
64  $combined[$tick][$index] = $this->divide(
65  $this->ag($index, $result1[$tick]),
66  $this->ag($index, $result2[$tick])
67  );
68  }
69  }
70  return $combined;
71  }
72 
73  public function getPieData()
74  {
75  return null;
76  }
77 }
78 
combine($result1, $result2)
$index
Definition: metadata.php:60
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
$key
Definition: croninfo.php:18