@@ -5,11 +5,11 @@ |
||
| 5 | 5 | $classname = ltrim($classname, '\\'); |
| 6 | 6 | $filename = ''; |
| 7 | 7 | $namespace = ''; |
| 8 | - if ($lastNsPos = strrpos($classname, '\\')) |
|
| 8 | + if($lastNsPos = strrpos($classname, '\\')) |
|
| 9 | 9 | {
|
| 10 | 10 | $namespace = substr($classname, 0, $lastNsPos); |
| 11 | 11 | $classname = substr($classname, $lastNsPos + 1); |
| 12 | - $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
|
|
| 12 | + $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR;
|
|
| 13 | 13 | } |
| 14 | 14 | $filename = __DIR__.DIRECTORY_SEPARATOR.$filename.'class.'.$classname.'.php'; |
| 15 | 15 | if(is_readable($filename)) |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | use PhpOffice\PhpSpreadsheet\Spreadsheet; |
| 4 | 4 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; |
| 5 | -use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf; |
|
| 6 | 5 | |
| 7 | 6 | class DepartmentAPI extends Http\Rest\DataTableAPI |
| 8 | 7 | { |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | { |
| 263 | 263 | $pdf = new \PDF\PDF(); |
| 264 | 264 | $html = '<body>'; |
| 265 | - $html.= '<style type="text/css">table {border-collapse: collapse;} table, th, td {border: 1px solid black;}</style>'; |
|
| 266 | - $html.= '<h1 style="text-align: center;">'.$dept['departmentName'].' Shift Schedule</h1>'; |
|
| 265 | + $html .= '<style type="text/css">table {border-collapse: collapse;} table, th, td {border: 1px solid black;}</style>'; |
|
| 266 | + $html .= '<h1 style="text-align: center;">'.$dept['departmentName'].' Shift Schedule</h1>'; |
|
| 267 | 267 | //Group shifts by day... |
| 268 | 268 | $days = array(); |
| 269 | 269 | $count = count($shifts); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $timeStr = $start->format('g:i A').' till '.$end->format('g:i A'); |
| 278 | 278 | if(strlen($shifts[$i]['name']) > 0) |
| 279 | 279 | { |
| 280 | - $timeStr.=' - <i>'.$shifts[$i]['name'].'</i>'; |
|
| 280 | + $timeStr .= ' - <i>'.$shifts[$i]['name'].'</i>'; |
|
| 281 | 281 | } |
| 282 | 282 | if(!isset($days[$dateStr])) |
| 283 | 283 | { |
@@ -292,22 +292,22 @@ discard block |
||
| 292 | 292 | ksort($days); |
| 293 | 293 | foreach($days as $dateStr=>$day) |
| 294 | 294 | { |
| 295 | - $html.='<h2>'.$dateStr.'</h2>'; |
|
| 295 | + $html .= '<h2>'.$dateStr.'</h2>'; |
|
| 296 | 296 | uksort($day, array($this, 'groupSort')); |
| 297 | 297 | foreach($day as $shiftStr=>$shifts) |
| 298 | 298 | { |
| 299 | 299 | usort($shifts, array($this, 'shiftSort')); |
| 300 | - $html.='<h3>'.$shiftStr.'</h3>'; |
|
| 301 | - $html.='<table width="100%"><tr><th style="width: 20%">Role</th><th>Volunteer Name</th><th>Volunteer Camp</th></tr>'; |
|
| 300 | + $html .= '<h3>'.$shiftStr.'</h3>'; |
|
| 301 | + $html .= '<table width="100%"><tr><th style="width: 20%">Role</th><th>Volunteer Name</th><th>Volunteer Camp</th></tr>'; |
|
| 302 | 302 | foreach($shifts as $shift) |
| 303 | 303 | { |
| 304 | 304 | //TODO Volunteer info for shift... |
| 305 | - $html.='<tr><td>'.$this->getRoleNameFromID($shift['roleID']).'</td><td></td><td></td></tr>'; |
|
| 305 | + $html .= '<tr><td>'.$this->getRoleNameFromID($shift['roleID']).'</td><td></td><td></td></tr>'; |
|
| 306 | 306 | } |
| 307 | - $html.='</table>'; |
|
| 307 | + $html .= '</table>'; |
|
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | - $html.='</body>'; |
|
| 310 | + $html .= '</body>'; |
|
| 311 | 311 | $pdf->setPDFFromHTML($html); |
| 312 | 312 | $response = $response->withHeader('Content-Type', 'application/pdf'); |
| 313 | 313 | $response->getBody()->write($pdf->toPDFBuffer()); |
@@ -354,9 +354,9 @@ discard block |
||
| 354 | 354 | $originalStartTime = $shifts[0]['startTime']; |
| 355 | 355 | $str = $shifts[0]['startTime']->format('c'); |
| 356 | 356 | $start = date_parse($str); |
| 357 | - $lastShift = $shifts[$count-1]; |
|
| 357 | + $lastShift = $shifts[$count - 1]; |
|
| 358 | 358 | $interval = $lastShift['endTime']->diff($shifts[0]['startTime']); |
| 359 | - $hourCount = ($interval->d*24)+$interval->h; |
|
| 359 | + $hourCount = ($interval->d * 24) + $interval->h; |
|
| 360 | 360 | $simpleHours = array(); |
| 361 | 361 | $militaryHours = array(); |
| 362 | 362 | $hour = $start['hour']; |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | } |
| 382 | 382 | else |
| 383 | 383 | { |
| 384 | - array_push($simpleHours, ($hour-12).'p'); |
|
| 384 | + array_push($simpleHours, ($hour - 12).'p'); |
|
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | array_push($militaryHours, $hour.':00'); |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | } |
| 394 | 394 | $sheat->fromArray($simpleHours, null, 'B2'); |
| 395 | 395 | $sheat->fromArray($militaryHours, null, 'B3'); |
| 396 | - $mergeCount = 24-$start['hour']; |
|
| 396 | + $mergeCount = 24 - $start['hour']; |
|
| 397 | 397 | if($mergeCount > $hourCount) |
| 398 | 398 | { |
| 399 | 399 | $mergeCount = $hourCount; |
@@ -402,12 +402,12 @@ discard block |
||
| 402 | 402 | $cellIndex = 2; |
| 403 | 403 | while($mergeCount) |
| 404 | 404 | { |
| 405 | - $sheat->mergeCellsByColumnAndRow($cellIndex, 1, $cellIndex+$mergeCount-1, 1); |
|
| 405 | + $sheat->mergeCellsByColumnAndRow($cellIndex, 1, $cellIndex + $mergeCount - 1, 1); |
|
| 406 | 406 | $sheat->setCellValueByColumnAndRow($cellIndex, 1, array_shift($days)); |
| 407 | 407 | $cell = $sheat->getCellByColumnAndRow($cellIndex, 1); |
| 408 | 408 | $cell->getStyle()->getAlignment()->setHorizontal('center'); |
| 409 | - $cellIndex+=$mergeCount; |
|
| 410 | - $hourCount-=$mergeCount; |
|
| 409 | + $cellIndex += $mergeCount; |
|
| 410 | + $hourCount -= $mergeCount; |
|
| 411 | 411 | $mergeCount = $hourCount; |
| 412 | 412 | if($mergeCount > 24) |
| 413 | 413 | { |
@@ -418,13 +418,13 @@ discard block |
||
| 418 | 418 | $rows = array(); |
| 419 | 419 | foreach($roles as $role=>$hour) |
| 420 | 420 | { |
| 421 | - $sheat->setCellValueByColumnAndRow(1, 4+$i, $this->getRoleNameFromID($role)); |
|
| 421 | + $sheat->setCellValueByColumnAndRow(1, 4 + $i, $this->getRoleNameFromID($role)); |
|
| 422 | 422 | array_push($rows, $role); |
| 423 | 423 | $overlaps = array(); |
| 424 | - for($j = 0; $j < count($roles2[$role])-1; $j++) |
|
| 424 | + for($j = 0; $j < count($roles2[$role]) - 1; $j++) |
|
| 425 | 425 | { |
| 426 | 426 | $currRole = $roles2[$role][$j]; |
| 427 | - $nextRole = $roles2[$role][$j+1]; |
|
| 427 | + $nextRole = $roles2[$role][$j + 1]; |
|
| 428 | 428 | if($currRole['end'] > $nextRole['start']) |
| 429 | 429 | { |
| 430 | 430 | $str = $currRole['start']->format('c'); |
@@ -438,10 +438,10 @@ discard block |
||
| 438 | 438 | if(!empty($overlaps)) |
| 439 | 439 | { |
| 440 | 440 | $overlapCount = max(array_values($overlaps)); |
| 441 | - for($j = 0; $j < $overlapCount+1; $j++) |
|
| 441 | + for($j = 0; $j < $overlapCount + 1; $j++) |
|
| 442 | 442 | { |
| 443 | 443 | $i++; |
| 444 | - $sheat->setCellValueByColumnAndRow(1, 4+$i, $this->getRoleNameFromID($role)); |
|
| 444 | + $sheat->setCellValueByColumnAndRow(1, 4 + $i, $this->getRoleNameFromID($role)); |
|
| 445 | 445 | if($j > 0) |
| 446 | 446 | { |
| 447 | 447 | array_push($rows, $role); |
@@ -458,35 +458,35 @@ discard block |
||
| 458 | 458 | { |
| 459 | 459 | $i = 1; |
| 460 | 460 | $timeDiff = $originalStartTime->diff($shift['startTime']); |
| 461 | - $hoursFromStart = ($timeDiff->d*24)+$timeDiff->h; |
|
| 461 | + $hoursFromStart = ($timeDiff->d * 24) + $timeDiff->h; |
|
| 462 | 462 | $firstRow = array_search($shift['roleID'], $rows); |
| 463 | - $cell = $sheat->getCellByColumnAndRow($hoursFromStart+2, $firstRow+4); |
|
| 463 | + $cell = $sheat->getCellByColumnAndRow($hoursFromStart + 2, $firstRow + 4); |
|
| 464 | 464 | if($cell->isInMergeRange()) |
| 465 | 465 | { |
| 466 | - while($rows[$firstRow+$i] === $shift['roleID']) |
|
| 466 | + while($rows[$firstRow + $i] === $shift['roleID']) |
|
| 467 | 467 | { |
| 468 | - $cell = $sheat->getCellByColumnAndRow($hoursFromStart+2, $firstRow+4+$i); |
|
| 468 | + $cell = $sheat->getCellByColumnAndRow($hoursFromStart + 2, $firstRow + 4 + $i); |
|
| 469 | 469 | if(!$cell->isInMergeRange()) |
| 470 | 470 | { |
| 471 | 471 | break; |
| 472 | 472 | } |
| 473 | 473 | $i++; |
| 474 | 474 | } |
| 475 | - $sheat->mergeCellsByColumnAndRow($hoursFromStart+2, $firstRow+4+$i, $hoursFromStart+1+$shift['length'], $firstRow+4+$i); |
|
| 475 | + $sheat->mergeCellsByColumnAndRow($hoursFromStart + 2, $firstRow + 4 + $i, $hoursFromStart + 1 + $shift['length'], $firstRow + 4 + $i); |
|
| 476 | 476 | } |
| 477 | 477 | else |
| 478 | 478 | { |
| 479 | - $sheat->mergeCellsByColumnAndRow($hoursFromStart+2, $firstRow+4, $hoursFromStart+1+$shift['length'], $firstRow+4); |
|
| 479 | + $sheat->mergeCellsByColumnAndRow($hoursFromStart + 2, $firstRow + 4, $hoursFromStart + 1 + $shift['length'], $firstRow + 4); |
|
| 480 | 480 | } |
| 481 | 481 | $shift = array_shift($shifts); |
| 482 | 482 | } |
| 483 | - $style = $sheat->getStyleByColumnAndRow(2, 4, 1+count($simpleHours), 3+count($rows)); |
|
| 483 | + $style = $sheat->getStyleByColumnAndRow(2, 4, 1 + count($simpleHours), 3 + count($rows)); |
|
| 484 | 484 | $style->getBorders()->getAllBorders()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN); |
| 485 | 485 | for($i = 0; $i < count($simpleHours); $i++) |
| 486 | 486 | { |
| 487 | 487 | for($j = 0; $j < count($rows); $j++) |
| 488 | 488 | { |
| 489 | - $cell = $sheat->getCellByColumnAndRow($i+2, $j+4); |
|
| 489 | + $cell = $sheat->getCellByColumnAndRow($i + 2, $j + 4); |
|
| 490 | 490 | if($cell->isInMergeRange()) |
| 491 | 491 | { |
| 492 | 492 | continue; |
@@ -59,24 +59,24 @@ |
||
| 59 | 59 | |
| 60 | 60 | protected function genUUID() |
| 61 | 61 | { |
| 62 | - return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', |
|
| 62 | + return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', |
|
| 63 | 63 | // 32 bits for "time_low" |
| 64 | - mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), |
|
| 64 | + mt_rand(0, 0xffff), mt_rand(0, 0xffff), |
|
| 65 | 65 | |
| 66 | 66 | // 16 bits for "time_mid" |
| 67 | - mt_rand( 0, 0xffff ), |
|
| 67 | + mt_rand(0, 0xffff), |
|
| 68 | 68 | |
| 69 | 69 | // 16 bits for "time_hi_and_version", |
| 70 | 70 | // four most significant bits holds version number 4 |
| 71 | - mt_rand( 0, 0x0fff ) | 0x4000, |
|
| 71 | + mt_rand(0, 0x0fff) | 0x4000, |
|
| 72 | 72 | |
| 73 | 73 | // 16 bits, 8 bits for "clk_seq_hi_res", |
| 74 | 74 | // 8 bits for "clk_seq_low", |
| 75 | 75 | // two most significant bits holds zero and one for variant DCE1.1 |
| 76 | - mt_rand( 0, 0x3fff ) | 0x8000, |
|
| 76 | + mt_rand(0, 0x3fff) | 0x8000, |
|
| 77 | 77 | |
| 78 | 78 | // 48 bits for "node" |
| 79 | - mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) |
|
| 79 | + mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) |
|
| 80 | 80 | ); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -154,7 +154,7 @@ |
||
| 154 | 154 | $start = new \DateTime($shift['startTime']); |
| 155 | 155 | $end = new \DateTime($shift['endTime']); |
| 156 | 156 | $diff = $end->diff($start); |
| 157 | -$shiftLength = $diff->h + ($diff->i/60.0); |
|
| 157 | +$shiftLength = $diff->h + ($diff->i / 60.0); |
|
| 158 | 158 | |
| 159 | 159 | $page->body .= '<div id="signupContent" '; |
| 160 | 160 | if($overlap) |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - function printPage($header=true) |
|
| 32 | + function printPage($header = true) |
|
| 33 | 33 | { |
| 34 | 34 | if($this->user === false || $this->user === null) |
| 35 | 35 | { |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | $page->content['selectors'] = '<div class="col-sm2"><button type="button" class="btn btn-primary" id="newRoleBtn" onclick="showRoleWizard();">New Role</button></div>'; |
| 14 | 14 | if(!isset($_GET['dept'])) |
| 15 | 15 | { |
| 16 | - $page->content['selectors'].='<div class="col-sm4"><select class="form-control" id="deptFilter"><option value="*"></option></select></div>'; |
|
| 16 | + $page->content['selectors'] .= '<div class="col-sm4"><select class="form-control" id="deptFilter"><option value="*"></option></select></div>'; |
|
| 17 | 17 | } |
| 18 | 18 | $page->content['body'] = ' |
| 19 | 19 | <div class="modal fade bd-example-modal-lg" id="roleWizard" tabindex="-1" role="dialog" aria-labelledby="roleWizardTitle" aria-hidden="true" data-backdrop="static" data-complete="newRole"> |