summaryrefslogtreecommitdiff
path: root/protected/controllers/MyAngebotController.php
diff options
context:
space:
mode:
Diffstat (limited to 'protected/controllers/MyAngebotController.php')
-rw-r--r--protected/controllers/MyAngebotController.php20
1 files changed, 20 insertions, 0 deletions
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);