search.html.twig 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. {#
  2. This file is part of the Sonata package.
  3. (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  4. For the full copyright and license information, please view the LICENSE
  5. file that was distributed with this source code.
  6. #}
  7. {% extends base_template %}
  8. {% block title %}{{ 'title_search_results'|trans({'%query%': query}, 'SonataAdminBundle') }}{% endblock%}
  9. {% block breadcrumb %}{% endblock %}
  10. {% block content %}
  11. <!--
  12. <div class="row-fluid">
  13. <form action="{{ url('sonata_admin_search') }}" method="GET" class="form-search">
  14. <div class="input-append">
  15. <input type="text" name="q" value="{{ query }}" class="input-large search-query"/>
  16. <button type="submit" class="btn">Search</button>
  17. </div>
  18. </form>
  19. </div>
  20. -->
  21. <h1>{{ 'title_search_results'|trans({'%query%': query}, 'SonataAdminBundle') }}</h1>
  22. {% if query is defined and query is not same as(false) %}
  23. {% set count = 0 %}
  24. <div class="row-fluid">
  25. {% for group in groups %}
  26. {% set display = (group.roles is empty or is_granted('ROLE_SUPER_ADMIN') ) %}
  27. {% for role in group.roles if not display %}
  28. {% set display = is_granted(role)%}
  29. {% endfor %}
  30. {% if display %}
  31. {% for admin in group.items %}
  32. {% if count % 3 == 0 %}
  33. </div><div class="row-fluid">
  34. {% endif %}
  35. {% set count = count + 1 %}
  36. {% if admin.hasroute('create') and admin.isGranted('CREATE') or admin.hasroute('list') and admin.isGranted('LIST') %}
  37. {{ sonata_block_render({
  38. 'type': 'sonata.admin.block.search_result'
  39. }, {
  40. 'query': query,
  41. 'admin_code': admin.code,
  42. 'page': 0,
  43. 'per_page': 10
  44. }) }}
  45. {% endif %}
  46. {% endfor %}
  47. {% endif %}
  48. {% endfor %}
  49. </div>
  50. {% endif %}
  51. {% endblock %}