PHP Classes
elePHPant
Icontem

File: src/Cabin/Bridge/View/macros/permtable.twig

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  CMS Airship  >  src/Cabin/Bridge/View/macros/permtable.twig  >  Download  
File: src/Cabin/Bridge/View/macros/permtable.twig
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: CMS Airship
Content management system with security features
Author: By
Last change:
Date: 1 year ago
Size: 4,757 bytes
 

Contents

Class file image Download
{% macro permTable(groupdata, parentid, depth = 0) %}
<tr class="perm_row"{#
        #} data-id="{{ groupdata.groupid|e('html_attr') }}"{#
        #} data-parent="{{ parentid|default(0)|e('html_attr') }}"{#
        #} id="group_{{ groupdata.groupid|e('html_attr') }}"{#
        #} data-children=""{#
        #} data-ancestors=""{#
    #}>
    <td class="permtable_name perm_row_group depth_{{ depth|default(0) }}">
        <div class="perm_groupname">{{ groupdata.name }}</div>
    </td>
    {% for label, value in groupdata.perms %}<td class="permtable_perm{#
                #}{% if groupdata.superuser %}{#
                    #} permtable_admin{#
                    #}" title="{{ groupdata.name|e('html_attr') }} - {{ label|ucfirst|e('html_attr') }}: {{ __("Yes (Administrator)")|e('html_attr') }}{#
                #}{% elseif value %}{#
                    #} permtable_on{#
                    #}" title="{{ groupdata.name|e('html_attr') }} - {{ label|ucfirst|e('html_attr') }}: {{ __("Yes")|e('html_attr') }}{#
                #}{% elseif groupdata.inherit[label] %}{#
                    #} permtable_inherits{#
                    #}" title="{{ groupdata.name|e('html_attr') }} - {{ label|ucfirst|e('html_attr') }}: {{ __("Yes (Inherited)")|e('html_attr') }}{#
                #}{% else %}{#
                    #} permtable_off{#
                    #}" title="{{ groupdata.name|e('html_attr') }} - {{ label|ucfirst|e('html_attr') }}: {{ __("No")|e('html_attr') }}{#
                #}{% endif %}{#
                #}" {#
            #}id="group_{{ groupdata.groupid|e('html_attr') }}_{{ label|e('html_attr') }}" {#
            #}data-group="{{ groupdata.groupid|e('html_attr') }}" {#
            #}data-label="{{ label|e('html_attr') }}"{#
            #}><!--
         --><input
                id="group_{{ groupdata.groupid }}_{{ label|e('html_attr') }}_cbox"
                class="perms_checkbox"
                type="checkbox"
                name="group_perms[{{ groupdata.groupid|e('html_attr') }}][{{ label|e('html_attr') }}]"
                value="1"{#
            #}{% if groupdata.superuser %}{#
                #} checked="true" disabled="disabled" {#
            #}{% elseif value %}{#
                #} checked="checked"{#
            #}{% endif %}
                id="group_{{ groupdata.groupid|e('html_attr') }}_{{ label|e('html_attr') }}_cbox"
                data-id="{{ groupdata.groupid|e('html_attr') }}"
            /><!--
         --><label id="group_{{ groupdata.groupid }}_{{ label|e('html_attr') }}_indicator" {#
            #} for="group_{{ groupdata.groupid }}_{{ label|e('html_attr') }}_cbox" {#
            #}{% if groupdata.superuser %}{#
                #}data-default="admin" data-state="admin"><i class="fa fa-bolt perm-admin"></i>{#
            #}{% elseif value %}{#
                #}data-default="on" data-state="on"><i class="fa fa-check perm-on"></i>{#
            #}{% elseif groupdata.inherit[label] %}{#
                #}data-default="inherit" data-state="inherit"><i class="fa fa-level-up fa-flip-horizontal perm-inherits"></i>{#
            #}{% else %}{#
                #}data-default="off" data-state="off"><i class="fa fa-close perm-off"></i>{#
            #}{% endif %}</label>
        </td><!--
        -->{% endfor %}
    </tr>{#
    #}{% if groupdata.children %}
    {% for child in groupdata.children %}
        {{ _self.permTable(child, groupdata.groupid, depth + 1) }}
    {% endfor %}
{% endif %}
{% endmacro %}

{% macro readOnlyTable(groupdata, parentid, depth = 0) %}
<tr class="perm_row read_only"{#
        #} id="group_{{ groupdata.groupid }}"{#
    #}>
    <td class="permtable_name depth_{{ depth|default(0) }}">
        <div class="perm_groupname"><a href="{{ cabin_url() }}crew/groups/edit/{{ groupdata.groupid|e('html_attr') }}">{#
            #}{{ groupdata.name }}{#
        #}</a></div>
    </td>
    {% for label, value in groupdata.perms %}{#
        #}{% if groupdata.superuser or value or groupdata.inherit[label] %}{#
            #}<td class="permtable_perm" title="{{ groupdata.name|e('html_attr') }} - {{ label|ucfirst|e('html_attr') }}: {{ __("Yes")|e('html_attr') }}">{#
                #}<i class="fa fa-check perm-on"></i>{#
            #}</td>{#
        #}{% else %}{#
            #}<td class="permtable_perm" title="{{ groupdata.name|e('html_attr') }} - {{ label|ucfirst|e('html_attr') }}: {{ __("No")|e('html_attr') }}">{#
                #}<i class="fa fa-close perm-off"></i>{#
            #}</td>{#
        #}{% endif %}<!--
        -->{% endfor %}
    </tr>{#
    #}{% if groupdata.children %}
    {% for child in groupdata.children %}
        {{ _self.readOnlyTable(child, groupdata.groupid, depth + 1) }}
    {% endfor %}
{% endif %}
{% endmacro %}