Completed
Push — FVSv2 ( ae4b85...bd131d )
by Patrick
01:32
created
signup.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 
6 6
 class ProcessorUser
7 7
 {
8
-  use Processor;
8
+    use Processor;
9 9
 
10
-  protected $isAdmin;
10
+    protected $isAdmin;
11 11
 
12
-  public function __construct($isAdmin)
13
-  {
14
-      $this->isAdmin = $isAdmin;
15
-  }
12
+    public function __construct($isAdmin)
13
+    {
14
+        $this->isAdmin = $isAdmin;
15
+    }
16 16
 }
17 17
 
18 18
 $page = new VolunteerPage('Burning Flipside - Flipside Volunteer System');
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 if(!isset($_GET['shiftID']))
25 25
 {
26
-  $page->body .= 'Error! Missing Shift ID. You must have followed a bad link!';
27
-  $page->printPage();
28
-  return;
26
+    $page->body .= 'Error! Missing Shift ID. You must have followed a bad link!';
27
+    $page->printPage();
28
+    return;
29 29
 }
30 30
 
31 31
 $shiftID = $_GET['shiftID'];
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 $shifts = $dataTable->read($filter);
35 35
 if(empty($shifts))
36 36
 {
37
-  $page->body .= 'Error! Could not locate shift. You must have followed an old link!';
38
-  $page->printPage();
39
-  return;
37
+    $page->body .= 'Error! Could not locate shift. You must have followed an old link!';
38
+    $page->printPage();
39
+    return;
40 40
 }
41 41
 $shift = $shifts[0];
42 42
 $myShift = new \VolunteerShift(false, $shift);
@@ -45,38 +45,38 @@  discard block
 block discarded – undo
45 45
 $profiles = $dataTable->read(new \Data\Filter('uid eq '.$page->user->uid));
46 46
 if(empty($profiles))
47 47
 {
48
-  $page->body .= 'Error! Could not locate user profile!';
49
-  $page->printPage();
50
-  return;
48
+    $page->body .= 'Error! Could not locate user profile!';
49
+    $page->printPage();
50
+    return;
51 51
 }
52 52
 $profile = $profiles[0];
53 53
 
54 54
 if($processor->isAdminForShift($shift, $page->user))
55 55
 {
56
-  if(isset($shift['groupID']) && strlen($shift['groupID'] > 0))
57
-  {
56
+    if(isset($shift['groupID']) && strlen($shift['groupID'] > 0))
57
+    {
58 58
     $page->body .= '
59 59
     <div class="alert alert-info" role="alert">
60 60
       You are an administrator for this shift. You can edit the shift <a href="_admin/shifts.php?shiftID='.$shiftID.'" class="alert-link">here</a>.
61 61
       Or you can edit the shift group <a href="_admin/shifts.php?groupID='.$shift['groupID'].'" class="alert-link">here</a>.
62 62
     </div>
63 63
     ';
64
-  }
65
-  else
66
-  {
64
+    }
65
+    else
66
+    {
67 67
     $page->body .= '
68 68
     <div class="alert alert-info" role="alert">
69 69
       You are an administrator for this shift. You can edit the shift <a href="_admin/shifts.php?shiftID='.$shiftID.'" class="alert-link">here</a>.
70 70
     </div>
71 71
     ';
72
-  }
72
+    }
73 73
 }
74 74
 
75 75
 //Is shift already taken?
76 76
 if(isset($entry['status']) && ($entry['status'] === 'pending' || $entry['status'] === 'filled'))
77 77
 {
78
-  if(isset($shift['participant']) && $shift['participant'] === $page->user->uid)
79
-  {
78
+    if(isset($shift['participant']) && $shift['participant'] === $page->user->uid)
79
+    {
80 80
     $page->body .= '<div class="alert alert-success" role="alert">
81 81
       You already have this shift!
82 82
     </div>
@@ -84,15 +84,15 @@  discard block
 block discarded – undo
84 84
       <button type="button" class="btn btn-secondary mr-auto" onClick="window.history.back();">Cancel</button>
85 85
       <button type="button" class="btn btn-primary" onclick="abandon();">Abandon Shift</button>
86 86
     </div>';
87
-  }
88
-  else
89
-  {
87
+    }
88
+    else
89
+    {
90 90
     $page->body .= '<div class="alert alert-danger" role="alert">
91 91
       Someone else took this shift!
92 92
     </div>';
93
-  }
94
-  $page->printPage();
95
-  return;
93
+    }
94
+    $page->printPage();
95
+    return;
96 96
 }
