@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | $highestColumn = $this->worksheet->getHighestDataColumn(3); |
| 90 | 90 | $higestRow = 0; |
| 91 | 91 | for ($row = $this->startRow(); $row <= $this->highestRow; $row++) { |
| 92 | - $rowData = $this->worksheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE); |
|
| 92 | + $rowData = $this->worksheet->rangeToArray('A'.$row.':'.$highestColumn.$row, NULL, TRUE, FALSE); |
|
| 93 | 93 | if (isEmptyRow(reset($rowData))) { |
| 94 | 94 | continue; |
| 95 | - } else { |
|
| 95 | + }else { |
|
| 96 | 96 | $higestRow += 1; |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $this->failures = []; |
| 107 | 107 | if (($column !== "") && (!in_array($column, $columns))) { |
| 108 | 108 | $this->isValidSheet = false; |
| 109 | - $this->error[] = 'Unsupported column found ,remove:' . $column; |
|
| 109 | + $this->error[] = 'Unsupported column found ,remove:'.$column; |
|
| 110 | 110 | $this->failure = new Failure(3, 'remark', $this->error, [null]); |
| 111 | 111 | $this->failures = new \Maatwebsite\Excel\Validators\ValidationException($error, [$this->failure]); |
| 112 | 112 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | foreach ($columns as $column) { |
| 126 | 126 | if (($column !== "") && (!in_array($column, $existingColumns))) { |
| 127 | 127 | $this->isValidSheet = false; |
| 128 | - $this->error[] = 'Missing Column :' . $column . ' Not found'; |
|
| 128 | + $this->error[] = 'Missing Column :'.$column.' Not found'; |
|
| 129 | 129 | $this->failure = new Failure(3, 'remark', $this->error, [null]); |
| 130 | 130 | $this->failures = new \Maatwebsite\Excel\Validators\ValidationException($error, [$this->failure]); |
| 131 | 131 | } |
@@ -142,16 +142,16 @@ discard block |
||
| 142 | 142 | $highestColumn = $this->worksheet->getHighestDataColumn(3); |
| 143 | 143 | $higestRow = 1; |
| 144 | 144 | for ($row = $this->startRow(); $row <= $this->highestRow; $row++) { |
| 145 | - $rowData = $this->worksheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE); |
|
| 145 | + $rowData = $this->worksheet->rangeToArray('A'.$row.':'.$highestColumn.$row, NULL, TRUE, FALSE); |
|
| 146 | 146 | if (isEmptyRow(reset($rowData))) { |
| 147 | 147 | continue; |
| 148 | - } else { |
|
| 148 | + }else { |
|
| 149 | 149 | $higestRow += 1; |
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | if ($higestRow == 0) { |
| 153 | 153 | exit; |
| 154 | - } else { |
|
| 154 | + }else { |
|
| 155 | 155 | return $higestRow; |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -176,17 +176,17 @@ discard block |
||
| 176 | 176 | case 'string': |
| 177 | 177 | $row[$column] = preg_replace('/[^A-Za-z0-9\-]/', '-', $row[$column]); |
| 178 | 178 | $row[$column] = date($format, strtotime($row[$column])); //date($row[$column]); |
| 179 | - $row[$column] = \Carbon\Carbon::createFromFormat($format, $row[$column]); |
|
| 179 | + $row[$column] = \Carbon\Carbon::createFromFormat($format, $row[$column]); |
|
| 180 | 180 | break; |
| 181 | 181 | case 'double'; |
| 182 | - $row[$column] = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[$column]); |
|
| 182 | + $row[$column] = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[$column]); |
|
| 183 | 183 | break; |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | return $row; |
| 187 | - } catch (Exception $e) { |
|
| 187 | + }catch (Exception $e) { |
|
| 188 | 188 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 189 | - $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system ' . $row[$column] . ' Not a valid date formate'], [null]); |
|
| 189 | + $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system '.$row[$column].' Not a valid date formate'], [null]); |
|
| 190 | 190 | $failures = [0 => $failure]; |
| 191 | 191 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
| 192 | 192 | } |
@@ -207,18 +207,18 @@ discard block |
||
| 207 | 207 | $row = $this->formateDate($row, 'mothers_date_of_birth_yyyy_mm_dd'); |
| 208 | 208 | $row = $this->formateDate($row, 'guardians_date_of_birth_yyyy_mm_dd'); |
| 209 | 209 | |
| 210 | - $row['admission_no'] = str_pad($row['admission_no'], 4, '0', STR_PAD_LEFT); |
|
| 210 | + $row['admission_no'] = str_pad($row['admission_no'], 4, '0', STR_PAD_LEFT); |
|
| 211 | 211 | |
| 212 | 212 | if (array_key_exists('identity_type', $row)) { |
| 213 | 213 | if ($row['identity_type'] == 'BC' && (!empty($row['birth_divisional_secretariat'])) && ($row['identity_number'] !== null) && $row['date_of_birth_yyyy_mm_dd'] !== null) { |
| 214 | - $row['identity_number'] = str_pad($row['identity_number'], 4, '0', STR_PAD_LEFT); |
|
| 214 | + $row['identity_number'] = str_pad($row['identity_number'], 4, '0', STR_PAD_LEFT); |
|
| 215 | 215 | // dd(($row['date_of_birth_yyyy_mm_dd'])); |
| 216 | - $BirthDivision = Area_administrative::where('name', 'like', '%' . $row['birth_divisional_secretariat'] . '%')->where('area_administrative_level_id', '=', 5)->first(); |
|
| 216 | + $BirthDivision = Area_administrative::where('name', 'like', '%'.$row['birth_divisional_secretariat'].'%')->where('area_administrative_level_id', '=', 5)->first(); |
|
| 217 | 217 | if ($BirthDivision !== null) { |
| 218 | - $BirthArea = Area_administrative::where('name', 'like', '%' . $row['birth_registrar_office_as_in_birth_certificate'] . '%') |
|
| 218 | + $BirthArea = Area_administrative::where('name', 'like', '%'.$row['birth_registrar_office_as_in_birth_certificate'].'%') |
|
| 219 | 219 | ->where('parent_id', '=', $BirthDivision->id)->first(); |
| 220 | 220 | if ($BirthArea !== null) { |
| 221 | - $row['identity_number'] = $BirthArea->id . '' . $row['identity_number'] . '' . substr($row['date_of_birth_yyyy_mm_dd']->format("yy"), -2) . '' . $row['date_of_birth_yyyy_mm_dd']->format("m"); |
|
| 221 | + $row['identity_number'] = $BirthArea->id.''.$row['identity_number'].''.substr($row['date_of_birth_yyyy_mm_dd']->format("yy"), -2).''.$row['date_of_birth_yyyy_mm_dd']->format("m"); |
|
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -230,9 +230,9 @@ discard block |
||
| 230 | 230 | { |
| 231 | 231 | if (array_key_exists($key, $row)) { |
| 232 | 232 | return true; |
| 233 | - } else { |
|
| 233 | + }else { |
|
| 234 | 234 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 235 | - $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]); |
|
| 235 | + $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]); |
|
| 236 | 236 | $failures = [0 => $failure]; |
| 237 | 237 | new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
| 238 | 238 | }; |
@@ -267,11 +267,11 @@ discard block |
||
| 267 | 267 | $exceededStudents = ($totalStudents + $this->limit()) > $institutionClass->no_of_students ? true : false; |
| 268 | 268 | if ($exceededStudents == true) { |
| 269 | 269 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 270 | - $failure = new Failure(3, 'remark', ['Class student count exceeded! Max number of students is' . $institutionClass->no_of_students], [null]); |
|
| 270 | + $failure = new Failure(3, 'remark', ['Class student count exceeded! Max number of students is'.$institutionClass->no_of_students], [null]); |
|
| 271 | 271 | $failures = [0 => $failure]; |
| 272 | 272 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
| 273 | 273 | Log::info('email-sent', [$this->file]); |
| 274 | - } else { |
|
| 274 | + }else { |
|
| 275 | 275 | return true; |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | public function createOrUpdateGuardian($row, $student, $param) |
| 334 | 334 | { |
| 335 | - if (!empty($row[$param . 's_full_name']) && ($row[$param . 's_date_of_birth_yyyy_mm_dd'] !== null)) { |
|
| 335 | + if (!empty($row[$param.'s_full_name']) && ($row[$param.'s_date_of_birth_yyyy_mm_dd'] !== null)) { |
|
| 336 | 336 | $guardian = Security_user::createOrUpdateGuardianProfile($row, $param, $this->file); |
| 337 | 337 | if (!is_null($guardian)) { |
| 338 | 338 | Security_user::where('id', '=', $guardian->id) |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | { |
| 375 | 375 | $mandatorySubject = Institution_class_subject::getMandatorySubjects($this->file['institution_class_id']); |
| 376 | 376 | $subjects = getMatchingKeys($row); |
| 377 | - $optionalSubjects = Institution_class_subject::getStudentOptionalSubject($subjects, $student, $row, $institution); |
|
| 377 | + $optionalSubjects = Institution_class_subject::getStudentOptionalSubject($subjects, $student, $row, $institution); |
|
| 378 | 378 | $allSubjects = array_merge_recursive($optionalSubjects, $mandatorySubject); |
| 379 | 379 | if (!empty($allSubjects)) { |
| 380 | 380 | $allSubjects = unique_multidim_array($allSubjects, 'institution_subject_id'); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | public function registerEvents(): array |
| 76 | 76 | { |
| 77 | 77 | return [ |
| 78 | - BeforeSheet::class => function (BeforeSheet $event) { |
|
| 78 | + BeforeSheet::class => function(BeforeSheet $event) { |
|
| 79 | 79 | $this->sheetNames[] = $event->getSheet()->getTitle(); |
| 80 | 80 | $this->worksheet = $event->getSheet(); |
| 81 | 81 | $this->validateClass(); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
| 88 | 88 | } |
| 89 | 89 | }, |
| 90 | - BeforeImport::class => function (BeforeImport $event) { |
|
| 90 | + BeforeImport::class => function(BeforeImport $event) { |
|
| 91 | 91 | $this->highestRow = ($event->getReader()->getDelegate()->getActiveSheet()->getHighestDataRow('C')); |
| 92 | 92 | if ($this->highestRow < 3) { |
| 93 | 93 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | if (!empty($institutionClass)) { |
| 115 | 115 | $row = $this->setGender($row); |
| 116 | - $studentInfo = Security_user::createOrUpdateStudentProfile($row,'create',$this->file); |
|
| 116 | + $studentInfo = Security_user::createOrUpdateStudentProfile($row, 'create', $this->file); |
|
| 117 | 117 | $academicPeriod = Academic_period::where('id', '=', $institutionClass->academic_period_id)->first(); |
| 118 | 118 | $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $institutionClass->id)->first(); |
| 119 | 119 | $assignee_id = $institutionClass->staff_id ? $institutionClass->staff_id : $this->file['security_user_id']; |
@@ -126,25 +126,25 @@ discard block |
||
| 126 | 126 | 'institution_class' => $institutionClass |
| 127 | 127 | ]; |
| 128 | 128 | |
| 129 | - Institution_student_admission::createAdmission($studentInfo->id,$row,$params,$this->file); |
|
| 130 | - Institution_student::createOrUpdate($studentInfo->id,$row,$params,$this->file); |
|
| 131 | - $student = Institution_class_student::createOrUpdate($studentInfo->id,$params,$this->file); |
|
| 132 | - User_special_need::createOrUpdate($student->student_id,$row,$this->file); |
|
| 133 | - User_body_mass::createOrUpdate($student->student_id,$row,$this->file); |
|
| 129 | + Institution_student_admission::createAdmission($studentInfo->id, $row, $params, $this->file); |
|
| 130 | + Institution_student::createOrUpdate($studentInfo->id, $row, $params, $this->file); |
|
| 131 | + $student = Institution_class_student::createOrUpdate($studentInfo->id, $params, $this->file); |
|
| 132 | + User_special_need::createOrUpdate($student->student_id, $row, $this->file); |
|
| 133 | + User_body_mass::createOrUpdate($student->student_id, $row, $this->file); |
|
| 134 | 134 | |
| 135 | - $this->createOrUpdateGuardian($row,$student,'father'); |
|
| 136 | - $this->createOrUpdateGuardian($row,$student,'mother'); |
|
| 137 | - $this->createOrUpdateGuardian($row,$student,'guardian'); |
|
| 135 | + $this->createOrUpdateGuardian($row, $student, 'father'); |
|
| 136 | + $this->createOrUpdateGuardian($row, $student, 'mother'); |
|
| 137 | + $this->createOrUpdateGuardian($row, $student, 'guardian'); |
|
| 138 | 138 | |
| 139 | 139 | $studentInfo['student_id'] = $studentInfo->id; |
| 140 | 140 | Institution_student::updateStudentArea($studentInfo->toArray()); |
| 141 | 141 | |
| 142 | - $this->insertOrUpdateSubjects($row,$student,$institution); |
|
| 142 | + $this->insertOrUpdateSubjects($row, $student, $institution); |
|
| 143 | 143 | |
| 144 | 144 | $totalStudents = Institution_class_student::getStudentsCount($this->file['institution_class_id']); |
| 145 | 145 | if ($totalStudents['total'] > $institutionClass->no_of_students) { |
| 146 | 146 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 147 | - $failure = new Failure(3, 'rows', [3 => 'Class student count exceeded! Max number of students is ' . $institutionClass->no_of_students], [null]); |
|
| 147 | + $failure = new Failure(3, 'rows', [3 => 'Class student count exceeded! Max number of students is '.$institutionClass->no_of_students], [null]); |
|
| 148 | 148 | $failures = [0 => $failure]; |
| 149 | 149 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
| 150 | 150 | Log::info('email-sent', [$this->file]); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $institutionClass = new Institution_class(); |
| 154 | 154 | $institutionClass->updateClassCount($this->file); |
| 155 | 155 | } |
| 156 | - } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 156 | + }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 157 | 157 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 158 | 158 | $failures = $e->failures(); |
| 159 | 159 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | '*.full_name' => 'required|regex:/^[a-zA-Z .]*$/u|max:256', |
| 169 | 169 | '*.preferred_name' => 'nullable|regex:/^[a-zA-Z .]*$/u|max:90', |
| 170 | 170 | '*.gender_mf' => 'required|in:M,F', |
| 171 | - '*.date_of_birth_yyyy_mm_dd' => 'date|required|admission_age:' . $this->file['institution_class_id'], |
|
| 171 | + '*.date_of_birth_yyyy_mm_dd' => 'date|required|admission_age:'.$this->file['institution_class_id'], |
|
| 172 | 172 | '*.address' => 'nullable', |
| 173 | 173 | '*.birth_registrar_office_as_in_birth_certificate' => 'nullable|exists:area_administratives,name|required_if:identity_type,BC|birth_place', |
| 174 | 174 | '*.birth_divisional_secretariat' => 'nullable|exists:area_administratives,name|required_with:birth_registrar_office_as_in_birth_certificate', |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | '*.identity_number' => 'nullable|identity:identity_type|required_with:*.identity_type', |
| 178 | 178 | '*.education_grade' => 'required', |
| 179 | 179 | '*.option_*' => 'nullable|exists:education_subjects,name', |
| 180 | - '*.bmi_height' => 'bail|required_with:*.bmi_weight|bmi:' . $this->file['institution_class_id'], |
|
| 181 | - '*.bmi_weight' => 'bail|required_with:*.bmi_height|bmi:' . $this->file['institution_class_id'], |
|
| 180 | + '*.bmi_height' => 'bail|required_with:*.bmi_weight|bmi:'.$this->file['institution_class_id'], |
|
| 181 | + '*.bmi_weight' => 'bail|required_with:*.bmi_height|bmi:'.$this->file['institution_class_id'], |
|
| 182 | 182 | '*.bmi_date_yyyy_mm_dd' => 'bail|required_with:*.bmi_height|date', //bmi:'. $this->file['institution_class_id'].' |
| 183 | 183 | '*.bmi_academic_period' => 'bail|required_with:*.bmi_height|exists:academic_periods,name', |
| 184 | 184 | '*.admission_no' => 'required|max:12|min:4|regex:/^[A-Za-z0-9\/]+$/', |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public static function boot() |
| 72 | 72 | { |
| 73 | 73 | parent::boot(); |
| 74 | - self::creating(function ($model) { |
|
| 74 | + self::creating(function($model) { |
|
| 75 | 75 | $model->id = (string) Uuid::generate(4); |
| 76 | 76 | $model->created = now(); |
| 77 | 77 | }); |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | 'institution_students.admission_id' |
| 130 | 130 | ) |
| 131 | 131 | ->where('institution_students.institution_id', $institutionGrade['institution_id']) |
| 132 | - ->where('institution_students.student_status_id',1) |
|
| 132 | + ->where('institution_students.student_status_id', 1) |
|
| 133 | 133 | ->where('institution_students.education_grade_id', $institutionGrade['education_grade_id']) |
| 134 | - ->where('institution_students.deleted_at',null) |
|
| 134 | + ->where('institution_students.deleted_at', null) |
|
| 135 | 135 | ->where('institution_students.academic_period_id', $academicPeriod->id)->get()->toArray(); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public static function createExaminationData($student, $admissionInfo) |
| 146 | 146 | { |
| 147 | - $student['sp_center'] = gettype((int)$student['sp_center']) == 'integer' ? $student['sp_center'] : 0; |
|
| 147 | + $student['sp_center'] = gettype((int) $student['sp_center']) == 'integer' ? $student['sp_center'] : 0; |
|
| 148 | 148 | try { |
| 149 | 149 | self::create([ |
| 150 | 150 | 'id' => (string) Uuid::generate(4), |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | 'created' => now(), |
| 170 | 170 | 'created_user_id' => 1 |
| 171 | 171 | ]); |
| 172 | - } catch (\Throwable $th) { |
|
| 172 | + }catch (\Throwable $th) { |
|
| 173 | 173 | Log::error($th); |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public static function updateExaminationData($student, $admissionInfo) |
| 185 | 185 | { |
| 186 | - $student['sp_center'] = gettype((int)$student['sp_center']) == 'integer' ? $student['sp_center'] : 0; |
|
| 186 | + $student['sp_center'] = gettype((int) $student['sp_center']) == 'integer' ? $student['sp_center'] : 0; |
|
| 187 | 187 | try { |
| 188 | 188 | self::where([ |
| 189 | 189 | 'student_id' => $student['student_id'], |
@@ -204,55 +204,55 @@ discard block |
||
| 204 | 204 | 'modified_user_id' => 1 |
| 205 | 205 | ] |
| 206 | 206 | ); |
| 207 | - } catch (\Throwable $th) { |
|
| 207 | + }catch (\Throwable $th) { |
|
| 208 | 208 | Log::error($th); |
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - public static function updateStudentArea(array $student){ |
|
| 213 | - $father = Student_guardian::where('student_id',$student['student_id']) |
|
| 214 | - ->join('security_users as sg','guardian_id', 'sg.id') |
|
| 215 | - ->where('guardian_relation_id',1) |
|
| 212 | + public static function updateStudentArea(array $student) { |
|
| 213 | + $father = Student_guardian::where('student_id', $student['student_id']) |
|
| 214 | + ->join('security_users as sg', 'guardian_id', 'sg.id') |
|
| 215 | + ->where('guardian_relation_id', 1) |
|
| 216 | 216 | ->get()->first(); |
| 217 | 217 | |
| 218 | - $mother = Student_guardian::where('student_id',$student['student_id']) |
|
| 219 | - ->join('security_users as sg','guardian_id', 'sg.id') |
|
| 220 | - ->where('guardian_relation_id',2) |
|
| 218 | + $mother = Student_guardian::where('student_id', $student['student_id']) |
|
| 219 | + ->join('security_users as sg', 'guardian_id', 'sg.id') |
|
| 220 | + ->where('guardian_relation_id', 2) |
|
| 221 | 221 | ->get()->first(); |
| 222 | 222 | |
| 223 | - $guardian = Student_guardian::where('student_id',$student['student_id']) |
|
| 224 | - ->join('security_users as sg','guardian_id', 'sg.id') |
|
| 225 | - ->where('guardian_relation_id',3) |
|
| 223 | + $guardian = Student_guardian::where('student_id', $student['student_id']) |
|
| 224 | + ->join('security_users as sg', 'guardian_id', 'sg.id') |
|
| 225 | + ->where('guardian_relation_id', 3) |
|
| 226 | 226 | ->get()->first(); |
| 227 | 227 | |
| 228 | - if(!is_null($father) && is_null($mother) && is_null($guardian)){ |
|
| 229 | - Security_user::where('id',$student['student_id']) |
|
| 228 | + if (!is_null($father) && is_null($mother) && is_null($guardian)) { |
|
| 229 | + Security_user::where('id', $student['student_id']) |
|
| 230 | 230 | ->update(['address_area_id' => $father->address_area_id]); |
| 231 | - }elseif(!is_null($mother) && (is_null($father) && is_null($guardian))){ |
|
| 232 | - Security_user::where('id',$student['student_id']) |
|
| 231 | + }elseif (!is_null($mother) && (is_null($father) && is_null($guardian))) { |
|
| 232 | + Security_user::where('id', $student['student_id']) |
|
| 233 | 233 | ->update(['address_area_id' => $mother->address_area_id]); |
| 234 | - }elseif(!is_null($guardian) && is_null($father) && is_null($mother)){ |
|
| 235 | - Security_user::where('id',$student['student_id']) |
|
| 234 | + }elseif (!is_null($guardian) && is_null($father) && is_null($mother)) { |
|
| 235 | + Security_user::where('id', $student['student_id']) |
|
| 236 | 236 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 237 | - }elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)){ |
|
| 238 | - Security_user::where('id',$student['student_id']) |
|
| 237 | + }elseif (!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)) { |
|
| 238 | + Security_user::where('id', $student['student_id']) |
|
| 239 | 239 | ->update(['address_area_id' => $mother->address_area_id]); |
| 240 | - }elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)){ |
|
| 241 | - Security_user::where('id',$student['student_id']) |
|
| 240 | + }elseif (!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)) { |
|
| 241 | + Security_user::where('id', $student['student_id']) |
|
| 242 | 242 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 243 | - }elseif(!is_null($father) && $father->address == $student['address']){ |
|
| 244 | - Security_user::where('id',$student['student_id']) |
|
| 243 | + }elseif (!is_null($father) && $father->address == $student['address']) { |
|
| 244 | + Security_user::where('id', $student['student_id']) |
|
| 245 | 245 | ->update(['address_area_id' => $father->address_area_id]); |
| 246 | - }elseif(!is_null($mother) && $mother->address == $student['address']){ |
|
| 247 | - Security_user::where('id',$student['student_id']) |
|
| 246 | + }elseif (!is_null($mother) && $mother->address == $student['address']) { |
|
| 247 | + Security_user::where('id', $student['student_id']) |
|
| 248 | 248 | ->update(['address_area_id' => $mother->address_area_id]); |
| 249 | - }elseif(!is_null($guardian) && $guardian->address == $student['address']){ |
|
| 250 | - Security_user::where('id',$student['student_id']) |
|
| 249 | + }elseif (!is_null($guardian) && $guardian->address == $student['address']) { |
|
| 250 | + Security_user::where('id', $student['student_id']) |
|
| 251 | 251 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - public static function createOrUpdate($studentId,$row,$params,$file){ |
|
| 255 | + public static function createOrUpdate($studentId, $row, $params, $file) { |
|
| 256 | 256 | self::create([ |
| 257 | 257 | 'student_status_id' => 1, |
| 258 | 258 | 'student_id' => $studentId, |
@@ -228,25 +228,25 @@ |
||
| 228 | 228 | if(!is_null($father) && is_null($mother) && is_null($guardian)){ |
| 229 | 229 | Security_user::where('id',$student['student_id']) |
| 230 | 230 | ->update(['address_area_id' => $father->address_area_id]); |
| 231 | - }elseif(!is_null($mother) && (is_null($father) && is_null($guardian))){ |
|
| 231 | + } elseif(!is_null($mother) && (is_null($father) && is_null($guardian))){ |
|
| 232 | 232 | Security_user::where('id',$student['student_id']) |
| 233 | 233 | ->update(['address_area_id' => $mother->address_area_id]); |
| 234 | - }elseif(!is_null($guardian) && is_null($father) && is_null($mother)){ |
|
| 234 | + } elseif(!is_null($guardian) && is_null($father) && is_null($mother)){ |
|
| 235 | 235 | Security_user::where('id',$student['student_id']) |
| 236 | 236 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 237 | - }elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)){ |
|
| 237 | + } elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)){ |
|
| 238 | 238 | Security_user::where('id',$student['student_id']) |
| 239 | 239 | ->update(['address_area_id' => $mother->address_area_id]); |
| 240 | - }elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)){ |
|
| 240 | + } elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)){ |
|
| 241 | 241 | Security_user::where('id',$student['student_id']) |
| 242 | 242 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 243 | - }elseif(!is_null($father) && $father->address == $student['address']){ |
|
| 243 | + } elseif(!is_null($father) && $father->address == $student['address']){ |
|
| 244 | 244 | Security_user::where('id',$student['student_id']) |
| 245 | 245 | ->update(['address_area_id' => $father->address_area_id]); |
| 246 | - }elseif(!is_null($mother) && $mother->address == $student['address']){ |
|
| 246 | + } elseif(!is_null($mother) && $mother->address == $student['address']){ |
|
| 247 | 247 | Security_user::where('id',$student['student_id']) |
| 248 | 248 | ->update(['address_area_id' => $mother->address_area_id]); |
| 249 | - }elseif(!is_null($guardian) && $guardian->address == $student['address']){ |
|
| 249 | + } elseif(!is_null($guardian) && $guardian->address == $student['address']){ |
|
| 250 | 250 | Security_user::where('id',$student['student_id']) |
| 251 | 251 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 252 | 252 | } |
@@ -70,17 +70,17 @@ discard block |
||
| 70 | 70 | if (empty($value)) { |
| 71 | 71 | return false; |
| 72 | 72 | } elseif ($gradeEntity !== null) { |
| 73 | - $admissionAge = (($gradeEntity->admission_age) * 12) - 1; |
|
| 73 | + $admissionAge = (($gradeEntity->admission_age)*12) - 1; |
|
| 74 | 74 | $to = $academicPeriod->start_date; |
| 75 | 75 | $diff_in_months = $to->diffInMonths($value); |
| 76 | 76 | $ageOfStudent = $diff_in_months; |
| 77 | 77 | $enrolmentMaximumAge = $admissionAge + 120; |
| 78 | 78 | return ($ageOfStudent <= $enrolmentMaximumAge) && ($ageOfStudent >= $admissionAge); |
| 79 | - } else { |
|
| 79 | + }else { |
|
| 80 | 80 | return false; |
| 81 | 81 | } |
| 82 | - } else { |
|
| 83 | - $this->_custom_messages['admission_age'] = 'given' . $attribute . 'Not found'; |
|
| 82 | + }else { |
|
| 83 | + $this->_custom_messages['admission_age'] = 'given'.$attribute.'Not found'; |
|
| 84 | 84 | $this->_set_custom_stuff(); |
| 85 | 85 | return false; |
| 86 | 86 | } |
@@ -91,16 +91,16 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | if (is_numeric($value)) { |
| 93 | 93 | if ($value < 10) { |
| 94 | - $this->_custom_messages['bmi'] = $attribute . ' is must greater than 10'; |
|
| 94 | + $this->_custom_messages['bmi'] = $attribute.' is must greater than 10'; |
|
| 95 | 95 | $this->_set_custom_stuff(); |
| 96 | 96 | return false; |
| 97 | 97 | } elseif ($value > 250) { |
| 98 | - $this->_custom_messages['bmi'] = $attribute . ' is must smaller than 250'; |
|
| 98 | + $this->_custom_messages['bmi'] = $attribute.' is must smaller than 250'; |
|
| 99 | 99 | $this->_set_custom_stuff(); |
| 100 | 100 | return false; |
| 101 | 101 | } |
| 102 | - } else { |
|
| 103 | - $this->_custom_messages['bmi'] = $attribute . ' is must a valid numeric'; |
|
| 102 | + }else { |
|
| 103 | + $this->_custom_messages['bmi'] = $attribute.' is must a valid numeric'; |
|
| 104 | 104 | $this->_set_custom_stuff(); |
| 105 | 105 | return false; |
| 106 | 106 | } |
@@ -109,18 +109,18 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | protected function validateBmi($attribute, $value, $parameters) |
| 111 | 111 | { |
| 112 | - $bmiGrades = ['G1', 'G4', 'G7', 'G10']; |
|
| 112 | + $bmiGrades = ['G1', 'G4', 'G7', 'G10']; |
|
| 113 | 113 | $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $parameters[0]) |
| 114 | 114 | ->join('education_grades', 'institution_class_grades.education_grade_id', 'education_grades.id') |
| 115 | 115 | ->first(); |
| 116 | - $educationGrade = Education_grade::where('id', '=', $institutionGrade->education_grade_id)->first(); |
|
| 116 | + $educationGrade = Education_grade::where('id', '=', $institutionGrade->education_grade_id)->first(); |
|
| 117 | 117 | if (in_array($institutionGrade->code, $bmiGrades)) { |
| 118 | 118 | if (!empty($value)) { |
| 119 | 119 | if (($attribute == 'bmi_height') || ('bmi_weight')) { |
| 120 | 120 | return $this->validateHW($attribute, $value); |
| 121 | 121 | } |
| 122 | - } else { |
|
| 123 | - $this->_custom_messages['bmi'] = $attribute . ' is required for ' . $educationGrade->name; |
|
| 122 | + }else { |
|
| 123 | + $this->_custom_messages['bmi'] = $attribute.' is required for '.$educationGrade->name; |
|
| 124 | 124 | $this->_set_custom_stuff(); |
| 125 | 125 | return false; |
| 126 | 126 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | if (($attribute == 'bmi_height') || ('bmi_weight')) { |
| 129 | 129 | return $this->validateHW($attribute, $value); |
| 130 | 130 | } |
| 131 | - } else { |
|
| 131 | + }else { |
|
| 132 | 132 | return true; |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -137,19 +137,19 @@ discard block |
||
| 137 | 137 | { |
| 138 | 138 | foreach ($validator->getData() as $data) { |
| 139 | 139 | if ($data['identity_type'] == 'BC' && key_exists('birth_divisional_secretariat', $data)) { |
| 140 | - $BirthDivision = Area_administrative::where('name', '=', '%' . $data['birth_divisional_secretariat'] . '%')->where('area_administrative_level_id', '=', 5); // |
|
| 140 | + $BirthDivision = Area_administrative::where('name', '=', '%'.$data['birth_divisional_secretariat'].'%')->where('area_administrative_level_id', '=', 5); // |
|
| 141 | 141 | if ($BirthDivision->count() > 0) { |
| 142 | - $BirthArea = Area_administrative::where('name', '=', '%' . $value . '%') //$data['birth_registrar_office_as_in_birth_certificate'] |
|
| 142 | + $BirthArea = Area_administrative::where('name', '=', '%'.$value.'%') //$data['birth_registrar_office_as_in_birth_certificate'] |
|
| 143 | 143 | ->where('parent_id', '=', $BirthDivision->first()->id)->count(); |
| 144 | - return $BirthArea > 0; |
|
| 144 | + return $BirthArea > 0; |
|
| 145 | 145 | } elseif (key_exists('birth_divisional_secretariat', $data) && (!key_exists('birth_registrar_office_as_in_birth_certificate', $data))) { |
| 146 | 146 | $this->_custom_messages['birth_place'] = 'birth_registrar_office_as_in_birth_certificate required with BC'; |
| 147 | 147 | $this->_set_custom_stuff(); |
| 148 | 148 | return false; |
| 149 | - } else { |
|
| 149 | + }else { |
|
| 150 | 150 | return true; |
| 151 | 151 | } |
| 152 | - } else { |
|
| 152 | + }else { |
|
| 153 | 153 | return true; |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -157,16 +157,16 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | protected function validateIsStudentInClass($attribute, $value, $perameters, $validator) |
| 159 | 159 | { |
| 160 | - $student = Security_user::where('openemis_no', '=', $value); |
|
| 160 | + $student = Security_user::where('openemis_no', '=', $value); |
|
| 161 | 161 | if ($student->count() > 0) { |
| 162 | 162 | $student = $student->first()->toArray(); |
| 163 | - $check = Institution_class_student::where('student_id', '=', $student['id'])->where('institution_class_id', '=', $perameters[0])->count(); |
|
| 163 | + $check = Institution_class_student::where('student_id', '=', $student['id'])->where('institution_class_id', '=', $perameters[0])->count(); |
|
| 164 | 164 | if ($check == 1) { |
| 165 | 165 | return true; |
| 166 | - } else { |
|
| 166 | + }else { |
|
| 167 | 167 | return false; |
| 168 | 168 | } |
| 169 | - } else { |
|
| 169 | + }else { |
|
| 170 | 170 | return false; |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | { |
| 178 | 178 | $valid = true; |
| 179 | 179 | foreach ($validator->getData() as $data) { |
| 180 | - switch($data[$perameters[0]]){ |
|
| 180 | + switch ($data[$perameters[0]]) { |
|
| 181 | 181 | case 'BC': |
| 182 | 182 | $valid = preg_match('/^([0-9]{3,5})/i', $value); |
| 183 | 183 | break; |
@@ -190,10 +190,10 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if ($valid == 0) { |
| 193 | - $this->_custom_messages['identity'] = $attribute . ' is not valid Please check the NIC number'; |
|
| 193 | + $this->_custom_messages['identity'] = $attribute.' is not valid Please check the NIC number'; |
|
| 194 | 194 | $this->_set_custom_stuff(); |
| 195 | 195 | return false; |
| 196 | - } else { |
|
| 196 | + }else { |
|
| 197 | 197 | return true; |
| 198 | 198 | } |
| 199 | 199 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | protected function validateUserUnique($attribute, $value, $perameters, $validator) |
| 202 | 202 | { |
| 203 | 203 | foreach ($validator->getData() as $data) { |
| 204 | - $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first(); |
|
| 204 | + $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first(); |
|
| 205 | 205 | if ($identityType !== null && ($value !== null)) { |
| 206 | 206 | if ($identityType->national_code === 'BC') { |
| 207 | 207 | return $this->checkUnique($value, $data, $identityType); |
@@ -217,14 +217,14 @@ discard block |
||
| 217 | 217 | protected function validateIsBc($attribute, $value, $perameters, $validator) |
| 218 | 218 | { |
| 219 | 219 | foreach ($validator->getData() as $data) { |
| 220 | - $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first(); |
|
| 220 | + $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first(); |
|
| 221 | 221 | if (($identityType !== null) && ($identityType !== "")) { |
| 222 | 222 | if (($identityType->national_code) === 'BC') { |
| 223 | 223 | return (strlen((string) $data['identity_number']) < 7); |
| 224 | - } else { |
|
| 224 | + }else { |
|
| 225 | 225 | return true; |
| 226 | 226 | } |
| 227 | - } else { |
|
| 227 | + }else { |
|
| 228 | 228 | return true; |
| 229 | 229 | } |
| 230 | 230 | } |
@@ -234,24 +234,24 @@ discard block |
||
| 234 | 234 | { |
| 235 | 235 | $isUnique = Security_user::where('identity_number', '=', $value)->where('identity_type_id', '=', $identityType->id); |
| 236 | 236 | if ($isUnique->count() > 0) { |
| 237 | - $this->_custom_messages['user_unique'] = 'The identity number already in use. User ID is : ' . $isUnique->first()->openemis_no; |
|
| 237 | + $this->_custom_messages['user_unique'] = 'The identity number already in use. User ID is : '.$isUnique->first()->openemis_no; |
|
| 238 | 238 | $this->_set_custom_stuff(); |
| 239 | 239 | return false; |
| 240 | - } else { |
|
| 240 | + }else { |
|
| 241 | 241 | return true; |
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | protected function IsBc($data, $value) |
| 246 | 246 | { |
| 247 | - $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first(); |
|
| 247 | + $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first(); |
|
| 248 | 248 | if ($identityType !== null) { |
| 249 | 249 | if (($identityType->national_code) === 'BC' && strlen((string) $value) < 8) { |
| 250 | 250 | return false; |
| 251 | - } else { |
|
| 251 | + }else { |
|
| 252 | 252 | return true; |
| 253 | 253 | } |
| 254 | - } else { |
|
| 254 | + }else { |
|
| 255 | 255 | return true; |
| 256 | 256 | } |
| 257 | 257 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 42 | 42 | $output->writeln('###########################################------Inserting file records------###########################################'); |
| 43 | 43 | |
| 44 | - ExaminationStudentsController::callOnClick($this->argument('year'),$this->argument('grade')); |
|
| 44 | + ExaminationStudentsController::callOnClick($this->argument('year'), $this->argument('grade')); |
|
| 45 | 45 | $output->writeln('###########################################------Finished inserting file records------###########################################'); |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -42,9 +42,9 @@ |
||
| 42 | 42 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 43 | 43 | $output->writeln('###########################################------Inserting file records------###########################################'); |
| 44 | 44 | $this->examinationController = new ExaminationStudentsController(2019, 'G4'); |
| 45 | - $students = Examination_student::all()->toArray(); |
|
| 45 | + $students = Examination_student::all()->toArray(); |
|
| 46 | 46 | $func = $this->examinationController; |
| 47 | - array_walk($students,array($func,'updateCensusNo')); |
|
| 47 | + array_walk($students, array($func, 'updateCensusNo')); |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $this->grade = $grade; |
| 31 | 31 | $this->student = new Security_user(); |
| 32 | 32 | $this->examination_student = new Examination_student(); |
| 33 | - $this->academic_period = Academic_period::where('code', '=', $this->year)->first(); |
|
| 33 | + $this->academic_period = Academic_period::where('code', '=', $this->year)->first(); |
|
| 34 | 34 | $this->education_grade = Education_grade::where('code', '=', $this->grade)->first(); |
| 35 | 35 | $this->output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 36 | 36 | } |
@@ -71,10 +71,10 @@ discard block |
||
| 71 | 71 | ); |
| 72 | 72 | Session::flash('message', 'File upload successfully!'); |
| 73 | 73 | // Redirect to index |
| 74 | - } else { |
|
| 74 | + }else { |
|
| 75 | 75 | Session::flash('message', 'File too large. File must be less than 20MB.'); |
| 76 | 76 | } |
| 77 | - } else { |
|
| 77 | + }else { |
|
| 78 | 78 | Session::flash('message', 'Invalid File Extension.'); |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $import->import($excelFile, 'local', \Maatwebsite\Excel\Excel::CSV); |
| 97 | 97 | if ($import->failures()->count() > 0) { |
| 98 | 98 | $errors = $import->failures(); |
| 99 | - $columns = [ |
|
| 99 | + $columns = [ |
|
| 100 | 100 | 'remarks', |
| 101 | 101 | 'st_no', |
| 102 | 102 | 'stu_no', |
@@ -117,10 +117,10 @@ discard block |
||
| 117 | 117 | Storage::put($file, implode(',', $columns)); |
| 118 | 118 | |
| 119 | 119 | foreach ($errors as $error) { |
| 120 | - Storage::append($file, implode(':', $error->errors()) . ',' . implode(',', $error->values())); |
|
| 120 | + Storage::append($file, implode(':', $error->errors()).','.implode(',', $error->values())); |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | - } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 123 | + }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $Institution = $Institution[0]; |
| 144 | 144 | if (count($student) == 1) { |
| 145 | 145 | $student = $student[0]; |
| 146 | - if (((int)$Institution['id']) != ((int)$student['institution_id'])) { |
|
| 146 | + if (((int) $Institution['id']) != ((int) $student['institution_id'])) { |
|
| 147 | 147 | $studentClass = Institution_class_student::where('student_id', $student['student_id']) |
| 148 | 148 | ->first(); |
| 149 | 149 | Institution_class_student::where('student_id', $student['student_id'])->delete(); |
@@ -153,12 +153,12 @@ discard block |
||
| 153 | 153 | if (!is_null($studentClass)) { |
| 154 | 154 | $class->updateClassCount($studentClass->toArray()); |
| 155 | 155 | } |
| 156 | - $output->writeln('updated student info:' . $data['nsid']); |
|
| 156 | + $output->writeln('updated student info:'.$data['nsid']); |
|
| 157 | 157 | } |
| 158 | - } else { |
|
| 158 | + }else { |
|
| 159 | 159 | Institution_student::where('institution_id', '<>', $Institution['id'])->where('student_id', $student[0]['student_id']) |
| 160 | 160 | ->delete(); |
| 161 | - $output->writeln('updated student info:' . $Institution['id'] . '==' . $Institution['id']); |
|
| 161 | + $output->writeln('updated student info:'.$Institution['id'].'=='.$Institution['id']); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $students = []; |
| 175 | 175 | switch ($mode) { |
| 176 | 176 | case 'duplicate': |
| 177 | - $students = DB::table('examination_students as es') |
|
| 177 | + $students = DB::table('examination_students as es') |
|
| 178 | 178 | ->select(DB::raw('count(*) as total'), 'e2.*') |
| 179 | 179 | ->where('grade', $this->grade) |
| 180 | 180 | ->where('year', $this->year) |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | ->limit($limit) |
| 187 | 187 | ->get()->toArray(); |
| 188 | 188 | $students = (array) json_decode(json_encode($students)); |
| 189 | - $this->output->writeln(count($students) . 'students remaining duplicate'); |
|
| 189 | + $this->output->writeln(count($students).'students remaining duplicate'); |
|
| 190 | 190 | array_walk($students, array($this, 'clone')); |
| 191 | 191 | $this->output->writeln('All are generated'); |
| 192 | 192 | break; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | ->limit($limit) |
| 200 | 200 | ->get()->toArray(); |
| 201 | 201 | $students = (array) json_decode(json_encode($students)); |
| 202 | - $this->output->writeln(count($students) . 'students remaining empty'); |
|
| 202 | + $this->output->writeln(count($students).'students remaining empty'); |
|
| 203 | 203 | array_walk($students, array($this, 'clone')); |
| 204 | 204 | $this->output->writeln('All are generated'); |
| 205 | 205 | break; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | ->where('year', $this->year) |
| 210 | 210 | ->get()->toArray(); |
| 211 | 211 | $students = (array) json_decode(json_encode($students)); |
| 212 | - $this->output->writeln(count($students) . 'students remaining with wrong NSID'); |
|
| 212 | + $this->output->writeln(count($students).'students remaining with wrong NSID'); |
|
| 213 | 213 | array_walk($students, array($this, 'clone')); |
| 214 | 214 | $this->output->writeln('All are generated'); |
| 215 | 215 | break; |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | ->count(); |
| 221 | 221 | $all = Examination_student::select('nsid') |
| 222 | 222 | ->count(); |
| 223 | - $this->output->writeln($all . 'Total Unique nsid are: ' . $count); |
|
| 223 | + $this->output->writeln($all.'Total Unique nsid are: '.$count); |
|
| 224 | 224 | break; |
| 225 | 225 | default: |
| 226 | 226 | $students = Examination_student::offset($offset) |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | ->limit($limit) |
| 230 | 230 | ->get()->toArray(); |
| 231 | 231 | $students = (array) json_decode(json_encode($students)); |
| 232 | - $this->output->writeln(count($students) . 'students remaining empty'); |
|
| 232 | + $this->output->writeln(count($students).'students remaining empty'); |
|
| 233 | 233 | array_walk($students, array($this, 'clone')); |
| 234 | 234 | $this->output->writeln('All are generated'); |
| 235 | 235 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | public function clone($student) |
| 277 | 277 | { |
| 278 | - $student = (array)json_decode(json_encode($student)); |
|
| 278 | + $student = (array) json_decode(json_encode($student)); |
|
| 279 | 279 | //get student matching with same dob and gender |
| 280 | 280 | |
| 281 | 281 | $matchedStudent = $this->getMatchingStudents($student); |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | //TODO implement insert student to admission table |
| 312 | 312 | $student['id'] = $sis_student['id']; |
| 313 | - $sis_student['student_id'] = $student['id']; |
|
| 313 | + $sis_student['student_id'] = $student['id']; |
|
| 314 | 314 | |
| 315 | 315 | $student = $this->setIsTakingExam($student); |
| 316 | 316 | if (count($institutionClass) == 1) { |
@@ -318,13 +318,13 @@ discard block |
||
| 318 | 318 | Institution_student::createExaminationData($student, $admissionInfo); |
| 319 | 319 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
| 320 | 320 | Institution_class_student::createExaminationData($student, $admissionInfo); |
| 321 | - } else { |
|
| 321 | + }else { |
|
| 322 | 322 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
| 323 | 323 | Institution_student::createExaminationData($student, $admissionInfo); |
| 324 | 324 | } |
| 325 | 325 | $this->updateStudentId($student, $sis_student); |
| 326 | 326 | // update the matched student's data |
| 327 | - } else { |
|
| 327 | + }else { |
|
| 328 | 328 | $student = $this->setIsTakingExam($student); |
| 329 | 329 | $studentData = $this->student->updateExaminationStudent($student, $matchedStudent); |
| 330 | 330 | $matchedStudent = array_merge((array) $student, $matchedStudent); |
@@ -332,9 +332,9 @@ discard block |
||
| 332 | 332 | Institution_student::updateExaminationData($studentData, $admissionInfo); |
| 333 | 333 | $this->updateStudentId($student, $studentData); |
| 334 | 334 | } |
| 335 | - } else { |
|
| 335 | + }else { |
|
| 336 | 336 | |
| 337 | - $this->output->writeln('Student ' . $student['st_no'] . ' not imorted' . $student['f_name']); |
|
| 337 | + $this->output->writeln('Student '.$student['st_no'].' not imorted'.$student['f_name']); |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | |
@@ -351,20 +351,20 @@ discard block |
||
| 351 | 351 | /** |
| 352 | 352 | */ |
| 353 | 353 | $sis_student = $this->student->getMatches($student); |
| 354 | - $doe_students = Examination_student::where('gender', $student['gender']) |
|
| 354 | + $doe_students = Examination_student::where('gender', $student['gender']) |
|
| 355 | 355 | ->where('b_date', $student['b_date']) |
| 356 | 356 | ->where('schoolid', $student['schoolid']) |
| 357 | - ->where('year',$this->year) |
|
| 358 | - ->where('grade',$this->grade) |
|
| 357 | + ->where('year', $this->year) |
|
| 358 | + ->where('grade', $this->grade) |
|
| 359 | 359 | ->count(); |
| 360 | 360 | $count = $this->student->getStudentCount($student); |
| 361 | 361 | |
| 362 | 362 | $studentData = []; |
| 363 | - $sis_users = (array) json_decode(json_encode($sis_student), true); |
|
| 363 | + $sis_users = (array) json_decode(json_encode($sis_student), true); |
|
| 364 | 364 | // if the same gender same DOE has more than one |
| 365 | 365 | if (($doe_students > 1) || ($count > 1)) { |
| 366 | 366 | $studentData = $this->searchSimilarName($student, $sis_users, false); |
| 367 | - } else { |
|
| 367 | + }else { |
|
| 368 | 368 | $studentData = $this->searchSimilarName($student, $sis_users); |
| 369 | 369 | } |
| 370 | 370 | return $studentData; |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | if (count($matches) > 1) { |
| 417 | - $highest = $this->searchSimilarName($student, $sis_students, false); |
|
| 417 | + $highest = $this->searchSimilarName($student, $sis_students, false); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | return $highest; |
@@ -430,18 +430,18 @@ discard block |
||
| 430 | 430 | public function updateStudentId($student, $sis_student) |
| 431 | 431 | { |
| 432 | 432 | try { |
| 433 | - $student['nsid'] = $sis_student['openemis_no']; |
|
| 433 | + $student['nsid'] = $sis_student['openemis_no']; |
|
| 434 | 434 | // add new NSID to the examinations data set |
| 435 | 435 | unset($student['id']); |
| 436 | 436 | unset($student['taking_g5_exam']); |
| 437 | 437 | unset($student['taking_al_exam']); |
| 438 | 438 | unset($student['taking_ol_exam']); |
| 439 | 439 | unset($student['total']); |
| 440 | - $students['updated_at'] = now(); |
|
| 440 | + $students['updated_at'] = now(); |
|
| 441 | 441 | $this->examination_student->where('st_no', $student['st_no'])->update($student); |
| 442 | 442 | unset($student['st_no']); |
| 443 | - $this->output->writeln('Updated to NSID' . $sis_student['openemis_no']); |
|
| 444 | - } catch (\Exception $th) { |
|
| 443 | + $this->output->writeln('Updated to NSID'.$sis_student['openemis_no']); |
|
| 444 | + }catch (\Exception $th) { |
|
| 445 | 445 | dd($th); |
| 446 | 446 | $this->output->writeln('error'); |
| 447 | 447 | Log::error($th); |
@@ -457,9 +457,9 @@ discard block |
||
| 457 | 457 | { |
| 458 | 458 | $adminUser = Security_user::where('username', 'admin')->first(); |
| 459 | 459 | try { |
| 460 | - (new ExaminationStudentsExport($this->year,$this->grade))->store('examination/student_data_with_nsid.' . time() . '.csv'); |
|
| 460 | + (new ExaminationStudentsExport($this->year, $this->grade))->store('examination/student_data_with_nsid.'.time().'.csv'); |
|
| 461 | 461 | (new ExportReady($adminUser)); |
| 462 | - } catch (\Throwable $th) { |
|
| 462 | + }catch (\Throwable $th) { |
|
| 463 | 463 | //throw $th; |
| 464 | 464 | dd($th); |
| 465 | 465 | } |
@@ -469,13 +469,13 @@ discard block |
||
| 469 | 469 | public function downloadErrors() |
| 470 | 470 | { |
| 471 | 471 | |
| 472 | - $file_path = storage_path() . '/app/examination/errors.csv'; |
|
| 472 | + $file_path = storage_path().'/app/examination/errors.csv'; |
|
| 473 | 473 | return Response::download($file_path); |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | public function downloadProcessedFile() |
| 477 | 477 | { |
| 478 | - $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv'; |
|
| 478 | + $file_path = storage_path().'/app/examination/student_data_with_nsid.csv'; |
|
| 479 | 479 | return Response::download($file_path); |
| 480 | 480 | } |
| 481 | 481 | } |