Advertisement
redpupmedia

Event Espresso table_display php

Feb 11th, 2013
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.17 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Events Table Display
  4. Author: Seth Shoultes
  5. Contact: support@eventespresso.com
  6. Website: http://www.eventespresso.com
  7. Description: This is a template file for displaying a list of events displayed in a table.
  8. Shortcode: [EVENT_TABLE_DISPLAY]
  9. Requirements:
  10. Notes: This file should be stored in your "/wp-content/uploads/espresso/templates/" directory and you should have downloaded the custom_shortcodes.php file from shoultes.net.
  11. */
  12.  
  13. function display_event_espresso_table(){
  14.     global $wpdb;
  15.     $org_options = get_option('events_organization_settings');
  16.     $event_page_id =$org_options['event_page_id'];
  17.     $curdate = date("Y-m-d");
  18. ?>
  19. <form id="event_espresso_table" name="event_espresso_table" method="post" action="<?php echo get_option('siteurl')?>/?page_id=<?php echo $event_page_id?>&regevent_action=register">
  20.   <table width="100%" border="0">
  21.     <thead align="left" style="font-size: 20px; border-bottom:1px solid #000;">
  22.         <th><?php _e('SHOW','event_espresso'); ?></th>
  23.         <th><?php _e('DATE','event_espresso'); ?></th>
  24.        
  25.         <th><?php _e('SHOW TIMES','event_espresso'); ?></th>
  26.     </thead>
  27.     <tbody>
  28. <?php
  29.    
  30.     $sql = "SELECT e.* FROM ". EVENTS_DETAIL_TABLE . " e ";
  31.     $sql .= " WHERE is_active = 'Y' ";//Makes sure event is active
  32.     $sql .= " AND event_status != 'D' ";//Makes sure event is not deleted
  33.     //$sql .= " AND event_category_id = 'category_id' ";//Makes sure event is not deleted
  34.     //$sql .= " AND event_status = 'O' ";//Un-comment to only show ongoing events
  35.                    
  36.     //Removing this line keeps events from showing that may be expired
  37.     $sql .= " AND start_date >= '".date ( 'Y-m-d' )."' ";
  38.                    
  39.     //These lines are used to show events within a registration start and end period
  40.     $sql .= " AND e.registration_start <= '".date ( 'Y-m-d' )."' ";
  41.     $sql .= " AND e.registration_end >= '".date ( 'Y-m-d' )."' ";
  42.                    
  43.     //This line orders the events by date
  44.     $sql .= " ORDER BY date(start_date), id";
  45.    
  46.     $results = $wpdb->get_results($sql);
  47.     if ($wpdb->num_rows > 0) {
  48.         foreach ($results as $result){
  49.             $event_id= $result->id;
  50.             $event_name=stripslashes($result->event_name);
  51.             $event_identifier=stripslashes($result->event_identifier);
  52.             $address = $result->address;
  53.             $reg_limit = $result->reg_limit;
  54.             $start_date = $result->start_date;
  55.             $end_date = $result->end_date;
  56.             $is_active= $result->is_active;
  57.             $event_price = $result->event_price;
  58. ?>         
  59.     <tr>
  60.       <td align="left" valign="top" style="max-width:300px;">
  61.       <p class="event_title"><?php echo $event_name?> @<br /><?php echo do_shortcode('[ESPRESSO_VENUE event_id="'.$event_id.'" outside_wrapper="div" outside_wrapper_class="event_venue" inside_wrapper_class="false" show_image="false" show_description="true" show_additional_details="false" show_address="false" show_map_image="false"]');?></p>
  62.         </td>
  63.         <td align="left" valign="top">
  64.         <?php echo event_date_display($start_date, 'D, M d, Y')?>
  65.         </td>
  66.      
  67.           <td valign="top" align="left">
  68.             <?php
  69.             $event_times = $wpdb->get_results("SELECT * FROM " . EVENTS_START_END_TABLE . " WHERE event_id='".$event_id."'");
  70.                 foreach ($event_times as $time){
  71.                     $start_time = $time->start_time;
  72.                     $time_id = $time->id;
  73.     ?>
  74.             <div style="margin:0;"><label>
  75.               <input type="radio" name="event_id_time" value="<?php echo $event_id?>|<?php echo $start_time?>|<?php echo $time_id?>" id="event_id_<?php echo $event_id?>_<?php echo $time_id?>" /><?php echo event_date_display($start_time, 'g:i A')?>
  76.               </label>
  77.             </div>
  78. <?php   }?><input name="Submit" type="submit" value="Register" />
  79.         </td>
  80.     </tr>
  81.     <tr style="border-bottom:1px solid #000;">
  82.     <td align="left" valign="top" ></td>
  83.     <td align="left" valign="top"></td>
  84.     <td align="left" valign="top"></td>
  85.     <td align="left" valign="top"></td>
  86.     </tr>
  87. <?php  
  88.         }//End for each event details
  89.        
  90.     }else{
  91. ?>         
  92.     <tr><h3 class="expired_event"><?php _e('Sorry, there are no events here.','event_espresso'); ?></h3></tr>
  93. <?php  
  94. }   ?>
  95.  
  96.     </tbody>
  97.    </table>
  98.    
  99.   </form>
  100. <?php //$myrole = event_espresso_get_current_user_role();
  101. //echo $myrole;?>
  102. <?php
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement