contest-8.x-1.0-alpha2/templates/contest-admin.html.twig
templates/contest-admin.html.twig
{# /** * @file * Default theme implementation to display the contest entries. * * Variables available: * - contest (object) * - - start (int) * - - end (int) * - - places (int) * - - period (int) * - - publish_winners (bool) * - - entrants (int) * - - entries (int) * - - contestants (array of objects) uid => contestant object * - - - uid (int) * - - - name (string) * - - - mail (string) * - - - qty (int) * - - - created (int) * - - - winner (bool) * - - host (object) * - - - uid (int) * - - - name (string) * - - - mail (string) * - - - title (string) * - - - full_name (string) * - - - business (string) * - - - address (string) * - - - city (string) * - - - state (string) * - - - zip (string) * - - - phone (string) * - - - birthdate (int) * - - sponsor (object) * - - - uid (int) * - - - name (string) * - - - mail (string) * - - - url (string) * - - - full_name (string) * - - - business (string) * - - - address (string) * - - - city (string) * - - - state (string) * - - - zip (string) * - - - phone (string) * - - - birthdate (int) * - - winners (array) uid => place */ #} <div id="contest-admin"> <p><a href="/admin/content/contest">{{ 'Contest List'|t }} »</a></p> <!-- Some host details. ---> <fieldset class="contest-admin-host"> <legend>{{ 'Host'|t }}</legend> <a href="/user/{{ contest.host.uid }}">{{ contest.host.title }}</a><br /> <a href="mailto:{{ contest.host.mail }}">{{ contest.host.mail }}</a><br /> {{ 'Phone'|t }}: {{ contest.host.phone }}<br /> {{ 'Address'|t }}: {{ contest.host.address }}, {{ contest.host.city }} {{ contest.host.state }} {{ contest.host.zip }} </fieldset> <!-- Some sponsor details. ---> <fieldset class="contest-admin-sponsor"> <legend>{{ 'Sponsor'|t }}</legend> <a href="/user/{{ contest.sponsor.uid }}">{{ contest.sponsor.name }}<br /> <a href="mailto:{{ contest.sponsor.mail }}">{{ contest.sponsor.mail }}</a><br /> <a href="{{ contest.sponsor.url }}">{{ contest.sponsor.url }}</a> </fieldset> <!-- Some contest details. ---> <div class="contest-admin-detail"> {{ 'Start Date'|t }}: {{ contest.start|date("F j Y")|t }}<br /> {{ 'End Date'|t }}: {{ contest.end|date("F j Y")|t }}<br /> {{ 'Total Entries'|t }}: {{ contest.entries }}<br /> {{ 'Total Users'|t }}: {{ contest.entrants }}<br /> {{ 'Places Allowed'|t }}: {{ contest.places }} </div> <!-- The administration actions. ---> {% if contest.end < contest.now %} <ul class="contest-admin-actions"> {% if contest.winners|length < contest.places %} <li><a href="/contest/pick-winner/{{ contest.id }}">{{ 'Pick Random Winner'|t }}</a></li> {% else %} <li class="inactive">{{ 'Pick Random Winner'|t }}</li> {% endif %} {% if contest.winners|length == contest.places and contest.publish_winners %} <li><a href="/contest/unpublish-winners/{{ contest.id }}">{{ 'Unpublish Winners'|t }}</a></li> {% elseif contest.winners|length == contest.places and not contest.publish_winners %} <li><a href="/contest/publish-winners/{{ contest.id }}">{{ 'Publish Winners'|t }}</a></li> {% else %} <li class="inactive">{{ 'Publish Winners'|t }}</li> {% endif %} {% if contest.winners|length and not contest.publish_winners %} <li><a href="/contest/clear-winners/{{ contest.id }}">{{ 'Clear All Winners'|t }}</a></li> {% else %} <li class="inactive">{{ 'Clear All Winners'|t }}</li> {% endif %} <li><a href="/contest/export-entries/{{ contest.id }}">{{ 'Export Entries'|t }}</a></li> <li><a href="/contest/export-unique/{{ contest.id }}">{{ 'Export Unique Users'|t }}</a></li> </ul> {% else %} <ul class="contest-admin-actions"> <li class="inactive">{{ 'Pick Random Winner'|t }}</li> <li class="inactive">{{ 'Publish Winners'|t }}</li> <li class="inactive">{{ 'Clear All Winners'|t }}</li> <li class="inactive">{{ 'Export Entries'|t }}</li> <li class="inactive">{{ 'Export Unique Users'|t }}</li> </ul> {% endif %} <!-- The contest winners. ---> {% if contest.winners %} <table border="0" cellspacing="0" class="contest-admin-winners"> <caption>{{ 'Contest Winners'|t }}</caption> <thead> <tr> <th>{{ 'Place'|t }}</th> <th>{{ 'Name'|t }}</th> <th>{{ 'Email'|t }}</th> <th>{{ 'Operation'|t }}</th> </tr> </thead> <tbody> {% for uid, place in contest.winners if contest.contestants[uid] is defined %} {% set usr = contest.contestants[uid] %} <tr class="{{ (loop.index % 2)? 'odd': 'even' }}"> <td>{{ place }}.</td> <td><a href="/user/{{ usr.uid }}" target="_blank">{{ usr.name }}</a></td> <td><a href="mailto:{{ usr.mail }}">{{ usr.mail }}</a></td> <td><a href="/contest/clear-winners/{{ contest.id }}/{{ usr.uid }}">{{ 'Clear'|t }}</a></td> </tr> {% endfor %} </tbody> </table> {% endif %} <!-- The contest contestants. ---> <table border="0" cellspacing="0" class="contest-admin-contestants"> <caption>{{ 'Contest Entrants'|t }}</caption> <thead> <tr> <th>{{ 'Name'|t }}</th> <th>{{ 'Email'|t }}</th> <th>{{ 'Count'|t }}</th> <th>{{ 'Operation'|t }}</th> </tr> </thead> <tbody> {% for usr in contest.contestants %} {% if loop.index % 50 == 0 %} <tr> <th>{{ 'Name'|t }}</th> <th>{{ 'Email'|t }}</th> <th>{{ 'Count'|t }}</th> <th>{{ 'Operation'|t }}</th> </tr> {% endif %} <tr class="{{ (index % 2)? 'odd': 'even' }}{{ usr.winner? ' winner': '' }}"> <td><a href="/user/{{ usr.uid }}" target="_blank">{{ usr.name }}</a></td> <td><a href="mailto:{{ usr.mail }}">{{ usr.mail }}</a></td> <td>{{ usr.qty }}</td> {% if contest.end < contest.now and usr.winner %} <td><a href="/contest/clear-winners/{{ contest.id }}/{{ usr.uid }}">{{ 'Clear'|t }}</a></td> {% elseif contest.end < contest.now and not usr.winner %} <td><a href="/contest/pick-winner/{{ contest.id }}/{{ usr.uid }}">{{ 'Pick'|t }}</a></td> {% else %} <td>—</td> {% endif %} </tr> {% endfor %} </tbody> </table> </div>