Commit d3ee926a458bf936a605ef1e2c482befb83c5a12
1 parent
a48bc8bd
Exists in
master
and in
106 other branches
users in dataset Stat
Showing
1 changed file
with
13 additions
and
6 deletions
Show diff stats
php/classes/AmdaStats.php
@@ -74,7 +74,7 @@ class AmdaStats { | @@ -74,7 +74,7 @@ class AmdaStats { | ||
74 | 74 | ||
75 | $doc2 = new DomDocument("1.0"); | 75 | $doc2 = new DomDocument("1.0"); |
76 | if ($year == null) $year = date("Y"); | 76 | if ($year == null) $year = date("Y"); |
77 | - | 77 | + |
78 | $users=glob(USERPATH."*"); | 78 | $users=glob(USERPATH."*"); |
79 | foreach ($users as $user) { | 79 | foreach ($users as $user) { |
80 | $name2 = $user."/Stats$year.xml"; | 80 | $name2 = $user."/Stats$year.xml"; |
@@ -82,7 +82,7 @@ class AmdaStats { | @@ -82,7 +82,7 @@ class AmdaStats { | ||
82 | if (!file_exists($name2)) continue; | 82 | if (!file_exists($name2)) continue; |
83 | 83 | ||
84 | $doc2->load($name2); | 84 | $doc2->load($name2); |
85 | - | 85 | + |
86 | foreach ($tags as $tag) { | 86 | foreach ($tags as $tag) { |
87 | $tag1 = $this->statXml->getElementsByTagName($tag)->item(0); | 87 | $tag1 = $this->statXml->getElementsByTagName($tag)->item(0); |
88 | $tag2 = $doc2->getElementsByTagName($tag)->item(0); | 88 | $tag2 = $doc2->getElementsByTagName($tag)->item(0); |
@@ -100,7 +100,7 @@ class AmdaStats { | @@ -100,7 +100,7 @@ class AmdaStats { | ||
100 | $this->getModulesStat(null,null,true); | 100 | $this->getModulesStat(null,null,true); |
101 | // write data statistics as json | 101 | // write data statistics as json |
102 | $this->getDataStat(0,null,null,true); | 102 | $this->getDataStat(0,null,null,true); |
103 | - | 103 | + |
104 | return $this->statXml->save(StatsXml); | 104 | return $this->statXml->save(StatsXml); |
105 | } | 105 | } |
106 | 106 | ||
@@ -210,6 +210,7 @@ class AmdaStats { | @@ -210,6 +210,7 @@ class AmdaStats { | ||
210 | $TOTALarray = array(); | 210 | $TOTALarray = array(); |
211 | $STARTarray = array(); | 211 | $STARTarray = array(); |
212 | $STOParray = array(); | 212 | $STOParray = array(); |
213 | + $usersArray = array(); | ||
213 | 214 | ||
214 | foreach ($this->tasks as $task) { | 215 | foreach ($this->tasks as $task) { |
215 | $theTask = $this->statXml->getElementsByTagName($task)->item(0); | 216 | $theTask = $this->statXml->getElementsByTagName($task)->item(0); |
@@ -219,10 +220,14 @@ class AmdaStats { | @@ -219,10 +220,14 @@ class AmdaStats { | ||
219 | foreach ($items as $item){ | 220 | foreach ($items as $item){ |
220 | $VIs = $item->getElementsByTagName('dataset'); | 221 | $VIs = $item->getElementsByTagName('dataset'); |
221 | $time = strtotime($item->getAttribute('date')); | 222 | $time = strtotime($item->getAttribute('date')); |
222 | - | 223 | + $user = $item->getAttribute('user'); |
224 | + | ||
223 | foreach ($VIs as $VI) { | 225 | foreach ($VIs as $VI) { |
224 | $id = $VI->nodeValue; | 226 | $id = $VI->nodeValue; |
225 | if ($id) { | 227 | if ($id) { |
228 | + | ||
229 | + $usersArray[$id][$user]++; | ||
230 | + | ||
226 | if ($TASKarray[$id]) { | 231 | if ($TASKarray[$id]) { |
227 | $TASKarray[$id]++; | 232 | $TASKarray[$id]++; |
228 | $TOTALarray[$id]++; | 233 | $TOTALarray[$id]++; |
@@ -251,7 +256,7 @@ class AmdaStats { | @@ -251,7 +256,7 @@ class AmdaStats { | ||
251 | } | 256 | } |
252 | $VIarray[$task] = $TASKarray; | 257 | $VIarray[$task] = $TASKarray; |
253 | } | 258 | } |
254 | - | 259 | + |
255 | $GENERALarray = array(); | 260 | $GENERALarray = array(); |
256 | arsort($TOTALarray); | 261 | arsort($TOTALarray); |
257 | 262 | ||
@@ -264,12 +269,14 @@ class AmdaStats { | @@ -264,12 +269,14 @@ class AmdaStats { | ||
264 | $mining = $VIarray['mining'][$key]; | 269 | $mining = $VIarray['mining'][$key]; |
265 | $print = $VIarray['print'][$key]; | 270 | $print = $VIarray['print'][$key]; |
266 | $stat = $VIarray['statistics'][$key]; | 271 | $stat = $VIarray['statistics'][$key]; |
272 | + $uniqueUsers = count($usersArray[$key]); | ||
273 | + | ||
267 | if ($key != 'undefined') | 274 | if ($key != 'undefined') |
268 | { | 275 | { |
269 | $GENERALarray[] = array('id' => $key, 'number' => $value, 'percent' => $value, | 276 | $GENERALarray[] = array('id' => $key, 'number' => $value, 'percent' => $value, |
270 | 'plot' => $plot, 'mining' => $mining, | 277 | 'plot' => $plot, 'mining' => $mining, |
271 | 'print' => $print,'statistics' => $stat, | 278 | 'print' => $print,'statistics' => $stat, |
272 | - 'start' => $viStart, 'stop' => $viStop); | 279 | + 'start' => $viStart, 'stop' => $viStop, 'unique' => $uniqueUsers); |
273 | 280 | ||
274 | $Ntotal += $value; | 281 | $Ntotal += $value; |
275 | } | 282 | } |