| @@ -1,6 +1,20 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 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 <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 | +/** | |
| 3 | 17 | * @var UserGroupController $controller |
| 4 | 18 | */ |
| 5 | 19 | |
| 6 | 20 | /** |
| @@ -9,9 +23,9 @@ | ||
| 9 | 23 | * |
| 10 | 24 | * @return string |
| 11 | 25 | */ |
| 12 | 26 | |
| 13 | -use UserAccessManager\Controller\Backend\Administration\UserGroupController; | |
| 27 | +use UserAccessManager\Controller\Backend\UserGroupController; | |
| 14 | 28 | use UserAccessManager\Object\ObjectHandler; |
| 15 | 29 | |
| 16 | 30 | $createHeaderColumn = function ($name, $sortingParameter) use ($controller) { |
| 17 | 31 | $isSorted = $controller->getRequestParameter('orderby') === $sortingParameter; |
| @@ -17,11 +31,11 @@ | ||
| 17 | 31 | $isSorted = $controller->getRequestParameter('orderby') === $sortingParameter; |
| 18 | 32 | $class = $isSorted === true ? 'sorted' : 'sortable'; |
| 19 | 33 | $sortOrder = $isSorted === true ? $controller->getRequestParameter('order') : 'asc'; |
| 20 | 34 | |
| 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>"; | |
| 35 | + $inner = "<span>{$name}</span><span class=\"sorting-indicator\"></span>"; | |
| 36 | + $link = "<a href=\"{$controller->getSortUrl($sortingParameter)}\" >{$inner}</a>"; | |
| 37 | + return "<th scope=\"col\" class=\"{$class} {$sortOrder}\">{$link}</th>"; | |
| 24 | 38 | } |
| 25 | 39 | |
| 26 | 40 | ?> |
| 27 | 41 | <form method="post" action="<?php echo $controller->getRequestUrl(); ?>"> |
| @@ -33,9 +47,9 @@ | ||
| 33 | 47 | value="<?php echo TXT_UAM_DELETE; ?>"/> |
| 34 | 48 | </div> |
| 35 | 49 | <br class="clear"/> |
| 36 | 50 | </div> |
| 37 | - <table class="wp-list-table widefat fixed striped"> | |
| 51 | + <table class="widefat"> | |
| 38 | 52 | <thead> |
| 39 | 53 | <tr class="thead"> |
| 40 | 54 | <th scope="col"></th> |
| 41 | 55 | <?php echo $createHeaderColumn(TXT_UAM_NAME, 'name'); ?> |
| @@ -51,22 +65,18 @@ | ||
| 51 | 65 | $currentAdminPage = $controller->getRequestParameter('page'); |
| 52 | 66 | $userGroups = $controller->getUserGroups(); |
| 53 | 67 | foreach ($userGroups as $userGroup) { |
| 54 | 68 | ?> |
| 55 | - <tr id="group-<?php echo $userGroup->getId(); ?>"> | |
| 69 | + <tr class="alternate" id="group-<?php echo $userGroup->getId(); ?>"> | |
| 56 | 70 | <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> | |
| 71 | + <label> | |
| 72 | + <input type="checkbox" value="<?php echo $userGroup->getId(); ?>" name="delete[]"/> | |
| 63 | 73 | </label> |
| 64 | 74 | </th> |
| 65 | 75 | <td> |
| 66 | 76 | <strong> |
| 67 | 77 | <?php |
| 68 | - $link = "?page=$currentAdminPage&uam_action=edit_user_group" | |
| 78 | + $link = "?page={$currentAdminPage}&uam_action=edit_user_group" | |
| 69 | 79 | . "&userGroupId={$userGroup->getId()}"; |
| 70 | 80 | ?> |
| 71 | 81 | <a href="<?php echo $link; ?>"> |
| 72 | 82 | <?php echo htmlentities($userGroup->getName()); ?> |
| @@ -106,9 +116,9 @@ | ||
| 106 | 116 | <ul style="margin: 0;"> |
| 107 | 117 | <?php |
| 108 | 118 | foreach ($groupRoles as $key => $role) { |
| 109 | 119 | ?> |
| 110 | - <li><?php echo $roleNames[$key] ?? $key; ?></li> | |
| 120 | + <li><?php echo isset($roleNames[$key]) ? $roleNames[$key] : $key; ?></li> | |
| 111 | 121 | <?php |
| 112 | 122 | } |
| 113 | 123 | ?> |
| 114 | 124 | </ul> |