| @@ -1,27 +1,37 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @var UserGroupController $controller | |
| 3 | + * UserGroupList.php | |
| 4 | + * | |
| 5 | + * Shows the user group edit list at the admin panel. | |
| 6 | + * | |
| 7 | + * PHP versions 5 | |
| 8 | + * | |
| 9 | + * @author Alexander Schneider <[email protected]> | |
| 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/ | |
| 4 | 14 | */ |
| 5 | 15 | |
| 6 | 16 | /** |
| 17 | + * @var \UserAccessManager\Controller\Backend\UserGroupController $controller | |
| 18 | + */ | |
| 19 | + | |
| 20 | +/** | |
| 7 | 21 | * @param string $name |
| 8 | 22 | * @param string $sortingParameter |
| 9 | 23 | * |
| 10 | 24 | * @return string |
| 11 | 25 | */ |
| 12 | - | |
| 13 | -use UserAccessManager\Controller\Backend\UserGroupController; | |
| 14 | -use UserAccessManager\Object\ObjectHandler; | |
| 15 | - | |
| 16 | 26 | $createHeaderColumn = function ($name, $sortingParameter) use ($controller) { |
| 17 | 27 | $isSorted = $controller->getRequestParameter('orderby') === $sortingParameter; |
| 18 | 28 | $class = $isSorted === true ? 'sorted' : 'sortable'; |
| 19 | 29 | $sortOrder = $isSorted === true ? $controller->getRequestParameter('order') : 'asc'; |
| 20 | 30 | |
| 21 | - $inner = "<span>$name</span><span class=\"sorting-indicator\"></span>"; | |
| 22 | - $link = "<a href=\"{$controller->getSortUrl($sortingParameter)}\" >$inner</a>"; | |
| 23 | - return "<th scope=\"col\" class=\"$class $sortOrder\">$link</th>"; | |
| 31 | + $inner = "<span>{$name}</span><span class=\"sorting-indicator\"></span>"; | |
| 32 | + $link = "<a href=\"{$controller->getSortUrl($sortingParameter)}\" >{$inner}</a>"; | |
| 33 | + return "<th scope=\"col\" class=\"{$class} {$sortOrder}\">{$link}</th>"; | |
| 24 | 34 | } |
| 25 | 35 | |
| 26 | 36 | ?> |
| 27 | 37 | <form method="post" action="<?php echo $controller->getRequestUrl(); ?>"> |
| @@ -53,21 +63,17 @@ | ||
| 53 | 63 | foreach ($userGroups as $userGroup) { |
| 54 | 64 | ?> |
| 55 | 65 | <tr class="alternate" id="group-<?php echo $userGroup->getId(); ?>"> |
| 56 | 66 | <th class="check-column"> |
| 57 | - <input id="uam-bulk-select" | |
| 58 | - type="checkbox" | |
| 59 | - value="<?php echo $userGroup->getId(); ?>" | |
| 60 | - name="delete[]"/> | |
| 61 | - <label for="uam-bulk-select"> | |
| 62 | - <span class="screen-reader-text"><?php echo TXT_UAM_DELETE; ?></span> | |
| 67 | + <label> | |
| 68 | + <input type="checkbox" value="<?php echo $userGroup->getId(); ?>" name="delete[]"/> | |
| 63 | 69 | </label> |
| 64 | 70 | </th> |
| 65 | 71 | <td> |
| 66 | 72 | <strong> |
| 67 | 73 | <?php |
| 68 | - $link = "?page=$currentAdminPage&uam_action=edit_user_group" | |
| 69 | - . "&userGroupId={$userGroup->getId()}"; | |
| 74 | + $link = "?page={$currentAdminPage}&uam_action=edit_user_group" | |
| 75 | + ."&userGroupId={$userGroup->getId()}"; | |
| 70 | 76 | ?> |
| 71 | 77 | <a href="<?php echo $link; ?>"> |
| 72 | 78 | <?php echo htmlentities($userGroup->getName()); ?> |
| 73 | 79 | </a> |
| @@ -97,9 +103,9 @@ | ||
| 97 | 103 | <td> |
| 98 | 104 | <?php |
| 99 | 105 | $roleNames = $controller->getRoleNames(); |
| 100 | 106 | $groupRoles = $userGroup->getAssignedObjectsByType( |
| 101 | - ObjectHandler::GENERAL_ROLE_OBJECT_TYPE | |
| 107 | + \UserAccessManager\Object\ObjectHandler::GENERAL_ROLE_OBJECT_TYPE | |
| 102 | 108 | ); |
| 103 | 109 | |
| 104 | 110 | if (count($groupRoles) > 0) { |
| 105 | 111 | ?> |
| @@ -106,9 +112,9 @@ | ||
| 106 | 112 | <ul style="margin: 0;"> |
| 107 | 113 | <?php |
| 108 | 114 | foreach ($groupRoles as $key => $role) { |
| 109 | 115 | ?> |
| 110 | - <li><?php echo $roleNames[$key] ?? $key; ?></li> | |
| 116 | + <li><?php echo isset($roleNames[$key]) ? $roleNames[$key] : $key; ?></li> | |
| 111 | 117 | <?php |
| 112 | 118 | } |
| 113 | 119 | ?> |
| 114 | 120 | </ul> |