summaryrefslogtreecommitdiff
path: root/protected/controllers
diff options
context:
space:
mode:
authorTristan Zur <tzur@ccwn.org>2012-05-16 18:14:16 +0200
committerTristan Zur <tzur@ccwn.org>2012-05-16 18:14:16 +0200
commit3cb7fbfceae978d2b87ae976bf4536c3461bb868 (patch)
tree36d42842f3dfbc8a9598ea519792933bac99c3f8 /protected/controllers
parent48f25c5eadd2a82a365b034a59b3cba4536a1e74 (diff)
Initiale Veranstaltungsverwaltung für die Vereine hinzugefügt
Diffstat (limited to 'protected/controllers')
-rw-r--r--protected/controllers/MyVeranstaltungController.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/protected/controllers/MyVeranstaltungController.php b/protected/controllers/MyVeranstaltungController.php
index 97efa52..568a93d 100644
--- a/protected/controllers/MyVeranstaltungController.php
+++ b/protected/controllers/MyVeranstaltungController.php
@@ -65,12 +65,15 @@ class MyVeranstaltungController extends Controller
if(isset($_POST['Veranstaltung']))
{
$model->attributes=$_POST['Veranstaltung'];
+ $model->verein_id = Yii::app()->user->vereinId;
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
+ $standorte = Standort::model()->findAll(array("condition"=>"published = 1 AND (type = 'Bühne' OR (type = 'Stand' AND id = (SELECT standort_id FROM vereine WHERE id = ".Yii::app()->user->vereinId.")))"));
$this->render('create',array(
'model'=>$model,
+ 'standorte'=>$standorte,
));
}
@@ -93,8 +96,10 @@ class MyVeranstaltungController extends Controller
$this->redirect(array('view','id'=>$model->id));
}
+ $standorte = Standort::model()->findAll(array("condition"=>"published = 1 AND (type = 'Bühne' OR (type = 'Stand' AND id = (SELECT standort_id FROM vereine WHERE id = ".Yii::app()->user->vereinId.")))"));
$this->render('update',array(
'model'=>$model,
+ 'standorte'=>$standorte,
));
}
@@ -112,7 +117,7 @@ class MyVeranstaltungController extends Controller
// 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'));
+ $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
}
else
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
@@ -138,8 +143,9 @@ class MyVeranstaltungController extends Controller
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Veranstaltung']))
$model->attributes=$_GET['Veranstaltung'];
+ $model->verein_id = Yii::app()->user->vereinId;
- $this->render('admin',array(
+ $this->render('index',array(
'model'=>$model,
));
}
@@ -151,7 +157,8 @@ class MyVeranstaltungController extends Controller
*/
public function loadModel($id)
{
- $model=Veranstaltung::model()->findByPk($id);
+ $attributes = array("verein_id"=>Yii::app()->user->vereinId, "id"=>$id);
+ $model=Veranstaltung::model()->findByAttributes($attributes);
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');
return $model;