Skip to content

Instantly share code, notes, and snippets.

@cawa87
Created December 15, 2014 09:18
Show Gist options
  • Save cawa87/485a4e46b4aecfdd4801 to your computer and use it in GitHub Desktop.
Save cawa87/485a4e46b4aecfdd4801 to your computer and use it in GitHub Desktop.
KnpPagination View with filters
{% extends "VswSystemAdminBundle::layout.html.twig" %}
{% block title %}
VswSystem - Donors
{% endblock %}
{% block content %}
{% from 'MopaBootstrapBundle::macros.html.twig' import label %}
<div class="page-header">
<h1>Donors
<small>
<hr>
Registred donors
</small>
</h1>
</div>
<!-- Table -->
<div class="count">
Total donors amount: {{ pagination.getTotalItemCount }}
</div>
<table class="table table-bordered table-hover">
<thead>
<tr>
<th colspan="3">{{ knp_pagination_filter(pagination, {'name': 'Name'}) }}</th>
<th colspan="3"><a href="{{ path('avro_csv_import_upload', {'alias': 'donor'}) }}">Go to import page</a></th>
</tr>
<tr>
<th>{{ knp_pagination_sortable(pagination, 'Id', 'id') }}</th>
<th{% if pagination.isSorted('Name') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'Name', 'name') }}</th>
<th{% if pagination.isSorted('Blood group') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'Blood group', 'bloodGroup') }}</th>
<th>Blood rh</th>
<th>City</th>
<th>Phone</th>
<th>Registred</th>
{% if is_granted('ROLE_SUPER_ADMIN') %}
<th>&nbsp</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for donor in pagination %}
<tr>
<td>{{ label(donor.id,'info') }}</td>
<td>{{ donor.name|e }}</td>
<td>{{ donor.bloodGroups[donor.bloodGroup|default(9)]|e }}</td>
<td>{{ donor.bloodRhs[donor.bloodRh|default(9)]|e }}</td>
<td>{{ donor.city|e }}</td>
<td>{{ donor.phone|e }}</td>
<td>{{ donor.createdAt|date('F j, Y, g:i a') }}</td>
{% if is_granted('ROLE_SUPER_ADMIN') %}
<td>
<a class="btn btn-danger confirm" id="contentBlockRemove"
href="{{ path('admin_donor_remove',{'id':donor.id}) }}"
data-toggle="tooltip" data-placement="top" title="Remove gallery donor block #{{ donor.id|e }}">
<span class="glyphicon glyphicon-trash"></span>
</a>
</a>
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
<tfoot>
<div class="row row row-centered">
{{ knp_pagination_render(pagination) }}
</div>
</tfoot>
</table>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment