Advertisement
Guest User

event redirect

a guest
Nov 16th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.77 KB | None | 0 0
  1. <?php
  2. //This is the event list template page.
  3. //This is a template file for displaying an event lsit on a page.
  4. //There should be a copy of this file in your wp-content/uploads/espresso/ folder.
  5. /*
  6. * use the following shortcodes in a page or post:
  7. * [EVENT_LIST]
  8. * [EVENT_LIST limit=1]
  9. * [EVENT_LIST css_class=my-custom-class]
  10. * [EVENT_LIST show_expired=true]
  11. * [EVENT_LIST show_deleted=true]
  12. * [EVENT_LIST show_secondary=false]
  13. * [EVENT_LIST show_recurrence=true]
  14. * [EVENT_LIST category_identifier=your_category_identifier]
  15. *
  16. * Example:
  17. * [EVENT_LIST limit=5 show_recurrence=true category_identifier=your_category_identifier]
  18. *
  19. */
  20.  
  21. //Print out the array of event status options
  22. //print_r (event_espresso_get_is_active($event_id));
  23. //Here we can create messages based on the event status. These variables can be echoed anywhere on the page to display your status message.
  24. $status = event_espresso_get_is_active(0,$event_meta);
  25. $status_display = ' - ' . $status['display_custom'];
  26. $status_display_ongoing = $status['status'] == 'ONGOING' ? ' - ' . $status['display_custom'] : '';
  27. $status_display_deleted = $status['status'] == 'DELETED' ? ' - ' . $status['display_custom'] : '';
  28. $status_display_secondary = $status['status'] == 'SECONDARY' ? ' - ' . $status['display_custom'] : ''; //Waitlist event
  29. $status_display_draft = $status['status'] == 'DRAFT' ? ' - ' . $status['display_custom'] : '';
  30. $status_display_pending = $status['status'] == 'PENDING' ? ' - ' . $status['display_custom'] : '';
  31. $status_display_denied = $status['status'] == 'DENIED' ? ' - ' . $status['display_custom'] : '';
  32. $status_display_expired = $status['status'] == 'EXPIRED' ? ' - ' . $status['display_custom'] : '';
  33. $status_display_reg_closed = $status['status'] == 'REGISTRATION_CLOSED' ? ' - ' . $status['display_custom'] : '';
  34. $status_display_not_open = $status['status'] == 'REGISTRATION_NOT_OPEN' ? ' - ' . $status['display_custom'] : '';
  35. $status_display_open = $status['status'] == 'REGISTRATION_OPEN' ? ' - ' . $status['display_custom'] : '';
  36.  
  37. //You can also display a custom message. For example, this is a custom registration not open message:
  38. $status_display_custom_closed = $status['status'] == 'REGISTRATION_CLOSED' ? ' - <span class="espresso_closed">' . __('Regsitration is closed', 'event_espresso') . '</span>' : '';
  39. global $this_event_id;
  40. $this_event_id = $event_id;
  41. ?>
  42. <div id="event_data-<?php echo $event_id ?>" class="event_data <?php echo $css_class; ?> <?php echo $category_identifier; ?> event-data-display event-list-display event-display-boxes ui-widget">
  43. <h3 id="event_title-<?php echo $event_id ?>" class="event_title ui-widget-header ui-corner-top"><a title="<?php echo stripslashes_deep($event_name) ?>" class="a_event_title" id="a_event_title-<?php echo $event_id ?>" href="<?php echo $registration_url; ?>"><?php echo stripslashes_deep($event_name) ?></a>
  44. <?php /* These are custom messages that can be displayed based on the event status. Just un-comment the one you want to use. */ ?>
  45. <?php //echo $status_display; //Turn this on to display the overall status of the event. ?>
  46. <?php //echo $status_display_ongoing; //Turn this on to display the ongoing message. ?>
  47. <?php //echo $status_display_deleted; //Turn this on to display the deleted message. ?>
  48. <?php //echo $status_display_secondary; //Turn this on to display the waitlist message. ?>
  49. <?php //echo $status_display_reg_closed; //Turn this on to display the registration closed message. ?>
  50. <?php //echo $status_display_not_open; //Turn this on to display the secondary message. ?>
  51. <?php //echo $status_display_open; //Turn this on to display the not open message. ?>
  52. <?php //echo $status_display_custom_closed; //Turn this on to display the closed message. ?>
  53. </h3>
  54. <div class="event-data-display ui-widget-content ui-corner-bottom">
  55. <?php
  56. echo apply_filters('filter_hook_espresso_display_add_to_calendar_by_event_id', $event_id);
  57. /* Venue details. Un-comment to display. */ ?>
  58. <?php //echo $venue_title != ''?'<p id="event_venue_name-'.$event_id.'" class="event_venue_name">'.stripslashes_deep($venue_title).'</p>':'' ?>
  59. <?php //echo $venue_address != ''?'<p id="event_venue_address-'.$event_id.'" class="event_venue_address">'.stripslashes_deep($venue_address).'</p>':''?>
  60. <?php //echo $venue_address2 != ''?'<p id="event_venue_address2-'.$event_id.'" class="event_venue_address2">'.stripslashes_deep($venue_address2).'</p>':''?>
  61. <?php //echo $venue_city != ''?'<p id="event_venue_city-'.$event_id.'" class="event_venue_city">'.stripslashes_deep($venue_city).'</p>':''?>
  62. <?php //echo $venue_state != ''?'<p id="event_venue_state-'.$event_id.'" class="event_venue_state">'.stripslashes_deep($venue_state).'</p>':''?>
  63. <?php //echo $venue_zip != ''?'<p id="event_venue_zip-'.$event_id.'" class="event_venue_zip">'.stripslashes_deep($venue_zip).'</p>':''?>
  64. <?php //echo $venue_country != ''?'<p id="event_venue_country-'.$event_id.'" class="event_venue_country">'.stripslashes_deep($venue_country).'</p>':''
  65. $event->event_cost = empty($event->event_cost) ? '' : $event->event_cost;
  66. ?>
  67.  
  68. <div class="event-meta">
  69. <?php if ( $event->event_cost != '0.00' ) { ?>
  70. <p id="p_event_price-<?php echo $event_id ?>" class="event_price"><span class="section-title"><?php echo __('Price: ', 'event_espresso'); ?></span> <?php echo $org_options['currency_symbol'].$event->event_cost; ?></p>
  71. <?php } else { ?>
  72. <p id="p_event_price-<?php echo $event_id ?>" class="event_price"><?php echo __('Free Event', 'event_espresso'); ?></p>
  73. <?php } ?>
  74.  
  75. <p id="event_date-<?php echo $event_id ?>"><span class="section-title"><?php _e('Date:', 'event_espresso'); ?></span> <?php echo event_date_display($start_date, get_option('date_format')) ?></p>
  76. </div>
  77. <?php
  78. //Show short descriptions
  79. if (!empty($event_desc) && isset($org_options['display_short_description_in_event_list']) && $org_options['display_short_description_in_event_list'] == 'Y') {
  80. ?>
  81. <div class="event-desc">
  82. <p><?php echo espresso_format_content($event_desc); ?></p>
  83. </div>
  84. <?php
  85. }
  86. ?>
  87.  
  88. <?php if ( (isset($location) && $location != '' ) && (isset($org_options['display_address_in_event_list']) && $org_options['display_address_in_event_list'] == 'Y') ) { ?>
  89. <p class="event_address" id="event_address-<?php echo $event_id ?>"><span class="section-title"><?php echo __('Address:', 'event_espresso'); ?></span> <br />
  90. <span class="address-block"><?php echo stripslashes_deep($location); ?>
  91. <span class="google-map-link"><?php echo $google_map_link; ?></span></span>
  92. </p>
  93. <?php
  94. }
  95.  
  96. //Social media buttons
  97. do_action('espresso_social_display_buttons', $event_id);
  98.  
  99. $num_attendees = get_number_of_attendees_reg_limit($event_id, 'num_attendees'); //Get the number of attendees. Please visit http://eventespresso.com/forums/?p=247 for available parameters for the get_number_of_attendees_reg_limit() function.
  100. if ($num_attendees >= $reg_limit) {
  101. ?>
  102. <p id="available_spaces-<?php echo $event_id ?>"><span class="section-title"><?php _e('Available Spaces:', 'event_espresso') ?> </span><?php echo get_number_of_attendees_reg_limit($event_id, 'available_spaces', 'All Seats Reserved') ?></p>
  103. <?php if ($overflow_event_id != '0' && $allow_overflow == 'Y') { ?>
  104. <p id="register_link-<?php echo $overflow_event_id ?>" class="register-link-footer"><a class="a_register_link ui-button ui-button-big ui-priority-primary ui-state-default ui-state-hover ui-state-focus ui-corner-all" id="a_register_link-<?php echo $overflow_event_id ?>" href="<?php echo espresso_reg_url($overflow_event_id); ?>" title="<?php echo stripslashes_deep($event_name) ?>"><?php _e('Join Waiting List', 'event_espresso'); ?></a></p>
  105. <?php
  106. }
  107. } else {
  108. if ($display_reg_form == 'Y' && $externalURL == '') {
  109. ?> <p id="available_spaces-<?php echo $event_id ?>" class="spaces-available"><span class="section-title"><?php _e('Available Spaces:', 'event_espresso') ?></span> <?php echo get_number_of_attendees_reg_limit($event_id, 'available_spaces') ?></p>
  110. <?php
  111. }
  112.  
  113. /**
  114. * Load the multi event link.
  115. * */
  116. //Un-comment these next lines to check if the event is active
  117. //echo event_espresso_get_status($event_id);
  118. //print_r( event_espresso_get_is_active($event_id));
  119.  
  120. if ($multi_reg && event_espresso_get_status($event_id) == 'ACTIVE'/* && $display_reg_form == 'Y'*/) {
  121. // Uncomment && $display_reg_form == 'Y' in the line above to hide the add to cart link/button form the event list when the registration form is turned off.
  122.  
  123. $params = array(
  124. //REQUIRED, the id of the event that needs to be added to the cart
  125. 'event_id' => $event_id,
  126. //REQUIRED, Anchor of the link, can use text or image
  127. 'anchor' => __("Add to Cart", 'event_espresso'), //'anchor' => '<img src="' . EVENT_ESPRESSO_PLUGINFULLURL . 'images/cart_add.png" />',
  128. //REQUIRED, if not available at this point, use the next line before this array declaration
  129. // $event_name = get_event_field('event_name', EVENTS_DETAIL_TABLE, ' WHERE id = ' . $event_id);
  130. 'event_name' => $event_name,
  131. //OPTIONAL, will place this term before the link
  132. 'separator' => __(" or ", 'event_espresso'),
  133.  
  134. 'direct_to_cart' => '1'
  135. );
  136.  
  137. $cart_link = event_espresso_cart_link($params);
  138.  
  139.  
  140.  
  141. }else{
  142. $cart_link = false;
  143. }
  144. if ($display_reg_form == 'Y') {
  145. //Check to see if the Members plugin is installed.
  146. $member_options = get_option('events_member_settings');
  147. if ( function_exists('espresso_members_installed') && espresso_members_installed() == true && !is_user_logged_in() && ($member_only == 'Y' || $member_options['member_only_all'] == 'Y') ) {
  148. echo '<p class="ee_member_only">'.__('Member Only Event', 'event_espresso').'</p>';
  149. }else{
  150. ?>
  151. <p id="register_link-<?php echo $event_id ?>" class="register-link-footer">
  152. <a class="a_register_link ui-button ui-button-big ui-priority-primary ui-state-default ui-state-hover ui-state-focus ui-corner-all" id="a_register_link-<?php echo $event_id ?>" href="<?php echo $registration_url; ?>" title="<?php echo stripslashes_deep($event_name) ?>"><?php _e('Register', 'event_espresso'); ?></a>
  153. <?php echo isset($cart_link) && $externalURL == '' ? $cart_link : ''; ?>
  154. </p>
  155. <?php
  156. }
  157. } else {
  158. ?>
  159. <p id="register_link-<?php echo $event_id ?>" class="register-link-footer">
  160. <a class="a_register_link ui-button ui-button-big ui-priority-primary ui-state-default ui-state-hover ui-state-focus ui-corner-all" id="a_register_link-<?php echo $event_id ?>" href="<?php echo $registration_url; ?>" title="<?php echo stripslashes_deep($event_name) ?>"><?php _e('View Details', 'event_espresso'); ?></a> <?php echo isset($cart_link) && $externalURL == '' ? $cart_link : ''; ?>
  161. </p>
  162. <?php
  163. }
  164. }
  165. ?>
  166. </div><!-- / .event-data-display -->
  167. </div><!-- / .event-display-boxes -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement