PHP Classes
elePHPant
Icontem

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

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  CMS Airship  >  src/Cabin/Bridge/View/macros/groups.twig  >  Download  
File: src/Cabin/Bridge/View/macros/groups.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: 0 years ago
Size: 2,292 bytes
 

Contents

Class file image Download
{% macro selectBox(groupdata, selected = "", fullpath = "", depth = 0) %}{#
    #}{% if fullpath %}{#
        #}{% set fullpath = fullpath ~ " › " ~ groupdata.name %}{#
    #}{% else %}{#
        #}{% set fullpath = groupdata.name %}{#
    #}{% endif %}
    <option
        value="{{ groupdata.groupid|e('html_attr') }}"
        data-fullpath="{{ fullpath|e('html_attr') }}"
        class="
        treeselect
        branch_{{ depth|default(0)|e('html_attr') }}
        {% if groupdata.children %}
            treeselect_parent
        {% endif %}"
        {% if selected is iterable %}
            {% if groupdata.groupid in selected %}
                selected="selected"
            {% endif %}
        {% else %}
            {% if groupdata.groupid == selected %}
                selected="selected"
            {% endif %}
        {% endif %}
    >
        {{ groupdata.name }}
    </option>
    {% if groupdata.children %}
        {% for child in groupdata.children %}
            {{ _self.selectBox(child, selected, fullpath, depth + 1) }}
        {% endfor %}
    {% endif %}
{% endmacro %}

{% macro groupTree(groupdata, depth) %}
    <li>
        <a
            class="pure-button pure-button-primary"
            href="{{ cabin_url() }}crew/groups/edit/{{ groupdata.groupid|e('html_attr') }}"
        >
            <i
                class="fa fa-pencil"
                title="{{ __(
                        "Edit Group (%s)", "default",
                        groupdata.name
                    )|e('html_attr')
                }}"
            ></i>
        </a>
        <a
            class="pure-button pure-button-secondary"
            href="{{ cabin_url() }}crew/groups/delete/{{ groupdata.groupid|e('html_attr') }}"
        >
            <i
                class="fa fa-trash-o"
                title="{{ __(
                        "Delete Group (%s)", "default",
                        groupdata.name
                    )|e('html_attr')
                }}"
            ></i>
        </a>
        {{ groupdata.name }}
    </li>
    {% if groupdata.children %}
        <ul>
            {% for child in groupdata.children %}
                {{ _self.groupTree(child, depth|default(0) + 1) }}
            {% endfor %}
        </ul>
    {% endif %}
{% endmacro %}