Passed
Push — master ( 45960c...20d4cd )
by Glegrith
01:58
created
app/custom/Http/Controller/SpaceFlightDatabase.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -114,15 +114,15 @@
 block discarded – undo
114 114
             }
115 115
 
116 116
             view("SpaceFlightDatabase/noMissionSpecified", [
117
-               "breadcrumb" => view("fetch:core/breadcrumb_single", [
118
-                       "isNotEndLevel" => true,
119
-                       "linkToLowerLevel" => "/sfdb",
120
-                       "text" => "Space Flight DB",
121
-                   ]).view("fetch:core/breadcrumb_single", [
122
-                       "text" => "Mission",
123
-                   ]),
124
-               "dataForStats" => json_encode($dataForJSONArray),
125
-               "SpaceFlightMissionTableData" => $missionTableData,
117
+                "breadcrumb" => view("fetch:core/breadcrumb_single", [
118
+                        "isNotEndLevel" => true,
119
+                        "linkToLowerLevel" => "/sfdb",
120
+                        "text" => "Space Flight DB",
121
+                    ]).view("fetch:core/breadcrumb_single", [
122
+                        "text" => "Mission",
123
+                    ]),
124
+                "dataForStats" => json_encode($dataForJSONArray),
125
+                "SpaceFlightMissionTableData" => $missionTableData,
126 126
             ]);
