ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
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
*/
6
class
sspmod_statistics_RatioDataset
extends
sspmod_statistics_StatDataset
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
sspmod_statistics_RatioDataset\combine
combine($result1, $result2)
Definition:
RatioDataset.php:57
$index
$index
Definition:
metadata.php:60
sspmod_statistics_RatioDataset\ag
ag($k, $a)
Definition:
RatioDataset.php:41
sspmod_statistics_StatDataset
Definition:
StatDataset.php:8
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
sspmod_statistics_RatioDataset\getPieData
getPieData()
Definition:
RatioDataset.php:73
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
sspmod_statistics_RatioDataset\aggregateSummary
aggregateSummary()
Definition:
RatioDataset.php:8
sspmod_statistics_RatioDataset
Definition:
RatioDataset.php:6
sspmod_statistics_RatioDataset\divide
divide($v1, $v2)
Definition:
RatioDataset.php:49
$key
$key
Definition:
croninfo.php:18
libs
composer
vendor
simplesamlphp
simplesamlphp
modules
statistics
lib
RatioDataset.php
Generated on Tue Jan 28 2025 19:01:12 for ILIAS by
1.8.13 (using
Doxyfile
)