public function actionPhoto() { $model = new Photo('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Photo'])) { $model->attributes = $_GET['Photo']; } $this->render('photo', compact('model')); }
/** * Manages all models. */ public function actionIndex() { $model = new Photo('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Photo'])) { $model->attributes = $_GET['Photo']; } $this->render('index', 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['Album'])) { $model->attributes = $_POST['Album']; if ($model->save()) { Yii::app()->user->setFlash('saved', "Data saved!"); // $this->redirect(array('update','id'=>$model->id)); } else { Yii::app()->user->setFlash('failure', "Data Not saved!"); } } Yii::import("xupload.models.XUploadForm"); $uploads = new XUploadForm(); $photos = new Photo('search'); $photos->unsetAttributes(); // clear any default values $photos->album_id = $id; $this->render('update', array('model' => $model, 'uploads' => $uploads, 'photos' => $photos)); }