/**
  * Manages all models.
  */
 public function actionAdminone()
 {
     $user = $this->getUser();
     /**
      * Though we made this action to display the users own album without 
      * considering the uguid received via GET parameter.
      * we should throw the exception if current user id is different 
      * from $user->id we fetched based on guid GET parameter.
      */
     if ($user->id != Yii::app()->user->id) {
         throw new CHttpException(403, 'You can manage your albums only.');
     }
     $this->subLayout = "album.views._layout";
     $model = new Album('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Album'])) {
         $model->attributes = $_GET['Album'];
     }
     $this->render('/album/admin', ['model' => $model, 'user' => $user]);
 }
Example #2
0
 public function actionManage()
 {
     $model = new Album('search');
     $model->unsetAttributes();
     if (isset($_GET['Album'])) {
         $model->setAttributes($_GET['Album']);
     }
     $this->render('manage', array('model' => $model));
 }
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Album('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Album'])) {
         $model->attributes = $_GET['Album'];
     }
     $this->render('admin', array('model' => $model));
 }