BakerMan

TEC Upcoming Events List - Concatenated Recurring Events

Aug 17th, 2012
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.48 KB | None | 0 0
  1. <?php
  2. /**
  3. * The TEC template for a list of events.
  4. *
  5. * This has been customized to show a method of "concatenating" recurring
  6. * events, so that the first event is listed as normal, then any recurring
  7. * instances are detailed within that listing ... rather than as
  8. * standalone events in their own right.
  9. *
  10. * It does also require that the EventListOrganiser class has been
  11. * defined already (code for that listed separately).
  12. */
  13.  
  14. // Don't load directly
  15. if ( !defined('ABSPATH') ) { die('-1'); }
  16.  
  17. ?>
  18. <div id="tribe-events-content" class="upcoming">
  19.  
  20.     <?php if(!tribe_is_day()): // day view doesn't have a grid ?>
  21.         <div id='tribe-events-calendar-header' class="clearfix">
  22.         <span class='tribe-events-calendar-buttons'>
  23.             <a class='tribe-events-button-on' href='<?php echo tribe_get_listview_link(); ?>'><?php _e('Event List', 'tribe-events-calendar')?></a>
  24.             <a class='tribe-events-button-off' href='<?php echo tribe_get_gridview_link(); ?>'><?php _e('Calendar', 'tribe-events-calendar')?></a>
  25.         </span>
  26.  
  27.         </div><!--tribe-events-calendar-header-->
  28.     <?php endif; ?>
  29.     <div id="tribe-events-loop" class="tribe-events-events post-list clearfix">
  30.    
  31.     <?php if (have_posts()) : ?>
  32.     <?php $hasPosts = true; $first = true; ?>
  33.     <?php while ( have_posts() ) : the_post(); ?>
  34.         <?php if (!EventListOrganiser::hasDisplayedAlready()): ?>
  35.         <?php global $more; $more = false; ?>
  36.         <div id="post-<?php the_ID() ?>" <?php post_class('tribe-events-event clearfix') ?> itemscope itemtype="http://schema.org/Event">
  37.             <?php if ( tribe_is_new_event_day() && !tribe_is_day() ) : ?>
  38.                 <h4 class="event-day"><?php echo tribe_get_start_date( null, false ); ?></h4>
  39.             <?php endif; ?>
  40.             <?php if ( tribe_is_day() && $first ) : $first = false; ?>
  41.                 <h4 class="event-day"><?php echo tribe_event_format_date(strtotime(get_query_var('eventDate')), false); ?></h4>
  42.             <?php endif; ?>
  43.             <?php the_title('<h2 class="entry-title" itemprop="name"><a href="' . tribe_get_event_link() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></h2>'); ?>
  44.             <div class="entry-content tribe-events-event-entry" itemprop="description">
  45.                 <?php if (has_excerpt ()): ?>
  46.                     <?php the_excerpt(); ?>
  47.                 <?php else: ?>
  48.                     <?php the_content(); ?>
  49.                 <?php endif; ?>
  50.             </div> <!-- End tribe-events-event-entry -->
  51.  
  52.             <div class="tribe-events-event-list-meta" itemprop="location" itemscope itemtype="http://schema.org/Place">
  53.                 <table cellspacing="0">
  54.                     <?php if (tribe_is_multiday() || !tribe_get_all_day()): ?>
  55.                     <tr>
  56.                         <td class="tribe-events-event-meta-desc"><?php _e('Start:', 'tribe-events-calendar') ?></td>
  57.                         <td class="tribe-events-event-meta-value" itemprop="startDate" content="<?php echo tribe_get_start_date(); ?>"><?php echo tribe_get_start_date(); ?></td>
  58.                     </tr>
  59.                     <tr>
  60.                         <td class="tribe-events-event-meta-desc"><?php _e('End:', 'tribe-events-calendar') ?></td>
  61.                         <td class="tribe-events-event-meta-value" itemprop="endDate" content="<?php echo tribe_get_end_date(); ?>"><?php echo tribe_get_end_date(); ?></td>
  62.                     </tr>
  63.                     <?php else: ?>
  64.                     <tr>
  65.                         <td class="tribe-events-event-meta-desc"><?php _e('Date:', 'tribe-events-calendar') ?></td>
  66.                         <td class="tribe-events-event-meta-value" itemprop="startDate" content="<?php echo tribe_get_start_date(); ?>"><?php echo tribe_get_start_date(); ?></td>
  67.                     </tr>
  68.                     <?php endif; ?>
  69.  
  70.                     <?php
  71.                         $venue = tribe_get_venue();
  72.                         if ( !empty( $venue ) ) :
  73.                     ?>
  74.                     <tr>
  75.                         <td class="tribe-events-event-meta-desc"><?php _e('Venue:', 'tribe-events-calendar') ?></td>
  76.                         <td class="tribe-events-event-meta-value" itemprop="name">
  77.                             <? if( class_exists( 'TribeEventsPro' ) ): ?>
  78.                                 <?php tribe_get_venue_link( get_the_ID(), class_exists( 'TribeEventsPro' ) ); ?>
  79.                             <? else: ?>
  80.                                 <?php echo tribe_get_venue( get_the_ID() ) ?>
  81.                             <? endif; ?>
  82.                         </td>
  83.                     </tr>
  84.                     <?php endif; ?>
  85.                     <?php
  86.                         $phone = tribe_get_phone();
  87.                         if ( !empty( $phone ) ) :
  88.                     ?>
  89.                     <tr>
  90.                         <td class="tribe-events-event-meta-desc"><?php _e('Phone:', 'tribe-events-calendar') ?></td>
  91.                         <td class="tribe-events-event-meta-value" itemprop="telephone"><?php echo $phone; ?></td>
  92.                     </tr>
  93.                     <?php endif; ?>
  94.                     <?php if (tribe_address_exists( get_the_ID() ) ) : ?>
  95.                     <tr>
  96.                         <td class="tribe-events-event-meta-desc"><?php _e('Address:', 'tribe-events-calendar'); ?><br />
  97.                         <?php if( get_post_meta( get_the_ID(), '_EventShowMapLink', true ) == 'true' ) : ?>
  98.                             <a class="gmap" itemprop="maps" href="<?php echo tribe_get_map_link(); ?>" title="Click to view a Google Map" target="_blank"><?php _e('Google Map', 'tribe-events-calendar' ); ?></a>
  99.                         <?php endif; ?></td>
  100.                         <td class="tribe-events-event-meta-value"><?php echo tribe_get_full_address( get_the_ID() ); ?></td>
  101.                     </tr>
  102.                     <?php endif; ?>
  103.                     <?php
  104.                         $cost = tribe_get_cost();
  105.                         if ( !empty( $cost ) ) :
  106.                     ?>
  107.                     <tr>
  108.                         <td class="tribe-events-event-meta-desc"><?php _e('Cost:', 'tribe-events-calendar') ?></td>
  109.                         <td class="tribe-events-event-meta-value" itemprop="price"><?php echo $cost; ?></td>
  110.                      </tr>
  111.                     <?php endif; ?>
  112.                     <?php if (tribe_is_recurring_event()): ?>
  113.                     <tr>
  114.                         <td>This event will also take place:</td>
  115.                         <td><ul>
  116.                             <?php EventListOrganiser::listFutureRecurringEventDates(); ?>
  117.                         </ul></td>
  118.                     </tr>
  119.                     <?php endif; ?>
  120.                 </table>
  121.             </div>
  122.         </div> <!-- End post -->
  123.         <?php endif; ?>
  124.     <?php endwhile;// posts ?>
  125.     <?php else :?>
  126.         <?php
  127.             $tribe_ecp = TribeEvents::instance();
  128.             if ( is_tax( $tribe_ecp->get_event_taxonomy() ) ) {
  129.                 $cat = get_term_by( 'slug', get_query_var('term'), $tribe_ecp->get_event_taxonomy() );
  130.                 if( tribe_is_upcoming() ) {
  131.                     $is_cat_message = sprintf(__(' listed under %s. Check out past events for this category or view the full calendar.','tribe-events-calendar'),$cat->name);
  132.                 } else if( tribe_is_past() ) {
  133.                     $is_cat_message = sprintf(__(' listed under %s. Check out upcoming events for this category or view the full calendar.','tribe-events-calendar'),$cat->name);
  134.                 }
  135.             }
  136.         ?>
  137.         <?php if(tribe_is_day()): ?>
  138.             <?php printf( __('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), date_i18n('F d, Y', strtotime(get_query_var('eventDate')))); ?>
  139.         <?php endif; ?>
  140.  
  141.         <?php if(tribe_is_upcoming()){ ?>
  142.             <?php _e('No upcoming events', 'tribe-events-calendar');
  143.             echo !empty($is_cat_message) ? $is_cat_message : ".";?>
  144.  
  145.         <?php }elseif(tribe_is_past()){ ?>
  146.             <?php _e('No previous events' , 'tribe-events-calendar');
  147.             echo !empty($is_cat_message) ? $is_cat_message : ".";?>
  148.         <?php } ?>
  149.        
  150.     <?php endif; ?>
  151.  
  152.  
  153.     </div><!-- #tribe-events-loop -->
  154.     <div id="tribe-events-nav-below" class="tribe-events-nav clearfix">
  155.  
  156.         <div class="tribe-events-nav-previous"><?php
  157.         // Display Previous Page Navigation
  158.         if( tribe_is_upcoming() && get_previous_posts_link() ) : ?>
  159.             <?php previous_posts_link( '<span>'.__('&laquo; Previous Events', 'tribe-events-calendar').'</span>' ); ?>
  160.         <?php elseif( tribe_is_upcoming() && !get_previous_posts_link( ) ) : ?>
  161.             <a href='<?php echo tribe_get_past_link(); ?>'><span><?php _e('&laquo; Previous Events', 'tribe-events-calendar' ); ?></span></a>
  162.         <?php elseif( tribe_is_past() && get_next_posts_link( ) ) : ?>
  163.             <?php next_posts_link( '<span>'.__('&laquo; Previous Events', 'tribe-events-calendar').'</span>' ); ?>
  164.         <?php endif; ?>
  165.         </div>
  166.  
  167.         <div class="tribe-events-nav-next"><?php
  168.         // Display Next Page Navigation
  169.         if( tribe_is_upcoming() && get_next_posts_link( ) ) : ?>
  170.             <?php next_posts_link( '<span>'.__('Next Events &raquo;', 'tribe-events-calendar').'</span>' ); ?>
  171.         <?php elseif( tribe_is_past() && get_previous_posts_link( ) ) : ?>
  172.             <?php previous_posts_link( '<span>'.__('Next Events &raquo;', 'tribe-events-calendar').'</span>' ); // a little confusing but in 'past view' to see newer events you want the previous page ?>
  173.         <?php elseif( tribe_is_past() && !get_previous_posts_link( ) ) : ?>
  174.             <a href='<?php echo tribe_get_upcoming_link(); ?>'><span><?php _e('Next Events &raquo;', 'tribe-events-calendar'); ?></span></a>
  175.         <?php endif; ?>
  176.         </div>
  177.  
  178.     </div>
  179.     <?php if ( !empty($hasPosts) && function_exists('tribe_get_ical_link') ): ?>
  180.         <a title="<?php esc_attr_e('iCal Import', 'tribe-events-calendar') ?>" class="ical" href="<?php echo tribe_get_ical_link(); ?>"><?php _e('iCal Import', 'tribe-events-calendar') ?></a>
  181.     <?php endif; ?>
  182. </div>
Advertisement
Add Comment
Please, Sign In to add comment