summaryrefslogtreecommitdiff
path: root/protected/views/user/admin.php
blob: ed6b6363538e30eb7d2911a856b1f1cab207e3d8 (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
<?php
$this->breadcrumbs=array(
	'Benutzer'=>array('index'),
	'Benutzerverwaltung',
);

$this->menu=array(
	array('label'=>'Benutzer', 'url'=>array('index')),
	array('label'=>'Neuen Benutzer erstellen', 'url'=>array('create')),
);
?>

<h1>Benutzerverwaltung</h1>

<?php $this->renderPartial('/common/_comparison_text'); ?>

<?php $this->renderPartial('/common/_advanced_search',array(
	'model'=>$model,
)); ?>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'user-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'id',
		'username',
		'created_at',
		'last_login',
        array('header'=>'Aktiviert?',
		        'name'=>'is_active',
                'value'=>'CHtml::image($data->is_active ? "images/ok.png" : "images/nok.png", $data->is_active ? "ok.png" : "nok.png")', 'type'=>'raw'),
		array('header'=>'Admin',
		        'name'=>'is_super_admin',
				'value'=>'CHtml::image($data->is_super_admin ? "images/ok.png" : "images/nok.png", $data->is_super_admin ? "ok.png" : "nok.png")', 'type'=>'raw'),
		//'admin_pw_reset',
        //'user_pw_reset',
	    array('header'=>'eMail',
				'value'=>'($data->verein) ? $data->verein->email : ""'),
		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>