127 127
         } else {
128 128
             $missionData                        = Missions::getInstance()->getByID($ID);
Please login to merge, or discard this patch.
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function masterMissions($masterMissionID)
32 32
     {
33
-        if($masterMissionID == null){
34
-            $missions = MasterMissions::getInstance()->getAll(['ID', 'Name', 'StartDate']);
35
-
36
-            foreach($missions as $key => $mission){
37
-                $all        = Missions::getInstance()->numOfDataSetsWhere(['MasterMissionIDs' => $mission['ID'], 'StartDateTime[>]'=>null]);
38
-                $successful = Missions::getInstance()->numOfDataSetsWhere(['MasterMissionIDs' => $mission['ID'], 'outcome' => 1, 'StartDateTime[>]' => null]);
39
-                $failed     = Missions::getInstance()->numOfDataSetsWhere(['MasterMissionIDs' => $mission['ID'], 'outcome' => 2, 'StartDateTime[>]' => null]);
40
-                $noData     = Missions::getInstance()->numOfDataSetsWhere(['MasterMissionIDs' => $mission['ID'], 'outcome' => null, 'StartDateTime[>]' => null]);
41
-
42
-                $missions[$key]['outcomeStats']['all']        = '<p class="text-info">'.$all.'</p>';
43
-                $missions[$key]['outcomeStats']['successful'] = '<p class="text-success">'.$successful.'</p>';
44
-                $missions[$key]['outcomeStats']['failed']     = '<p class="text-danger">'.$failed.'</p>';
45
-                $missions[$key]['outcomeStats']['noData']     = '<p class="\">'.$noData.'</p>';
33
+        if ($masterMissionID == null) {
34
+            $missions = MasterMissions::getInstance()->getAll([ 'ID', 'Name', 'StartDate' ]);
35
+
36
+            foreach ($missions as $key => $mission) {
37
+                $all        = Missions::getInstance()->numOfDataSetsWhere([ 'MasterMissionIDs' => $mission[ 'ID' ], 'StartDateTime[>]'=>null ]);
38
+                $successful = Missions::getInstance()->numOfDataSetsWhere([ 'MasterMissionIDs' => $mission[ 'ID' ], 'outcome' => 1, 'StartDateTime[>]' => null ]);
39
+                $failed     = Missions::getInstance()->numOfDataSetsWhere([ 'MasterMissionIDs' => $mission[ 'ID' ], 'outcome' => 2, 'StartDateTime[>]' => null ]);
40
+                $noData     = Missions::getInstance()->numOfDataSetsWhere([ 'MasterMissionIDs' => $mission[ 'ID' ], 'outcome' => null, 'StartDateTime[>]' => null ]);
41
+
42
+                $missions[ $key ][ 'outcomeStats' ][ 'all' ]        = '<p class="text-info">'.$all.'</p>';
43
+                $missions[ $key ][ 'outcomeStats' ][ 'successful' ] = '<p class="text-success">'.$successful.'</p>';
44
+                $missions[ $key ][ 'outcomeStats' ][ 'failed' ]     = '<p class="text-danger">'.$failed.'</p>';
45
+                $missions[ $key ][ 'outcomeStats' ][ 'noData' ]     = '<p class="\">'.$noData.'</p>';
46 46
             }
47 47
 
48 48
             view("SpaceFlightDatabase/masterMission", [
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             ]);
59 59
         } else {
60 60
             // show specific Master Mission
61
-            $missions = Missions::getInstance()->getAllWhere(['ID', 'Name', 'StartDateTime'], ['MasterMissionIDs' => $masterMissionID, 'StartDateTime[>]' => null, 'ORDER' => ['StartDateTime' => 'ASC']]);
61
+            $missions = Missions::getInstance()->getAllWhere([ 'ID', 'Name', 'StartDateTime' ], [ 'MasterMissionIDs' => $masterMissionID, 'StartDateTime[>]' => null, 'ORDER' => [ 'StartDateTime' => 'ASC' ] ]);
62 62
             $currentMasterMissionName = MasterMissions::getInstance()->getByID("Name", $masterMissionID);
63 63
 
64 64
             view("SpaceFlightDatabase/masterMission", [
@@ -82,35 +82,35 @@  discard block
 block discarded – undo
82 82
 
83 83
     public function mission($ID)
84 84
     {
85
-        if($this->isNull($ID)) {
86
-            $numOfMissionsPerYearData = Missions::getInstance()->getAllWhere(['ID', 'StartDateTime'], ["ID[>=]" => 0, "ORDER" => ['StartDateTime'=>"ASC"]]);
87
-            $dataForJSONArray = [];
88
-            $temp = [];
85
+        if ($this->isNull($ID)) {
86
+            $numOfMissionsPerYearData = Missions::getInstance()->getAllWhere([ 'ID', 'StartDateTime' ], [ "ID[>=]" => 0, "ORDER" => [ 'StartDateTime'=>"ASC" ] ]);
87
+            $dataForJSONArray = [ ];
88
+            $temp = [ ];
89 89
 
90
-            foreach ($numOfMissionsPerYearData as $dataSet){
91
-                if($dataSet['StartDateTime'] !== null){
92
-                    $dateTime = $this->datetime($dataSet['StartDateTime']);
90
+            foreach ($numOfMissionsPerYearData as $dataSet) {
91
+                if ($dataSet[ 'StartDateTime' ] !== null) {
92
+                    $dateTime = $this->datetime($dataSet[ 'StartDateTime' ]);
93 93
 
94
-                    if($temp[$dateTime->getYear()]){
95
-                        $temp[$dateTime->getYear()] += 1;
94
+                    if ($temp[ $dateTime->getYear() ]) {
95
+                        $temp[ $dateTime->getYear() ] += 1;
96 96
                     } else {
97
-                        $temp[$dateTime->getYear()] = 1;
97
+                        $temp[ $dateTime->getYear() ] = 1;
98 98
                     }
99 99
                 }
100 100
             }
101 101
 
102
-            foreach($temp as $key => $value){
103
-                $dataForJSONArray[] = [
104
-                    "year" => (string)$key,
102
+            foreach ($temp as $key => $value) {
103
+                $dataForJSONArray[ ] = [
104
+                    "year" => (string) $key,
105 105
                     "value" => $value
106 106
                 ];
107 107
             }
108 108
 
109
-            $missionTableData = Missions::getInstance()->getAllWhere("*", ["ID[>=]" => "1", "StartDateTime[>]"=>null, "ORDER"=>['StartDateTime'=>"ASC"]]);
110
-            foreach($missionTableData as $key => $dataSet){
111
-                $missionTableData[$key]['outcome']             = Missions::getInstance()->getOutcomeByID($dataSet['outcome']);
112
-                $missionTableData[$key]['SpaceLaunchSystemID'] = SpaceLaunchSystem::getInstance()->getByID(["ID","Name"], $dataSet['SpaceLaunchSystemID']);
113
-                $missionTableData[$key]['MasterMissionIDs']    = MasterMissions::getInstance()->getByID(["ID","Name"], $dataSet['MasterMissionIDs']);
109
+            $missionTableData = Missions::getInstance()->getAllWhere("*", [ "ID[>=]" => "1", "StartDateTime[>]"=>null, "ORDER"=>[ 'StartDateTime'=>"ASC" ] ]);
110
+            foreach ($missionTableData as $key => $dataSet) {
111
+                $missionTableData[ $key ][ 'outcome' ]             = Missions::getInstance()->getOutcomeByID($dataSet[ 'outcome' ]);
112
+                $missionTableData[ $key ][ 'SpaceLaunchSystemID' ] = SpaceLaunchSystem::getInstance()->getByID([ "ID", "Name" ], $dataSet[ 'SpaceLaunchSystemID' ]);
113
+                $missionTableData[ $key ][ 'MasterMissionIDs' ]    = MasterMissions::getInstance()->getByID([ "ID", "Name" ], $dataSet[ 'MasterMissionIDs' ]);
114 114
             }
115 115
 
116 116
             view("SpaceFlightDatabase/noMissionSpecified", [
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
             ]);
127 127
         } else {
128 128
             $missionData                        = Missions::getInstance()->getByID($ID);
129
-            $missionData['outcome']             = Missions::getInstance()->getOutcomeByID($missionData['outcome']);
130
-            $missionData['LaunchSiteID']        = LaunchSites::getInstance()->getByID($missionData['LaunchSiteID']);
131
-            $missionData['SpaceLaunchSystemID'] = SpaceLaunchSystem::getInstance()->getByID($missionData['SpaceLaunchSystemID']);
132
-            $missionData['MasterMissionIDs']    = MasterMissions::getInstance()->getByID($missionData['MasterMissionIDs']);
129
+            $missionData[ 'outcome' ]             = Missions::getInstance()->getOutcomeByID($missionData[ 'outcome' ]);
130
+            $missionData[ 'LaunchSiteID' ]        = LaunchSites::getInstance()->getByID($missionData[ 'LaunchSiteID' ]);
131
+            $missionData[ 'SpaceLaunchSystemID' ] = SpaceLaunchSystem::getInstance()->getByID($missionData[ 'SpaceLaunchSystemID' ]);
132
+            $missionData[ 'MasterMissionIDs' ]    = MasterMissions::getInstance()->getByID($missionData[ 'MasterMissionIDs' ]);
133 133
 
134
-            $missionData['SpaceLaunchSystemID']['MaxPayloadLEO'] = number_format($missionData['SpaceLaunchSystemID']['MaxPayloadLEO'], 2, ',', '.')." kg";
135
-            $missionData['SpaceLaunchSystemID']['MaxHeight']     = number_format($missionData['SpaceLaunchSystemID']['MaxHeight'],2, ',', '.')." m";
136
-            $missionData['SpaceLaunchSystemID']['maxDiameter']   = number_format($missionData['SpaceLaunchSystemID']['MaxDiameter'],2, ',', '.')." m";
134
+            $missionData[ 'SpaceLaunchSystemID' ][ 'MaxPayloadLEO' ] = number_format($missionData[ 'SpaceLaunchSystemID' ][ 'MaxPayloadLEO' ], 2, ',', '.')." kg";
135
+            $missionData[ 'SpaceLaunchSystemID' ][ 'MaxHeight' ]     = number_format($missionData[ 'SpaceLaunchSystemID' ][ 'MaxHeight' ], 2, ',', '.')." m";
136
+            $missionData[ 'SpaceLaunchSystemID' ][ 'maxDiameter' ]   = number_format($missionData[ 'SpaceLaunchSystemID' ][ 'MaxDiameter' ], 2, ',', '.')." m";
137 137
 
138 138
             view("SpaceFlightDatabase/mission", [
139 139
                 "breadcrumb" => view("fetch:core/breadcrumb_single", [
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
                             "linkToLowerLevel" => "/sfdb/mission",
146 146
                             "text" => "Mission",
147 147
                         ]).view("fetch:core/breadcrumb_single", [
148
-                            "text" => $missionData['Name']
148
+                            "text" => $missionData[ 'Name' ]
149 149
                         ]),
150 150
 
151 151
                 'MissionMainInfo'      => $missionData,
152
-                'MasterMission'        => $missionData['MasterMissionIDs'],
153
-                'payloadAndTrajectory' => $this->payloadData($missionData['PayloadIDs']),
154
-                'LaunchSiteData'       => $missionData['LaunchSiteID'],
155
-                'SpaceLaunchSystem'    => $missionData['SpaceLaunchSystemID'],
156
-                'spaceman'             => $this->showSpaceman($missionData['Crew']),
152
+                'MasterMission'        => $missionData[ 'MasterMissionIDs' ],
153
+                'payloadAndTrajectory' => $this->payloadData($missionData[ 'PayloadIDs' ]),
154
+                'LaunchSiteData'       => $missionData[ 'LaunchSiteID' ],
155
+                'SpaceLaunchSystem'    => $missionData[ 'SpaceLaunchSystemID' ],
156
+                'spaceman'             => $this->showSpaceman($missionData[ 'Crew' ]),
157 157
             ]);
158 158
         }
159 159
     }
@@ -184,21 +184,21 @@  discard block
 block discarded – undo
184 184
     public function showSpacemanDetailed($ID)
185 185
     {
186 186
         $spacemanData = Spaceman::getInstance()->getByID($ID);
187
-        $post         = Post::getInstance()->getAllWhere('ID', ['AstronautIDs' => $spacemanData['ID']]);
188
-        $crew         = Crew::getInstance()->getAllWhere('ID', ['Post' => (int) $post[0]]);
189
-        $missions     = Missions::getInstance()->getAllWhere(['ID', 'Name', 'StartDateTime'], ['Crew' => $crew[0]]);
187
+        $post         = Post::getInstance()->getAllWhere('ID', [ 'AstronautIDs' => $spacemanData[ 'ID' ] ]);
188
+        $crew         = Crew::getInstance()->getAllWhere('ID', [ 'Post' => (int) $post[ 0 ] ]);
189
+        $missions     = Missions::getInstance()->getAllWhere([ 'ID', 'Name', 'StartDateTime' ], [ 'Crew' => $crew[ 0 ] ]);
190 190
 
191 191
         foreach ($missions as $key => $mission) {
192
-            $TempTimeObj = $this->datetime($mission['StartDateTime']);
193
-            $missions[$key]['timeAgo'] = $TempTimeObj->getTimeAgo();
194
-            $missions[$key]['year'] = $TempTimeObj->getYear();
195
-            $missions[$key]['StartDate'] = explode(" ", $TempTimeObj->val())[0];
192
+            $TempTimeObj = $this->datetime($mission[ 'StartDateTime' ]);
193
+            $missions[ $key ][ 'timeAgo' ] = $TempTimeObj->getTimeAgo();
194
+            $missions[ $key ][ 'year' ] = $TempTimeObj->getYear();
195
+            $missions[ $key ][ 'StartDate' ] = explode(" ", $TempTimeObj->val())[ 0 ];
196 196
         }
197 197
 
198 198
         view("SpaceFlightDatabase/spacemanDetailed", [
199 199
             "pageName" => "Spaceman",
200 200
 
201
-            "title" => "Spaceman ".$spacemanData['Name'],
201
+            "title" => "Spaceman ".$spacemanData[ 'Name' ],
202 202
             "breadcrumb" => view("fetch:core/breadcrumb_single", [
203 203
                     "isNotEndLevel" => true,
204 204
                     "linkToLowerLevel" => "/sfdb",
@@ -208,16 +208,16 @@  discard block
 block discarded – undo
208 208
                     "linkToLowerLevel" => "/sfdb/Spaceman",
209 209
                     "text" => "Spaceman",
210 210
                 ]).view("fetch:core/breadcrumb_single", [
211
-                    "text" => $spacemanData['Name'],
211
+                    "text" => $spacemanData[ 'Name' ],
212 212
                 ]),
213 213
 
214
-            'name'        => $spacemanData['Name'],
215
-            'birth'       => $spacemanData['Birth'],
216
-            'death'       => $spacemanData['Death'],
217
-            'nationality' => $spacemanData['Nationality'],
218
-            'eva'         => $spacemanData['EVAs'],
219
-            'training'    => $spacemanData['Training'],
220
-            'job'         => $spacemanData['Job'],
214
+            'name'        => $spacemanData[ 'Name' ],
215
+            'birth'       => $spacemanData[ 'Birth' ],
216
+            'death'       => $spacemanData[ 'Death' ],
217
+            'nationality' => $spacemanData[ 'Nationality' ],
218
+            'eva'         => $spacemanData[ 'EVAs' ],
219
+            'training'    => $spacemanData[ 'Training' ],
220
+            'job'         => $spacemanData[ 'Job' ],
221 221
 
222 222
             'missions' => $missions
223 223
         ]);
@@ -225,26 +225,26 @@  discard block
 block discarded – undo
225 225
 
226 226
     public function hangar()
227 227
     {
228
-        $spaceLaunchSystemData = SpaceLaunchSystem::getInstance()->getAllWhere(['ID','Name', 'Manufacturer'], ['ID[>=]' => 0]);
228
+        $spaceLaunchSystemData = SpaceLaunchSystem::getInstance()->getAllWhere([ 'ID', 'Name', 'Manufacturer' ], [ 'ID[>=]' => 0 ]);
229 229
         $htmlForOutput = "";
230 230
 
231 231
         foreach ($spaceLaunchSystemData as $key => $dataEntity) {
232
-            $spaceLaunchSystemData[$key]['additionalData'] = Missions::getInstance()->getAllWhere(['ID','Name', 'outcome'], ['SpaceLaunchSystemID' => $dataEntity['ID']]);
232
+            $spaceLaunchSystemData[ $key ][ 'additionalData' ] = Missions::getInstance()->getAllWhere([ 'ID', 'Name', 'outcome' ], [ 'SpaceLaunchSystemID' => $dataEntity[ 'ID' ] ]);
233 233
         }
234 234
 
235 235
         foreach ($spaceLaunchSystemData as $dataEntity) {
236 236
             $htmlForOutput .= "<tr>";
237
-            $htmlForOutput .= "<td>".$dataEntity['ID']."</td>";
238
-            $htmlForOutput .= "<td><a href='/sfdb/hangar/".$dataEntity['ID']."'>".$dataEntity['Name']."</a></td>";
239
-            $htmlForOutput .= "<td>".$dataEntity['Manufacturer']."</td>";
240
-            $htmlForOutput .= "<td>".count($dataEntity['additionalData'])."</td>";
237
+            $htmlForOutput .= "<td>".$dataEntity[ 'ID' ]."</td>";
238
+            $htmlForOutput .= "<td><a href='/sfdb/hangar/".$dataEntity[ 'ID' ]."'>".$dataEntity[ 'Name' ]."</a></td>";
239
+            $htmlForOutput .= "<td>".$dataEntity[ 'Manufacturer' ]."</td>";
240
+            $htmlForOutput .= "<td>".count($dataEntity[ 'additionalData' ])."</td>";
241 241
 
242 242
             $successful = 0;
243 243
             $failed     = 0;
244 244
             $else       = 0;
245 245
 
246
-            foreach ($dataEntity['additionalData'] as $additionalDataSet) {
247
-                switch ($additionalDataSet['outcome']) {
246
+            foreach ($dataEntity[ 'additionalData' ] as $additionalDataSet) {
247
+                switch ($additionalDataSet[ 'outcome' ]) {
248 248
                     case 1:
249 249
                         $successful++;
250 250
                         break;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
             $htmlForOutput .= "</tr>";
266 266
         }
267 267
 
268
-        view("SpaceFlightDatabase/hangar",[
268
+        view("SpaceFlightDatabase/hangar", [
269 269
             "pageName" => "Hangar",
270 270
 
271 271
             "title" => "",
@@ -283,24 +283,24 @@  discard block
 block discarded – undo
283 283
 
284 284
     public function spaceLaunchSystem($ID)
285 285
     {
286
-        $missionsData   = Missions::getInstance()->getAllWhere(['ID', 'Name', 'StartDateTime', 'LaunchSiteID', 'PayloadIDs', 'outcome'], ['SpaceLaunchSystemID' => $ID, 'ORDER' => ['StartDateTime' => 'ASC']]);
287
-        $launchSysSpecs = SpaceLaunchSystem::getInstance()->getByID($ID, ['Name', 'StageIDs']);
288
-        $launchSysSpecs['StageIDs'] = explode(',', $launchSysSpecs['StageIDs']);
286
+        $missionsData   = Missions::getInstance()->getAllWhere([ 'ID', 'Name', 'StartDateTime', 'LaunchSiteID', 'PayloadIDs', 'outcome' ], [ 'SpaceLaunchSystemID' => $ID, 'ORDER' => [ 'StartDateTime' => 'ASC' ] ]);
287
+        $launchSysSpecs = SpaceLaunchSystem::getInstance()->getByID($ID, [ 'Name', 'StageIDs' ]);
288
+        $launchSysSpecs[ 'StageIDs' ] = explode(',', $launchSysSpecs[ 'StageIDs' ]);
289 289
 
290
-        foreach($launchSysSpecs['StageIDs'] as $key => $stageID) {
291
-            if(explode('x', $launchSysSpecs['StageIDs'][$key])[1] != null) {
292
-                $launchSysSpecs['StageIDs'][$key] = explode('x', $launchSysSpecs['StageIDs'][$key]);
290
+        foreach ($launchSysSpecs[ 'StageIDs' ] as $key => $stageID) {
291
+            if (explode('x', $launchSysSpecs[ 'StageIDs' ][ $key ])[ 1 ] != null) {
292
+                $launchSysSpecs[ 'StageIDs' ][ $key ] = explode('x', $launchSysSpecs[ 'StageIDs' ][ $key ]);
293 293
             }
294 294
 
295
-            if(is_array($launchSysSpecs['StageIDs'][$key])) {
296
-                $launchSysSpecs['StageIDs'][$key] = $launchSysSpecs['StageIDs'][$key][0]." x ".SLSstages::getInstance()->getByID($launchSysSpecs['StageIDs'][$key][1], 'Type');
295
+            if (is_array($launchSysSpecs[ 'StageIDs' ][ $key ])) {
296
+                $launchSysSpecs[ 'StageIDs' ][ $key ] = $launchSysSpecs[ 'StageIDs' ][ $key ][ 0 ]." x ".SLSstages::getInstance()->getByID($launchSysSpecs[ 'StageIDs' ][ $key ][ 1 ], 'Type');
297 297
             } else {
298
-                $launchSysSpecs['StageIDs'][$key] = SLSstages::getInstance()->getByID($stageID, 'Type');
298
+                $launchSysSpecs[ 'StageIDs' ][ $key ] = SLSstages::getInstance()->getByID($stageID, 'Type');
299 299
             }
300 300
         }
301 301
 
302
-        foreach($missionsData as $key => $dataSet){
303
-            $missionsData[$key]['outcome'] = PossibleOutcome::getInstance()->getByID($dataSet['outcome'], 'Name');
302
+        foreach ($missionsData as $key => $dataSet) {
303
+            $missionsData[ $key ][ 'outcome' ] = PossibleOutcome::getInstance()->getByID($dataSet[ 'outcome' ], 'Name');
304 304
         }
305 305
 
306 306
         //TODO: look in smarty doc for loop iterations and use them instead of the $key
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
                 "linkToLowerLevel" => "/sfdb/hangar",
315 315
                 "text" => "Hangar",
316 316
             ]).view("fetch:core/breadcrumb_single", [
317
-                "text" => $launchSysSpecs['Name'],
317
+                "text" => $launchSysSpecs[ 'Name' ],
318 318
             ]),
319 319
             "launchSysSpecs" => $launchSysSpecs,
320 320
             "SpaceFlightVehicleTableData" => $missionsData,
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
 
324 324
     public function sorted($by = null, $param = null)
325 325
     {
326
-        switch ($by){
326
+        switch ($by) {
327 327
             case "year":
328 328
                 if (!$this->isNull($param)) {
329
-                    $data = Missions::getInstance()->getAllWhere(['ID', 'Name', 'StartDateTime', 'EndDateTime', 'outcome'], ['StartDateTime[~]' => $param, "ORDER" => ["StartDateTime" => "ASC"]]);
329
+                    $data = Missions::getInstance()->getAllWhere([ 'ID', 'Name', 'StartDateTime', 'EndDateTime', 'outcome' ], [ 'StartDateTime[~]' => $param, "ORDER" => [ "StartDateTime" => "ASC" ] ]);
330 330
 
331 331
                     foreach ($data as $key => $value) {
332
-                        $data[$key]['outcome'] = PossibleOutcome::getInstance()->getByID($data[$key]['outcome'], 'Name');
332
+                        $data[ $key ][ 'outcome' ] = PossibleOutcome::getInstance()->getByID($data[ $key ][ 'outcome' ], 'Name');
333 333
                     }
334 334
                 }
335 335
 
@@ -355,18 +355,18 @@  discard block
 block discarded – undo
355 355
 
356 356
     private function payloadData($IDs)
357 357
     {
358
-        $temp   = explode(",",$IDs);
358
+        $temp   = explode(",", $IDs);
359 359
 
360 360
         $result = Payloads::getInstance()->getAllByIDs($temp, '*');
361 361
         $output = "";
362 362
 
363
-        foreach($result as $payload) {
363
+        foreach ($result as $payload) {
364 364
             $missionEvents = Payloads::getInstance()->getMissionEvents($payload);
365 365
             Payloads::getInstance()->fullFillData($payload);
366 366
 
367
-            $payload['Mass'] = number_format($payload['Mass'], 2, ',', '.') . " kg";
367
+            $payload[ 'Mass' ] = number_format($payload[ 'Mass' ], 2, ',', '.')." kg";
368 368
 
369
-            if($_GET['edit'] != 'payload') {
369
+            if ($_GET[ 'edit' ] != 'payload') {
370 370
                 $output .= view('fetch:SpaceFlightDatabase/payload', [
371 371
                     'payloadData'    => $payload,
372 372
                     'missionEvents'  => $this->getMissionEvents($missionEvents)
@@ -383,18 +383,18 @@  discard block
 block discarded – undo
383 383
     {
384 384
         $output = '';
385 385
 
386
-        foreach($data as $key => $mission){
386
+        foreach ($data as $key => $mission) {
387 387
 
388
-            if($key % 3 == 0){
389
-                if($key == 3){
388
+            if ($key % 3 == 0) {
389
+                if ($key == 3) {
390 390
                     $output .= '</div>';
391 391
                 }
392 392
                 $output .= '<div class="row">';
393 393
             }
394 394
 
395
-            $mission['FromSpacecraftName'] = Payloads::getInstance()->getName($mission['FromSpacecraftID']);
396
-            $mission['Periapsis']          = number_format($mission['Periapsis'], 2, ',', '.')." km";
397
-            $mission['Apoapsis']           = number_format($mission['Apoapsis'],2, ',', '.')." km";
395
+            $mission[ 'FromSpacecraftName' ] = Payloads::getInstance()->getName($mission[ 'FromSpacecraftID' ]);
396
+            $mission[ 'Periapsis' ]          = number_format($mission[ 'Periapsis' ], 2, ',', '.')." km";
397
+            $mission[ 'Apoapsis' ]           = number_format($mission[ 'Apoapsis' ], 2, ',', '.')." km";
398 398
 
399 399
             $output .= view("fetch:SpaceFlightDatabase/missionEvent", [
400 400
                 'missionEvent'     => $mission
@@ -407,18 +407,18 @@  discard block
 block discarded – undo
407 407
     private function showSpaceman($ID)
408 408
     {
409 409
         $crew         = Crew::getInstance()->getByID($ID);
410
-        $crew['Post'] = Post::getInstance()->getAllByIDs(explode(",", $crew['Post']), '*');
411
-        $output   = '';
410
+        $crew[ 'Post' ] = Post::getInstance()->getAllByIDs(explode(",", $crew[ 'Post' ]), '*');
411
+        $output = '';
412 412
 
413
-        foreach ($crew['Post'] as $key => $post) {
414
-            $crew['Post'][$key]['AstronautIDs'] = Spaceman::getInstance()->getAllByIDs(explode(",", $post['AstronautIDs']), '*');
413
+        foreach ($crew[ 'Post' ] as $key => $post) {
414
+            $crew[ 'Post' ][ $key ][ 'AstronautIDs' ] = Spaceman::getInstance()->getAllByIDs(explode(",", $post[ 'AstronautIDs' ]), '*');
415 415
         }
416 416
 
417
-        foreach($crew['Post'] as $post) {
417
+        foreach ($crew[ 'Post' ] as $post) {
418 418
             $output .= view("fetch:SpaceFlightDatabase/post", [
419
-                'ID'       => $post['ID'],
420
-                'postName' => $post['Name'],
421
-                'spacemans' => $post['AstronautIDs']
419
+                'ID'       => $post[ 'ID' ],
420
+                'postName' => $post[ 'Name' ],
421
+                'spacemans' => $post[ 'AstronautIDs' ]
422 422
             ]);
423 423
         }
424 424
 
Please login to merge, or discard this patch.
app/custom/Http/Controller/ProjectManager/TaskController.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -19,27 +19,27 @@  discard block
 block discarded – undo
19 19
         view("projectManager/task/new", [
20 20
             'status'     => StatusModel::getInstance()->all(),
21 21
             'priorities' => PriorityModel::getInstance()->all(),
22
-            'project' => DB::select("SELECT id FROM projects WHERE id=".$projectId)[0]
22
+            'project' => DB::select("SELECT id FROM projects WHERE id=".$projectId)[ 0 ]
23 23
         ]);
24 24
     }
25 25
 
26 26
     function create($projectId)
27 27
     {
28 28
         // validate fields
29
-        $this->validate($_POST['title'], ['required', 'min length:3', 'max length:255']);
30
-        $this->validate($_POST['description'],['max length:255']);
31
-        $this->validate($_POST['status'],['number']);
32
-        $this->validate($_POST['priority'],['number']);
29
+        $this->validate($_POST[ 'title' ], [ 'required', 'min length:3', 'max length:255' ]);
30
+        $this->validate($_POST[ 'description' ], [ 'max length:255' ]);
31
+        $this->validate($_POST[ 'status' ], [ 'number' ]);
32
+        $this->validate($_POST[ 'priority' ], [ 'number' ]);
33 33
 
34 34
         TaskModel::getInstance()->create(
35 35
             $projectId,
36
-            $_POST['title'],
37
-            $_POST['description'],
38
-            $_POST['status'],
39
-            $_POST['priority']
36
+            $_POST[ 'title' ],
37
+            $_POST[ 'description' ],
38
+            $_POST[ 'status' ],
39
+            $_POST[ 'priority' ]
40 40
         );
41 41
 
42
-        header("Location: /manager/project/$projectId");exit;
42
+        header("Location: /manager/project/$projectId"); exit;
43 43
     }
44 44
 
45 45
     function show($projectId, $taskId)
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
         view("projectManager/task/show", [
50 50
             'task' => $task,
51
-            'project' => DB::select("SELECT id FROM projects WHERE id=".$projectId)[0]
51
+            'project' => DB::select("SELECT id FROM projects WHERE id=".$projectId)[ 0 ]
52 52
         ]);
53 53
     }
54 54
 
@@ -58,20 +58,20 @@  discard block
 block discarded – undo
58 58
             'task'       => TaskModel::getInstance()->getOne($projectId, $taskId, false),
59 59
             'status'     => StatusModel::getInstance()->all(),
60 60
             'priorities' => PriorityModel::getInstance()->all(),
61
-            'project' => DB::select("SELECT id FROM projects WHERE id=".$projectId)[0]
61
+            'project' => DB::select("SELECT id FROM projects WHERE id=".$projectId)[ 0 ]
62 62
         ]);
63 63
     }
64 64
 
65 65
     function edit($projectId, $taskId)
66 66
     {
67
-        $errorMsg = [];
68
-        $errorMsg['title']       = $this->validate($_POST['title'], ['required', 'min length:3', 'max length:255'], false);
69
-        $errorMsg['description'] = $this->validate($_POST['description'],['max length:255'], false);
70
-        $errorMsg['status']      = $this->validate($_POST['status'],['number'], false);
71
-        $errorMsg['priority']    = $this->validate($_POST['priority'],['number'], false);
67
+        $errorMsg = [ ];
68
+        $errorMsg[ 'title' ]       = $this->validate($_POST[ 'title' ], [ 'required', 'min length:3', 'max length:255' ], false);
69
+        $errorMsg[ 'description' ] = $this->validate($_POST[ 'description' ], [ 'max length:255' ], false);
70
+        $errorMsg[ 'status' ]      = $this->validate($_POST[ 'status' ], [ 'number' ], false);
71
+        $errorMsg[ 'priority' ]    = $this->validate($_POST[ 'priority' ], [ 'number' ], false);
72 72
 
73 73
         foreach ($errorMsg as $msg) {
74
-            if($msg !== true) {
74
+            if ($msg !== true) {
75 75
                 return view("projectManager/task/new", [
76 76
                     'task' => TaskModel::getInstance()->getOne($projectId, $taskId),
77 77
                     'errors' => $errorMsg
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
                 updated_at =NOW()
90 90
             WHERE
91 91
                 id=:id", [
92
-            'title' => $_POST['title'],
93
-            'description' => $_POST['description'],
94
-            'assignedTo' => (int)$_POST['assignTo'],
95
-            'tstatus' => (int)$_POST['status'],
96
-            'priority' => (int)$_POST['priority'],
97
-            'id' => (int)$taskId
92
+            'title' => $_POST[ 'title' ],
93
+            'description' => $_POST[ 'description' ],
94
+            'assignedTo' => (int) $_POST[ 'assignTo' ],
95
+            'tstatus' => (int) $_POST[ 'status' ],
96
+            'priority' => (int) $_POST[ 'priority' ],
97
+            'id' => (int) $taskId
98 98
         ]);
99 99
 
100
-        header("Location: /manager/project/$projectId");exit;
100
+        header("Location: /manager/project/$projectId"); exit;
101 101
     }
102 102
 }
Please login to merge, or discard this patch.
app/custom/Http/Controller/ProjectManager/ProjectController.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -22,77 +22,77 @@  discard block
 block discarded – undo
22 22
             NOW(), 
23 23
             NOW()
24 24
         )", [
25
-            'pname'       => $_POST['name'],
26
-            'description' => $_POST['description'],
27
-            'powner'      => $_SESSION['user']['id']
25
+            'pname'       => $_POST[ 'name' ],
26
+            'description' => $_POST[ 'description' ],
27
+            'powner'      => $_SESSION[ 'user' ][ 'id' ]
28 28
         ]);
29 29
 
30
-        header("Location: /manager");exit;
30
+        header("Location: /manager"); exit;
31 31
     }
32 32
 
33 33
     function show($id)
34 34
     {
35 35
         $project = DB::select(
36 36
             "SELECT * FROM projects WHERE id=:id and owner=:powner",
37
-            ['id' => $id, 'powner' => $_SESSION['user']['id']]
38
-        )[0];
37
+            [ 'id' => $id, 'powner' => $_SESSION[ 'user' ][ 'id' ] ]
38
+        )[ 0 ];
39 39
 
40 40
         $tasks = DB::select(
41 41
             "SELECT * FROM tasks WHERE project=:projectId ORDER BY status, priority DESC",
42
-            ['projectId' => $project->id]
42
+            [ 'projectId' => $project->id ]
43 43
         );
44 44
 
45 45
         foreach ($tasks as $key => $task) {
46
-            $tasks[$key]->status = DB::select(
46
+            $tasks[ $key ]->status = DB::select(
47 47
                 "SELECT text FROM status WHERE id=:stat",
48
-                ['stat' => $task->status]
49
-            )[0]->text;
50
-            $tasks[$key]->priority = DB::select(
48
+                [ 'stat' => $task->status ]
49
+            )[ 0 ]->text;
50
+            $tasks[ $key ]->priority = DB::select(
51 51
                 "SELECT text FROM priority WHERE id=:priority",
52
-                ['priority' => $task->priority]
53
-            )[0]->text;
54
-            $tasks[$key]->createdBy = DB::select(
52
+                [ 'priority' => $task->priority ]
53
+            )[ 0 ]->text;
54
+            $tasks[ $key ]->createdBy = DB::select(
55 55
                 "SELECT username FROM user WHERE id=:id",
56
-                ['id' => $task->createdBy]
57
-            )[0]->username;
58
-            $tasks[$key]->assignedTo = DB::select(
56
+                [ 'id' => $task->createdBy ]
57
+            )[ 0 ]->username;
58
+            $tasks[ $key ]->assignedTo = DB::select(
59 59
                 "SELECT username FROM user WHERE id=:id",
60
-                ['id' => $task->assignedTo]
61
-            )[0]->username;
60
+                [ 'id' => $task->assignedTo ]
61
+            )[ 0 ]->username;
62 62
         }
63 63
 
64
-        view("projectManager/project/overview", ['project' => $project, 'tasks'=>$tasks]);
64
+        view("projectManager/project/overview", [ 'project' => $project, 'tasks'=>$tasks ]);
65 65
     }
66 66
 
67 67
     public function settings(Request $request, $errors = null, $page = null)
68 68
     {
69
-        $members = [];
69
+        $members = [ ];
70 70
         if ($request->paramsGet()->get("p") == "members") {
71 71
             // get id of project owner
72 72
             $ownerID = DB::select("SELECT owner FROM projects WHERE id=:id", [
73 73
                 'id' => $request->__get('id')
74
-            ])[0]->owner;
74
+            ])[ 0 ]->owner;
75 75
 
76 76
             // use owner id to get owner username
77
-            $member['username'] = DB::select(
77
+            $member[ 'username' ] = DB::select(
78 78
                 "SELECT username FROM user WHERE id=:id",
79
-                ['id'=>$ownerID]
80
-            )[0]->username;
79
+                [ 'id'=>$ownerID ]
80
+            )[ 0 ]->username;
81 81
 
82 82
             // get number of tasks assigned to user.
83
-            $member['tasksAssigned'] = count(DB::select(
83
+            $member[ 'tasksAssigned' ] = count(DB::select(
84 84
                 "SELECT id FROM tasks WHERE assignedTo=:user_id", [
85
-                    'id' => $_SESSION['user']['id']
85
+                    'id' => $_SESSION[ 'user' ][ 'id' ]
86 86
                 ]
87 87
             ));
88 88
 
89
-            $members[] = $member;
89
+            $members[ ] = $member;
90 90
         }
91 91
         return view("projectManager/project/settings", [
92 92
             'project' => DB::select(
93 93
                 "SELECT * FROM projects WHERE id=:id",
94
-                ['id' => $request->__get("id")]
95
-            )[0],
94
+                [ 'id' => $request->__get("id") ]
95
+            )[ 0 ],
96 96
             'members' => $members,
97 97
             'errors' => $errors,
98 98
             'goto' => $page
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         switch ($request->paramsPost()->get("category")) {
105 105
             case "general":
106 106
                 $param = $request->paramsPost()->all();
107
-                $param['pname'] = $param['name'];
107
+                $param[ 'pname' ] = $param[ 'name' ];
108 108
                 DB::update(
109 109
                     "UPDATE projects SET name=:pname, description=:description WHERE id=".$request->__get("id"),
110 110
                     $param
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
         $projectId = $request->__get("id");
128 128
 
129 129
         // check if user is already in project
130
-        $owner = DB::select("SELECT owner FROM projects WHERE id=".$projectId)[0]->owner;
130
+        $owner = DB::select("SELECT owner FROM projects WHERE id=".$projectId)[ 0 ]->owner;
131 131
         if ($owner == $userIdToAdd) {
132 132
             $errormessage = "You cant add the owner to his own project";
133 133
         }
134 134
 
135
-        $userId = DB::select("SELECT id FROM user WHERE id=".$userIdToAdd)[0]->id;
135
+        $userId = DB::select("SELECT id FROM user WHERE id=".$userIdToAdd)[ 0 ]->id;
136 136
 
137 137
         if (!is_null($userId)) {
138 138
             $errormessage = "User does not exist";
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
         $userId = DB::select(
146 146
             "SELECT user_id FROM `projects-users` WHERE project_id=".$projectId
147
-        )[0]->user_id;
147
+        )[ 0 ]->user_id;
148 148
 
149 149
         if (is_null($userId)) {
150 150
             DB::insert("INSERT INTO `projects-users` VALUES (
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
                 now(),
154 154
                 now()
155 155
              )", [
156
-                "user_id" => (int)$userIdToAdd,
157
-                "project_id" => (int)$projectId
156
+                "user_id" => (int) $userIdToAdd,
157
+                "project_id" => (int) $projectId
158 158
             ]);
159 159
 
160 160
             header("Location: /manager/project/$projectId/settings?p=members");
Please login to merge, or discard this patch.
app/custom/Http/Controller/WatchlistController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@
 block discarded – undo
11 11
         $listData = Watchlist::getInstance()->getAllByUserID();
12 12
 
13 13
         $temp = $listData;
14
-        foreach($listData as $key => $listEntity) {
15
-            $last = $listData[$key - 1];
16
-            if($listEntity['SeriesName'] == $last['SeriesName']) {
17
-                if($listEntity['Session'] >= $last['Session']) {
18
-                    unset($temp[$key]);
14
+        foreach ($listData as $key => $listEntity) {
15
+            $last = $listData[ $key - 1 ];
16
+            if ($listEntity[ 'SeriesName' ] == $last[ 'SeriesName' ]) {
17
+                if ($listEntity[ 'Session' ] >= $last[ 'Session' ]) {
18
+                    unset($temp[ $key ]);
19 19
                 }
20 20
             }
21 21
         }
Please login to merge, or discard this patch.
app/custom/Http/Controller/ProjectManagerController.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
 
7 7
 class ProjectManagerController
8 8
 {
9
-   public function dashboard()
10
-   {
11
-       $projects = DB::select(
12
-           "SELECT id, name, description FROM projects WHERE owner=:user_id",
13
-           ['user_id' => $_SESSION['user']['id']]
14
-       );
9
+    public function dashboard()
10
+    {
11
+        $projects = DB::select(
12
+            "SELECT id, name, description FROM projects WHERE owner=:user_id",
13
+            ['user_id' => $_SESSION['user']['id']]
14
+        );
15 15
 
16
-       view("projectManager/dashboard", ['projects' => $projects]);
17
-   }
16
+        view("projectManager/dashboard", ['projects' => $projects]);
17
+    }
18 18
 }
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@
 block discarded – undo
10 10
    {
11 11
        $projects = DB::select(
12 12
            "SELECT id, name, description FROM projects WHERE owner=:user_id",
13
-           ['user_id' => $_SESSION['user']['id']]
13
+           [ 'user_id' => $_SESSION[ 'user' ][ 'id' ] ]
14 14
        );
15 15
 
16
-       view("projectManager/dashboard", ['projects' => $projects]);
16
+       view("projectManager/dashboard", [ 'projects' => $projects ]);
17 17
    }
18 18
 }
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
app/custom/Models/ProjectManager/StatusModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,6 +16,6 @@
 block discarded – undo
16 16
 
17 17
     public function getOneById($id)
18 18
     {
19
-        return DB::select("SELECT * FROM status where id=:id", ['id'=>$id])[0];
19
+        return DB::select("SELECT * FROM status where id=:id", [ 'id'=>$id ])[ 0 ];
20 20
     }
21 21
 }
Please login to merge, or discard this patch.
app/custom/Models/ProjectManager/TaskModel.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
                 NOW(), 
34 34
                 NOW()
35 35
             )", [
36
-            'project' => (int)$projectId,
36
+            'project' => (int) $projectId,
37 37
             'title' => $title,
38 38
             'description' => $description,
39
-            'creator' => $_SESSION['user']['id'],
40
-            'status' => (int)$status,
41
-            'priority' => (int)$priority
39
+            'creator' => $_SESSION[ 'user' ][ 'id' ],
40
+            'status' => (int) $status,
41
+            'priority' => (int) $priority
42 42
         ]);
43 43
     }
44 44
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $value = DB::select(
48 48
             "SELECT * FROM tasks WHERE project=:project_id and id=:task_id",
49
-            ['project_id' => $projectId, 'task_id' => $taskId]
50
-        )[0];
49
+            [ 'project_id' => $projectId, 'task_id' => $taskId ]
50
+        )[ 0 ];
51 51
 
52 52
         if ($doTheOtherStuff) {
53 53
             $value->createdByUser = UserModel::getInstance()->getUserNameById($value->createdBy);
Please login to merge, or discard this patch.
app/custom/Models/ProjectManager/PriorityModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,6 +16,6 @@
 block discarded – undo
16 16
 
17 17
     public function getOneById($id)
18 18
     {
19
-        return DB::select("SELECT * FROM priority where id=:id", ['id'=>$id])[0];
19
+        return DB::select("SELECT * FROM priority where id=:id", [ 'id'=>$id ])[ 0 ];
20 20
     }
21 21
 }
Please login to merge, or discard this patch.
routes/web.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 
40 40
 Router::get("/manager/project/[i:id]/task/new", "ProjectManager\TaskController@showCreate");
41 41
 
42
-Router::post("/manager/project/[i:id]/task/new","ProjectManager\TaskController@create");
42
+Router::post("/manager/project/[i:id]/task/new", "ProjectManager\TaskController@create");
43 43
 
44 44
 Router::get("/manager/project/[i:id]/task/[i:task_id]", "ProjectManager\TaskController@show");
45 45
 
Please login to merge, or discard this patch.