public function newNotification()
 {
     $model = new sNotification();
     // $this->performAjaxValidation($model);
     if (isset($_POST['sNotification'])) {
         $model->attributes = $_POST['sNotification'];
         $model->sender_id = Yii::app()->user->id;
         $model->type_id = 2;
         $model->read_id = 1;
         $model->category_id = 12;
         if ($model->save()) {
             Yii::app()->user->setFlash('success', 'Message has been sent...');
             $this->refresh();
         }
     }
     return $model;
 }
 public function newNotification()
 {
     $model = new sNotification();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['sNotification'])) {
         $model->attributes = $_POST['sNotification'];
         $model->sender_id = Yii::app()->user->id;
         $model->type_id = 2;
         $model->read_id = 1;
         $model->category_id = 12;
         if ($model->save()) {
             Yii::app()->user->setFlash('success', 'data has been saved successfully');
             $this->refresh();
         }
     }
     return $model;
 }
 public function actionCreate()
 {
     $model = new sNotification();
     // $this->performAjaxValidation($model);
     if (isset($_POST['sNotification'])) {
         $model->attributes = $_POST['sNotification'];
         if (Yii::app()->user->name != 'admin') {
             $model->type_id = 2;
         }
         /*
         			 1 = Admin Message
         			2 = User Message
         			3 = Allocation Custom Message
         */
         if ($model->sender_ref == null) {
             $model->sender_ref = Yii::app()->user->name . ' / ' . $model->receiver;
         }
         if ($model->save()) {
             Yii::app()->user->setFlash('success', '<strong>Great!</strong> Your message has been sent successfully');
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }