1 | <?php |
||
16 | class JpasImportHandler implements ImportHandler |
||
17 | { |
||
18 | use DateFormat; |
||
19 | |||
20 | private $unique; |
||
21 | private $changes; |
||
22 | |||
23 | /** |
||
24 | * Set our variables as new collections. |
||
25 | */ |
||
26 | public function __construct() |
||
31 | |||
32 | /** |
||
33 | * Initial call from UserController. |
||
34 | * Based on what we get, we will either call an initial import or the resolve import. |
||
35 | * |
||
36 | * @param $import |
||
37 | * |
||
38 | * @return array |
||
39 | */ |
||
40 | public function handle($import) |
||
55 | |||
56 | /** |
||
57 | * Cycle through our excel spreadsheet. |
||
58 | * If we can't figure where data goes, we will push it to a collection so the user can map it. |
||
59 | * Otherwise, we will update the record. |
||
60 | * |
||
61 | * @param $excel |
||
62 | */ |
||
63 | private function initialImport($excel) |
||
77 | |||
78 | /** |
||
79 | * User has mapped some accounts. We need to update those records. |
||
80 | * |
||
81 | * @param $excel |
||
82 | * @param $data |
||
83 | */ |
||
84 | private function resolveImport($excel, $data) |
||
94 | |||
95 | /** |
||
96 | * Place changes so the user can approve/reject them. |
||
97 | * |
||
98 | * @param $user |
||
99 | */ |
||
100 | private function getUserChanges($user) |
||
113 | |||
114 | /** |
||
115 | * Update user. If there are changes, let's log them to an array. |
||
116 | * |
||
117 | * @param $user |
||
118 | */ |
||
119 | private function updateAndLogUser($user) |
||
132 | |||
133 | /** |
||
134 | * Map the data from our JPAS Excel to our User model. |
||
135 | * |
||
136 | * @param $user |
||
137 | * @param $data |
||
138 | */ |
||
139 | private function mapJpasToUser($user, $data) |
||
149 | |||
150 | /** |
||
151 | * @param $excel |
||
152 | * @param $userGroup |
||
153 | * @param $jpasName |
||
154 | * |
||
155 | * @return mixed |
||
156 | */ |
||
157 | private function importNewData($excel, $userGroup, $jpasName) |
||
167 | |||
168 | /** |
||
169 | * @param $userGroup |
||
170 | */ |
||
171 | private function updateUserData($userGroup) |
||
183 | } |
||
184 |