Advertisement
Guest User

event-list.php

a guest
Aug 16th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.08 KB | None | 0 0
  1. <?php
  2. /*
  3.  * Default Events List Template
  4.  * This page displays a list of events, called during the em_content() if this is an events list page.
  5.  * You can override the default display settings pages by copying this file to yourthemefolder/plugins/events-manager/templates/ and modifying it however you need.
  6.  * You can display events however you wish, there are a few variables made available to you:
  7.  *
  8.  * $args - the args passed onto EM_Events::output()
  9.  *
  10.  */
  11. if( get_option('dbem_events_page_search') && !defined('DOING_AJAX') )
  12. {
  13.     em_locate_template('templates/events-search.php',true);
  14. }
  15.  
  16. //TODO fine tune ajax searches - we have some pagination issues otherwise, due to search querystrings
  17. if( get_option('dbem_events_page_ajax', (defined('EM_AJAX_SEARCH'))) )
  18.    echo "<div class='em-events-search-ajax'>";
  19.    
  20. $events_count = EM_Events::count( apply_filters('em_content_events_args', $args) );
  21. $args['limit'] = get_option('dbem_events_default_limit');
  22. $args['page'] = (!empty($_REQUEST['pno']) && is_numeric($_REQUEST['pno']) )? $_REQUEST['pno'] : 1;
  23.  
  24. $format = '<li class="articleintro">
  25.                     <a href="#_EVENTURL" title="#_EVENTNAME">
  26.                         <div>            
  27.                            <div class="articlethumbcontainer">#_EVENTIMAGE{175,175}</div> <!-- articlethumbcontainer -->
  28.                            
  29.                            <div class="articledetails">
  30.                                <div class="articledateandsection">
  31.                                    <span class="entry-date">#_EVENTDATES</span>
  32.                                    <span class="section">#_LOCATIONNAME</span>                                
  33.                                </div> <!-- articledateandsection -->
  34.                                <div class="articledescription">
  35.                                  <div class="articledescription_wrap">
  36.                                    <h1>#_EVENTNAME</h1>
  37.                                    <div class="entry-content">#_EVENTEXCERPT</div>
  38.                                  </div>
  39.                                </div>
  40.                            </div>  <!-- article details -->
  41.                        
  42.                         </div> <!-- post div -->
  43.                    </a>
  44.                 </li> <!-- article intro --> ';              
  45.                  
  46.  
  47. $args['format'] = $format;
  48.  
  49. if( $events_count > 0 )
  50. {
  51.     //If there's a search, let's change the pagination a little here
  52.     if(!empty($_REQUEST['action']) && $_REQUEST['action'] == 'search_events')
  53.     {
  54.         $args['pagination'] = false;
  55.         if(get_option('dbem_event_list_groupby') )
  56.         {
  57.             $args['mode'] = get_option('dbem_event_list_groupby');
  58.             $args['date_format'] = get_option('dbem_event_list_groupby_format');
  59.             echo em_events_list_grouped($args);
  60.         }
  61.         else
  62.         {
  63.             echo EM_Events::output( $args );
  64.         }
  65.         //do some custom pagination (if needed/requested)
  66.         if( !empty($args['limit']) && $events_count > $args['limit'] )
  67.         {
  68.             //Show the pagination links (unless there's less than $limit events), note that we set em_search instead of search to prevent conflicts
  69.             $search_args = array_merge(EM_Events::get_post_search(), array('pno'=>'%PAGE%','action'=>'search_events','search'=>null, 'em_search'=>$args['search']));
  70.             $page_link_template = em_add_get_params($_SERVER['REQUEST_URI'], $search_args, false); //don't html encode, so em_paginate does its thing
  71.             echo apply_filters('em_events_output_pagination', em_paginate( $page_link_template, $events_count, $args['limit'], $args['pno']), $page_link_template, $events_count, $args['limit'], $args['pno']);
  72.         }
  73.     }
  74.     else
  75.     {
  76.         if(get_option('dbem_event_list_groupby') )
  77.         {
  78.             $args['mode'] = get_option('dbem_event_list_groupby');
  79.             $args['date_format'] = get_option('dbem_event_list_groupby_format');
  80.             echo em_events_list_grouped($args);
  81.         }
  82.         else
  83.         {
  84.             echo EM_Events::output( $args );
  85.         }
  86.     }
  87. }
  88. else
  89. {
  90.     echo get_option ( 'dbem_no_events_message' );
  91. }
  92. if( get_option('dbem_events_page_ajax', (defined('EM_AJAX_SEARCH'))) ) echo "</div>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement