5 public $defaultAction =
'admin';
16 return CMap::mergeArray(
34 'roles'=>array(
'Admin'),
37 'users' => array(
'*'),
49 $model =
new User(
'search');
50 $model->status = null;
51 $model->is_bulk = null;
52 if (isset($_GET[
'User'])) {
53 $model->attributes = $_GET[
'User'];
55 $this->render(
'index', array(
'model' => $model,));
73 array_push($attributes,
78 'name' =>
'createtime',
79 'value' => $model->createtime,
82 'name' =>
'lastvisit',
83 'value' => (($model->lastvisit) ? $model->lastvisit :
UserModule::t(
"Not visited")),
87 'value' => User::itemAlias(
"UserStatus", $model->status),
94 foreach ($profileFields as $field) {
96 $varname = $field->varname;
97 if(in_array($varname, array(
"send_me_notifications",
"find_me_in_phone_book")) ){
98 $value = ($model->profile->$varname == 1)?
true :
false;
100 $value = ($field->widgetView($model->profile)) ? $field->widgetView($model->profile) : (($field->range) ? Profile::range($field->range, $model->profile->getAttribute($field->varname)) : $model->profile->getAttribute($field->varname));
102 array_push($attributes, array(
104 'name' => $field->varname,
111 foreach ($attributes as $i => &$attribute) {
112 if(!is_null($attribute)&&(in_array($attribute, array(
"password",
"activkey")))){
113 unset($attributes[$i]);
115 elseif (is_null($attribute[
'value'])) {
116 $attribute[
'value'] =
'';
123 'attributes' => $attributes,
138 if (isset($_POST[
'User'])) {
139 $model->attributes = $_POST[
'User'];
140 $model->activkey = Yii::app()->controller->module->encrypting(microtime() . $model->password);
141 $model->createtime = date(
'Y-m-d H:i:s');
142 $model->lastvisit = date(
'Y-m-d H:i:s');
143 $profile->attributes = $_POST[
'Profile'];
144 $profile->user_id = 0;
145 if ($model->validate() && $profile->validate()) {
146 $model->password = Yii::app()->controller->module->encrypting($model->password);
147 if ($model->save()) {
148 $profile->user_id = $model->id;
151 $this->redirect(array(
'view',
'id' => $model->id));
153 $profile->validate();
160 'profile' => $profile,
174 $profile = $model->profile;
175 if (isset($_POST[
'User'])) {
176 $model->attributes = $_POST[
'User'];
177 $profile->attributes = $_POST[
'Profile'];
179 if ($model->validate() && $profile->validate()) {
180 $old_password =
User::model()->notsafe()->findByPk($model->id);
181 if ($old_password->password != $model->password) {
182 $model->password = Yii::app()->controller->module->encrypting($model->password);
183 $model->activkey = Yii::app()->controller->module->encrypting(microtime() . $model->password);
187 $this->redirect(array(
'view',
'id' => $model->id));
189 $profile->validate();
196 'profile' => $profile,
211 if (Yii::app()->request->isPostRequest) {
216 if ($account =
Account::model()->findByAttributes(array(
'user_id'=>$model->id))) {
223 if (!isset($_POST[
'ajax'])) {
224 $this->redirect(array(
'/user/admin'));
227 throw new CHttpException(400,
'Invalid request. Please do not repeat this request again.');
238 $this->render(
'managePersonalisation');
251 if ($this->_model === null) {
252 if (isset($_GET[
'id'])) {
255 if ($this->_model===null) {
256 throw new CHttpException(404,
'The requested page does not exist.');
259 return $this->_model;