Пример #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new wUsers();
     if (isset($_POST['wUsers'])) {
         $model->attributes = $_POST['wUsers'];
         $model->id = CFunction::GUID();
         $model->password = CFunction::encrypt($_POST['wUsers']['password'], Yii::app()->params->hashkey);
         $model->repassword = CFunction::encrypt($_POST['wUsers']['repassword'], Yii::app()->params->hashkey);
         $model->created_date = date("Y-m-d H:i:s");
         $model->active_key = CFunction::random_generator(Yii::app()->params->number_active);
         $model->status = 0;
         if ($model->save()) {
             $activation_url = $this->createAbsoluteUrl('/wUsers/activation', array("activekey" => $model->active_key, "email" => $model->email));
         }
         //CFunction::sendMail($model->email, Yii::t('web/app',"registed"), Yii::t("web/app","active_code").$activation_url);
         //Yii::app()->user->setFlash('success', Yii::t('adm/app','register_success'));
         $this->render('alert', array('msg' => Yii::t('web/app', 'register_success')));
         //$this->redirect(array('create','type'=>$_GET['type']));
     }
     $this->render('create', array('model' => $model));
 }