|
1
|
|
|
<?php |
|
2
|
|
|
class VolunteerEvent extends VolunteerObject |
|
3
|
|
|
{ |
|
4
|
|
|
public function __construct($departmentID, $dbData = null) |
|
5
|
|
|
{ |
|
6
|
|
|
parent::__construct($departmentID, $dbData, 'events', '_id'); |
|
7
|
|
|
} |
|
8
|
|
|
|
|
9
|
|
|
public function hasVolOnEEList($uid, $eeListIndex) |
|
10
|
|
|
{ |
|
11
|
|
|
$uid = urlencode($uid); |
|
12
|
|
|
$uid = str_replace('.', '%2E', $uid); |
|
13
|
|
|
if($eeListIndex === 1 || $eeListIndex === 0) |
|
14
|
|
|
{ |
|
15
|
|
|
//Check earlier EE lists too |
|
16
|
|
|
$val = $this->hasVolOnEEList($uid, $eeListIndex + 1); |
|
17
|
|
|
if($val === true) |
|
18
|
|
|
{ |
|
19
|
|
|
return true; |
|
20
|
|
|
} |
|
21
|
|
|
} |
|
22
|
|
|
if(isset($this->dbData['eeLists']) && isset($this->dbData['eeLists'][$eeListIndex])) |
|
23
|
|
|
{ |
|
24
|
|
|
$eeList = $this->dbData['eeLists'][$eeListIndex]; |
|
25
|
|
|
if(isset($eeList[$uid]) && $eeList[$uid]['AAR'] === true && $eeList[$uid]['AF'] === true && $eeList[$uid]['Lead'] === true) |
|
26
|
|
|
{ |
|
27
|
|
|
return true; |
|
28
|
|
|
} |
|
29
|
|
|
} |
|
30
|
|
|
return false; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function addToEEList($uid, $eeListIndex) |
|
34
|
|
|
{ |
|
35
|
|
|
$uid = urlencode($uid); |
|
36
|
|
|
$uid = str_replace('.', '%2E', $uid); |
|
37
|
|
|
if(!isset($this->dbData['eeLists'])) |
|
38
|
|
|
{ |
|
39
|
|
|
$this->dbData['eeLists'] = array(); |
|
40
|
|
|
} |
|
41
|
|
|
if(!isset($this->dbData['eeLists'][$eeListIndex])) |
|
42
|
|
|
{ |
|
43
|
|
|
$this->dbData['eeLists'][$eeListIndex] = array(); |
|
44
|
|
|
} |
|
45
|
|
|
$eeList = $this->dbData['eeLists'][$eeListIndex]; |
|
|
|
|
|
|
46
|
|
|
if(!isset($this->dbData['eeLists'][$eeListIndex][$uid])) |
|
47
|
|
|
{ |
|
48
|
|
|
$this->dbData['eeLists'][$eeListIndex][$uid] = array('AAR'=>false, 'AF'=>false, 'Lead'=>false); |
|
49
|
|
|
$dt = $this->getDataTable(); |
|
50
|
|
|
$filter = $this->getDataFilter(); |
|
51
|
|
|
return $dt->update($filter, $this->dbData); |
|
52
|
|
|
} |
|
53
|
|
|
return true; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function approveEE($uid, $eeListIndex, $type) |
|
57
|
|
|
{ |
|
58
|
|
|
$ret = false; |
|
59
|
|
|
switch($type) |
|
60
|
|
|
{ |
|
61
|
|
|
case 'aar': |
|
62
|
|
|
$this->dbData['eeLists'][$eeListIndex][$uid]['AAR'] = true; |
|
63
|
|
|
$ret = true; |
|
64
|
|
|
break; |
|
65
|
|
|
case 'af': |
|
66
|
|
|
$this->dbData['eeLists'][$eeListIndex][$uid]['AF'] = true; |
|
67
|
|
|
$ret = true; |
|
68
|
|
|
break; |
|
69
|
|
|
case 'lead': |
|
70
|
|
|
$this->dbData['eeLists'][$eeListIndex][$uid]['Lead'] = true; |
|
71
|
|
|
$ret = true; |
|
72
|
|
|
break; |
|
73
|
|
|
} |
|
74
|
|
|
if($ret) |
|
75
|
|
|
{ |
|
76
|
|
|
$dt = $this->getDataTable(); |
|
77
|
|
|
$filter = $this->getDataFilter(); |
|
78
|
|
|
return $dt->update($filter, $this->dbData); |
|
79
|
|
|
} |
|
80
|
|
|
return $ret; |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
/* vim: set tabstop=4 shiftwidth=4 expandtab: */ |
|
84
|
|
|
|