@@ -1,29 +1,29 @@ |
||
1 | 1 | <?php |
2 | -function VolunteerAutoload($classname) |
|
3 | -{ |
|
2 | +function VolunteerAutoload($classname) |
|
3 | +{ |
|
4 | 4 | $classname = str_replace('/', '\\', $classname); |
5 | 5 | $classname = ltrim($classname, '\\'); |
6 | 6 | $filename = ''; |
7 | 7 | $namespace = ''; |
8 | - if($lastNsPos = strrpos($classname, '\\')) |
|
9 | - { |
|
8 | + if($lastNsPos = strrpos($classname, '\\')) |
|
9 | + { |
|
10 | 10 | $namespace = substr($classname, 0, $lastNsPos); |
11 | 11 | $classname = substr($classname, $lastNsPos + 1); |
12 | 12 | $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR; |
13 | 13 | } |
14 | 14 | $filename = __DIR__.DIRECTORY_SEPARATOR.$filename.'class.'.$classname.'.php'; |
15 | - if(is_readable($filename)) |
|
16 | - { |
|
15 | + if(is_readable($filename)) |
|
16 | + { |
|
17 | 17 | require $filename; |
18 | 18 | } |
19 | 19 | } |
20 | 20 | |
21 | -if(version_compare(PHP_VERSION, '5.3.0', '>=')) |
|
22 | -{ |
|
21 | +if(version_compare(PHP_VERSION, '5.3.0', '>=')) |
|
22 | +{ |
|
23 | 23 | spl_autoload_register('VolunteerAutoload', true, true); |
24 | -} |
|
25 | -else |
|
26 | -{ |
|
24 | +} |
|
25 | +else |
|
26 | +{ |
|
27 | 27 | spl_autoload_register('VolunteerAutoload'); |
28 | 28 | } |
29 | 29 | /* vim: set tabstop=4 shiftwidth=4 expandtab: */ |
@@ -12,6 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | protected abstract function isVolunteerAdmin($request); |
14 | 14 | |
15 | + /** |
|
16 | + * @param VolunteerProfile|null $user |
|
17 | + */ |
|
15 | 18 | public function canUserDoRole($user, $role) |
16 | 19 | { |
17 | 20 | static $certs = null; |
@@ -155,6 +158,9 @@ discard block |
||
155 | 158 | return !in_array($deptId, $privateDepts); |
156 | 159 | } |
157 | 160 | |
161 | + /** |
|
162 | + * @param VolunteerShift $shift |
|
163 | + */ |
|
158 | 164 | protected function doShiftTimeChecks($shift, $entry) |
159 | 165 | { |
160 | 166 | $now = new DateTime(); |
@@ -3,6 +3,9 @@ |
||
3 | 3 | |
4 | 4 | class PendingRejectedEmail extends VolunteerEmail |
5 | 5 | { |
6 | + /** |
|
7 | + * @param \VolunteerProfile $userProfile |
|
8 | + */ |
|
6 | 9 | public function __construct($userProfile) |
7 | 10 | { |
8 | 11 | parent::__construct($userProfile); |
@@ -177,6 +177,9 @@ |
||
177 | 177 | return $res; |
178 | 178 | } |
179 | 179 | |
180 | + /** |
|
181 | + * @param Data\DataTable $dataTable |
|
182 | + */ |
|
180 | 183 | public function makeCopy($dataTable) |
181 | 184 | { |
182 | 185 | $tmp = $this->dbData; |
@@ -221,6 +221,11 @@ |
||
221 | 221 | return $response->withJSON($res, 500); |
222 | 222 | } |
223 | 223 | |
224 | + /** |
|
225 | + * @param string $status |
|
226 | + * @param Data\Filter $filter |
|
227 | + * @param Data\DataTable $dataTable |
|
228 | + */ |
|
224 | 229 | protected function doSignup($uid, $status, $entity, $filter, $dataTable) |
225 | 230 | { |
226 | 231 | if(isset($entity['earlyLate']) && $entity['earlyLate'] !== '-1') |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | } |
53 | 53 | if(!isset($obj['departmentID'])) |
54 | 54 | { |
55 | - return false; |
|
55 | + return false; |
|
56 | 56 | } |
57 | 57 | if(isset($obj['unbounded']) && $obj['unbounded']) |
58 | 58 | { |
59 | 59 | if(!isset($obj['minShifts']) || $obj['minShifts'] === 0 || $obj['minShifts'] === '') |
60 | 60 | { |
61 | - $obj['minShifts'] = '1'; |
|
61 | + $obj['minShifts'] = '1'; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | return $this->isUserDepartmentLead($obj['departmentID'], $this->user); |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | $ret = $dataTable->update($filter, $entArray[$i]); |
160 | 160 | if($ret === false) |
161 | 161 | { |
162 | - $myRet = false; |
|
163 | - array_push($errors, $array[$i]); |
|
162 | + $myRet = false; |
|
163 | + array_push($errors, $array[$i]); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | if($myRet) |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $entity = $this->processShift($entity, $request); |
266 | 266 | if(isset($entity['minShifts']) && $entity['minShifts'] > 0) |
267 | 267 | { |
268 | - $shift->makeCopy($dataTable); |
|
268 | + $shift->makeCopy($dataTable); |
|
269 | 269 | } |
270 | 270 | if(isset($entity['overlap']) && $entity['overlap']) |
271 | 271 | { |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $entity['status'] = 'unfilled'; |
332 | 332 | if(isset($entity['needEEApproval'])) |
333 | 333 | { |
334 | - unset($entity['needEEApproval']); |
|
334 | + unset($entity['needEEApproval']); |
|
335 | 335 | } |
336 | 336 | return $response->withJSON($dataTable->update($filter, $entity)); |
337 | 337 | } |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | $entity['status'] = 'unfilled'; |
529 | 529 | if(isset($entity['needEEApproval'])) |
530 | 530 | { |
531 | - unset($entity['needEEApproval']); |
|
531 | + unset($entity['needEEApproval']); |
|
532 | 532 | } |
533 | 533 | $ret = $dataTable->update($filter, $entity); |
534 | 534 | if($ret) |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | $entity['status'] = 'unfilled'; |
564 | 564 | if(isset($entity['needEEApproval'])) |
565 | 565 | { |
566 | - unset($entity['needEEApproval']); |
|
566 | + unset($entity['needEEApproval']); |
|
567 | 567 | } |
568 | 568 | return $response->withJSON($dataTable->update($filter, $entity)); |
569 | 569 | } |
@@ -6,6 +6,9 @@ discard block |
||
6 | 6 | parent::__construct($departmentID, $dbData, 'events', '_id'); |
7 | 7 | } |
8 | 8 | |
9 | + /** |
|
10 | + * @param integer $eeListIndex |
|
11 | + */ |
|
9 | 12 | public function hasVolOnEEList($uid, $eeListIndex) |
10 | 13 | { |
11 | 14 | if($eeListIndex === 1 || $eeListIndex === 0) |
@@ -28,6 +31,9 @@ discard block |
||
28 | 31 | return false; |
29 | 32 | } |
30 | 33 | |
34 | + /** |
|
35 | + * @param integer $eeListIndex |
|
36 | + */ |
|
31 | 37 | public function addToEEList($uid, $eeListIndex) |
32 | 38 | { |
33 | 39 | if(!isset($this->dbData['eeLists'])) |
@@ -28,62 +28,62 @@ |
||
28 | 28 | |
29 | 29 | protected function createPDFBody() |
30 | 30 | { |
31 | - $html = '<body>'; |
|
32 | - $html .= '<style type="text/css">table {border-collapse: collapse;} table, th, td {border: 1px solid black;}</style>'; |
|
33 | - $html .= '<h1 style="text-align: center;">'.$this->deptName.' Shift Schedule</h1>'; |
|
34 | - //Group shifts by day... |
|
35 | - $days = array(); |
|
36 | - $shifts = $this->shifts; |
|
37 | - $count = count($shifts); |
|
38 | - for($i = 0; $i < $count; $i++) |
|
39 | - { |
|
40 | - $start = new \DateTime($shifts[$i]['startTime']); |
|
41 | - $end = new \DateTime($shifts[$i]['endTime']); |
|
42 | - $shifts[$i]['startTime'] = $start; |
|
43 | - $shifts[$i]['endTime'] = $end; |
|
44 | - $dateStr = $start->format('l (n/j/Y)'); |
|
45 | - $timeStr = $start->format('g:i A').' till '.$end->format('g:i A'); |
|
46 | - if(strlen($shifts[$i]['name']) > 0) |
|
47 | - { |
|
48 | - $timeStr .= ' - <i>'.$shifts[$i]['name'].'</i>'; |
|
49 | - } |
|
50 | - if(!isset($days[$dateStr])) |
|
51 | - { |
|
52 | - $days[$dateStr] = array(); |
|
53 | - } |
|
54 | - if(!isset($days[$dateStr][$timeStr])) |
|
55 | - { |
|
56 | - $days[$dateStr][$timeStr] = array(); |
|
57 | - } |
|
58 | - array_push($days[$dateStr][$timeStr], $shifts[$i]); |
|
59 | - } |
|
60 | - uksort($days, array($this, 'daySort')); |
|
61 | - foreach($days as $dateStr=>$day) |
|
62 | - { |
|
63 | - $html .= '<h2>'.$dateStr.'</h2>'; |
|
64 | - uksort($day, array($this, 'groupSort')); |
|
65 | - foreach($day as $shiftStr=>$shifts) |
|
66 | - { |
|
67 | - usort($shifts, array($this, 'shiftSort')); |
|
68 | - $html .= '<h3>'.$shiftStr.'</h3>'; |
|
69 | - $html .= '<table width="100%"><tr><th style="width: 20%">Role</th><th>Volunteer Name</th><th>Volunteer Camp</th></tr>'; |
|
70 | - foreach($shifts as $shift) |
|
71 | - { |
|
72 | - $shift = new \VolunteerShift(false, $shift); |
|
73 | - $participant = $shift->participantObj; |
|
74 | - if($participant !== false) |
|
75 | - { |
|
76 | - $html .= '<tr><td>'.$this->getRoleNameFromID($shift->roleID).'</td><td>'.$participant->getDisplayName('paperName').'</td><td>'.$participant->campName.'</td></tr>'; |
|
77 | - } |
|
78 | - else |
|
79 | - { |
|
80 | - $html .= '<tr><td>'.$this->getRoleNameFromID($shift->roleID).'</td><td></td><td></td></tr>'; |
|
81 | - } |
|
82 | - } |
|
83 | - $html .= '</table>'; |
|
84 | - } |
|
85 | - } |
|
86 | - $html .= '</body>'; |
|
87 | - $this->setPDFFromHTML($html); |
|
31 | + $html = '<body>'; |
|
32 | + $html .= '<style type="text/css">table {border-collapse: collapse;} table, th, td {border: 1px solid black;}</style>'; |
|
33 | + $html .= '<h1 style="text-align: center;">'.$this->deptName.' Shift Schedule</h1>'; |
|
34 | + //Group shifts by day... |
|
35 | + $days = array(); |
|
36 | + $shifts = $this->shifts; |
|
37 | + $count = count($shifts); |
|
38 | + for($i = 0; $i < $count; $i++) |
|
39 | + { |
|
40 | + $start = new \DateTime($shifts[$i]['startTime']); |
|
41 | + $end = new \DateTime($shifts[$i]['endTime']); |
|
42 | + $shifts[$i]['startTime'] = $start; |
|
43 | + $shifts[$i]['endTime'] = $end; |
|
44 | + $dateStr = $start->format('l (n/j/Y)'); |
|
45 | + $timeStr = $start->format('g:i A').' till '.$end->format('g:i A'); |
|
46 | + if(strlen($shifts[$i]['name']) > 0) |
|
47 | + { |
|
48 | + $timeStr .= ' - <i>'.$shifts[$i]['name'].'</i>'; |
|
49 | + } |
|
50 | + if(!isset($days[$dateStr])) |
|
51 | + { |
|
52 | + $days[$dateStr] = array(); |
|
53 | + } |
|
54 | + if(!isset($days[$dateStr][$timeStr])) |
|
55 | + { |
|
56 | + $days[$dateStr][$timeStr] = array(); |
|
57 | + } |
|
58 | + array_push($days[$dateStr][$timeStr], $shifts[$i]); |
|
59 | + } |
|
60 | + uksort($days, array($this, 'daySort')); |
|
61 | + foreach($days as $dateStr=>$day) |
|
62 | + { |
|
63 | + $html .= '<h2>'.$dateStr.'</h2>'; |
|
64 | + uksort($day, array($this, 'groupSort')); |
|
65 | + foreach($day as $shiftStr=>$shifts) |
|
66 | + { |
|
67 | + usort($shifts, array($this, 'shiftSort')); |
|
68 | + $html .= '<h3>'.$shiftStr.'</h3>'; |
|
69 | + $html .= '<table width="100%"><tr><th style="width: 20%">Role</th><th>Volunteer Name</th><th>Volunteer Camp</th></tr>'; |
|
70 | + foreach($shifts as $shift) |
|
71 | + { |
|
72 | + $shift = new \VolunteerShift(false, $shift); |
|
73 | + $participant = $shift->participantObj; |
|
74 | + if($participant !== false) |
|
75 | + { |
|
76 | + $html .= '<tr><td>'.$this->getRoleNameFromID($shift->roleID).'</td><td>'.$participant->getDisplayName('paperName').'</td><td>'.$participant->campName.'</td></tr>'; |
|
77 | + } |
|
78 | + else |
|
79 | + { |
|
80 | + $html .= '<tr><td>'.$this->getRoleNameFromID($shift->roleID).'</td><td></td><td></td></tr>'; |
|
81 | + } |
|
82 | + } |
|
83 | + $html .= '</table>'; |
|
84 | + } |
|
85 | + } |
|
86 | + $html .= '</body>'; |
|
87 | + $this->setPDFFromHTML($html); |
|
88 | 88 | } |
89 | 89 | } |
@@ -72,7 +72,7 @@ |
||
72 | 72 | $shift = new \VolunteerShift(false, $shift); |
73 | 73 | $participant = $shift->participantObj; |
74 | 74 | if($participant !== false) |
75 | - { |
|
75 | + { |
|
76 | 76 | $html .= '<tr><td>'.$this->getRoleNameFromID($shift->roleID).'</td><td>'.$participant->getDisplayName('paperName').'</td><td>'.$participant->campName.'</td></tr>'; |
77 | 77 | } |
78 | 78 | else |
@@ -232,7 +232,7 @@ |
||
232 | 232 | while($shift) |
233 | 233 | { |
234 | 234 | $timeDiff = $originalStartTime->diff($shift['startTime']); |
235 | - $hoursFromStart = ($timeDiff->d * 24)+$timeDiff->h; |
|
235 | + $hoursFromStart = ($timeDiff->d * 24) + $timeDiff->h; |
|
236 | 236 | $rowForShift = $this->getRowForShift($shift['roleID'], $rows, $hoursFromStart + 2, $sheat); |
237 | 237 | $this->createShiftCell($sheat, $hoursFromStart + 2, $rowForShift, $shift); |
238 | 238 | $shift = array_shift($shifts); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $page->body .= '<div class="row"><h3>Filled Shifts</h3></div><div class="row"><table class="table"><tr><th>Role</th><th>Participant</th></tr>'; |
50 | 50 | foreach($filled as $shift) |
51 | 51 | { |
52 | - $page->body .= '<tr><td>'.$shift->role->display_name.'</td><td>'.$shift->webParticipantName.'</td></tr>'; |
|
52 | + $page->body .= '<tr><td>'.$shift->role->display_name.'</td><td>'.$shift->webParticipantName.'</td></tr>'; |
|
53 | 53 | } |
54 | 54 | $page->body .= '</table></div>'; |
55 | 55 | $page->body .= '<div class="row"><h3>Unfilled Shifts</h3></div><div class="row"><table class="table"><tr><th>Role</th><th>Sign Up</th></tr>'; |