summaryrefslogtreecommitdiff
path: root/protected/views/user/admin.php
blob: 488559fd19223a6c37ca994c1f4d2d12012ce1c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
$this->breadcrumbs=array(
	'Users'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'List User', 'url'=>array('index')),
	array('label'=>'Create User', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('user-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Manage Users</h1>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'user-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'id',
		'username',
		'created_at',
		'last_login',
		'is_active',
		'is_super_admin',
        'admin_pw_reset',
        'user_pw_reset',
		array(
			'class'=>'CButtonColumn',
		    'template'=>'{email}{view}{update}{delete}',
		    'buttons'=>array(
		                    'email'=>array(
		                                   'label'=>'Generate new password and email it',
		                                   'imageUrl'=>Html::imageUrl('email.png'),
		                                   'click'=>'function(){generatePassword($(this).parent().parent().children(":first-child").text());}'
		                                   )
		                    )
		),
	),
)); ?>

<script type="text/javascript">
function generatePassword(id) {
	console.log(id);
    <?php echo CHtml::ajax(array(
            'url'=>array('user/newPassword'),
            'data'=> "js:{'id':id}",
            'type'=>'post',
            'dataType'=>'json',
            'success'=>"function(data)
            {
                if (data.status == 'failure')
                {
                    alert(data.message);
                }
                else
                {
                   alert(data.message);
                }
 
            } ",
            ))?>;
    return false; 
 
}
 
</script>