From 40cf298654b879f6996e41bee096798313769f68 Mon Sep 17 00:00:00 2001 From: Patrick Seeger Date: Wed, 15 May 2013 09:59:28 +0200 Subject: =?UTF-8?q?L=C3=B6schen=20eingebaut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protected/controllers/MyAngebotController.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/protected/controllers/MyAngebotController.php b/protected/controllers/MyAngebotController.php index b85846e..d0adfd2 100644 --- a/protected/controllers/MyAngebotController.php +++ b/protected/controllers/MyAngebotController.php @@ -77,6 +77,26 @@ class MyAngebotController extends Controller )); } + /** + * Deletes a particular model. + * If deletion is successful, the browser will be redirected to the 'admin' page. + * @param integer $id the ID of the model to be deleted + */ + public function actionDelete($id) + { + if(Yii::app()->request->isPostRequest) + { + // we only allow deletion via POST request + $this->loadModel($id)->delete(); + + // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser + if(!isset($_GET['ajax'])) + $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); + } + else + throw new CHttpException(400,'Invalid request. Please do not repeat this request again.'); + } + public function actionUpdate($id) { $model = $this->loadModel($id); -- cgit v1.0-28-g1787