From f50cfa3c95c50e3a0a9bcc491fb76dd6e210707b Mon Sep 17 00:00:00 2001 From: Sergio Casizzone Date: Tue, 7 Apr 2020 11:42:40 +0200 Subject: [PATCH] users fix --- protected/controllers/UsersController.php | 8 ++++++++ protected/views/users/index.php | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/protected/controllers/UsersController.php b/protected/controllers/UsersController.php index 7161d2b..ad29946 100755 --- a/protected/controllers/UsersController.php +++ b/protected/controllers/UsersController.php @@ -63,6 +63,14 @@ public function actionView($id) )); } + public function actionDisable($id) + { + $user = $this->loadModel(crypt::Decrypt($id)); + $user->status_activation_code = 0; + $user->update(); + $this->redirect(array('index')); + } + /** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. diff --git a/protected/views/users/index.php b/protected/views/users/index.php index 3a788a3..56b4e7e 100755 --- a/protected/views/users/index.php +++ b/protected/views/users/index.php @@ -31,26 +31,26 @@ function type($type){
widget('zii.widgets.grid.CGridView', array( - 'id'=>'soci-grid', - 'htmlOptions' => array('class' => 'table table-wallet '), - 'dataProvider'=>$dataProvider, - 'id'=>'users-grid', - 'enablePagination' => true, + 'id'=>'soci-grid', + 'htmlOptions' => array('class' => 'table table-wallet '), + 'dataProvider'=>$dataProvider, + 'id'=>'users-grid', + 'enablePagination' => true, 'columns' => array( array( 'type'=> 'raw', 'name'=>'name', 'header'=>'Nome', - 'value' => 'CHtml::link(CHtml::encode(strtoupper(Users::model()->findByPk($data->id_user)->surname).chr(32).Users::model()->findByPk($data->id_user)->name), Yii::app()->createUrl("users/view")."&id=".CHtml::encode(crypt::Encrypt($data->id_user)))', - 'filter' => CHtml::listData(Users::model()->findAll(array('order'=>'surname ASC, name ASC')), 'surname', function($items) { - return $items->surname.' '.$items->name; - }) + 'value' => '($data->status_activation_code == 0) ? strtoupper(Users::model()->findByPk($data->id_user)->surname).chr(32).Users::model()->findByPk($data->id_user)->name : CHtml::link(CHtml::encode(strtoupper(Users::model()->findByPk($data->id_user)->surname).chr(32).Users::model()->findByPk($data->id_user)->name), Yii::app()->createUrl("users/view")."&id=".CHtml::encode(crypt::Encrypt($data->id_user)))', + 'filter' => CHtml::listData(Users::model()->findAll(array('order'=>'surname ASC, name ASC')), 'surname', function($items) { + return $items->surname.' '.$items->name; + }) ), array( 'name'=>'email', 'type'=>'raw', - 'value' => 'CHtml::link(CHtml::encode($data->email), Yii::app()->createUrl("users/view")."&id=".CHtml::encode(crypt::Encrypt($data->id_user)))', + 'value' => '($data->status_activation_code == 0) ? CHtml::encode($data->email) : CHtml::link(CHtml::encode($data->email), Yii::app()->createUrl("users/view")."&id=".CHtml::encode(crypt::Encrypt($data->id_user)))', ),