97 97
 
98 98
 $overlap = false;
@@ -117,46 +117,46 @@  discard block
 block discarded – undo
117 117
 $depts = $dataTable->read(new \Data\Filter('departmentID eq '.$shift['departmentID']));
118 118
 if(!empty($depts))
119 119
 {
120
-  $deptName = $depts[0]['departmentName'];
120
+    $deptName = $depts[0]['departmentName'];
121 121
 }
122 122
 
123 123
 $dataTable = DataSetFactory::getDataTableByNames('fvs', 'events');
124 124
 $events = $dataTable->read(new \Data\Filter('_id eq '.$shift['eventID']));
125 125
 if(!empty($events))
126 126
 {
127
-  if($events[0]['tickets'])
128
-  {
127
+    if($events[0]['tickets'])
128
+    {
129 129
     //TODO... Event requires tickets. Does this account have tickets?
130
-  }
130
+    }
131 131
 }
132 132
 
133 133
 $dataTable = DataSetFactory::getDataTableByNames('fvs', 'roles');
134 134
 $roles = $dataTable->read(new \Data\Filter('short_name eq '.$shift['roleID']));
135 135
 if(!empty($roles))
136 136
 {
137
-  $roleName = $roles[0]['display_name'];
137
+    $roleName = $roles[0]['display_name'];
138 138
 }
139 139
 
140 140
 //Is user eligible for shift?
141 141
 $canDo = $processor->canUserDoRole($profile, $roles[0]);
142 142
 if($canDo !== true)
143 143
 {
144
-  $page->body .= '<div class="alert alert-danger" role="alert">';
145
-  switch($canDo['whyClass'])
146
-  {
144
+    $page->body .= '<div class="alert alert-danger" role="alert">';
145
+    switch($canDo['whyClass'])
146
+    {
147 147
     case 'INVITE':
148 148
       $page->body .= 'This shift requires an invite from the department lead. If you think you should have recieved such an invite please <a href="https://www.burningflipside.com/contact" class="alert-link">contact the lead</a>.';
149
-      break;
149
+        break;
150 150
     case 'CERT':
151 151
        $page->body .= $canDo['whyMsg'].' If you have this certification it is not recorded in your profile. You can <a href="certiciation.php" class="alert-link">record that certification</a> to sign up.';
152
-       break;
152
+        break;
153 153
     default:
154 154
       $page->body .= 'You are not eligible for this shift because: '.$canDo['whyMsg'];
155
-      break;
156
-  }
157
-  $page->body .= '</div>';
158
-  $page->printPage();
159
-  return;  
155
+        break;
156
+    }
157
+    $page->body .= '</div>';
158
+    $page->printPage();
159
+    return;  
160 160
 }
161 161
 
162 162
 $start = new \DateTime($shift['startTime']);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 $page->body .= '<div id="signupContent" ';
168 168
 if($overlap)
169 169
 {
170
-  $page->body .= 'class="d-none" ';
170
+    $page->body .= 'class="d-none" ';
171 171
 }
172 172
 $page->body .= '/>';
173 173
 $page->body .= '
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 //Is group eligible?
209 209
 if(isset($shift['groupID']) && isset($roles[0]['groups_allowed']) && $roles[0]['groups_allowed'])
210 210
 {
211
-  $page->body .= '
211
+    $page->body .= '
212 212
   <div class="row">
213 213
     <div class="alert alert-primary" role="alert">
214 214
       You have selected a group eligible shift. This means you can generate a link for your friends to sign up on the shift with you. Would you like to sign up for the shift and generate that link now?
Please login to merge, or discard this patch.