summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Seeger <pseeger@ccwn.org>2013-05-15 09:59:28 +0200
committerPatrick Seeger <pseeger@ccwn.org>2013-05-15 09:59:28 +0200
commit40cf298654b879f6996e41bee096798313769f68 (patch)
tree1fca4df0668fbe69850fba5b09e90796c1b4ea59
parent4aa53ab46a0551698a85932bdb03aeba0502ce50 (diff)
Löschen eingebaut
-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);