@@ 192-212 (lines=21) @@ | ||
189 | { |
|
190 | $data = $this->input->get_form_data(); |
|
191 | ||
192 | if ($preview) |
|
193 | { |
|
194 | $this->ad_preview($data['ad_code']); |
|
195 | } |
|
196 | else if ($upload_banner) |
|
197 | { |
|
198 | $data['ad_code'] = $this->input->banner_upload($data['ad_code']); |
|
199 | } |
|
200 | else if ($analyse_ad_code) |
|
201 | { |
|
202 | $this->analyser->run($data['ad_code']); |
|
203 | } |
|
204 | else if (!$this->input->has_errors()) |
|
205 | { |
|
206 | $ad_id = $this->manager->insert_ad($data); |
|
207 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
208 | ||
209 | $this->helper->log('ADD', $data['ad_name']); |
|
210 | ||
211 | $this->success('ACP_AD_ADD_SUCCESS'); |
|
212 | } |
|
213 | ||
214 | $this->helper->assign_locations($data['ad_locations']); |
|
215 | $this->helper->assign_form_data($data); |
|
@@ 254-278 (lines=25) @@ | ||
251 | { |
|
252 | $this->ad_preview($data['ad_code']); |
|
253 | } |
|
254 | else if ($upload_banner) |
|
255 | { |
|
256 | $data['ad_code'] = $this->input->banner_upload($data['ad_code']); |
|
257 | } |
|
258 | else if ($analyse_ad_code) |
|
259 | { |
|
260 | $this->analyser->run($data['ad_code']); |
|
261 | } |
|
262 | else if (!$this->input->has_errors()) |
|
263 | { |
|
264 | $success = $this->manager->update_ad($ad_id, $data); |
|
265 | ||
266 | if ($success) |
|
267 | { |
|
268 | // Only insert new ad locations to DB when ad exists |
|
269 | $this->manager->delete_ad_locations($ad_id); |
|
270 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
271 | ||
272 | $this->helper->log('EDIT', $data['ad_name']); |
|
273 | ||
274 | $this->success('ACP_AD_EDIT_SUCCESS'); |
|
275 | } |
|
276 | ||
277 | $this->error('ACP_AD_DOES_NOT_EXIST'); |
|
278 | } |
|
279 | } |
|
280 | else |
|
281 | { |