-
Notifications
You must be signed in to change notification settings - Fork 3
/
class.payment.list.php
80 lines (73 loc) · 2.52 KB
/
class.payment.list.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
class paymentlist {
private $arList = NULL;
private $iSender = NULL;
private $iReceiver = NULL;
private $iSenderGroup = NULL;
private $iReceiverGroup = NULL;
private $iMarket = NULL;
public function paymentlist($arArguments) {
foreach ($arArguments as $strKey=>$oValue) {
switch(strtolower($strKey)) {
case "sender":
$this->sender($oValue);
break;
case "receiver":
$this->receiver($oValue);
break;
case "sendergroup":
$this->sender(NULL, $oValue);
break;
case "receivergroup":
$this->receiver(NULL, $oValue);
break;
case "market":
$this->market($oValue);
break;
default:
error("class.payment.list : $strKey is ongeldig argument");
}
}
}
public function sender($iSender = NULL, $iGroup = NULL){
if (!is_null($iSender)) $this->iSender = $iSender;
if (!is_null($iGroup)) $this->iSenderGroup = $iGroup;
return $this->iSender;
}
public function receiver($iReceiver = NULL){
if (!is_null($iReceiver)) $this->iReceiver = $iReceiver;
if (!is_null($iGroup)) $this->iReceiverGroup = $iGroup;
return $this->iReceiver;
}
public function market($iMarket = NULL){
if (!is_null($iMarket)) $this->iMarket = $iMarket;
return $this->iMarket;
}
public function getList(){
if (is_null($this->arList)) {
$arWhere = array();
if (!is_null($iMarket)) $arWhere[] = "(market = " . $iMarket . " or voorschot = " . $iMarket . ")";
if (!is_null($iSender)) $arWhere[] = "sender = " . $iSender;
if (!is_null($iReceiver)) $arWhere[] = "receiver = " . $iReceiver;
if (!is_null($iSenderGroup)) $arWhere[] = "sendergroup = " . $iSender;
if (!is_null($iReceiverGroup)) $arWhere[] = "receivergroup = " . $iReceiver;
$this->arList = array();
$oDB = new database("select * from tblPayments where " . implode(" and ", $arWhere) . " order by id desc;" , TRUE);
while ($oDB->nextRecord()) {
$oPayment = new payment(array(
"id" => $oDB->get("id"),
"sender" => $oDB->get("sender"),
"receiver" => $oDB->get("receiver"),
"sendergroup" => $oDB->get("sendergroup"),
"receivergroup" => $oDB->get("receivergroup"),
"initiator" => $oDB->get("initiator"),
"market" => $oDB->get("market"),
"voorschot" => ($oDB->get("voorschot")!=0),
));
if ($oPayment->voorschot()) $oPayment->market($oDB->get("market"));
$this->arList[] = $oPayment;
}
}
return $this->arList;
}
}