@@ 131-145 (lines=15) @@ | ||
128 | * |
|
129 | * @return void |
|
130 | */ |
|
131 | public function edit() |
|
132 | { |
|
133 | $data = $this->request->post->get(); |
|
134 | if (array_key_exists('hummingbird_id', $data)) |
|
135 | { |
|
136 | $this->anime_collection_model->update($data); |
|
137 | $this->set_flash_message('Successfully updated collection item.', 'success'); |
|
138 | } |
|
139 | else |
|
140 | { |
|
141 | $this->set_flash_message('Failed to update collection item', 'error'); |
|
142 | } |
|
143 | ||
144 | $this->session_redirect(); |
|
145 | } |
|
146 | ||
147 | /** |
|
148 | * Add a collection item |
|
@@ 152-166 (lines=15) @@ | ||
149 | * |
|
150 | * @return void |
|
151 | */ |
|
152 | public function add() |
|
153 | { |
|
154 | $data = $this->request->post->get(); |
|
155 | if (array_key_exists('id', $data)) |
|
156 | { |
|
157 | $this->anime_collection_model->add($data); |
|
158 | $this->set_flash_message('Successfully added collection item', 'success'); |
|
159 | } |
|
160 | else |
|
161 | { |
|
162 | $this->set_flash_message('Failed to add collection item.', 'error'); |
|
163 | } |
|
164 | ||
165 | $this->session_redirect(); |
|
166 | } |
|
167 | ||
168 | /** |
|
169 | * Remove a collection item |
|
@@ 173-184 (lines=12) @@ | ||
170 | * |
|
171 | * @return void |
|
172 | */ |
|
173 | public function delete() |
|
174 | { |
|
175 | $data = $this->request->post->get(); |
|
176 | if ( ! array_key_exists('id', $data)) |
|
177 | { |
|
178 | $this->redirect("collection/view", 303); |
|
179 | } |
|
180 | ||
181 | $this->anime_collection_model->delete($data); |
|
182 | ||
183 | $this->redirect("collection/view", 303); |
|
184 | } |
|
185 | } |
|
186 | // End of CollectionController.php |