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