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