/
_permissions.php
126 lines (114 loc) · 4.88 KB
/
_permissions.php
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
/** @var Permissiontemplates $oModel */
Yii::app()->getController()->renderPartial(
'/layouts/partial_modals/modal_header',
['modalTitle' => gT('Edit permissions')]
);
?>
<?= TbHtml::formTb(
null,
App()->createUrl('userRole/savePermissions'),
'post',
["id" => "RoleControl--modalform"]
) ?>
<div class="modal-body selector--edit-permissions-container table-responsive">
<div class="container-center">
<input type='hidden' name='ptid' value='<?php
echo(isset($oModel) ? $oModel->ptid : ''); ?>'/>
<table id='RoleControl--permissions-table' class='activecell table table-striped'>
<thead>
<tr>
<th></th>
<th><?php
eT("Permission"); ?></th>
<th><?php
eT("General"); ?></th>
<th><?php
eT("Create"); ?></th>
<th><?php
eT("View/read"); ?></th>
<th><?php
eT("Update"); ?></th>
<th><?php
eT("Delete"); ?></th>
<th><?php
eT("Import"); ?></th>
<th><?php
eT("Export"); ?></th>
</tr>
</thead>
<!-- Permissions -->
<?php
foreach ($aBasePermissions as $sPermissionKey => $aCRUDPermissions): ?>
<tr>
<!-- Icon -->
<td>
<i class="<?php
echo $aCRUDPermissions['img']; ?> text-success"></i>
<?php
echo $aCRUDPermissions['description']; ?>
</td>
<!-- Warning super admin -->
<td>
<?php
if ($sPermissionKey == 'superadmin') { ?> <span class='warning'> <?php
};
echo $aCRUDPermissions['title'];
if ($sPermissionKey == 'superadmin') { ?> </span> <?php
}; ?>
</td>
<!-- checkbox -->
<td>
<input type="checkbox" class="general-row-selector" id='all_<?php
echo $sPermissionKey; ?>' name='PermissionAll[<?php
echo $sPermissionKey; ?>]'/>
</td>
<!-- CRUD -->
<?php
foreach ($aCRUDPermissions as $sCRUDKey => $CRUDValue): ?>
<?php
if (!in_array($sCRUDKey, array('create', 'read', 'update', 'delete', 'import', 'export'))) {
continue;
} ?>
<!-- Extended container -->
<td class='specific-settings-block'>
<?php
if ($CRUDValue): ?>
<?php
if (!($sPermissionKey == 'survey' && $sCRUDKey == 'read')): ?>
<!-- checkbox -->
<input type="checkbox" class="specific-permission-selector" name='Permission[<?php
echo $sPermissionKey . '][' . $sCRUDKey; ?>]' id='perm_<?php
echo $sPermissionKey . '_' . $sCRUDKey; ?>'
<?php
if (Permission::model()->roleHasPermission(
$oModel->ptid,
$sPermissionKey,
$sCRUDKey
)): ?>
checked="checked"
<?php
endif; ?>
<?php
if (substr($sPermissionKey, 0, 5) === 'auth_' && $sCRUDKey === 'read'): ?>
style="visibility:hidden"
<?php
endif; ?>/>
<?php
endif; ?>
<?php
endif; ?>
</td>
<?php
endforeach; ?>
</tr>
<?php
endforeach; ?>
</table>
</div>
</div>
<div class="modal-footer modal-footer-buttons" style="margin-top: 15px;">
<button class="btn btn-cancel selector--exitForm" id="exitForm"><?= gT('Cancel') ?></button>
<button class="btn btn-success selector--submitForm" id="submitForm"><?= gT('Save') ?></button>
</div>
</form>