Newer
Older
<?php
$info=array();
if ($role) {
$title = __('Update Role');
$action = 'update';
$submit_text = __('Save Changes');
$info = $role->getInfo();
$trans['name'] = $role->getTranslateTag('name');
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
$newcount=2;
} else {
$title = __('Add New Role');
$action = 'add';
$submit_text = __('Add Role');
$newcount=4;
}
$info = Format::htmlchars(($errors && $_POST) ? array_merge($info, $_POST) : $info);
?>
<form action="" method="post" id="save">
<?php csrf_token(); ?>
<input type="hidden" name="do" value="<?php echo $action; ?>">
<input type="hidden" name="a" value="<?php echo Format::htmlchars($_REQUEST['a']); ?>">
<input type="hidden" name="id" value="<?php echo $info['id']; ?>">
<h2> <?php echo $role ?: __('New Role'); ?></h2>
<br>
<ul class="tabs">
<li class="active"><a href="#definition">
<i class="icon-file"></i> <?php echo __('Definition'); ?></a></li>
<li><a href="#permissions">
<i class="icon-lock"></i> <?php echo __('Permissions'); ?></a></li>
</ul>
<div id="definition" class="tab_content">
<table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2">
<thead>
<tr>
<th colspan="2">
<h4><?php echo $title; ?></h4>
<em><?php echo __(
'Roles are used to define agents\' permissions'
); ?> <i class="help-tip icon-question-sign"
href="#roles"></i></em>
</th>
</tr>
</thead>
<tbody>
<tr>
<td width="180" class="required"><?php echo __('Name'); ?>:</td>
<td>
<input size="50" type="text" name="name" value="<?php echo
$info['name']; ?>" data-translate-tag="<?php echo $trans['name']; ?>"/>
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
<span class="error">* <?php echo $errors['name']; ?></span>
</td>
</tr>
</tbody>
<tbody>
<tr>
<th colspan="7">
<em><strong><?php echo __('Internal Notes'); ?></strong> </em>
</th>
</tr>
<tr>
<td colspan="7"><textarea name="notes" class="richtext no-bar"
rows="6" cols="80"><?php
echo $info['notes']; ?></textarea>
</td>
</tr>
</tbody>
</table>
</div>
<div id="permissions" class="tab_content" style="display:none">
<table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2">
<thead>
<tr>
<th>
<em><?php echo __('Check all permissions applicable to this role.') ?></em>
</th>
</tr>
</thead>
<tbody>
<?php
$setting = $role ? $role->getPermissionInfo() : array();
foreach (RolePermission::allPermissions() as $g => $perms) { ?>
<tr><th><?php
echo Format::htmlchars(__($g)); ?></th></tr>
<?php
foreach($perms as $k => $v) { ?>
<tr>
<td>
<label>
<?php
echo sprintf('<input type="checkbox" name="perms[]" value="%s" %s />',
$k,
(isset($setting[$k]) && $setting[$k]) ? 'checked="checked"' : '');
?>
<?php
echo sprintf('%s - <em>%s</em>',
Format::htmlchars(__($v[0])),
Format::htmlchars(__($v[1])));
?>
</label>
</td>
</tr>
<?php
}
} ?>
</tbody>
</table>
</div>
<p class="centered">
<input type="submit" name="submit" value="<?php echo $submit_text; ?>">
<input type="reset" name="reset" value="<?php echo __('Reset'); ?>">
<input type="button" name="cancel" value="<?php echo __('Cancel'); ?>"
onclick='window.location.href="?"'>
</p>
</form>