/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $cs = Yii::app()->getClientScript();
     //$cs->registerScriptFile(Yii::app()->theme->baseUrl.'/js/ckeditor/ckeditor.js');
     $cs->registerCssFile(Yii::app()->theme->baseUrl . '/js/jqueryUpload/jquery.fileupload.css');
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/bootstrap-datepicker/bootstrap-datetimepicker.js', CClientScript::POS_END);
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jqueryUpload/jquery.ui.widget.js', CClientScript::POS_END);
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jqueryUpload/jquery.fileupload.js', CClientScript::POS_END);
     $model = new WUser();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['WUser'])) {
         $model->attributes = $_POST['WUser'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
 public function actionCreateTrainee()
 {
     $cs = Yii::app()->getClientScript();
     //$cs->registerScriptFile(Yii::app()->theme->baseUrl.'/js/ckeditor/ckeditor.js');
     $cs->registerCssFile(Yii::app()->theme->baseUrl . '/js/jqueryUpload/jquery.fileupload.css');
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/bootstrap-datepicker/bootstrap-datetimepicker.js', CClientScript::POS_END);
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jqueryUpload/jquery.ui.widget.js', CClientScript::POS_END);
     $cs->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jqueryUpload/jquery.fileupload.js', CClientScript::POS_END);
     $model = new WUser();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['WUser'])) {
         $model->attributes = $_POST['WUser'];
         $model->password = CFunction::encrypt(Yii::app()->params->password_default, Yii::app()->params->hashkey);
         $model->supervisor_code = Yii::app()->user->id;
         $model->status = 1;
         if ($model->save()) {
             $this->redirect(array('AllTrainee'));
         }
     }
     $this->render('createtrainee', array('model' => $model));
 }