Completed
Push — FVSv2 ( 10d7ab...2b5aa4 )
by Patrick
01:37
created
api/v1/class.ShiftAPI.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
api/v1/class.ParticipantAPI.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -103,24 +103,24 @@
 block discarded – undo
103 103
         $filter = new \Data\Filter("participant eq '$uid'");
104 104
         $shifts = $dataTable->read($filter);
105 105
         $text = "BEGIN:VCALENDAR\r\n";
106
-        $text.= "VERSION:2.0\r\n";
107
-        $text.= "PRODID:-//hacksw/handcal//NONSGML v1.0//EN\r\n";
106
+        $text .= "VERSION:2.0\r\n";
107
+        $text .= "PRODID:-//hacksw/handcal//NONSGML v1.0//EN\r\n";
108 108
         $count = count($shifts);
109 109
         for($i = 0; $i < $count; $i++)
110 110
         {
111
-            $text.= "BEGIN:VEVENT\r\n";
112
-            $text.= "UID:".$this->user->mail."\r\n";
111
+            $text .= "BEGIN:VEVENT\r\n";
112
+            $text .= "UID:".$this->user->mail."\r\n";
113 113
             $d = new DateTime($shifts[$i]['startTime']);
114 114
             $d->setTimezone(new \DateTimeZone('UTC'));
115
-            $text.= "DTSTAMP:".$d->format('Ymd\THis\Z')."\r\n";
116
-            $text.= "DTSTART:".$d->format('Ymd\THis\Z')."\r\n";
115
+            $text .= "DTSTAMP:".$d->format('Ymd\THis\Z')."\r\n";
116
+            $text .= "DTSTART:".$d->format('Ymd\THis\Z')."\r\n";
117 117
             $d = new DateTime($shifts[$i]['endTime']);
118 118
             $d->setTimezone(new \DateTimeZone('UTC'));
119
-            $text.= "DTEND:".$d->format('Ymd\THis\Z')."\r\n";
120
-            $text.= "SUMMARY:".$shifts[$i]['roleID'].' '.$shifts[$i]['name']."\r\n";
121
-            $text.= "END:VEVENT\r\n";
119
+            $text .= "DTEND:".$d->format('Ymd\THis\Z')."\r\n";
120
+            $text .= "SUMMARY:".$shifts[$i]['roleID'].' '.$shifts[$i]['name']."\r\n";
121
+            $text .= "END:VEVENT\r\n";
122 122
         }
123
-        $text.= "END:VCALENDAR\r\n";
123
+        $text .= "END:VCALENDAR\r\n";
124 124
         $response = $response->withHeader('Content-type', 'text/calendar');
125 125
         $response = $response->withHeader('Content-Disposition', 'attachment; filename="MyShifts.ics"');
126 126
         $body = $response->getBody();
Please login to merge, or discard this patch.
api/v1/class.EventAPI.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
_admin/class.VolunteerAdminPage.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
app/VolunteerAutoload.php 1 patch
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 block discarded – undo
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: */
Please login to merge, or discard this patch.
app/Schedules/class.SimplePDF.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 } 
Please login to merge, or discard this patch.
app/class.VolunteerShift.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
 
67 67
     public function isFilled()
68 68
     {
69
-         return isset($this->dbData['status']) && ($this->dbData['status'] === 'pending' || $this->dbData['status'] === 'filled');
69
+            return isset($this->dbData['status']) && ($this->dbData['status'] === 'pending' || $this->dbData['status'] === 'filled');
70 70
     }
71 71
 
72 72
     public function findOverlaps($uid, $shortCircuit = false)
Please login to merge, or discard this patch.
app/Schedules/class.GridSchedule.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
api/v1/class.Processor.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -12,6 +12,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
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
     }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             $tmp = $dataTable->read();
189 189
             foreach($tmp as $role)
190 190
             {
191
-               $roles[$role['short_name']] = $role;
191
+                $roles[$role['short_name']] = $role;
192 192
             }
193 193
         }
194 194
         $shift = new \VolunteerShift(false, $entry);
Please login to merge, or discard this patch.