@@ -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); |
@@ -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 |
@@ -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 | } |
@@ -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(); |
@@ -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) |
@@ -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); |