1 | <?php |
||
15 | class JpasImportHandler implements ImportHandler |
||
16 | { |
||
17 | private $unique; |
||
18 | private $changes; |
||
19 | |||
20 | /** |
||
21 | * Set our variables as new collections. |
||
22 | */ |
||
23 | public function __construct() |
||
28 | |||
29 | /** |
||
30 | * Initial call from UserController. |
||
31 | * Based on what we get, we will either call an initial import or the resolve import. |
||
32 | * |
||
33 | * @param $import |
||
34 | * |
||
35 | * @return array |
||
36 | */ |
||
37 | public function handle($import) |
||
52 | |||
53 | /** |
||
54 | * Cycle through our excel spreadsheet. |
||
55 | * If we can't figure where data goes, we will push it to a collection so the user can map it. |
||
56 | * Otherwise, we will update the record. |
||
57 | * |
||
58 | * @param $excel |
||
59 | */ |
||
60 | private function initialImport($excel) |
||
74 | |||
75 | /** |
||
76 | * User has mapped some accounts. We need to update those records. |
||
77 | * |
||
78 | * @param $excel |
||
79 | * @param $data |
||
80 | */ |
||
81 | private function resolveImport($excel, $data) |
||
91 | |||
92 | /** |
||
93 | * Place changes so the user can approve/reject them. |
||
94 | * |
||
95 | * @param $user |
||
96 | */ |
||
97 | private function getUserChanges($user) |
||
110 | |||
111 | /** |
||
112 | * Update user. If there are changes, let's log them to an array. |
||
113 | * |
||
114 | * @param $user |
||
115 | */ |
||
116 | private function updateAndLogUser($user) |
||
129 | |||
130 | /** |
||
131 | * Map the data from our JPAS Excel to our User model. |
||
132 | * |
||
133 | * @param $user |
||
134 | * @param $data |
||
135 | */ |
||
136 | private function mapJpasToUser($user, $data) |
||
146 | |||
147 | private function getCorrectDateFormat($date) |
||
168 | |||
169 | /** |
||
170 | * @param $excel |
||
171 | * @param $userGroup |
||
172 | * @param $jpasName |
||
173 | * |
||
174 | * @return mixed |
||
175 | */ |
||
176 | private function importNewData($excel, $userGroup, $jpasName) |
||
186 | |||
187 | /** |
||
188 | * @param $userGroup |
||
189 | */ |
||
190 | private function updateUserData($userGroup) |
||
202 | } |
||
203 |