diff options
| author | Patrick Seeger <pseeger@ccwn.org> | 2012-05-18 22:20:31 +0200 |
|---|---|---|
| committer | Patrick Seeger <pseeger@ccwn.org> | 2012-05-18 22:20:31 +0200 |
| commit | 02f4fe62412d3e8ba2d5b7e02cc06ad8540cb628 (patch) | |
| tree | 51dbed61e1577e810de045f6f773613671c9570e | |
| parent | d50b3996c581aa1dafa930dc7e2302e4062430db (diff) | |
controller auf read only reduziert
| -rw-r--r-- | protected/controllers/KategorieController.php | 73 | ||||
| -rw-r--r-- | protected/controllers/SpeisTrankController.php | 72 | ||||
| -rw-r--r-- | protected/controllers/StandortController.php | 99 | ||||
| -rw-r--r-- | protected/controllers/VeranstaltungController.php | 78 | ||||
| -rw-r--r-- | protected/controllers/VereinController.php | 77 |
5 files changed, 4 insertions, 395 deletions
diff --git a/protected/controllers/KategorieController.php b/protected/controllers/KategorieController.php index ceeaf42..acaab94 100644 --- a/protected/controllers/KategorieController.php +++ b/protected/controllers/KategorieController.php @@ -31,8 +31,8 @@ class KategorieController extends Controller { return array( array('allow', // allow admin user to perform 'admin' and 'delete' actions - 'actions'=>array('index','create','update','delete','view'), - 'users'=>array('admin'), + 'actions'=>array('index','view'), + 'users'=>array('*'), ), array('deny', // deny all users 'users'=>array('*'), @@ -52,75 +52,6 @@ class KategorieController extends Controller } /** - * Creates a new model. - * If creation is successful, the browser will be redirected to the 'view' page. - */ - public function actionCreate() - { - $model=new Kategorie; - - // Uncomment the following line if AJAX validation is needed - // $this->performAjaxValidation($model); - - if(isset($_POST['Kategorie'])) - { - $model->attributes=$_POST['Kategorie']; - if($model->save()) - $this->redirect(array('view','id'=>$model->id)); - } - - $this->render('create',array( - 'model'=>$model, - )); - } - - /** - * Updates a particular model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id the ID of the model to be updated - */ - public function actionUpdate($id) - { - $model=$this->loadModel($id); - - // Uncomment the following line if AJAX validation is needed - // $this->performAjaxValidation($model); - - if(isset($_POST['Kategorie'])) - { - $model->attributes=$_POST['Kategorie']; - $model->default_menge = str_replace(",", ".", $model->default_menge); - if($model->save()) { - $this->redirect(array('view','id'=>$model->id)); - } - } - - $this->render('update',array( - 'model'=>$model, - )); - } - - /** - * 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.'); - } - - /** * Lists all models. */ public function actionIndex() diff --git a/protected/controllers/SpeisTrankController.php b/protected/controllers/SpeisTrankController.php index 2ba08a7..fb3bcc5 100644 --- a/protected/controllers/SpeisTrankController.php +++ b/protected/controllers/SpeisTrankController.php @@ -48,78 +48,6 @@ class SpeisTrankController extends Controller )); } - /** - * Creates a new model. - * If creation is successful, the browser will be redirected to the 'view' page. - */ - public function actionCreate() - { - $model=new Angebot; - - // Uncomment the following line if AJAX validation is needed - // $this->performAjaxValidation($model); - - if(isset($_POST['Angebot'])) - { - $model->attributes=$_POST['Angebot']; - if($model->save()) - $this->redirect(array('view','id'=>$model->id)); - } - - $kategorien = Kategorie::model()->findAll(array("condition"=>"published=1")); - - $this->render('create',array( - 'model'=>$model, - 'kategorien'=>$kategorien - )); - } - - /** - * Updates a particular model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id the ID of the model to be updated - */ - public function actionUpdate($id) - { - $model=$this->loadModel($id); - - // Uncomment the following line if AJAX validation is needed - // $this->performAjaxValidation($model); - - if(isset($_POST['Angebot'])) - { - $model->attributes=$_POST['Angebot']; - if($model->save()) - $this->redirect(array('view','id'=>$model->id)); - } - - $kategorien = Kategorie::model()->findAll(array("condition"=>"published=1")); - - $this->render('update',array( - 'model'=>$model, - 'kategorien'=>$kategorien - )); - } - - /** - * 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.'); - } /** * Lists all models. diff --git a/protected/controllers/StandortController.php b/protected/controllers/StandortController.php index 59e0ca5..09c1361 100644 --- a/protected/controllers/StandortController.php +++ b/protected/controllers/StandortController.php @@ -49,105 +49,6 @@ class StandortController extends Controller } /** - * Creates a new model. - * If creation is successful, the browser will be redirected to the 'view' page. - */ - public function actionCreate() - { - $model=new Standort; - - // Uncomment the following line if AJAX validation is needed - // $this->performAjaxValidation($model); - - if(isset($_POST['Standort'])) - { - $model->attributes=$_POST['Standort']; - if($model->save()) - $this->redirect(array('index')); - } - - $this->render('create',array( - 'model'=>$model, - )); - } - - /** - * Updates a particular model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id the ID of the model to be updated - */ - public function actionUpdate($id) - { - $model=$this->loadModel($id); - - // Uncomment the following line if AJAX validation is needed - // $this->performAjaxValidation($model); - - if(isset($_POST['Standort'])) - { - $model->attributes=$_POST['Standort']; - if($model->save()) - $this->redirect(array('view','id'=>$model->id)); - } - - $this->render('update',array( - 'model'=>$model, - )); - } - - - /** - * Updates the standort with $id. - * This method loads the post parameters - * <ul> - * <li>lat</li> - * <li>lng</li> - * </ul> - * @param integer $id the ID of the standort to be moved - * @throws CHttpException if - * <ul> - * <li>one of the parameters is not set or</li> - * <li>the standort does not exist or</li> - * <li>the save action was unsuccessful</li> - * </ul> - */ - public function actionSavecoords($id) { - $model=$this->loadModel($id); - - if (isset($_POST['lat']) && isset($_POST['lng'])) { - $model->pos_lat = $_POST['lat']; - $model->pos_long = $_POST['lng']; - if($model->save()) { - echo "success"; - } else { - throw new CHttpException(500, "Could not save"); - } - } else { - throw new CHttpException(400, "Wrong parameters"); - } - } - - /** - * 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.'); - } - - /** * Manages all models. */ public function actionIndex() diff --git a/protected/controllers/VeranstaltungController.php b/protected/controllers/VeranstaltungController.php index 0e88513..cc198ab 100644 --- a/protected/controllers/VeranstaltungController.php +++ b/protected/controllers/VeranstaltungController.php @@ -47,84 +47,6 @@ class VeranstaltungController extends Controller )); } - /** - * Creates a new model. - * If creation is successful, the browser will be redirected to the 'view' page. - */ - public function actionCreate() - { - $model=new Veranstaltung; - - // Uncomment the following line if AJAX validation is needed - // $this->performAjaxValidation($model); - - if(isset($_POST['Veranstaltung'])) - { - $model->attributes=$_POST['Veranstaltung']; - Yii::trace(print_r($model, true), "VERANSTALTUNG"); - if($model->save()) - $this->redirect(array('view','id'=>$model->id)); - } - - $standorte = Standort::model()->findAll(array("condition"=>"published=1 and type='Bühne'")); - $vereine = Verein::model()->findAll(array("condition"=>"published=1")); - - $this->render('create',array( - 'model'=>$model, - 'vereine'=>$vereine, - 'standorte'=>$standorte - )); - } - - /** - * Updates a particular model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id the ID of the model to be updated - */ - public function actionUpdate($id) - { - $model=$this->loadModel($id); - - // Uncomment the following line if AJAX validation is needed - // $this->performAjaxValidation($model); - - if(isset($_POST['Veranstaltung'])) - { - $model->attributes=$_POST['Veranstaltung']; - - if($model->save()) - $this->redirect(array('view','id'=>$model->id)); - } - - $standorte = Standort::model()->findAll(array("condition"=>"published=1 and type='Bühne'")); - $vereine = Verein::model()->findAll(array("condition"=>"published=1")); - - $this->render('update',array( - 'model'=>$model, - 'vereine'=>$vereine, - 'standorte'=>$standorte - )); - } - - /** - * 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.'); - } /** * Lists all models. diff --git a/protected/controllers/VereinController.php b/protected/controllers/VereinController.php index e0a3e68..0358f16 100644 --- a/protected/controllers/VereinController.php +++ b/protected/controllers/VereinController.php @@ -27,8 +27,8 @@ class VereinController extends Controller { return array( array('allow', // allow admin user to perform 'admin' and 'delete' actions - 'actions'=>array('index','create','view','update','delete'), - 'users'=>array('admin'), + 'actions'=>array('index','view'), + 'users'=>array('*'), ), array('deny', // deny all users 'actions'=>array('create','update','delete'), @@ -49,79 +49,6 @@ class VereinController extends Controller } /** - * Creates a new model. - * If creation is successful, the browser will be redirected to the 'view' page. - */ - public function actionCreate() - { - $model=new Verein; - - // Uncomment the following line if AJAX validation is needed - // $this->performAjaxValidation($model); - - if(isset($_POST['Verein'])) - { - $model->attributes=$_POST['Verein']; - if($model->save()) - $this->redirect(array('view','id'=>$model->id)); - } - - $standorte = Standort::model()->findAll(array("condition"=>"published=1 and type='Stand'")); - $this->render('create',array( - 'model'=>$model, - 'standorte'=>$standorte - )); - } - - /** - * Updates a particular model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id the ID of the model to be updated - */ - public function actionUpdate($id) - { - $model=$this->loadModel($id); - - // Uncomment the following line if AJAX validation is needed - // $this->performAjaxValidation($model); - - if(isset($_POST['Verein'])) - { - $model->attributes=$_POST['Verein']; - if($model->save()) - $this->redirect(array('view','id'=>$model->id)); - } - - $standorte = Standort::model()->findAll(array("condition"=>"published=1 and type='Stand'")); - $slugs = User::model()->findAll(); - $this->render('update',array( - 'model'=>$model, - 'standorte'=>$standorte, - 'slugs'=>$slugs - )); - } - - /** - * 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.'); - } - - /** * Lists all models. */ public function actionIndex() |
