/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new PhotoCategory();
     if (isset($_POST['PhotoCategory'])) {
         $model->attributes = $_POST['PhotoCategory'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', Yii::t('main', 'Данные успешно сохранены!'));
             $this->redirect(array('update', 'id' => $model->id));
         } else {
             Yii::app()->user->setFlash('error', Yii::t('main', 'Ошибка сохранения данных!'));
         }
     }
     $this->render('create', array('model' => $model));
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new PhotoCategory();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['PhotoCategory'])) {
         $model->attributes = $_POST['PhotoCategory'];
         $model->date = date('Y-m-d h:i:s', time());
         if ($model->save()) {
             Yii::app()->user->setFlash('success', Yii::t('main', 'Данные успешно сохранены!'));
             sleep(2);
             $this->redirect(array('index'));
         } else {
             Yii::app()->user->setFlash('error', Yii::t('main', 'Ошибка!'));
         }
     }
     $this->render('create', array('model' => $model));
 }