| @@ -1,0 +1,106 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +// No direct access | |
| 4 | +defined('ABSPATH') or die('No script kiddies please!'); | |
| 5 | + | |
| 6 | +$ignores = array('administrator'); | |
| 7 | + | |
| 8 | +?> | |
| 9 | + | |
| 10 | +<form action="admin.php" method="post" name="adminForm" id="adminForm"> | |
| 11 | + | |
| 12 | + <?php if (wp_doing_ajax()) { ?> | |
| 13 | + <div class="btn-toolbar"> | |
| 14 | + <div class="btn-group pull-left"> | |
| 15 | + <button type="submit" class="page-title-action page-title-action" onclick="document.adminForm.task.value='acl.save';"> | |
| 16 | + <?php echo JText::translate('JTOOLBAR_APPLY'); ?> | |
| 17 | + </button> | |
| 18 | + </div> | |
| 19 | + </div> | |
| 20 | + <?php } ?> | |
| 21 | + | |
| 22 | + <div class="btn-toolbar"> | |
| 23 | + <div class="btn-group pull-left"> | |
| 24 | + <select name="activerole" id="role-select"> | |
| 25 | + <?php foreach ($this->roles as $role => $name) { | |
| 26 | + $selected = $role == $this->activeRole ? 'selected="selected"' : ''; | |
| 27 | + ?> | |
| 28 | + <option value="<?php echo $role; ?>" <?php echo $selected; ?>><?php echo $name; ?></option> | |
| 29 | + <?php } ?> | |
| 30 | + </select> | |
| 31 | + </div> | |
| 32 | + </div> | |
| 33 | + | |
| 34 | + <?php | |
| 35 | + foreach ($this->roles as $role => $name) | |
| 36 | + { | |
| 37 | + ?> | |
| 38 | + <div class="acl-role-container" id="role-<?php echo $role; ?>" style="<?php echo ($this->activeRole == $role ? '' : 'display: none;'); ?>"> | |
| 39 | + <h2><?php echo $name; ?></h2> | |
| 40 | + | |
| 41 | + <table class="wp-list-table widefat fixed striped"> | |
| 42 | + | |
| 43 | + <thead> | |
| 44 | + <tr> | |
| 45 | + <th width="50%"><?php echo JText::translate('JACTION'); ?></th> | |
| 46 | + <th width="15%" style="text-align: center;"><?php echo JText::translate('JNEW_SETTING'); ?></th> | |
| 47 | + <th width="15%" style="text-align: center;"><?php echo JText::translate('JCURRENT_SETTING'); ?></th> | |
| 48 | + </tr> | |
| 49 | + </thead> | |
| 50 | + <?php | |
| 51 | + | |
| 52 | + foreach ($this->actions as $action) | |
| 53 | + { | |
| 54 | + $has = JAccess::checkGroup($role, $action->name, 'com_vikbooking'); | |
| 55 | + $cap = JAccess::adjustCapability($action->name, 'com_vikbooking'); | |
| 56 | + | |
| 57 | + ?> | |
| 58 | + <tr> | |
| 59 | + | |
| 60 | + <td> | |
| 61 | + <b><?php echo $action->title; ?></b><br /><?php echo $action->description; ?> | |
| 62 | + </td> | |
| 63 | + | |
| 64 | + <td style="text-align: center;"> | |
| 65 | + <select name="acl[<?php echo $role; ?>][<?php echo $cap; ?>]" <?php echo (in_array($role, $ignores) ? 'disabled="disabled"' : ''); ?>> | |
| 66 | + <option value="-1">--</option> | |
| 67 | + <option value="1"><?php echo JText::translate('JALLOWED'); ?></option> | |
| 68 | + <option value="0"><?php echo JText::translate('JDENIED'); ?></option> | |
| 69 | + </select> | |
| 70 | + </td> | |
| 71 | + | |
| 72 | + <td style="text-align: center"> | |
| 73 | + <span class="acl-rule-<?php echo ($has ? 'allowed' : 'denied'); ?>"> | |
| 74 | + <?php echo JText::translate($has ? 'JALLOWED' : 'JDENIED'); ?> | |
| 75 | + </span> | |
| 76 | + </td> | |
| 77 | + | |
| 78 | + </tr> | |
| 79 | + <?php | |
| 80 | + } | |
| 81 | + | |
| 82 | + ?> | |
| 83 | + </table> | |
| 84 | + </div> | |
| 85 | + <?php } ?> | |
| 86 | + | |
| 87 | + <?php echo JHtml::fetch('form.token'); ?> | |
| 88 | + | |
| 89 | + <input type="hidden" name="option" value="com_vikbooking" /> | |
| 90 | + <input type="hidden" name="task" value="" /> | |
| 91 | + <input type="hidden" name="return" value="<?php echo $this->escape($this->returnLink); ?>" /> | |
| 92 | + | |
| 93 | +</form> | |
| 94 | + | |
| 95 | +<script> | |
| 96 | + | |
| 97 | + jQuery(function() { | |
| 98 | + | |
| 99 | + jQuery('#role-select').on('change', function() { | |
| 100 | + jQuery('.acl-role-container').hide(); | |
| 101 | + jQuery('#role-' + jQuery(this).val()).show(); | |
| 102 | + }); | |
| 103 | + | |
| 104 | + }); | |
| 105 | + | |
| 106 | +</script> | |