| @@ 223-244 (lines=22) @@ | ||
| 220 | * |
|
| 221 | * @return void |
|
| 222 | */ |
|
| 223 | public function form_update() |
|
| 224 | { |
|
| 225 | $data = $this->request->getParsedBody(); |
|
| 226 | ||
| 227 | // Do some minor data manipulation for |
|
| 228 | // large form-based updates |
|
| 229 | $transformer = new AnimeListTransformer(); |
|
| 230 | $post_data = $transformer->untransform($data); |
|
| 231 | $full_result = $this->model->updateLibraryItem($post_data); |
|
| 232 | ||
| 233 | if ($full_result['statusCode'] === 200) |
|
| 234 | { |
|
| 235 | $this->set_flash_message("Successfully updated.", 'success'); |
|
| 236 | $this->cache->clear(); |
|
| 237 | } |
|
| 238 | else |
|
| 239 | { |
|
| 240 | $this->set_flash_message('Failed to update anime.', 'error'); |
|
| 241 | } |
|
| 242 | ||
| 243 | $this->session_redirect(); |
|
| 244 | } |
|
| 245 | ||
| 246 | /** |
|
| 247 | * Update an anime item |
|
| @@ 193-215 (lines=23) @@ | ||
| 190 | * |
|
| 191 | * @return void |
|
| 192 | */ |
|
| 193 | public function form_update() |
|
| 194 | { |
|
| 195 | $data = $this->request->getParsedBody(); |
|
| 196 | ||
| 197 | // Do some minor data manipulation for |
|
| 198 | // large form-based updates |
|
| 199 | $transformer = new MangaListTransformer(); |
|
| 200 | $post_data = $transformer->untransform($data); |
|
| 201 | $full_result = $this->model->updateLibraryItem($post_data); |
|
| 202 | ||
| 203 | if ($full_result['statusCode'] === 200) |
|
| 204 | { |
|
| 205 | $this->set_flash_message("Successfully updated manga.", 'success'); |
|
| 206 | $this->cache->clear(); |
|
| 207 | } |
|
| 208 | else |
|
| 209 | { |
|
| 210 | $this->set_flash_message('Failed to update manga.', 'error'); |
|
| 211 | ||
| 212 | } |
|
| 213 | ||
| 214 | $this->session_redirect(); |
|
| 215 | } |
|
| 216 | ||
| 217 | /** |
|
| 218 | * Update a manga item |
|