1 | <?php |
||
2 | class VolunteerDepartment extends VolunteerObject |
||
3 | { |
||
4 | public function __construct($departmentID, $dbData = null) |
||
5 | { |
||
6 | parent::__construct($departmentID, $dbData, 'departments', 'departmentID'); |
||
7 | } |
||
8 | |||
9 | public function getLeadEmails() |
||
10 | { |
||
11 | $leadTitle = $this->dbData['lead']; |
||
12 | $auth = \AuthProvider::getInstance(); |
||
13 | $users = $auth->getUsersByFilter(new \Data\Filter('title eq '.$leadTitle), array('mail')); |
||
14 | if(empty($users)) |
||
15 | { |
||
16 | return null; |
||
17 | } |
||
18 | $count = count($users); |
||
19 | for($i = 0; $i < $count; $i++) |
||
20 | { |
||
21 | $users[$i] = $users[$i]['mail']; |
||
22 | } |
||
23 | return $users; |
||
24 | } |
||
25 | |||
26 | public static function getPrivateDepartments() |
||
27 | { |
||
28 | $dataTable = DataSetFactory::getDataTableByNames('fvs', 'departments'); |
||
29 | $filter = new \Data\Filter('public eq false'); |
||
30 | $depts = $dataTable->read($filter); |
||
31 | $res = array(); |
||
32 | if(empty($depts)) |
||
33 | { |
||
34 | return $res; |
||
35 | } |
||
36 | $count = count($depts); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
37 | for($i = 0; $i < $count; $i++) |
||
38 | { |
||
39 | array_push($res, $depts[$i]['departmentID']); |
||
40 | } |
||
41 | return $res; |
||
42 | } |
||
43 | } |
||
44 |