The Framework Code

twigs/framework/admin/roleselect.twig

File List

{% import '@content/iconmacro.twig' as i %}
{% import '@util/formmacro.twig' as f %}

    <fieldset>
        <legend>Roles</legend>
        {% set rs = bean.roles(TRUE) %}
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>Context</th>
                    <th>Role</th>
                    <th>Start</th>
                    <th>End</th>
                    <th>Other Info</th>
                    <th>&nbsp;</th>
                </tr>
            </thead>
            <tbody>
                {% for r in bean.roles(TRUE) %}
                    <tr data-id="{{r.getID}}" {% if not r.valid() %} class="notvalid"{% endif %}>
                        {{f.hidden({name: 'exist[]', value: r.getID})}}
                        <td>{{r.rolecontext.name}}</td>
                        <td>{{r.rolename.name}}</td>
                        <td><input type="text" name="xstart[]" value="{{r.start}}" placeholder="Start Date or Now" class="form-control"/></td>
                        <td><input type="text" name="xend[]" value="{{r.end == '' ? 'Never' : r.end}}" placeholder="End Date or Never" class="form-control"/></td>
                        <td><input type="text" name="xotherinfo[]" value="{{r.otherinfo}}" placeholder="Other Info" class="form-control"/></td>
                        <td>{{i.delete('delb')}}</td>
                    </tr>
                {% endfor %}
                <tr id="example">
                    <td>
                       <select name="context[]">
                            <option value="">&mdash; Context &mdash;</option>
                            {% for sr in siteinfo.contexts %}
                                <option value="{{sr.getID}}">{{sr.name}}</option>
                            {% endfor %}
                        </select>
                    </td>
                     <td>
                        <select name="role[]">
                            <option value="">&mdash; Role &mdash;</option>
                            {% for sr in siteinfo.roles %}
                                <option value="{{sr.getID}}">{{sr.name}}</option>
                            {% endfor %}
                        </select>
                    </td>
                    <td><input type="text" name="start[]" value="" placeholder="Start Date or Now" class="form-control"/></td>
                    <td><input type="text" name="end[]" value="" placeholder="End Date or Never" class="form-control"/></td>
                    <td><input type="text" name="otherinfo[]" value="" placeholder="Other Info" class="form-control"/></td>
                </tr>
                <tr id="mrow">
                    <td colspan="4">&nbsp;</td>
                    <td><button id="more" class="btn btn-xs btn-info pull-right">Add More</button></td>
                </tr>
            </tbody>
        </table>
    </fieldset>