PluginProbe
User Access Manager / 2.0.6
User Access Manager v2.0.6
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
user-access-manager / src / UserAccessManager / View / AdminUserGroup.php

AdminUserGroup.php in User Access Manager 2.0.6, at src/UserAccessManager/View/AdminUserGroup.php

305 lines 12.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * AdminUserGroup.php
4 *
5 * Shows the user group page at the admin panel.
6 *
7 * PHP versions 5
8 *
9 * @author Alexander Schneider <alexanderschneider85@gmail.com>
10 * @copyright 2008-2017 Alexander Schneider
11 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2
12 * @version SVN: $id$
13 * @link http://wordpress.org/extend/plugins/user-access-manager/
14 */
15
16 /**
17 * @var \UserAccessManager\Controller\AdminUserGroupController $controller
18 */
19 if ($controller->hasUpdateMessage()) {
20 ?>
21 <div class="updated">
22 <p><strong><?php echo $controller->getUpdateMessage(); ?></strong></p>
23 </div>
24 <?php
25 }
26
27 if ($controller->getRequestParameter('uam_action') === null
28 || $controller->getRequestParameter('uam_action') === 'delete_user_group'
29 ) {
30 ?>
31 <div class="wrap">
32 <form method="post" action="<?php echo $controller->getRequestUrl(); ?>">
33 <?php $controller->createNonceField('uamDeleteGroup'); ?>
34 <input type="hidden" value="delete_user_group" name="uam_action"/>
35 <h2><?php echo TXT_UAM_MANAGE_GROUP; ?></h2>
36 <div class="tablenav">
37 <div class="alignleft">
38 <input type="submit" class="button-secondary delete" name="deleteit"
39 value="<?php echo TXT_UAM_DELETE; ?>"/>
40 </div>
41 <br class="clear"/>
42 </div>
43 <table class="widefat">
44 <thead>
45 <tr class="thead">
46 <th scope="col"></th>
47 <th scope="col"><?php echo TXT_UAM_NAME; ?></th>
48 <th scope="col"><?php echo TXT_UAM_DESCRIPTION; ?></th>
49 <th scope="col"><?php echo TXT_UAM_READ_ACCESS; ?></th>
50 <th scope="col"><?php echo TXT_UAM_WRITE_ACCESS; ?></th>
51 <th scope="col"><?php echo TXT_UAM_GROUP_ROLE; ?></th>
52 <th scope="col"><?php echo TXT_UAM_IP_RANGE; ?></th>
53 </tr>
54 </thead>
55 <tbody>
56 <?php
57 $currentAdminPage = $controller->getRequestParameter('page');
58 $userGroups = $controller->getUserGroups();
59 foreach ($userGroups as $userGroup) {
60 ?>
61 <tr class="alternate" id="group-<?php echo $userGroup->getId(); ?>">
62 <th class="check-column" scope="row">
63 <label>
64 <input type="checkbox" value="<?php echo $userGroup->getId(); ?>" name="delete[]"/>
65 </label>
66 </th>
67 <td>
68 <strong>
69 <?php
70 $link = "?page={$currentAdminPage}&amp;uam_action=edit_user_group"
71 ."&amp;userGroupId={$userGroup->getId()}";
72 ?>
73 <a href="<?php echo $link; ?>">
74 <?php echo htmlentities($userGroup->getName()); ?>
75 </a>
76 </strong>
77 </td>
78 <td><?php echo htmlentities($userGroup->getDescription()) ?></td>
79 <td>
80 <?php
81 if ($userGroup->getReadAccess() === 'all') {
82 echo TXT_UAM_ALL;
83 } elseif ($userGroup->getReadAccess() === 'group') {
84 echo TXT_UAM_ONLY_GROUP_USERS;
85 }
86 ?>
87 </td>
88 <td>
89 <?php
90 if ($userGroup->getWriteAccess() === 'all') {
91 echo TXT_UAM_ALL;
92 } elseif ($userGroup->getWriteAccess() === 'group') {
93 echo TXT_UAM_ONLY_GROUP_USERS;
94 }
95 ?>
96 </td>
97 <td>
98 <?php
99 $roleNames = $controller->getRoleNames();
100 $groupRoles = $userGroup->getAssignedObjectsByType(
101 \UserAccessManager\ObjectHandler\ObjectHandler::GENERAL_ROLE_OBJECT_TYPE
102 );
103
104 if (count($groupRoles) > 0) {
105 ?>
106 <ul style="margin: 0;">
107 <?php
108 foreach ($groupRoles as $key => $role) {
109 ?>
110 <li><?php echo isset($roleNames[$key]) ? $roleNames[$key] : $key; ?></li>
111 <?php
112 }
113 ?>
114 </ul>
115 <?php
116 } else {
117 echo TXT_UAM_NONE;
118 }
119 ?>
120 </td>
121 <td>
122 <?php
123 $ipRanges = $userGroup->getIpRangeArray();
124
125 if (count($ipRanges) > 0) {
126 ?>
127 <ul>
128 <?php
129 foreach ($ipRanges as $ipRange) {
130 ?>
131 <li><?php echo htmlentities($ipRange); ?></li>
132 <?php
133 }
134 ?>
135 </ul>
136 <?php
137 } else {
138 echo TXT_UAM_NONE;
139 }
140 ?>
141 </td>
142 </tr>
143 <?php
144 }
145 ?>
146 </tbody>
147 </table>
148 <div class="tablenav">
149 <div class="alignleft">
150 <input type="submit" class="button-secondary delete" name="deleteit"
151 value="<?php echo TXT_UAM_DELETE; ?>"/>
152 </div>
153 <br class="clear"/>
154 </div>
155 </form>
156 </div>
157 <?php
158 }
159 ?>
160 <div class="wrap">
161 <h2>
162 <?php
163 if ($controller->getRequestParameter('uam_action') === 'editGroup') {
164 echo TXT_UAM_EDIT_GROUP;
165 } else {
166 echo TXT_UAM_ADD_GROUP;
167 }
168 ?>
169 </h2>
170 <form method="post" action="<?php echo $controller->getRequestUrl(); ?>">
171 <input type="hidden" value="insert_update_user_group" name="uam_action"/>
172 <?php
173 $userGroup = $controller->getUserGroup();
174 $controller->createNonceField('uamInsertUpdateGroup');
175 if ($userGroup->getId() !== null) {
176 ?>
177 <input type="hidden" value="<?php echo $userGroup->getId(); ?>" name="userGroupId"/>
178 <?php
179 }
180 ?>
181 <table class="form-table">
182 <tbody>
183 <tr class="form-field form-required">
184 <th valign="top" scope="row"><label for="userGroupName"><?php echo TXT_UAM_GROUP_NAME; ?></label></th>
185 <td>
186 <input type="text" size="40" value="<?php echo htmlentities($userGroup->getName()); ?>"
187 id="userGroupName" name="userGroupName"/><br/>
188 <?php echo TXT_UAM_GROUP_NAME_DESC; ?>
189 </td>
190 </tr>
191 <tr class="form-field form-required">
192 <th valign="top" scope="row"><label for="userGroupDescription"><?php echo TXT_UAM_GROUP_DESC; ?></label>
193 </th>
194 <td>
195 <input type="text" size="40" value="<?php echo htmlentities($userGroup->getDescription()); ?>"
196 id="userGroupDescription" name="userGroupDescription"/><br/>
197 <?php echo TXT_UAM_GROUP_DESC_DESC; ?>
198 </td>
199 </tr>
200 <tr class="form-field form-required">
201 <th valign="top" scope="row"><label for="ipRange"><?php echo TXT_UAM_GROUP_IP_RANGE; ?></label></th>
202 <td><input type="text" size="40" value="<?php echo htmlentities($userGroup->getIpRange()); ?>"
203 id="ipRange" name="ipRange"/><br/>
204 <?php echo TXT_UAM_GROUP_IP_RANGE_DESC; ?>
205 </td>
206 </tr>
207 <tr class="form-field form-required">
208 <th valign="top" scope="row"><label for="readAccess"><?php echo TXT_UAM_GROUP_READ_ACCESS; ?></label>
209 </th>
210 <td>
211 <select id="readAccess" name="readAccess">
212 <option value="group"
213 <?php
214 if ($userGroup->getReadAccess() === 'group') {
215 echo 'selected="selected"';
216 }
217 ?>
218 >
219 <?php echo TXT_UAM_ONLY_GROUP_USERS ?>
220 </option>
221 <option value="all"
222 <?php
223 if ($userGroup->getReadAccess() === 'all') {
224 echo 'selected="selected"';
225 }
226 ?>
227 >
228 <?php echo TXT_UAM_ALL ?>
229 </option>
230 </select><br/>
231 <?php echo TXT_UAM_GROUP_READ_ACCESS_DESC; ?>
232 </td>
233 </tr>
234 <tr class="form-field form-required">
235 <th valign="top" scope="row"><label for="writeAccess"><?php echo TXT_UAM_GROUP_WRITE_ACCESS; ?></label>
236 </th>
237 <td>
238 <select id="writeAccess" name="writeAccess">
239 <option value="group"
240 <?php
241 if ($userGroup->getWriteAccess() === 'group') {
242 echo 'selected="selected"';
243 }
244 ?>
245 >
246 <?php echo TXT_UAM_ONLY_GROUP_USERS ?>
247 </option>
248 <option value="all"
249 <?php
250 if ($userGroup->getWriteAccess() === 'all') {
251 echo 'selected="selected"';
252 }
253 ?>
254 >
255 <?php echo TXT_UAM_ALL ?>
256 </option>
257 </select><br/>
258 <?php echo TXT_UAM_GROUP_WRITE_ACCESS_DESC; ?>
259 </td>
260 </tr>
261 <tr>
262 <th valign="top" scope="row"><?php echo TXT_UAM_GROUP_ROLE; ?></th>
263 <td>
264 <ul class='uam_role'>
265 <?php
266 $groupRoles = $userGroup->getAssignedObjectsByType(
267 \UserAccessManager\ObjectHandler\ObjectHandler::GENERAL_ROLE_OBJECT_TYPE
268 );
269 $roleNames = $controller->getRoleNames();
270
271 foreach ($roleNames as $role => $name) {
272 if ($role !== 'administrator') {
273 ?>
274 <li class="selectit">
275 <input id="role-<?php echo $role; ?>" type="checkbox"
276 <?php
277 if (isset($groupRoles[$role]) === true) {
278 echo 'checked="checked"';
279 }
280 ?>
281 value="<?php echo $role; ?>" name="roles[]"/>
282 <label for="role-<?php echo $role; ?>">
283 <?php echo $name; ?>
284 </label>
285 </li>
286 <?php
287 }
288 }
289 ?>
290 </ul>
291 </td>
292 </tr>
293 </tbody>
294 </table>
295 <p class="submit">
296 <input type="submit" value="<?php
297 if ($userGroup->getId() !== null) {
298 echo TXT_UAM_UPDATE_GROUP;
299 } else {
300 echo TXT_UAM_ADD_GROUP;
301 }
302 ?>" name="submit" class="button"/>
303 </p>
304 </form>
305 </div>