@@ -41,7 +41,7 @@ |
||
| 41 | 41 | protected function canUpdate($request, $entity) |
| 42 | 42 | { |
| 43 | 43 | if($this->isVolunteerAdmin($request)) |
| 44 | - { |
|
| 44 | + { |
|
| 45 | 45 | return true; |
| 46 | 46 | } |
| 47 | 47 | return $this->isUserDepartmentLead($entity['departmentID'], $this->user); |
@@ -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') |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | protected function canUpdate($request, $entity) |
| 34 | 34 | { |
| 35 | - if($this->isVolunteerAdmin($request)) |
|
| 35 | + if($this->isVolunteerAdmin($request)) |
|
| 36 | 36 | { |
| 37 | 37 | return true; |
| 38 | 38 | } |
@@ -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 | } |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | protected function canUpdate($request, $entity) |
| 37 | 37 | { |
| 38 | 38 | if($this->isVolunteerAdmin($request)) |
| 39 | - { |
|
| 39 | + { |
|
| 40 | 40 | return true; |
| 41 | 41 | } |
| 42 | 42 | //TODO give access to department lead |
@@ -106,24 +106,24 @@ |
||
| 106 | 106 | if($format === false || $format === 'text/calendar') |
| 107 | 107 | { |
| 108 | 108 | $text = "BEGIN:VCALENDAR\r\n"; |
| 109 | - $text.= "VERSION:2.0\r\n"; |
|
| 110 | - $text.= "PRODID:-//hacksw/handcal//NONSGML v1.0//EN\r\n"; |
|
| 109 | + $text .= "VERSION:2.0\r\n"; |
|
| 110 | + $text .= "PRODID:-//hacksw/handcal//NONSGML v1.0//EN\r\n"; |
|
| 111 | 111 | $count = count($shifts); |
| 112 | 112 | for($i = 0; $i < $count; $i++) |
| 113 | 113 | { |
| 114 | - $text.= "BEGIN:VEVENT\r\n"; |
|
| 115 | - $text.= "UID:".$this->user->mail."\r\n"; |
|
| 114 | + $text .= "BEGIN:VEVENT\r\n"; |
|
| 115 | + $text .= "UID:".$this->user->mail."\r\n"; |
|
| 116 | 116 | $d = new DateTime($shifts[$i]['startTime']); |
| 117 | 117 | $d->setTimezone(new \DateTimeZone('UTC')); |
| 118 | - $text.= "DTSTAMP:".$d->format('Ymd\THis\Z')."\r\n"; |
|
| 119 | - $text.= "DTSTART:".$d->format('Ymd\THis\Z')."\r\n"; |
|
| 118 | + $text .= "DTSTAMP:".$d->format('Ymd\THis\Z')."\r\n"; |
|
| 119 | + $text .= "DTSTART:".$d->format('Ymd\THis\Z')."\r\n"; |
|
| 120 | 120 | $d = new DateTime($shifts[$i]['endTime']); |
| 121 | 121 | $d->setTimezone(new \DateTimeZone('UTC')); |
| 122 | - $text.= "DTEND:".$d->format('Ymd\THis\Z')."\r\n"; |
|
| 123 | - $text.= "SUMMARY:".$shifts[$i]['roleID'].' '.$shifts[$i]['name']."\r\n"; |
|
| 124 | - $text.= "END:VEVENT\r\n"; |
|
| 122 | + $text .= "DTEND:".$d->format('Ymd\THis\Z')."\r\n"; |
|
| 123 | + $text .= "SUMMARY:".$shifts[$i]['roleID'].' '.$shifts[$i]['name']."\r\n"; |
|
| 124 | + $text .= "END:VEVENT\r\n"; |
|
| 125 | 125 | } |
| 126 | - $text.= "END:VCALENDAR\r\n"; |
|
| 126 | + $text .= "END:VCALENDAR\r\n"; |
|
| 127 | 127 | $response = $response->withHeader('Content-type', 'text/calendar'); |
| 128 | 128 | $response = $response->withHeader('Content-Disposition', 'attachment; filename="MyShifts.ics"'); |
| 129 | 129 | $body = $response->getBody(); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | protected function canUpdate($request, $entity) |
| 34 | 34 | { |
| 35 | - if($this->isVolunteerAdmin($request)) |
|
| 35 | + if($this->isVolunteerAdmin($request)) |
|
| 36 | 36 | { |
| 37 | 37 | return true; |
| 38 | 38 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $odata = $request->getAttribute('odata', new \ODataParams(array())); |
| 90 | 90 | $filter = $this->getFilterForPrimaryKey($uid); |
| 91 | 91 | $areas = $dataTable->read($filter, $odata->select, $odata->top, |
| 92 | - $odata->skip, $odata->orderby); |
|
| 92 | + $odata->skip, $odata->orderby); |
|
| 93 | 93 | if(empty($areas)) |
| 94 | 94 | { |
| 95 | 95 | return $response->withStatus(404); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $odata = $request->getAttribute('odata', new \ODataParams(array())); |
| 161 | 161 | $filter = $this->getFilterForPrimaryKey($uid); |
| 162 | 162 | $areas = $dataTable->read($filter, array('certs'), $odata->top, |
| 163 | - $odata->skip, $odata->orderby); |
|
| 163 | + $odata->skip, $odata->orderby); |
|
| 164 | 164 | if(empty($areas)) |
| 165 | 165 | { |
| 166 | 166 | return $response->withStatus(404); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $user = $users[0]; |
| 195 | 195 | if(!isset($user['certs'])) |
| 196 | 196 | { |
| 197 | - $user['certs'] = array(); |
|
| 197 | + $user['certs'] = array(); |
|
| 198 | 198 | } |
| 199 | 199 | $files = $request->getUploadedFiles(); |
| 200 | 200 | $file = $files['file']; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | protected function canUpdate($request, $entity) |
| 39 | 39 | { |
| 40 | - if($this->isVolunteerAdmin($request)) |
|
| 40 | + if($this->isVolunteerAdmin($request)) |
|
| 41 | 41 | { |
| 42 | 42 | return true; |
| 43 | 43 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | $shifts = $dataTable->read($filter, $odata->select, $odata->top, |
| 99 | - $odata->skip, $odata->orderby); |
|
| 99 | + $odata->skip, $odata->orderby); |
|
| 100 | 100 | if($shifts === false) |
| 101 | 101 | { |
| 102 | 102 | $shifts = array(); |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | protected function canUpdate($request, $entity) |
| 39 | 39 | { |
| 40 | 40 | if($this->isVolunteerAdmin($request)) |
| 41 | - { |
|
| 41 | + { |
|
| 42 | 42 | return true; |
| 43 | 43 | } |
| 44 | 44 | return false; |
@@ -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: */ |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | for($j = 0; $j < $rowCount; $j++) |
| 48 | 48 | { |
| 49 | - $cell = $sheat->getCellByColumnAndRow($i+2, $j+4); |
|
| 50 | - if($cell->isInMergeRange()) |
|
| 51 | - { |
|
| 52 | - continue; |
|
| 53 | - } |
|
| 54 | - else |
|
| 55 | - { |
|
| 56 | - $style = $cell->getStyle(); |
|
| 57 | - $style->getBorders()->getAllBorders()->setBorderStyle(false); |
|
| 58 | - $style->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_PATTERN_LIGHTGRAY); |
|
| 59 | - } |
|
| 49 | + $cell = $sheat->getCellByColumnAndRow($i+2, $j+4); |
|
| 50 | + if($cell->isInMergeRange()) |
|
| 51 | + { |
|
| 52 | + continue; |
|
| 53 | + } |
|
| 54 | + else |
|
| 55 | + { |
|
| 56 | + $style = $cell->getStyle(); |
|
| 57 | + $style->getBorders()->getAllBorders()->setBorderStyle(false); |
|
| 58 | + $style->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_PATTERN_LIGHTGRAY); |
|
| 59 | + } |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -86,15 +86,15 @@ discard block |
||
| 86 | 86 | $shifts[$i]['length'] = $diff->h; |
| 87 | 87 | if(!isset($roles[$shifts[$i]['roleID']])) |
| 88 | 88 | { |
| 89 | - $roles[$shifts[$i]['roleID']] = $shifts[$i]['length']; |
|
| 90 | - $roles2[$shifts[$i]['roleID']] = array(); |
|
| 89 | + $roles[$shifts[$i]['roleID']] = $shifts[$i]['length']; |
|
| 90 | + $roles2[$shifts[$i]['roleID']] = array(); |
|
| 91 | 91 | } |
| 92 | 92 | else |
| 93 | 93 | { |
| 94 | - if($roles[$shifts[$i]['roleID']] < $shifts[$i]['length']) |
|
| 95 | - { |
|
| 96 | - $roles[$shifts[$i]['roleID']] = $shifts[$i]['length']; |
|
| 97 | - } |
|
| 94 | + if($roles[$shifts[$i]['roleID']] < $shifts[$i]['length']) |
|
| 95 | + { |
|
| 96 | + $roles[$shifts[$i]['roleID']] = $shifts[$i]['length']; |
|
| 97 | + } |
|
| 98 | 98 | } |
| 99 | 99 | array_push($roles2[$shifts[$i]['roleID']], array('start'=>$start, 'end'=>$end)); |
| 100 | 100 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | for($j = 0; $j < $rowCount; $j++) |
| 53 | 53 | { |
| 54 | - $cell = $sheat->getCellByColumnAndRow($i+2, $j+4); |
|
| 54 | + $cell = $sheat->getCellByColumnAndRow($i + 2, $j + 4); |
|
| 55 | 55 | if($cell->isInMergeRange()) |
| 56 | 56 | { |
| 57 | 57 | continue; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | protected function createShiftCell($sheat, $col, $row, $shift) |
| 95 | 95 | { |
| 96 | - $sheat->mergeCellsByColumnAndRow($col, $row, $col+$shift['length']-1, $row); |
|
| 96 | + $sheat->mergeCellsByColumnAndRow($col, $row, $col + $shift['length'] - 1, $row); |
|
| 97 | 97 | $this->setShiftNameInCell($sheat, $col, $row, $shift); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -101,21 +101,21 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | $i = 1; |
| 103 | 103 | $firstRow = array_search($roleID, $rows); |
| 104 | - $cell = $sheat->getCellByColumnAndRow($col, $firstRow+4); |
|
| 104 | + $cell = $sheat->getCellByColumnAndRow($col, $firstRow + 4); |
|
| 105 | 105 | if($cell->isInMergeRange()) |
| 106 | 106 | { |
| 107 | - while($rows[$firstRow+$i] === $roleID) |
|
| 107 | + while($rows[$firstRow + $i] === $roleID) |
|
| 108 | 108 | { |
| 109 | - $cell = $sheat->getCellByColumnAndRow($col, $firstRow+4+$i); |
|
| 109 | + $cell = $sheat->getCellByColumnAndRow($col, $firstRow + 4 + $i); |
|
| 110 | 110 | if(!$cell->isInMergeRange()) |
| 111 | 111 | { |
| 112 | 112 | break; |
| 113 | 113 | } |
| 114 | 114 | $i++; |
| 115 | 115 | } |
| 116 | - return $firstRow+4+$i; |
|
| 116 | + return $firstRow + 4 + $i; |
|
| 117 | 117 | } |
| 118 | - return $firstRow+4; |
|
| 118 | + return $firstRow + 4; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | protected function createSpreadSheet() |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $start = date_parse($str); |
| 163 | 163 | $lastShift = $shifts[$count - 1]; |
| 164 | 164 | $interval = $lastShift['endTime']->diff($shifts[0]['startTime']); |
| 165 | - $hourCount = ($interval->d*24) + $interval->h; |
|
| 165 | + $hourCount = ($interval->d * 24) + $interval->h; |
|
| 166 | 166 | $tmp = $this->getHoursArrays($start['hour'], $hourCount); |
| 167 | 167 | $simpleHours = $tmp[0]; |
| 168 | 168 | $militaryHours = $tmp[1]; |
@@ -232,13 +232,13 @@ discard block |
||
| 232 | 232 | while($shift) |
| 233 | 233 | { |
| 234 | 234 | $timeDiff = $originalStartTime->diff($shift['startTime']); |
| 235 | - $hoursFromStart = ($timeDiff->d*24)+$timeDiff->h; |
|
| 236 | - $rowForShift = $this->getRowForShift($shift['roleID'], $rows, $hoursFromStart+2, $sheat); |
|
| 237 | - $this->createShiftCell($sheat, $hoursFromStart+2, $rowForShift, $shift); |
|
| 235 | + $hoursFromStart = ($timeDiff->d * 24) + $timeDiff->h; |
|
| 236 | + $rowForShift = $this->getRowForShift($shift['roleID'], $rows, $hoursFromStart + 2, $sheat); |
|
| 237 | + $this->createShiftCell($sheat, $hoursFromStart + 2, $rowForShift, $shift); |
|
| 238 | 238 | $shift = array_shift($shifts); |
| 239 | 239 | } |
| 240 | 240 | $rowCount = count($rows); |
| 241 | - $style = $sheat->getStyleByColumnAndRow(2, 4, 1+count($simpleHours), 3 + $rowCount); |
|
| 241 | + $style = $sheat->getStyleByColumnAndRow(2, 4, 1 + count($simpleHours), 3 + $rowCount); |
|
| 242 | 242 | $style->getBorders()->getAllBorders()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN); |
| 243 | 243 | $hourCount = count($simpleHours); |
| 244 | 244 | $this->grayOutUnused($hourCount, $rowCount, $sheat); |
@@ -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(); |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | try { |
| 64 | 64 | $profile = new \VolunteerProfile($uid); |
| 65 | 65 | $uids[$uid] = $profile->getDisplayName(); |
| 66 | - } catch (Exception $e) { |
|
| 66 | + } catch(Exception $e) { |
|
| 67 | 67 | $uids[$uid] = $uid; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -60,10 +60,13 @@ |
||
| 60 | 60 | static $uids = array(); |
| 61 | 61 | if(!isset($uids[$uid])) |
| 62 | 62 | { |
| 63 | - try { |
|
| 63 | + try |
|
| 64 | + { |
|
| 64 | 65 | $profile = new \VolunteerProfile($uid); |
| 65 | 66 | $uids[$uid] = $profile->getDisplayName(); |
| 66 | - } catch (Exception $e) { |
|
| 67 | + } |
|
| 68 | + catch (Exception $e) |
|
| 69 | + { |
|
| 67 | 70 | $uids[$uid] = $uid; |
| 68 | 71 | } |
| 69 | 72 | } |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | for($i = 0; $i < $certCount; $i++) |
| 49 | 49 | { |
| 50 | - if($this->certCheck($requirements, $userCerts, $certs[$i]['certID'])) |
|
| 51 | - { |
|
| 52 | - return array('whyClass' => 'CERT', 'whyMsg' => 'Shift requires '.$certs[$i]['name'].' and you do not have that certification'); |
|
| 53 | - } |
|
| 50 | + if($this->certCheck($requirements, $userCerts, $certs[$i]['certID'])) |
|
| 51 | + { |
|
| 52 | + return array('whyClass' => 'CERT', 'whyMsg' => 'Shift requires '.$certs[$i]['name'].' and you do not have that certification'); |
|
| 53 | + } |
|
| 54 | 54 | } |
| 55 | 55 | return true; |
| 56 | 56 | } |
@@ -192,20 +192,20 @@ discard block |
||
| 192 | 192 | $tmp = $dataTable->read(); |
| 193 | 193 | foreach($tmp as $role) |
| 194 | 194 | { |
| 195 | - $roles[$role['short_name']] = $role; |
|
| 195 | + $roles[$role['short_name']] = $role; |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | if(isset($entry['volunteer'])) |
| 199 | 199 | { |
| 200 | - unset($entry['volunteer']); |
|
| 200 | + unset($entry['volunteer']); |
|
| 201 | 201 | } |
| 202 | 202 | if(isset($entry['why'])) |
| 203 | 203 | { |
| 204 | - unset($entry['why']); |
|
| 204 | + unset($entry['why']); |
|
| 205 | 205 | } |
| 206 | 206 | if(isset($entry['whyClass'])) |
| 207 | 207 | { |
| 208 | - unset($entry['whyClass']); |
|
| 208 | + unset($entry['whyClass']); |
|
| 209 | 209 | } |
| 210 | 210 | $shift = new \VolunteerShift(false, $entry); |
| 211 | 211 | $entry['isAdmin'] = $this->isAdminForShift($entry, $this->user); |
@@ -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); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $filter = new \Data\Filter("departmentID eq '$deptId'"); |
| 78 | 78 | $odata = $request->getAttribute('odata', new \ODataParams(array())); |
| 79 | 79 | $roles = $dataTable->read($filter, $odata->select, $odata->top, |
| 80 | - $odata->skip, $odata->orderby); |
|
| 80 | + $odata->skip, $odata->orderby); |
|
| 81 | 81 | if($roles === false) |
| 82 | 82 | { |
| 83 | 83 | $roles = array(); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | $shifts = $dataTable->read($filter, $odata->select, $odata->top, |
| 117 | - $odata->skip, $odata->orderby); |
|
| 117 | + $odata->skip, $odata->orderby); |
|
| 118 | 118 | if($shifts === false) |
| 119 | 119 | { |
| 120 | 120 | $shifts = array(); |
@@ -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(); |