forked from scieloorg/Web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AccessServiceResult.php
45 lines (32 loc) · 1.41 KB
/
AccessServiceResult.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
require_once(dirname(__FILE__)."/ServiceResult.php");
require_once(dirname(__FILE__)."/../ArticleStats.php");
require_once(dirname(__FILE__)."/../ArticleRequests.php");
class AccessServiceResult extends ServiceResult {
/* ===================================================================== */
function AccessServiceResult($stringXml){
$this->ServiceResult($stringXml);
}
function getStats(){
$articleStats = new ArticleStats();
$tmp = &$this->domLiteDocument->getElementsByPath("//STATPARAM");
for ($i=0;$i<$tmp->getLength();$i++){
$item = $tmp->item($i);
$articleStats->setStartDate($this->getNodeText($item, 'START_DATE'));
$articleStats->setCurrentDate($this->getNodeText($item, 'CURRENT_DATE'));
}
$tmp = &$this->domLiteDocument->getElementsByPath("//ARTICLE");
for ($i=0;$i<$tmp->getLength();$i++){
$articleRequests = new ArticleRequests();
$item = $tmp->item($i);
$articleRequests->setLang($this->getNodeAttribute($item, 'TEXT_LANG'));
$articleRequests->setYear($this->getNodeAttribute($item, 'ANO'));
$articleRequests->setMonth($this->getNodeAttribute($item, 'MES'));
$articleRequests->setNumberOfRequests($this->getNodeAttribute($item, 'REQUESTS'));
$arrayArticleRequests[] = $articleRequests;
}
$articleStats->setRequests($arrayArticleRequests);
return $articleStats;
}
}//class
?>