@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Import_mapping extends Model { |
|
7 | +class Import_mapping extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | protected $dates = []; |
43 | 43 | |
44 | 44 | |
45 | - public static function getSheetColumns($model = null){ |
|
45 | + public static function getSheetColumns($model = null) { |
|
46 | 46 | $columns = Import_mapping::where('model', '=', $model) |
47 | 47 | ->orderBy('order') |
48 | 48 | ->get()->toArray(); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | use Illuminate\Database\Eloquent\Model; |
8 | 8 | |
9 | 9 | |
10 | -class Education_programmes_next_programme extends Model { |
|
10 | +class Education_programmes_next_programme extends Model { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * The database table used by the model. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $institution = Institution_class::find($file['institution_class_id']); |
25 | 25 | |
26 | 26 | $this->user = User::find($file['security_user_id']); |
27 | - $this->subject = 'SIS Bulk upload: '. $file['subject'] .$institution->institution->code.': '. $institution->name.' ' . date('Y:m:d H:i:s'); |
|
27 | + $this->subject = 'SIS Bulk upload: '.$file['subject'].$institution->institution->code.': '.$institution->name.' '.date('Y:m:d H:i:s'); |
|
28 | 28 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
29 | 29 | $this->from_name = 'SIS Bulk Uploader'; |
30 | 30 | $this->with = [ |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function build() |
46 | 46 | { |
47 | 47 | return $this->view('emails.mail') |
48 | - ->from($this->from_address,$this->from_name) |
|
48 | + ->from($this->from_address, $this->from_name) |
|
49 | 49 | ->to($this->user->email) |
50 | 50 | ->subject($this->subject) |
51 | 51 | ->with($this->with); |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | |
24 | 24 | |
25 | 25 | $this->user = User::find($file['security_user_id']); |
26 | - $this->subject = 'SIS Bulk Upload: IncorrectTemplate'.$institution->institution->code.': '. $institution->name.' '. date('Y:m:d H:i:s'); |
|
26 | + $this->subject = 'SIS Bulk Upload: IncorrectTemplate'.$institution->institution->code.': '.$institution->name.' '.date('Y:m:d H:i:s'); |
|
27 | 27 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
28 | 28 | $this->from_name = 'SIS Bulk Uploader'; |
29 | 29 | $this->with = [ |
30 | 30 | 'name' => $this->user->first_name, |
31 | - 'link' => env('APP_URL').'/download/' .$file['filename'] |
|
31 | + 'link' => env('APP_URL').'/download/'.$file['filename'] |
|
32 | 32 | $this->viewData = [ |
33 | 33 | 'name'=>$this->user->first_name, "body" => "The Template you used for upload having some issues, please reconfirm and re-upload with correct template", |
34 | - 'link' => env('APP_URL').'/download/' .$file['filename'] |
|
34 | + 'link' => env('APP_URL').'/download/'.$file['filename'] |
|
35 | 35 | ]; |
36 | 36 | } |
37 | 37 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function build() |
44 | 44 | { |
45 | 45 | return $this->view('emails.mail') |
46 | - ->from($this->from_address,$this->from_name) |
|
46 | + ->from($this->from_address, $this->from_name) |
|
47 | 47 | ->to($this->user->email) |
48 | 48 | ->subject($this->subject) |
49 | 49 | ->with($this->with); |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | $institution = Institution_class::find($file['institution_class_id']); |
32 | 32 | |
33 | 33 | $this->user = User::find($file['security_user_id']); |
34 | - $this->subject = 'SIS Bulk Upload: Upload Failed '.$institution->institution->code.': '. $institution->name . date('Y:m:d H:i:s'); |
|
34 | + $this->subject = 'SIS Bulk Upload: Upload Failed '.$institution->institution->code.': '.$institution->name.date('Y:m:d H:i:s'); |
|
35 | 35 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
36 | 36 | $this->from_name = 'SIS Bulk Uploader'; |
37 | 37 | $this->with = [ |
38 | 38 | 'name' => $this->user->first_name, |
39 | - 'link' => env('APP_URL').'/download/' .$file['filename'] |
|
39 | + 'link' => env('APP_URL').'/download/'.$file['filename'] |
|
40 | 40 | ]; |
41 | 41 | $this->viewData = [ |
42 | 42 | 'name'=>$this->user->first_name, "body" => "The class you tried to import data is exceeded the student count limit.Please check the class / increase the student limit", |
43 | - 'link' => env('APP_URL').'/download/' .$file['filename'] |
|
43 | + 'link' => env('APP_URL').'/download/'.$file['filename'] |
|
44 | 44 | ]; |
45 | 45 | } |
46 | 46 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function build() |
53 | 53 | { |
54 | 54 | return $this->view('emails.mail') |
55 | - ->from($this->from_address,$this->from_name) |
|
55 | + ->from($this->from_address, $this->from_name) |
|
56 | 56 | ->to($this->user->email) |
57 | 57 | ->subject($this->subject) |
58 | 58 | ->with($this->with); |
@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | |
25 | 25 | |
26 | 26 | $this->user = User::find($file['security_user_id']); |
27 | - $this->subject = 'SIS Bulk Upload: ' .$file['subject']. $institution->institution->code.': '. $institution->name.' '. date('Y:m:d H:i:s'); |
|
27 | + $this->subject = 'SIS Bulk Upload: '.$file['subject'].$institution->institution->code.': '.$institution->name.' '.date('Y:m:d H:i:s'); |
|
28 | 28 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
29 | 29 | $this->from_name = 'SIS Bulk Uploader'; |
30 | 30 | $this->with = [ |
31 | 31 | 'name' => $this->user->first_name, |
32 | - 'link' => env('APP_URL').'/download/' .$file['filename'] |
|
32 | + 'link' => env('APP_URL').'/download/'.$file['filename'] |
|
33 | 33 | ]; |
34 | 34 | $this->viewData = [ |
35 | - 'name'=>$this->user->first_name, "body" => "We found some errors on your data file ". $file['filename']. ' Pleas fix the errors and re-upload only with incorrect data, |
|
35 | + 'name'=>$this->user->first_name, "body" => "We found some errors on your data file ".$file['filename'].' Pleas fix the errors and re-upload only with incorrect data, |
|
36 | 36 | We uploaded the correct data to the system', |
37 | - 'link' => env('APP_URL').'/download/' .$file['filename'] |
|
37 | + 'link' => env('APP_URL').'/download/'.$file['filename'] |
|
38 | 38 | ]; |
39 | 39 | } |
40 | 40 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function build() |
47 | 47 | { |
48 | 48 | return $this->view('emails.mail') |
49 | - ->from($this->from_address,$this->from_name) |
|
49 | + ->from($this->from_address, $this->from_name) |
|
50 | 50 | ->to($this->user->email) |
51 | 51 | ->subject($this->subject) |
52 | 52 | ->with($this->with); |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | |
23 | 23 | $institution = Institution_class::find($file['institution_class_id']); |
24 | 24 | $this->user = User::find($file['security_user_id']); |
25 | - $this->subject = 'SIS Bulk Upload: Process Terminated'.$institution->institution->code.': '. $institution->name.' '. date('Y:m:d H:i:s'); |
|
25 | + $this->subject = 'SIS Bulk Upload: Process Terminated'.$institution->institution->code.': '.$institution->name.' '.date('Y:m:d H:i:s'); |
|
26 | 26 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
27 | 27 | $this->from_name = 'SIS Bulk Uploader'; |
28 | 28 | $this->with = [ |
29 | 29 | 'name' => $this->user->first_name, |
30 | - 'link' => env('APP_URL').'/download/' .$file['filename'] |
|
30 | + 'link' => env('APP_URL').'/download/'.$file['filename'] |
|
31 | 31 | ]; |
32 | 32 | $this->viewData = [ |
33 | 33 | 'name'=>$this->user->first_name, "body" => "Apologize ,The process of you file has been terminated in the middle, |
34 | 34 | We advice you to check the student data and re-upload with only with correct data which are not in the system ", |
35 | - 'link' => env('APP_URL').'/download/' .$file['filename'] |
|
35 | + 'link' => env('APP_URL').'/download/'.$file['filename'] |
|
36 | 36 | ]; |
37 | 37 | } |
38 | 38 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public function build() |
45 | 45 | { |
46 | 46 | return $this->view('emails.mail') |
47 | - ->from($this->from_address,$this->from_name) |
|
47 | + ->from($this->from_address, $this->from_name) |
|
48 | 48 | ->to($this->user->email) |
49 | 49 | ->subject($this->subject) |
50 | 50 | ->with($this->with); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | $this->user = User::find($file['security_user_id']); |
28 | - $this->subject = 'SIS Bulk Upload: ' .$file['subject'].' Empty ' . $institution->institution->code.': '. $institution->name.' '. date('Y:m:d H:i:s'); |
|
28 | + $this->subject = 'SIS Bulk Upload: '.$file['subject'].' Empty '.$institution->institution->code.': '.$institution->name.' '.date('Y:m:d H:i:s'); |
|
29 | 29 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
30 | 30 | $this->from_name = 'SIS Bulk Uploader'; |
31 | 31 | $this->with = [ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 'link' => env('APP_URL').'bulk-upload/' |
34 | 34 | ]; |
35 | 35 | $this->viewData = [ |
36 | - 'name'=>$this->user->first_name, "body" => "No data Found in ". $file['filename']. ' Please re-upload the file with data', |
|
36 | + 'name'=>$this->user->first_name, "body" => "No data Found in ".$file['filename'].' Please re-upload the file with data', |
|
37 | 37 | 'link' => env('APP_URL').'bulk-upload/' |
38 | 38 | ]; |
39 | 39 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function build() |
47 | 47 | { |
48 | 48 | return $this->view('emails.mail') |
49 | - ->from($this->from_address,$this->from_name) |
|
49 | + ->from($this->from_address, $this->from_name) |
|
50 | 50 | ->to($this->user->email) |
51 | 51 | ->subject($this->subject) |
52 | 52 | ->with($this->with); |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Gen name with initials with help of fullname |
4 | -function genNameWithInitials($fullname = null){ |
|
4 | +function genNameWithInitials($fullname = null) { |
|
5 | 5 | $names = explode(' ', $fullname); |
6 | - $length = count($names); |
|
6 | + $length = count($names); |
|
7 | 7 | $Initials = ''; |
8 | - if($length > 1){ |
|
9 | - for ($i = 0; ($length-1) > $i; $i++) { |
|
10 | - $Initials = $Initials . '' . mb_substr($names[$i], 0, 1, "UTF-8"); |
|
8 | + if ($length > 1) { |
|
9 | + for ($i = 0; ($length - 1) > $i; $i++) { |
|
10 | + $Initials = $Initials.''.mb_substr($names[$i], 0, 1, "UTF-8"); |
|
11 | 11 | } |
12 | - $nameWithInitials = $Initials . ' ' . $names[$length - 1]; |
|
13 | - }else{ |
|
12 | + $nameWithInitials = $Initials.' '.$names[$length - 1]; |
|
13 | + }else { |
|
14 | 14 | $nameWithInitials = $fullname; |
15 | 15 | } |
16 | 16 | return $nameWithInitials; |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | -function getMatchingKeys($array){ |
|
32 | +function getMatchingKeys($array) { |
|
33 | 33 | $keys = []; |
34 | - foreach ($array as $key => $value){ |
|
35 | - if(strstr($key , 'option')) |
|
34 | + foreach ($array as $key => $value) { |
|
35 | + if (strstr($key, 'option')) |
|
36 | 36 | $keys[] = $key; |
37 | 37 | } |
38 | 38 | return $keys; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | return (bool) preg_match('/^[0-9a-f]{40}$/i', $str); |
43 | 43 | } |
44 | 44 | |
45 | -function isEmpty($value){ |
|
45 | +function isEmpty($value) { |
|
46 | 46 | return $value['institution_optional_subject'] !== null; |
47 | 47 | } |
48 | 48 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $i = 0; |
52 | 52 | $key_array = array(); |
53 | 53 | |
54 | - foreach($array as $val) { |
|
54 | + foreach ($array as $val) { |
|
55 | 55 | if (!in_array($val[$key], $key_array)) { |
56 | 56 | $key_array[$i] = $val[$key]; |
57 | 57 | $temp_array[$i] = $val; |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | -function merge_two_arrays($array1,$array2) { |
|
66 | +function merge_two_arrays($array1, $array2) { |
|
67 | 67 | |
68 | 68 | $data = array(); |
69 | - $arrayAB = array_merge($array1,$array2); |
|
69 | + $arrayAB = array_merge($array1, $array2); |
|
70 | 70 | |
71 | 71 | foreach ($arrayAB as $value) { |
72 | 72 | dd($arrayAB); |
@@ -74,25 +74,25 @@ discard block |
||
74 | 74 | if (!isset($data[$id])) { |
75 | 75 | $data[$id] = array(); |
76 | 76 | } |
77 | - $data[$id] = array_merge($data[$id],$value); |
|
77 | + $data[$id] = array_merge($data[$id], $value); |
|
78 | 78 | } |
79 | 79 | return $data; |
80 | 80 | } |
81 | 81 | |
82 | -function array_value_recursive($key, array $arr){ |
|
82 | +function array_value_recursive($key, array $arr) { |
|
83 | 83 | $val = array(); |
84 | 84 | array_walk_recursive($arr, function($v, $k) use($key, &$val){ |
85 | - if($k == $key) array_push($val, $v); |
|
85 | + if ($k == $key) array_push($val, $v); |
|
86 | 86 | }); |
87 | 87 | return count($val) > 1 ? $val : array_pop($val); |
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | -function merge_error_by_row($errors,$key){ |
|
91 | +function merge_error_by_row($errors, $key) { |
|
92 | 92 | $temp_array = array(); |
93 | 93 | $i = 0; |
94 | 94 | |
95 | - foreach($errors as $keys => $val) { |
|
95 | + foreach ($errors as $keys => $val) { |
|
96 | 96 | if (!in_array($val[$key], $temp_array)) { |
97 | 97 | $temp_array[$keys]['errors'][] = $val; |
98 | 98 | } |
@@ -108,17 +108,17 @@ discard block |
||
108 | 108 | * bind error messages to the excel file |
109 | 109 | */ |
110 | 110 | |
111 | -function append_errors_to_excel($error, $count, $reader){ |
|
111 | +function append_errors_to_excel($error, $count, $reader) { |
|
112 | 112 | $active_sheet = $reader->getActiveSheet(); |
113 | 113 | $prev_value = $active_sheet->getCell('A'.$error['row'])->getValue(); |
114 | - $active_sheet->setCellValue('A'. ($error['row']) , $prev_value.','.implode(',',$error['errors'])); |
|
115 | - $active_sheet->getStyle('A'. ($error['row']))->getAlignment()->setWrapText(true); |
|
114 | + $active_sheet->setCellValue('A'.($error['row']), $prev_value.','.implode(',', $error['errors'])); |
|
115 | + $active_sheet->getStyle('A'.($error['row']))->getAlignment()->setWrapText(true); |
|
116 | 116 | $columns = Illuminate\Support\Facades\Config::get('excel.columns'); |
117 | 117 | |
118 | - $column = array_keys($columns,$error['attribute']); |
|
119 | - if(!empty($column)){ |
|
120 | - $column = $column[0]+1; |
|
121 | - $selectedCells = $active_sheet->setSelectedCellByColumnAndRow($column,$error['row']); |
|
118 | + $column = array_keys($columns, $error['attribute']); |
|
119 | + if (!empty($column)) { |
|
120 | + $column = $column[0] + 1; |
|
121 | + $selectedCells = $active_sheet->setSelectedCellByColumnAndRow($column, $error['row']); |
|
122 | 122 | $active_cell = ($selectedCells->getActiveCell()); |
123 | 123 | |
124 | 124 | $active_sheet->getStyle($active_cell) |
@@ -130,23 +130,23 @@ discard block |
||
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | -function rows($error){ |
|
133 | +function rows($error) { |
|
134 | 134 | return $error['row']; |
135 | 135 | } |
136 | 136 | |
137 | -function rowIndex($row){ |
|
137 | +function rowIndex($row) { |
|
138 | 138 | return $row->getRowIndex(); |
139 | 139 | } |
140 | 140 | |
141 | -function removeRows($row,$param){ |
|
142 | - if(in_array($row,$param['rows'])){ |
|
141 | +function removeRows($row, $param) { |
|
142 | + if (in_array($row, $param['rows'])) { |
|
143 | 143 | $param['reader']->getActiveSheet()->removeRow($row); |
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | -function colorizeCell($column,$error,$active_sheet){ |
|
148 | - $column = array_keys($column,$error['attribute']); |
|
149 | - $selectedCells = $active_sheet->setSelectedCellByColumnAndRow($column,$error['row']); |
|
147 | +function colorizeCell($column, $error, $active_sheet) { |
|
148 | + $column = array_keys($column, $error['attribute']); |
|
149 | + $selectedCells = $active_sheet->setSelectedCellByColumnAndRow($column, $error['row']); |
|
150 | 150 | $active_cell = ($selectedCells->getActiveCell()); |
151 | 151 | |
152 | 152 | $active_sheet->getStyle($active_cell) |
@@ -158,14 +158,14 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | |
161 | -function errors_unique_array($item,$key){ |
|
161 | +function errors_unique_array($item, $key) { |
|
162 | 162 | |
163 | - $search = array_filter($item,function ($data) use ($item){ |
|
164 | - return isset($data['row']) && ($data['row'] == $item->row()); |
|
163 | + $search = array_filter($item, function($data) use ($item){ |
|
164 | + return isset($data['row']) && ($data['row'] == $item->row()); |
|
165 | 165 | }); |
166 | 166 | |
167 | - if($search){ |
|
168 | - array_push($search[0]['errors'],implode(',',$item->errors())); |
|
167 | + if ($search) { |
|
168 | + array_push($search[0]['errors'], implode(',', $item->errors())); |
|
169 | 169 | $errors = $search; |
170 | 170 | } |
171 | 171 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | function isEmptyRow($row) { |
176 | - foreach($row as $cell){ |
|
176 | + foreach ($row as $cell) { |
|
177 | 177 | if (null !== $cell) return false; |
178 | 178 | } |
179 | 179 | return true; |