public function actionHistory()
 {
     $model = new StudentWorkshop('search');
     $model->user_id = Yii::app()->user->id;
     $model->is_active = true;
     $model->unsetAttributes();
     if (isset($_GET['ajax'])) {
         $model->attributes = $_GET['StudentWorkshop'];
     }
     $this->render('history', array('model' => $model));
 }
 public function actionSignup($id)
 {
     if (isset($id)) {
         if (Yii::app()->request->isPostRequest) {
             /* @var $workshop Workshop */
             $workshop = Workshop::model()->findByPk($id);
             if ($workshop != null && $workshop->is_approved == 1) {
                 $studentWorkshop = new StudentWorkshop();
                 $studentWorkshop->user_id = Yii::app()->user->id;
                 $studentWorkshop->post_item_id = $id;
                 if ($studentWorkshop->save()) {
                     Yii::app()->user->setFlash('success', Yii::t('app', 'msg.success.workshop_signup'));
                     $this->redirect(array('view', 'id' => $id));
                 }
             } else {
                 throw new CHttpException(400, 'Event not found.');
             }
         } else {
             throw new CHttpException(400, 'Invalid Request');
         }
     } else {
         throw new CHttpException(400, 'Event not found.');
     }
 }