/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new ContentCategory();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['ContentCategory'])) {
         $model->attributes = $_POST['ContentCategory'];
         if ($model->save()) {
             $this->redirect(array('admin'));
         }
     }
     $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 ContentCategory();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['ContentCategory'])) {
         $model->attributes = $_POST['ContentCategory'];
         $model->created_time = new CDbExpression('NOW()');
         $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));
 }