Simplify user approval #54

This commit is contained in:
Andy Strobel 2014-06-05 17:56:47 +02:00
parent 87c5f42a75
commit 6e0a649433
3 changed files with 16 additions and 54 deletions

View File

@ -49,24 +49,6 @@ class ApprovalController extends Controller {
));
}
/**
* Shows options for a user registration request.
*
* Options are approve or decline
*/
public function actionApproveUser() {
$id = (int) Yii::app()->request->getQuery('id');
$model = User::model()->resetScope()->unapproved()->findByPk($id);
if ($model == null)
throw new CHttpException(404, Yii::t('AdminModule.approval', 'Could not load requested user!'));
$model->scenario = 'edit';
$this->render('approveUser', array('model' => $model));
}
/**
* Approves a user registration request
*

View File

@ -1,27 +0,0 @@
<h1><?php echo Yii::t('AdminModule.base', 'Approve user: {displayName}', array('{displayName}' => $model->displayName)); ?></h1>
<br>
<?php
$this->widget('zii.widgets.CDetailView', array(
'data' => $model,
'attributes' => array(
'username',
'email:email',
array(
'name' => 'group_id',
'value' => Group::getGroupNameById($model->group_id),
),
'created_at',
),
));
?>
<br>
<a href="<?php echo $this->createUrl('approveUserAccept', array('id' => $model->id)) ?>"
class="btn btn-primary"><?php echo Yii::t('AdminModule.base', 'Approve membership'); ?></a>
<a href="<?php echo $this->createUrl('approveUserDecline', array('id' => $model->id)) ?>"
class="btn btn-danger"><?php echo Yii::t('AdminModule.base', 'Decline membership'); ?></a>

View File

@ -34,21 +34,28 @@ $this->widget('zii.widgets.grid.CGridView', array(
),
array(
'class' => 'CButtonColumn',
'template' => '{view}',
'viewButtonUrl' => 'Yii::app()->createUrl("admin/approval/approveUser", array("id"=>$data->id));',
'template' => '{accept}{decline}',
'htmlOptions' => array('width' => '160px'),
'buttons'=>array
(
'view' => array
'accept' => array
(
'label'=>'<i class="fa fa-eye"></i>',
'label'=>Yii::t('AdminModule.approval', 'Accept'),
'url'=>'Yii::app()->createUrl("admin/approval/approveUserAccept", array("id" => $data->id))',
'imageUrl'=>false,
'options' => array(
'style' => 'margin-right: 3px',
'class' => 'btn btn-primary btn-xs tt',
'data-toggle' => 'tooltip',
'data-placement' => 'top',
'title' => '',
'data-original-title' => 'View user approval',
'class' => 'btn btn-primary btn-sm',
),
),
'decline' => array
(
'label'=>Yii::t('AdminModule.approval', 'Decline'),
'url'=>'Yii::app()->createUrl("admin/approval/approveUserDecline", array("id" => $data->id))',
'imageUrl'=>false,
'options' => array(
'style' => 'margin-right: 3px',
'class' => 'btn btn-danger btn-sm',
),
),
),