@@ -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); |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | |
10 | 10 | if(!isset($_GET['id'])) |
11 | 11 | { |
12 | - $page->body .= 'Error! Missing Group ID. You must have followed a bad link!'; |
|
13 | - $page->printPage(); |
|
14 | - return; |
|
12 | + $page->body .= 'Error! Missing Group ID. You must have followed a bad link!'; |
|
13 | + $page->printPage(); |
|
14 | + return; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | $groupID = $_GET['id']; |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | $shifts = $dataTable->read($filter); |
21 | 21 | if(empty($shifts)) |
22 | 22 | { |
23 | - $page->body .= 'Error! Could not locate shifts. You must have followed an old link!'; |
|
24 | - $page->printPage(); |
|
25 | - return; |
|
23 | + $page->body .= 'Error! Could not locate shifts. You must have followed an old link!'; |
|
24 | + $page->printPage(); |
|
25 | + return; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $filled = array(); |
@@ -32,35 +32,35 @@ discard block |
||
32 | 32 | $count = count($shifts); |
33 | 33 | for($i = 0; $i < $count; $i++) |
34 | 34 | { |
35 | - $shifts[$i] = new \VolunteerShift(false, $shifts[$i]); |
|
36 | - if($shifts[$i]->status === 'filled' || $shifts[$i]->status === 'pending') |
|
37 | - { |
|
38 | - array_push($filled, $shifts[$i]); |
|
39 | - if($page->user && $shifts[$i]->participant === $page->user->uid) |
|
40 | - { |
|
41 | - $alreadySignedUp = true; |
|
42 | - } |
|
43 | - } |
|
44 | - else |
|
45 | - { |
|
46 | - array_push($available, $shifts[$i]); |
|
47 | - } |
|
35 | + $shifts[$i] = new \VolunteerShift(false, $shifts[$i]); |
|
36 | + if($shifts[$i]->status === 'filled' || $shifts[$i]->status === 'pending') |
|
37 | + { |
|
38 | + array_push($filled, $shifts[$i]); |
|
39 | + if($page->user && $shifts[$i]->participant === $page->user->uid) |
|
40 | + { |
|
41 | + $alreadySignedUp = true; |
|
42 | + } |
|
43 | + } |
|
44 | + else |
|
45 | + { |
|
46 | + array_push($available, $shifts[$i]); |
|
47 | + } |
|
48 | 48 | } |
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>'; |
56 | 56 | foreach($available as $shift) |
57 | 57 | { |
58 | - $cell = '<i>You already have a shift!</i>'; |
|
59 | - if($alreadySignedUp === false) |
|
60 | - { |
|
58 | + $cell = '<i>You already have a shift!</i>'; |
|
59 | + if($alreadySignedUp === false) |
|
60 | + { |
|
61 | 61 | $cell = '<button type="button" class="btn btn-primary" onClick="signUp(\''.$shift->_id.'\');">Sign Up</button>'; |
62 | - } |
|
63 | - $page->body.= '<tr><td>'.$shift->role->display_name.'</td><td>'.$cell.'</td></tr>'; |
|
62 | + } |
|
63 | + $page->body.= '<tr><td>'.$shift->role->display_name.'</td><td>'.$cell.'</td></tr>'; |
|
64 | 64 | } |
65 | 65 | $page->body .= '</table></div>'; |
66 | 66 | $page->printPage(); |
@@ -49,7 +49,7 @@ discard block |
||
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>'; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | { |
61 | 61 | $cell = '<button type="button" class="btn btn-primary" onClick="signUp(\''.$shift->_id.'\');">Sign Up</button>'; |
62 | 62 | } |
63 | - $page->body.= '<tr><td>'.$shift->role->display_name.'</td><td>'.$cell.'</td></tr>'; |
|
63 | + $page->body .= '<tr><td>'.$shift->role->display_name.'</td><td>'.$cell.'</td></tr>'; |
|
64 | 64 | } |
65 | 65 | $page->body .= '</table></div>'; |
66 | 66 | $page->printPage(); |
@@ -113,7 +113,7 @@ |
||
113 | 113 | |
114 | 114 | public function isFilled() |
115 | 115 | { |
116 | - return isset($this->dbData['status']) && ($this->dbData['status'] === 'pending' || $this->dbData['status'] === 'filled' || $this->dbData['status'] === 'groupPending'); |
|
116 | + return isset($this->dbData['status']) && ($this->dbData['status'] === 'pending' || $this->dbData['status'] === 'filled' || $this->dbData['status'] === 'groupPending'); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | public function findOverlaps($uid, $shortCircuit = false) |
@@ -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; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $timeStr = $start->format('g:i A').' till '.$end->format('g:i A'); |
46 | 46 | if(strlen($shifts[$i]['name']) > 0) |
47 | 47 | { |
48 | - $timeStr .=' - <i>'.$shifts[$i]['name'].'</i>'; |
|
48 | + $timeStr .= ' - <i>'.$shifts[$i]['name'].'</i>'; |
|
49 | 49 | } |
50 | 50 | if(!isset($days[$dateStr])) |
51 | 51 | { |
@@ -60,30 +60,30 @@ discard block |
||
60 | 60 | uksort($days, array($this, 'daySort')); |
61 | 61 | foreach($days as $dateStr=>$day) |
62 | 62 | { |
63 | - $html .='<h2>'.$dateStr.'</h2>'; |
|
63 | + $html .= '<h2>'.$dateStr.'</h2>'; |
|
64 | 64 | uksort($day, array($this, 'groupSort')); |
65 | 65 | foreach($day as $shiftStr=>$shifts) |
66 | 66 | { |
67 | 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>'; |
|
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 | 70 | foreach($shifts as $shift) |
71 | 71 | { |
72 | 72 | $shift = new \VolunteerShift(false, $shift); |
73 | 73 | $participant = $shift->participantObj; |
74 | 74 | if($participant !== false) |
75 | 75 | { |
76 | - $html .='<tr><td>'.$this->getRoleNameFromID($shift->roleID).'</td><td>'.$participant->getDisplayName('paperName').'</td><td>'.$participant->campName.'</td></tr>'; |
|
76 | + $html .= '<tr><td>'.$this->getRoleNameFromID($shift->roleID).'</td><td>'.$participant->getDisplayName('paperName').'</td><td>'.$participant->campName.'</td></tr>'; |
|
77 | 77 | } |
78 | 78 | else |
79 | 79 | { |
80 | - $html .='<tr><td>'.$this->getRoleNameFromID($shift->roleID).'</td><td></td><td></td></tr>'; |
|
80 | + $html .= '<tr><td>'.$this->getRoleNameFromID($shift->roleID).'</td><td></td><td></td></tr>'; |
|
81 | 81 | } |
82 | 82 | } |
83 | - $html .='</table>'; |
|
83 | + $html .= '</table>'; |
|
84 | 84 | } |
85 | 85 | } |
86 | - $html .='</body>'; |
|
86 | + $html .= '</body>'; |
|
87 | 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 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $this->isLead = $this->user->isInGroupNamed('Leads'); |
37 | 37 | if($this->isLead) |
38 | 38 | { |
39 | - $this->is_admin = true; |
|
39 | + $this->is_admin = true; |
|
40 | 40 | } |
41 | 41 | else |
42 | 42 | { |
@@ -44,7 +44,7 @@ |
||
44 | 44 | $uid = $this->user->uid; |
45 | 45 | $email = $this->user->mail; |
46 | 46 | $filter = new \Data\Filter("others eq $uid or others eq $email"); |
47 | - $dataTable = DataSetFactory::getDataTableByNames('fvs','departments'); |
|
47 | + $dataTable = DataSetFactory::getDataTableByNames('fvs', 'departments'); |
|
48 | 48 | $depts = $dataTable->read($filter); |
49 | 49 | $this->isLead = !empty($depts); |
50 | 50 | $this->is_admin = true; |
@@ -44,15 +44,15 @@ |
||
44 | 44 | $start = $this->shift->startTime->format('r'); |
45 | 45 | $end = $this->shift->endTime->format('r'); |
46 | 46 | $vars = array( |
47 | - '{$firstName}' => $firstName, |
|
48 | - '{$lastName}' => $lastName, |
|
49 | - '{$paperName}' => $paperName, |
|
50 | - '{$webName}' => $webName, |
|
51 | - '{$department}' => $department, |
|
52 | - '{$role}' => $role, |
|
53 | - '{$event}' => $event, |
|
54 | - '{$start}' => $start, |
|
55 | - '{$end}' => $end |
|
47 | + '{$firstName}' => $firstName, |
|
48 | + '{$lastName}' => $lastName, |
|
49 | + '{$paperName}' => $paperName, |
|
50 | + '{$webName}' => $webName, |
|
51 | + '{$department}' => $department, |
|
52 | + '{$role}' => $role, |
|
53 | + '{$event}' => $event, |
|
54 | + '{$start}' => $start, |
|
55 | + '{$end}' => $end |
|
56 | 56 | ); |
57 | 57 | if(strpos($this->text, '{$newStart}') !== false || strpos($this->text, '{$newEnd}') !== false) |
58 | 58 | { |
@@ -76,7 +76,7 @@ |
||
76 | 76 | $end = strpos($rawText, "</script>"); |
77 | 77 | if($index === 0) |
78 | 78 | { |
79 | - $rawText = substr($rawText, $end+9); |
|
79 | + $rawText = substr($rawText, $end + 9); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | return strtr(strip_tags($rawText), $vars); |
@@ -48,12 +48,12 @@ |
||
48 | 48 | $certType = $this->additionalProps['certType']; |
49 | 49 | $rejectReason = $this->additionalProps['reason']; |
50 | 50 | $vars = array( |
51 | - '{$firstName}' => $firstName, |
|
52 | - '{$lastName}' => $lastName, |
|
53 | - '{$paperName}' => $paperName, |
|
54 | - '{$webName}' => $webName, |
|
55 | - '{$certType}' => $certType, |
|
56 | - '{$rejectReason}' => $rejectReason |
|
51 | + '{$firstName}' => $firstName, |
|
52 | + '{$lastName}' => $lastName, |
|
53 | + '{$paperName}' => $paperName, |
|
54 | + '{$webName}' => $webName, |
|
55 | + '{$certType}' => $certType, |
|
56 | + '{$rejectReason}' => $rejectReason |
|
57 | 57 | ); |
58 | 58 | if($html === true) |
59 | 59 | { |
@@ -76,7 +76,7 @@ |
||
76 | 76 | $end = strpos($rawText, "</script>"); |
77 | 77 | if($index === 0) |
78 | 78 | { |
79 | - $rawText = substr($rawText, $end+9); |
|
79 | + $rawText = substr($rawText, $end + 9); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | return strtr(strip_tags($rawText), $vars); |