Advertisement
Guest User

event-list.php -- 2

a guest
Mar 12th, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.84 KB | None | 0 0
  1. if( get_option('dbem_events_page_search') && !defined('DOING_AJAX') ){
  2.     em_locate_template('templates/events-search.php',true);
  3. }
  4.  
  5. //TODO fine tune ajax searches - we have some pagination issues otherwise, due to search querystrings
  6. if( get_option('dbem_events_page_ajax', (defined('EM_AJAX_SEARCH'))) ) echo "<div class='em-events-search-ajax'>";
  7. $events_count = EM_Events::count( apply_filters('em_content_events_args', $args) );
  8. $args['category'] = '6,7,8,10,11,12,13,14';
  9. $args['limit'] = get_option('dbem_events_default_limit');
  10. $args['page'] = (!empty($_REQUEST['page']) && is_numeric($_REQUEST['page']) )? $_REQUEST['page'] : 1;
  11. if( $events_count > 0 ){
  12.     //If there's a search, let's change the pagination a little here
  13.     if(!empty($_REQUEST['action']) && $_REQUEST['action'] == 'search_events'){
  14.         $args['pagination'] = false;
  15.         echo EM_Events::output( $args );
  16.         //do some custom pagination (if needed/requested)
  17.         if( !empty($args['limit']) && $events_count > $args['limit'] ){
  18.             //Show the pagination links (unless there's less than $limit events), note that we set em_search instead of search to prevent conflicts
  19.             $search_args = array_merge(EM_Events::get_post_search(), array('page'=>'%PAGE%','action'=>'search_events','search'=>null, 'em_search'=>$args['search']));
  20.             $page_link_template = em_add_get_params($_SERVER['REQUEST_URI'], $search_args, false); //don't html encode, so em_paginate does its thing
  21.             echo apply_filters('em_events_output_pagination', em_paginate( $page_link_template, $events_count, $args['limit'], $args['page']), $page_link_template, $events_count, $args['limit'], $args['page']);
  22.         }
  23.     }else{
  24.         echo EM_Events::output( $args, $args['category'] = '6,7,8,10,11,12,13,14');
  25.     }
  26. }else{
  27.     echo get_option ( 'dbem_no_events_message' );
  28. }
  29. if( get_option('dbem_events_page_ajax', (defined('EM_AJAX_SEARCH'))) ) echo "</div>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement