@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | return Response::download($file_path, Auth::user()->openemis_no.'_'.$filename.$version, [ |
| 118 | 118 | 'Content-Length: '.filesize($file_path) |
| 119 | 119 | ]); |
| 120 | - } else |
|
| 120 | + }else |
|
| 121 | 121 | { |
| 122 | 122 | return View::make('errors.404'); |
| 123 | 123 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | return Response::download($file_path, $filename, [ |
| 137 | 137 | 'Content-Length: '.filesize($file_path) |
| 138 | 138 | ]); |
| 139 | - } else |
|
| 139 | + }else |
|
| 140 | 140 | { |
| 141 | 141 | abort(404, 'We did not found an error file.'); |
| 142 | 142 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | return Response::download($file_path, $filename, [ |
| 151 | 151 | 'Content-Length: '.filesize($file_path) |
| 152 | 152 | ]); |
| 153 | - } else |
|
| 153 | + }else |
|
| 154 | 154 | { |
| 155 | 155 | |
| 156 | 156 | abort(404, 'We did not found an error file.'); |
@@ -13,88 +13,88 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function index() |
| 15 | 15 | { |
| 16 | - return Datatables::of(Upload::with(['classRoom'])->where('security_user_id','=',Auth::user()->id)) |
|
| 17 | - ->editColumn('is_processed', function ($data) { |
|
| 16 | + return Datatables::of(Upload::with(['classRoom'])->where('security_user_id', '=', Auth::user()->id)) |
|
| 17 | + ->editColumn('is_processed', function($data) { |
|
| 18 | 18 | |
| 19 | 19 | $nowTime = \Carbon\Carbon::now(); |
| 20 | 20 | $to = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $nowTime); |
| 21 | 21 | $from = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $data->updated_at); |
| 22 | 22 | $diff_in_hours = $to->diffInHours($from); |
| 23 | 23 | |
| 24 | - if($diff_in_hours >= 2 && $data->is_processed == 3){ |
|
| 24 | + if ($diff_in_hours >= 2 && $data->is_processed == 3) { |
|
| 25 | 25 | return "Terminated"; |
| 26 | 26 | } elseif ($data->is_processed === 1) { |
| 27 | 27 | return "Success"; |
| 28 | - } elseif ($data->is_processed === 2){ |
|
| 28 | + } elseif ($data->is_processed === 2) { |
|
| 29 | 29 | return "Failed"; |
| 30 | - } elseif($diff_in_hours < 2 && $data->is_processed == 3){ |
|
| 30 | + } elseif ($diff_in_hours < 2 && $data->is_processed == 3) { |
|
| 31 | 31 | return "Processing"; |
| 32 | - } elseif ($data->is_processed == 4){ |
|
| 32 | + } elseif ($data->is_processed == 4) { |
|
| 33 | 33 | return "Process Paused"; |
| 34 | - } else{ |
|
| 34 | + }else { |
|
| 35 | 35 | return 'Pending'; |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | 38 | }) |
| 39 | - ->editColumn('is_email_sent', function ($data) { |
|
| 39 | + ->editColumn('is_email_sent', function($data) { |
|
| 40 | 40 | if ($data->is_email_sent === 1) { |
| 41 | 41 | return "Success"; |
| 42 | - } elseif($data->is_email_sent === 2 ){ |
|
| 42 | + } elseif ($data->is_email_sent === 2) { |
|
| 43 | 43 | return 'Failed'; |
| 44 | - } else{ |
|
| 44 | + }else { |
|
| 45 | 45 | return 'Pending'; |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | 48 | }) |
| 49 | - ->editColumn('update', function ($data) { |
|
| 49 | + ->editColumn('update', function($data) { |
|
| 50 | 50 | if ($data->update === 0) { |
| 51 | 51 | return "No Processes"; |
| 52 | - } elseif($data->update === 1 ){ |
|
| 52 | + } elseif ($data->update === 1) { |
|
| 53 | 53 | return 'Success'; |
| 54 | - } elseif($data->update === 3 ){ |
|
| 54 | + } elseif ($data->update === 3) { |
|
| 55 | 55 | return 'Partial Success'; |
| 56 | - } else{ |
|
| 56 | + }else { |
|
| 57 | 57 | return 'Failed'; |
| 58 | 58 | }; |
| 59 | 59 | |
| 60 | 60 | }) |
| 61 | - ->editColumn('insert', function ($data) { |
|
| 61 | + ->editColumn('insert', function($data) { |
|
| 62 | 62 | if ($data->insert === 0) { |
| 63 | 63 | return "No Processes"; |
| 64 | - } elseif($data->insert === 1 ){ |
|
| 64 | + } elseif ($data->insert === 1) { |
|
| 65 | 65 | return 'Success'; |
| 66 | - } elseif($data->insert === 3 ){ |
|
| 66 | + } elseif ($data->insert === 3) { |
|
| 67 | 67 | return 'Partial Success'; |
| 68 | - } else{ |
|
| 68 | + }else { |
|
| 69 | 69 | return 'Failed'; |
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | 72 | }) |
| 73 | - ->editColumn('filename', function ($data) { |
|
| 73 | + ->editColumn('filename', function($data) { |
|
| 74 | 74 | return '<a href='.env('APP_URL').'/download_file/'.$data->filename.'>'.substr($data->classRoom->name, 0, 10).'</a>'; |
| 75 | 75 | }) |
| 76 | - ->editColumn('error', function ($data) { |
|
| 76 | + ->editColumn('error', function($data) { |
|
| 77 | 77 | return '<a href='.env('APP_URL').'/download/'.$data->filename.'>'.substr($data->classRoom->name, 0, 10).'</a>'; |
| 78 | - })->editColumn('actions', function ($data) { |
|
| 78 | + })->editColumn('actions', function($data) { |
|
| 79 | 79 | |
| 80 | 80 | $nowTime = \Carbon\Carbon::now(); |
| 81 | 81 | $to = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $nowTime); |
| 82 | 82 | $from = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $data->updated_at); |
| 83 | 83 | $diff_in_hours = $to->diffInHours($from); |
| 84 | 84 | |
| 85 | - if($diff_in_hours >= 2 && $data->is_processed == 3){ |
|
| 85 | + if ($diff_in_hours >= 2 && $data->is_processed == 3) { |
|
| 86 | 86 | return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-primary text-uppercase">reprocess</button>'; |
| 87 | - } elseif ($data->is_processed == 1){ |
|
| 87 | + } elseif ($data->is_processed == 1) { |
|
| 88 | 88 | return '<div><h6>Processing <span class="badge badge-success text-uppercase">Successful</span></h6></div>'; |
| 89 | - } elseif ($data->is_processed == 2){ |
|
| 89 | + } elseif ($data->is_processed == 2) { |
|
| 90 | 90 | return '<div><h6>Processing <span class="badge badge-danger text-uppercase">Failed</span></h6></div>'; |
| 91 | - } elseif ($data->is_processed == 0){ |
|
| 91 | + } elseif ($data->is_processed == 0) { |
|
| 92 | 92 | return '<button onclick="updateProcess('.($data->id).',200)" class="btn btn-block btn-warning text-uppercase">pause</button>'; |
| 93 | - } elseif ($data->is_processed == 4){ |
|
| 93 | + } elseif ($data->is_processed == 4) { |
|
| 94 | 94 | return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-block btn-success text-uppercase">resume</button>'; |
| 95 | 95 | } |
| 96 | 96 | }) |
| 97 | - ->rawColumns(['filename','error','actions']) |
|
| 97 | + ->rawColumns(['filename', 'error', 'actions']) |
|
| 98 | 98 | ->make(true); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -18,9 +18,9 @@ |
||
| 18 | 18 | // dd($request->user()->permissions); |
| 19 | 19 | if ($request->user() && (!($request->user()->permissions->isEmpty())) && $request->user()->permissions[0]->roles && $request->user()->permissions[0]->roles->code === 'HOMEROOM_TEACHER') { |
| 20 | 20 | return $next($request); |
| 21 | - }elseif ($request->user() && (!($request->user()->principal->isEmpty())) && $request->user()->principal[0]->roles && $request->user()->principal[0]->roles->code === 'PRINCIPAL') { |
|
| 21 | + } elseif ($request->user() && (!($request->user()->principal->isEmpty())) && $request->user()->principal[0]->roles && $request->user()->principal[0]->roles->code === 'PRINCIPAL') { |
|
| 22 | 22 | return $next($request); |
| 23 | - }elseif ($request->user() && (!($request->user()->zonal_cordinator->isEmpty())) && $request->user()->zonal_cordinator[0]->roles && $request->user()->zonal_cordinator[0]->roles->code === 'PRINCIPAL') { |
|
| 23 | + } elseif ($request->user() && (!($request->user()->zonal_cordinator->isEmpty())) && $request->user()->zonal_cordinator[0]->roles && $request->user()->zonal_cordinator[0]->roles->code === 'PRINCIPAL') { |
|
| 24 | 24 | return $next($request); |
| 25 | 25 | } |
| 26 | 26 | return redirect('/login')->with('status', 'Your dont have access for upload data. Please get assign your to the class and try'); |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | return $row; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - protected function checkKeys($key,$count,$row){ |
|
| 197 | - if(array_key_exists($key,$row)){ |
|
| 196 | + protected function checkKeys($key, $count, $row) { |
|
| 197 | + if (array_key_exists($key, $row)) { |
|
| 198 | 198 | return true; |
| 199 | - }else{ |
|
| 199 | + }else { |
|
| 200 | 200 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 201 | - $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'. $key ,' Is missing form the template'], [null]); |
|
| 201 | + $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'.$key, ' Is missing form the template'], [null]); |
|
| 202 | 202 | $failures = [0 => $failure]; |
| 203 | 203 | new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
| 204 | 204 | }; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | public function map($row): array { |
| 218 | 218 | try { |
| 219 | 219 | $row = $this->mapFields($row); |
| 220 | - } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 220 | + }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 221 | 221 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 222 | 222 | $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'], [null]); |
| 223 | 223 | $failures = [0 => $failure]; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $rowData = $this->worksheet->rangeToArray('A'.$row.':'.$highestColumn.$row, NULL, TRUE, FALSE); |
| 88 | 88 | if (isEmptyRow(reset($rowData))) { |
| 89 | 89 | continue; |
| 90 | - }else { |
|
| 90 | + } else { |
|
| 91 | 91 | $higestRow += 1; |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | $rowData = $this->worksheet->rangeToArray('A'.$row.':'.$highestColumn.$row, NULL, TRUE, FALSE); |
| 115 | 115 | if (isEmptyRow(reset($rowData))) { |
| 116 | 116 | continue; |
| 117 | - }else { |
|
| 117 | + } else { |
|
| 118 | 118 | $higestRow += 1; |
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | if ($higestRow == 0) { |
| 122 | 122 | exit; |
| 123 | - }else { |
|
| 123 | + } else { |
|
| 124 | 124 | return $higestRow; |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | return $row; |
| 153 | - }catch (Exception $e) { |
|
| 153 | + } catch (Exception $e) { |
|
| 154 | 154 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 155 | 155 | $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'], [null]); |
| 156 | 156 | $failures = [0 => $failure]; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | protected function checkKeys($key,$count,$row){ |
| 197 | 197 | if(array_key_exists($key,$row)){ |
| 198 | 198 | return true; |
| 199 | - }else{ |
|
| 199 | + } else{ |
|
| 200 | 200 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 201 | 201 | $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'. $key ,' Is missing form the template'], [null]); |
| 202 | 202 | $failures = [0 => $failure]; |
@@ -243,10 +243,10 @@ discard block |
||
| 243 | 243 | $failures = [0 => $failure]; |
| 244 | 244 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
| 245 | 245 | Log::info('email-sent', [$this->file]); |
| 246 | - }catch (Exception $e) { |
|
| 246 | + } catch (Exception $e) { |
|
| 247 | 247 | Log::info('email-sending-failed', [$e]); |
| 248 | 248 | } |
| 249 | - }else { |
|
| 249 | + } else { |
|
| 250 | 250 | return true; |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | User_contact::createOrUpdate($father, $this->file['security_user_id']); |
| 299 | 299 | } |
| 300 | 300 | Student_guardian::createStudentGuardian($student, $father, $this->file['security_user_id']); |
| 301 | - }else { |
|
| 301 | + } else { |
|
| 302 | 302 | Security_user::where('id', '=', $father->id) |
| 303 | 303 | ->update(['is_guardian' => 1]); |
| 304 | 304 | $father['guardian_relation_id'] = 1; |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | User_contact::createOrUpdate($mother, $this->file['security_user_id']); |
| 359 | 359 | } |
| 360 | 360 | Student_guardian::createStudentGuardian($student, $mother, $this->file['security_user_id']); |
| 361 | - }else { |
|
| 361 | + } else { |
|
| 362 | 362 | Security_user::where('id', '=', $mother->id) |
| 363 | 363 | ->update(['is_guardian' => 1]); |
| 364 | 364 | $mother['guardian_relation_id'] = 2; |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | User_contact::createOrUpdate($guardian, $this->file['security_user_id']); |
| 421 | 421 | } |
| 422 | 422 | Student_guardian::createStudentGuardian($student, $guardian, $this->file['security_user_id']); |
| 423 | - }else { |
|
| 423 | + } else { |
|
| 424 | 424 | Security_user::where('id', '=', $guardian->id) |
| 425 | 425 | ->update(['is_guardian' => 1]); |
| 426 | 426 | $guardian['guardian_relation_id'] = 3; |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | 'total_male_students' => $totalStudents['total_male_students'], |
| 466 | 466 | 'total_female_students' => $totalStudents['total_female_students']]); |
| 467 | 467 | } |
| 468 | - }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 468 | + } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 469 | 469 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 470 | 470 | // $failure = new Failure(3, 'remark', [3 => ], [null]); |
| 471 | 471 | $failures = $e->failures(); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | User_contact::createOrUpdate($father, $this->file['security_user_id']); |
| 257 | 257 | } |
| 258 | 258 | Student_guardian::createStudentGuardian($student, $father, $this->file['security_user_id']); |
| 259 | - }else { |
|
| 259 | + } else { |
|
| 260 | 260 | Security_user::where('id', '=', $father->id) |
| 261 | 261 | ->update(['is_guardian' => 1]); |
| 262 | 262 | $father['guardian_relation_id'] = 1; |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | User_contact::createOrUpdate($mother, $this->file['security_user_id']); |
| 308 | 308 | } |
| 309 | 309 | Student_guardian::createStudentGuardian($student, $mother, $this->file['security_user_id']); |
| 310 | - }else { |
|
| 310 | + } else { |
|
| 311 | 311 | Security_user::where('id', '=', $mother->id) |
| 312 | 312 | ->update(['is_guardian' => 1]); |
| 313 | 313 | $mother['guardian_relation_id'] = 2; |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | User_contact::createOrUpdate($guardian, $this->file['security_user_id']); |
| 362 | 362 | } |
| 363 | 363 | Student_guardian::createStudentGuardian($student, $guardian, $this->file['security_user_id']); |
| 364 | - }else { |
|
| 364 | + } else { |
|
| 365 | 365 | Security_user::where('id', '=', $guardian->id) |
| 366 | 366 | ->update(['is_guardian' => 1]); |
| 367 | 367 | $guardian['guardian_relation_id'] = 3; |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | 'total_male_students' => $totalStudents['total_male_students'], |
| 409 | 409 | 'total_female_students' => $totalStudents['total_female_students']]); |
| 410 | 410 | } |
| 411 | - }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 411 | + } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 412 | 412 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 413 | 413 | $failures = $e->failures(); |
| 414 | 414 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
@@ -423,8 +423,9 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | protected function insertSubject($subject) { |
| 426 | - if (!Institution_subject_student::isDuplicated($subject)) |
|
| 427 | - Institution_subject_student::updateOrInsert($subject); |
|
| 426 | + if (!Institution_subject_student::isDuplicated($subject)) { |
|
| 427 | + Institution_subject_student::updateOrInsert($subject); |
|
| 428 | + } |
|
| 428 | 429 | } |
| 429 | 430 | |
| 430 | 431 | |