15 return CMap::mergeArray(parent::filters(), array(
29 'actions' => array(
'admin',
'delete',
'create',
'update',
'view'),
33 'users' => array(
'*'),
42 $model =
new User(
'search');
43 $model->unsetAttributes();
44 if (isset($_GET[
'User'])) {
45 $model->attributes = $_GET[
'User'];
48 $this->render(
'index', array(
68 $this->render(
'view', array(
82 if (isset($_POST[
'User'])) {
83 $model->attributes = $_POST[
'User'];
84 $model->activkey = Yii::app()->controller->module->encrypting(microtime().$model->password);
85 $profile->attributes = $_POST[
'Profile'];
86 $profile->user_id = 0;
87 if ($model->validate() && $profile->validate()) {
88 $model->password = Yii::app()->controller->module->encrypting($model->password);
90 $profile->user_id = $model->id;
94 $RegistrationForm->setDefaultUserAssignments($model->id);
96 $this->redirect(array(
'view',
'id' => $model->id));
102 $this->render(
'create', array(
104 'profile' => $profile,
115 $profile = $model->profile;
117 if (isset($_POST[
'User'])) {
118 $model->attributes = $_POST[
'User'];
119 $profile->attributes = $_POST[
'Profile'];
121 if ($model->validate() && $profile->validate()) {
122 $old_password =
User::model()->notsafe()->findByPk($model->id);
123 if ($old_password->password != $model->password) {
124 $model->password = Yii::app()->controller->module->encrypting($model->password);
125 $model->activkey = Yii::app()->controller->module->encrypting(microtime().$model->password);
129 $this->redirect(array(
'view',
'id' => $model->id));
131 $profile->validate();
135 $this->render(
'update', array(
137 'profile' => $profile,
147 if (Yii::app()->request->isPostRequest) {
154 if (!isset($_POST[
'ajax'])) {
155 $this->redirect(array(
'/user/admin'));
158 throw new CHttpException(400,
'Invalid request. Please do not repeat this request again.');
169 if (isset($_POST[
'ajax']) && $_POST[
'ajax'] ===
'user-form') {
170 echo CActiveForm::validate($validate);
181 if ($this->_model === null) {
182 if (isset($_GET[
'id'])) {
183 $this->_model =
User::model()->notsafe()->findbyPk($_GET[
'id']);
185 if ($this->_model === null) {
186 throw new CHttpException(404,
'The requested page does not exist.');