Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * template to show rider list with names
- * avatars = attendees.php
- *
- * 0 => Pending
- * 1 => Approved
- * 2 => Rejected
- * 3 => Cancelled
- * 4 => Awaiting Online Payment
- * 5 => Awaiting Payment
- */
- $EM_Bookings = $EM_Event->get_bookings();
- $confirmed_places = $EM_Event->get_bookings()->get_booked_spaces(); // confirmed bookings
- // $confirmed_places = 1; // for testing only
- $pending_places = $EM_Event->get_bookings()->get_pending_spaces(); // pending spaces
- $one_cat_per_ticket = array(5380,5400);
- // print_r($EM_Event->event_end_date);
- // print_r(date('Y-m-d'));
- if ( $confirmed_places > 0 ) {
- $event_id = $EM_Bookings->event_id;
- $event_post_id = $EM_Event->post_id;
- // count available classes
- $allowed = get_post_meta($event_post_id, 'Allowed classes', true);
- // $allowed = 2; // test to 'fake' 2 or more classes
- ?>
- <div class="hide480 notice">Rotate your screen for a better view.</div>
- <h2>Rider list</h2>
- <table class="table--riderslist">
- <thead>
- <tr class="">
- <th class="attendee-count"> </th>
- <th class="attendee-name">Name</th>
- <th class="attendee-country xshow568"><span class="hide640">Nat.</span><span class="show640">Nat.</span></th>
- <th class="attendee-discipline1">Category <?php if ( $allowed > 1 ) { ?>1<?php } ?></th>
- <?php if ( $allowed == 2 ) { ?>
- <th class="attendee-discipline2">Category 2</th>
- <?php } ?>
- </tr>
- </thead>
- <?php
- $guest_bookings = get_option('dbem_bookings_registration_disable');
- $guest_booking_user = get_option('dbem_bookings_registration_user');
- $counter = 0;
- $people = array();
- $nationalities_array = array();
- $categories_array = array();
- $stylesheet_dir = get_stylesheet_directory_uri();
- // echo '<pre>'; print_r($EM_Bookings); echo '</pre>';
- foreach ( $EM_Bookings as $EM_Booking) {
- // if ($EM_Booking->booking_status == 1 && !in_array($EM_Booking->get_person()->ID, $people) ) { // if status = approved
- if ( in_array($EM_Booking->booking_status, array(1)) ) { // if status = approved
- $member = $EM_Booking->get_person()->ID;
- $attendees = $EM_Booking->booking_meta['attendees'];
- $attendees_list = "";
- $rider_name = $EM_Booking->get_person()->get_name();
- // if event is past
- if ( $EM_Event->event_end_date > date('Y-m-d') )
- {
- // change rider name to "Unpaid IDF member" if unpaid membership
- if ( get_user_field ('s2member_access_role', $member ) == 'subscriber')
- {
- $rider_name = '→ Unpaid IDF member';
- }
- }
- $nationality = get_user_field ('nationality', $member );
- $member_data = get_userdata($member);
- $counter++;
- $attendees_list .= '<tr>';
- $attendees_list .= '<td>'.$counter.'.</td>';
- $attendees_list .= '<td><a href="'.home_url().'/member/'.$member_data->user_nicename.'/">'.$rider_name.'</a></td>';
- $attendees_list .= '<td class="xshow568">'.$nationality.'</td>';
- $nationalities_array[] = $nationality;
- // if ( in_array($event_post_id, $one_cat_per_ticket) ) {
- if ( $allowed != 2 ) { // if allowed classes is less than 2
- foreach ( $attendees as $key => $value) {
- foreach ( $value as $key_attendee => $value_attendee) {
- $attendees_list .= '<td>'.$value_attendee['attendee_categories'].'</td>';
- $categories_array[] = $value_attendee['attendee_categories'];
- }
- // $attendees_list .= "<td> </td>";
- }
- } else {
- foreach ( $attendees as $key => $value) { // if multiple categories per ticket are set (checkbox)
- foreach ( $value as $key_attendee => $value_attendee) {
- foreach ( $value_attendee['attendee_categories'] as $category ) {
- $attendees_list .= '<td>'.$category.'</td>';
- $categories_array[] = $category;
- }
- if ( $allowed > 1 && count($value_attendee['attendee_categories']) == 1 ) {
- $attendees_list .= "<td> </td>"; // if one category is registrated, add an empty table cell to fill cell for category 2
- }
- }
- }
- }
- $counter = $counter;
- echo $attendees_list;
- // var_dump($category_array);
- }
- } // end foreach
- // Freeride list Insul 2016
- $freeride = false;
- if ( $EM_Event->post_id == 5436 ) {
- $freeride = array(
- 'Christoph Neubrech',
- 'Anouschka Hölscher',
- 'Tim Louis Schrumpf',
- 'Cyrine Allagi',
- 'Simon Schneeberger',
- 'Marc Hürstel',
- 'Malte Kahmann',
- 'Michael Exner',
- 'Noël Ohletz',
- // 'Julian Stroppel',
- 'Matthias Korte',
- 'Julian Paries',
- 'Jerome Ries',
- 'Liesa Seifert',
- 'Wietse Morreau',
- 'Dina Miss',
- 'Alexander Willhöft',
- 'Christian Flore',
- // 'Felix Mayerhofer',
- 'Janosch Müller',
- 'Robin Zeitler',
- 'Miguel De Melo',
- 'Tom Bauler',
- 'Marco Marques',
- // 'Julio Canchon',
- 'Cornelius Kaup',
- 'Marcus Plate',
- 'Maike Westerich',
- 'Reuben Helfenbaum',
- 'Michael Kürschner',
- 'Jorge Kalau von Hofe',
- // 'Daniel Theis-Heinrich',
- 'Felix Laux',
- 'Dominique Kohn',
- 'Happe Linus',
- // 'Marvin Lorff',
- 'Matthias Kirschner',
- 'Noah Mayer',
- 'Milan Pierau',
- 'Clemens Richter',
- // 'Gunnar Peitz',
- 'Markus Schuttler',
- // 'Olivier Detry',
- // 'Sebastian Raszke',
- 'Andreas Rau',
- 'Alessandro Pupillo',
- 'Georg Emmerich',
- 'Jette Schönefeld',
- 'Niklas Szczepaniak',
- // 'Robert Leer',
- 'Max Deutsch',
- 'Leandro Cordon',
- 'Uwe Dederer',
- // 'Janik Loerges',
- 'Richie Mac Dermott',
- 'Markus Strahlhofer',
- // 'Leon Kürschner',
- );
- if ( $freeride ) {
- $freeride_count = count($freeride);
- $freeride_list = '';
- foreach($freeride as $freerider) {
- $counter++;
- $freeride_list .= '<tr>';
- $freeride_list .= '<td>'.$counter.'.</td>';
- $freeride_list .= '<td>'.$freerider.'</td>';
- $freeride_list .= '<td>n/a</td>';
- $freeride_list .= '<td>Freeride</td>';
- $freeride_list .= '</tr>';
- }
- echo $freeride_list;
- }
- }
- echo "\n";
- ?>
- </table>
- <?php
- asort($nationalities_array);
- // echo '<pre>'; print_r($nationalities_array); echo '</pre>';
- $nationality_count = count(array_count_values($nationalities_array));
- if ($nationality_count > 1 ) {
- echo '<div class="riderslist-summary">';
- echo '<h3>Riders p/nationality</h3>';
- $all_nationalities = array_count_values($nationalities_array);
- arsort($all_nationalities);
- echo '<ul>';
- foreach ( $all_nationalities as $nationality => $count ) {
- echo '<li>';
- echo '<span class="land"><img src="'.$stylesheet_dir.'/assets/images/flags/'.strtolower($nationality).'.png" class="flag" alt="" /> '.$nationality.'</span> - ';
- echo '<span class="count">'.$count.'</span>';
- echo '</li>';
- }
- echo '</ul>';
- echo '</div>';
- }
- asort($categories_array);
- $category_count = count(array_count_values($categories_array));
- if ($category_count > 1 ) {
- echo '<div class="riderslist-summary">';
- echo '<h3>Riders p/category</h3>';
- $all_categories = array_count_values($categories_array);
- arsort($all_categories);
- echo '<ul>';
- foreach ( $all_categories as $category => $count ) {
- echo '<li>';
- echo $category.' - ';
- echo '<span class="count">'.$count.'</span>';
- echo '</li>';
- }
- if ( $freeride ) {
- echo '<li>Freeride - '. $freeride_count .'</li>';
- }
- echo '</ul>';
- echo '</div>';
- }
- if ($nationality_count > 1 ) {
- echo '<p>There are riders from '.$nationality_count.' different nationalities attending this ';
- if ( $EM_Event->post_id == 5436 ) { echo 'race'; } else { echo 'event'; }
- echo '.</p>';
- }
- } // if confirmed places > 0
- if ( count($EM_Bookings->bookings) == 0 ) {
- echo '<p>No one registered yet... Will you be the first ?</p>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement