Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

DrawOption()

Description

Renders an option in the Permission Manager (admin_group_permissions.php page)

Parameters

ColumnTypeDefaultDescription
$permission string Permission identifier
$description string User friendly description of the permission
$reverse boolean false Reverse the permission
$reload boolean false deprecated - Autosave changes done on this permission
$disabled boolean false: void { global $permissions Disable this permission as another supersedes it (greys it out and checks it)
$permissions;

Location

include/render_functions.php lines 5163 to 5203

Definition

 
function DrawOption(string $permissionstring $descriptionbool $reverse falsebool $reload falsebool $disabled false): void
    
{
    global 
$permissions,$permissions_done;

    
$description_escaped strip_paragraph_tags(strip_tags_and_attributes($description));
    
    
$checked in_array($permission$permissions);
    if (
$reverse)
        {
        
$checked = !$checked;
        }
    
    
$input_value $reverse "reverse" "normal";
    
$base64_perm base64_encode($permission);

    
// Other attributes - note: a disabled input also gets checked automatically (some plugins do it)
    
$disabled_attr '';
    
$onchange_attr " onchange=SavePermissions(['$base64_perm']);";
    if (
$disabled)
        {
        
$checked true;
        
$disabled_attr ' disabled';
        
$onchange_attr '';
        }
    
$checked_attr $checked ' checked' '';
    
?>
    <input type="hidden" name="permission_ echo $base64_perm?>" value=" echo $input_value?>">
    <tr class=" echo count($permissions_done) % == 'tableRowEven' 'tableRowOdd'?>">
    <td> if ($reverse) {?><i> ?> echo escape($permission?> if ($reverse) {?></i> ?></td>
        <td> echo $description_escaped?></td>
        <td>
            <input
                type="checkbox"
                name="checked_ echo $base64_perm?>"
                data-reverse=" echo (int) $reverse?>"
                 echo $disabled_attr $checked_attr $onchange_attr?>>
        </td>
    </tr>
    
    $permissions_done
[] = $permission;
    }

This article was last updated 12th December 2024 06:35 Europe/London time based on the source file dated 11th December 2024 15:55 Europe/London time.