@@ -1,6 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | trait Processor |
| 3 | 3 | { |
| 4 | + /** |
|
| 5 | + * @param string $certType |
|
| 6 | + */ |
|
| 4 | 7 | protected function certCheck($requirements, $certs, $certType) |
| 5 | 8 | { |
| 6 | 9 | if(isset($requirements[$certType]) && $requirements[$certType]) |
@@ -177,7 +177,7 @@ |
||
| 177 | 177 | $tmp = $dataTable->read(); |
| 178 | 178 | foreach($tmp as $role) |
| 179 | 179 | { |
| 180 | - $roles[$role['short_name']] = $role; |
|
| 180 | + $roles[$role['short_name']] = $role; |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | $shift = new \VolunteerShift(false, $entry); |
@@ -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); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | protected function canUpdate($request, $entity) |
| 31 | 31 | { |
| 32 | - if($this->isVolunteerAdmin($request)) |
|
| 32 | + if($this->isVolunteerAdmin($request)) |
|
| 33 | 33 | { |
| 34 | 34 | return true; |
| 35 | 35 | } |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | $ret = $dataTable->update($filter, $entArray[$i]); |
| 103 | 103 | if($ret === false) |
| 104 | 104 | { |
| 105 | - $myRet = false; |
|
| 106 | - array_push($errors, $array[$i]); |
|
| 105 | + $myRet = false; |
|
| 106 | + array_push($errors, $array[$i]); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | if($myRet) |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | protected function canUpdate($request, $entity) |
| 37 | 37 | { |
| 38 | - if($this->isVolunteerAdmin($request)) |
|
| 38 | + if($this->isVolunteerAdmin($request)) |
|
| 39 | 39 | { |
| 40 | 40 | return true; |
| 41 | 41 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $odata = $request->getAttribute('odata', new \ODataParams(array())); |
| 84 | 84 | $filter = $this->getFilterForPrimaryKey($uid); |
| 85 | 85 | $areas = $dataTable->read($filter, $odata->select, $odata->top, |
| 86 | - $odata->skip, $odata->orderby); |
|
| 86 | + $odata->skip, $odata->orderby); |
|
| 87 | 87 | if(empty($areas)) |
| 88 | 88 | { |
| 89 | 89 | return $response->withStatus(404); |
@@ -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 |
@@ -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; |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $this->isLead = $this->user->isInGroupNamed('Leads'); |
| 33 | 33 | if($this->isLead) |
| 34 | 34 | { |
| 35 | - $this->is_admin = true; |
|
| 35 | + $this->is_admin = true; |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -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: */ |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $timeStr = $start->format('g:i A').' till '.$end->format('g:i A'); |
| 36 | 36 | if(strlen($shifts[$i]['name']) > 0) |
| 37 | 37 | { |
| 38 | - $timeStr .=' - <i>'.$shifts[$i]['name'].'</i>'; |
|
| 38 | + $timeStr .= ' - <i>'.$shifts[$i]['name'].'</i>'; |
|
| 39 | 39 | } |
| 40 | 40 | if(!isset($days[$dateStr])) |
| 41 | 41 | { |
@@ -50,22 +50,22 @@ discard block |
||
| 50 | 50 | ksort($days); |
| 51 | 51 | foreach($days as $dateStr=>$day) |
| 52 | 52 | { |
| 53 | - $html .='<h2>'.$dateStr.'</h2>'; |
|
| 53 | + $html .= '<h2>'.$dateStr.'</h2>'; |
|
| 54 | 54 | uksort($day, array($this, 'groupSort')); |
| 55 | 55 | foreach($day as $shiftStr=>$shifts) |
| 56 | 56 | { |
| 57 | 57 | usort($shifts, array($this, 'shiftSort')); |
| 58 | - $html .='<h3>'.$shiftStr.'</h3>'; |
|
| 59 | - $html .='<table width="100%"><tr><th style="width: 20%">Role</th><th>Volunteer Name</th><th>Volunteer Camp</th></tr>'; |
|
| 58 | + $html .= '<h3>'.$shiftStr.'</h3>'; |
|
| 59 | + $html .= '<table width="100%"><tr><th style="width: 20%">Role</th><th>Volunteer Name</th><th>Volunteer Camp</th></tr>'; |
|
| 60 | 60 | foreach($shifts as $shift) |
| 61 | 61 | { |
| 62 | 62 | //TODO Volunteer info for shift... |
| 63 | - $html .='<tr><td>'.$this->getRoleNameFromID($shift['roleID']).'</td><td></td><td></td></tr>'; |
|
| 63 | + $html .= '<tr><td>'.$this->getRoleNameFromID($shift['roleID']).'</td><td></td><td></td></tr>'; |
|
| 64 | 64 | } |
| 65 | - $html .='</table>'; |
|
| 65 | + $html .= '</table>'; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | - $html .='</body>'; |
|
| 68 | + $html .= '</body>'; |
|
| 69 | 69 | $this->setPDFFromHTML($html); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -242,6 +242,9 @@ |
||
| 242 | 242 | return $response; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | + /** |
|
| 246 | + * @param string $type |
|
| 247 | + */ |
|
| 245 | 248 | public function generateGridSchedule($dept, $shifts, $response, $type) |
| 246 | 249 | { |
| 247 | 250 | $ss = new \Schedules\GridSchedule($dept, $shifts); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $filter = new \Data\Filter("departmentID eq '$deptId'"); |
| 100 | 100 | $odata = $request->getAttribute('odata', new \ODataParams(array())); |
| 101 | 101 | $roles = $dataTable->read($filter, $odata->select, $odata->top, |
| 102 | - $odata->skip, $odata->orderby); |
|
| 102 | + $odata->skip, $odata->orderby); |
|
| 103 | 103 | if($roles === false) |
| 104 | 104 | { |
| 105 | 105 | $roles = array(); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $filter = new \Data\Filter("departmentID eq '$deptId'"); |
| 124 | 124 | $odata = $request->getAttribute('odata', new \ODataParams(array())); |
| 125 | 125 | $shifts = $dataTable->read($filter, $odata->select, $odata->top, |
| 126 | - $odata->skip, $odata->orderby); |
|
| 126 | + $odata->skip, $odata->orderby); |
|
| 127 | 127 | if($shifts === false) |
| 128 | 128 | { |
| 129 | 129 | $shifts = array(); |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | $shifts[$i]['length'] = $diff->h; |
| 46 | 46 | if(!isset($roles[$shifts[$i]['roleID']])) |
| 47 | 47 | { |
| 48 | - $roles[$shifts[$i]['roleID']] = $shifts[$i]['length']; |
|
| 49 | - $roles2[$shifts[$i]['roleID']] = array(); |
|
| 48 | + $roles[$shifts[$i]['roleID']] = $shifts[$i]['length']; |
|
| 49 | + $roles2[$shifts[$i]['roleID']] = array(); |
|
| 50 | 50 | } |
| 51 | 51 | else |
| 52 | 52 | { |
| 53 | - if($roles[$shifts[$i]['roleID']] < $shifts[$i]['length']) |
|
| 54 | - { |
|
| 55 | - $roles[$shifts[$i]['roleID']] = $shifts[$i]['length']; |
|
| 56 | - } |
|
| 53 | + if($roles[$shifts[$i]['roleID']] < $shifts[$i]['length']) |
|
| 54 | + { |
|
| 55 | + $roles[$shifts[$i]['roleID']] = $shifts[$i]['length']; |
|
| 56 | + } |
|
| 57 | 57 | } |
| 58 | 58 | array_push($roles2[$shifts[$i]['roleID']], array('start'=>$start, 'end'=>$end)); |
| 59 | 59 | } |
@@ -196,17 +196,17 @@ discard block |
||
| 196 | 196 | { |
| 197 | 197 | for($j = 0; $j < $rowCount; $j++) |
| 198 | 198 | { |
| 199 | - $cell = $sheat->getCellByColumnAndRow($i+2, $j+4); |
|
| 200 | - if($cell->isInMergeRange()) |
|
| 201 | - { |
|
| 202 | - continue; |
|
| 203 | - } |
|
| 204 | - else |
|
| 205 | - { |
|
| 206 | - $style = $cell->getStyle(); |
|
| 207 | - $style->getBorders()->getAllBorders()->setBorderStyle(false); |
|
| 208 | - $style->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_PATTERN_LIGHTGRAY); |
|
| 209 | - } |
|
| 199 | + $cell = $sheat->getCellByColumnAndRow($i+2, $j+4); |
|
| 200 | + if($cell->isInMergeRange()) |
|
| 201 | + { |
|
| 202 | + continue; |
|
| 203 | + } |
|
| 204 | + else |
|
| 205 | + { |
|
| 206 | + $style = $cell->getStyle(); |
|
| 207 | + $style->getBorders()->getAllBorders()->setBorderStyle(false); |
|
| 208 | + $style->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_PATTERN_LIGHTGRAY); |
|
| 209 | + } |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | $sheat->getColumnDimension('A')->setAutoSize(true); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | $start = date_parse($str); |
| 309 | 309 | $lastShift = $shifts[$count - 1]; |
| 310 | 310 | $interval = $lastShift['endTime']->diff($shifts[0]['startTime']); |
| 311 | - $hourCount = ($interval->d*24) + $interval->h; |
|
| 311 | + $hourCount = ($interval->d * 24) + $interval->h; |
|
| 312 | 312 | $simpleHours = array(); |
| 313 | 313 | $militaryHours = array(); |
| 314 | 314 | $hour = $start['hour']; |
@@ -410,37 +410,37 @@ discard block |
||
| 410 | 410 | { |
| 411 | 411 | $i = 1; |
| 412 | 412 | $timeDiff = $originalStartTime->diff($shift['startTime']); |
| 413 | - $hoursFromStart = ($timeDiff->d*24)+$timeDiff->h; |
|
| 413 | + $hoursFromStart = ($timeDiff->d * 24) + $timeDiff->h; |
|
| 414 | 414 | $firstRow = array_search($shift['roleID'], $rows); |
| 415 | - $cell = $sheat->getCellByColumnAndRow($hoursFromStart+2, $firstRow+4); |
|
| 415 | + $cell = $sheat->getCellByColumnAndRow($hoursFromStart + 2, $firstRow + 4); |
|
| 416 | 416 | if($cell->isInMergeRange()) |
| 417 | 417 | { |
| 418 | - while($rows[$firstRow+$i] === $shift['roleID']) |
|
| 418 | + while($rows[$firstRow + $i] === $shift['roleID']) |
|
| 419 | 419 | { |
| 420 | - $cell = $sheat->getCellByColumnAndRow($hoursFromStart+2, $firstRow+4+$i); |
|
| 420 | + $cell = $sheat->getCellByColumnAndRow($hoursFromStart + 2, $firstRow + 4 + $i); |
|
| 421 | 421 | if(!$cell->isInMergeRange()) |
| 422 | 422 | { |
| 423 | 423 | break; |
| 424 | 424 | } |
| 425 | 425 | $i++; |
| 426 | 426 | } |
| 427 | - $sheat->mergeCellsByColumnAndRow($hoursFromStart+2, $firstRow+4+$i, $hoursFromStart+1+$shift['length'], $firstRow+4+$i); |
|
| 427 | + $sheat->mergeCellsByColumnAndRow($hoursFromStart + 2, $firstRow + 4 + $i, $hoursFromStart + 1 + $shift['length'], $firstRow + 4 + $i); |
|
| 428 | 428 | } |
| 429 | 429 | else |
| 430 | 430 | { |
| 431 | - $sheat->mergeCellsByColumnAndRow($hoursFromStart+2, $firstRow+4, $hoursFromStart+1+$shift['length'], $firstRow+4); |
|
| 431 | + $sheat->mergeCellsByColumnAndRow($hoursFromStart + 2, $firstRow + 4, $hoursFromStart + 1 + $shift['length'], $firstRow + 4); |
|
| 432 | 432 | } |
| 433 | 433 | $shift = array_shift($shifts); |
| 434 | 434 | } |
| 435 | 435 | $rowCount = count($rows); |
| 436 | - $style = $sheat->getStyleByColumnAndRow(2, 4, 1+count($simpleHours), 3 + $rowCount); |
|
| 436 | + $style = $sheat->getStyleByColumnAndRow(2, 4, 1 + count($simpleHours), 3 + $rowCount); |
|
| 437 | 437 | $style->getBorders()->getAllBorders()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN); |
| 438 | 438 | $hourCount = count($simpleHours); |
| 439 | 439 | for($i = 0; $i < $hourCount; $i++) |
| 440 | 440 | { |
| 441 | 441 | for($j = 0; $j < $rowCount; $j++) |
| 442 | 442 | { |
| 443 | - $cell = $sheat->getCellByColumnAndRow($i+2, $j+4); |
|
| 443 | + $cell = $sheat->getCellByColumnAndRow($i + 2, $j + 4); |
|
| 444 | 444 | if($cell->isInMergeRange()) |
| 445 | 445 | { |
| 446 | 446 | continue; |