/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new BannerCategory();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['BannerCategory'])) {
         $model->attributes = $_POST['BannerCategory'];
         $model->created_time = date('Y-m-d H:i');
         $model->created_by = Yii::app()->user->id;
         if (empty($model->alias)) {
             $model->alias = str_replace(' ', '-', strtolower($model->title));
         } else {
             $model->alias = str_replace(' ', '-', strtolower($model->alias));
         }
         if ($model->save()) {
             Yii::app()->user->setFlash('success', 'Saved successfully');
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }