array('create','index','delete','update','view'), 'users'=>array('@'), ), array('deny', // deny all users 'users'=>array('*'), ), ); } /** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model=new AngebotVerein; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if(isset($_POST['AngebotVerein'])) { $model->attributes=$_POST['AngebotVerein']; if($model->save()) $this->redirect(array('index')); } $this->render('create',array( 'model'=>$model, 'angebote'=>Angebot::model()->findAll(), )); } public function actionIndex() { $model=new AngebotVerein('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['AngebotVerein'])) { $model->attributes = $_GET['AngebotVerein']; } $model->verein_id = Yii::app()->user->vereinId; $this->render('index',array( 'model'=>$model, )); } public function actionUpdate($id) { $model=$this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if(isset($_POST['AngebotVerein'])) { $model->attributes=$_POST['AngebotVerein']; if($model->save()) $this->redirect(array('index')); } $angebot = Angebot::model()->findAll(); $angebote = array(); foreach ($angebot as $a) { $an = array(); $an["label"] = $a->name; $an["value"] = $a->id; $an["einheiten"] = $a->kategorie->einheiten; array_push($angebote, $an); } $this->render('update',array( 'model'=>$model, 'angebote'=>$angebote, 'einheiten'=>$model->angebot->kategorie->einheiten )); } /** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model=AngebotVerein::model()->findByPk($id); if($model===null) throw new CHttpException(404,'The requested page does not exist.'); return $model; } // Uncomment the following methods and override them if needed /* public function filters() { // return the filter configuration for this controller, e.g.: return array( 'inlineFilterName', array( 'class'=>'path.to.FilterClass', 'propertyName'=>'propertyValue', ), ); } public function actions() { // return external action classes, e.g.: return array( 'action1'=>'path.to.ActionClass', 'action2'=>array( 'class'=>'path.to.AnotherActionClass', 'propertyName'=>'propertyValue', ), ); } */ }