-
Notifications
You must be signed in to change notification settings - Fork 10
/
editrole.php
205 lines (136 loc) · 6.3 KB
/
editrole.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?php include 'app/inc/header.php'; ?>
<?php
$roleid = isset($_GET['roleid']) ? $_GET['roleid'] : '';
if (!isset($roleid) && $roleid == NULL) {
//header("Location:role.php");
echo "<script>location.href='role.php';</script>";
exit();
}else{
$roleid = preg_replace('/[^a-zA-Z0-9-]/', '', $roleid);
$getRol = $rol->editRoleById($roleid);
}
?>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
$updateRole = $rol->updateUserRole($_POST, $roleid);
}
?>
<!--====== Start Main Wrapper Section======-->
<section class="d-flex" id="wrapper">
<?php include 'app/inc/sidebar.php'; ?>
<div class="page-content-wrapper">
<!-- Header BreadCrumb -->
<div class="content-header">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="dashboard.php"><i class="material-icons">home</i>Home</a></li>
<li class="breadcrumb-item"><a href="role.php">Role</a></li>
<li class="breadcrumb-item active" aria-current="page">Edit User Role</li>
</ol>
</nav>
</div>
<!-- Header BreadCrumb -->
<!-- Flash Message -->
<?php if (isset($updateRole)) {
echo $updateRole;
} ?>
<!-- Flash Message -->
<!-- Create New User -->
<div class="main-content">
<div class="card bg-white">
<div class="card-body mt-5 mb-5">
<div class="viewuser">
<?php
if ($getRol) {
while ($result = $getRol->fetch_assoc()) {
?>
<form action="" method="POST">
<div class="form-group row">
<div class="col-md-2">Role Name</div>
<div class="col-md-8">
<input id="rolename" type="text" class="form-control" readonly="readonly"
value="<?php echo $result['rolename']; ?>" autofocus="">
</div>
</div>
<div class="form-group row">
<div class="col-md-2">Display Name</div>
<div class="col-md-8">
<input id="roledname" type="text" class="form-control" name="roledname"
value="<?php echo $result['roledname']; ?>" autofocus="">
</div>
</div>
<div class="form-group row">
<div class="col-md-2">Permissions Edit</div>
<div class="col-md-8">
<!--TAGS-->
<div class="form-group">
<div>
<select required="readonly" name="permission_items[]" id="select2-example-tags"
class="form-control select-tag-primary" multiple="multiple" style="width: 100%">
<optgroup>
<?php
$permission_list = $prm->selectAllPermissions();
if ($permission_list) {
while ($allow = $permission_list->fetch_assoc()) {
$list = explode(',', $result['permission_items']);
foreach ($list as $item)
{
$item;
echo '<option value="'.$item.'"';
if (in_array($item,$allow)) {
echo 'selected';
echo '>'.$item.'</option>';
}
}
?>
<?php } }?>
</optgroup>
</select>
</div>
</div>
</div>
</div>
<div class="form-group pt-2 row">
<div class="col-md-2"></div>
<div class="col-md-4">
<button class="theme-primary-btn btn btn-success" type="submit" name="update">Update
Role</button>
<button class="btn btn-warning text-white" type="reset">Reset</button>
</div>
</div>
</form>
<?php
}}else{
echo "<script>window.location='role.php';</script>";
}
?>
</div>
</div>
</div>
</div>
<!-- Create New User-->
<div class="row mt-3">
<div class="col-md-12">
<div class="card ">
<div class="card-body footer-p">
<p>Design and developed by Nababur rahaman send a thanks giving mail or do you want any support :)
<a href="mailto:nababurdev@gmail.com">nababurdev@gmail.com</a>
</p>
<p>Do you want to develop any php or laravel or wordpress project ? send a mail:) <a
href="mailto:nababurdev@gmail.com">nababurdev@gmail.com</a> </p>
<p>CEO of GridTemaplate: <a target="_blank"
href="https://www.gridtemplate.com/">https://www.gridtemplate.com/</a>
</p>
<p>Connect with Github: <a target="_blank"
href="https://github.com/nababur">https://github.com/nababur</a>
</p>
</div>
</div>
</div>
</div>
</div>
<!-- main-content -->
</div>
</section>
<!--====== End Main Wrapper Section======-->
<?php include 'app/inc/footer.php'; ?>