forked from nybohansen/rostanvo
/
Clicks.class.php
54 lines (48 loc) · 1.69 KB
/
Clicks.class.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
46
47
48
49
50
51
52
53
54
<?php
/**
* @copyright Copyright (c) 2007 Quality Unit s.r.o.
* @author Michal Bebjak
* @package PostAffiliatePro
* @since Version 1.0.0
*
* Licensed under the Quality Unit, s.r.o. Standard End User License Agreement,
* Version 1.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.qualityunit.com/licenses/license
*
*/
/**
* @package PostAffiliatePro
*/
class Pap_Stats_Computer_Clicks extends Pap_Stats_Computer_Base {
/**
* @var Pap_Stats_Data_Click
*/
private $result;
public function __construct(Pap_Stats_Params $params) {
parent::__construct(Pap_Db_Table_Clicks::getInstance(), $params);
}
protected function initSelectClause() {
$this->selectBuilder->select->add("sum(t.".Pap_Db_Table_Clicks::RAW.")", "raw");
$this->selectBuilder->select->add("sum(t.".Pap_Db_Table_Clicks::UNIQUE.")", "uniq");
$this->selectBuilder->select->add("sum(t.".Pap_Db_Table_Clicks::DECLINED.")", "declined");
}
protected function processResult() {
try {
$resultRow = $this->selectBuilder->getOneRow();
$this->result = new Pap_Stats_Data_Click($resultRow->get("raw"),
$resultRow->get("uniq"),
$resultRow->get("declined"));
} catch (Gpf_DbEngine_NoRowException $e) {
$this->result = new Pap_Stats_Data_Click(0, 0, 0);
return;
}
}
/**
* @return Pap_Stats_Data_Click
*/
public function getResult() {
return $this->result;
}
}
?>