Advertisement
davinian

Events Manager - calendar-full.php

Apr 1st, 2013
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.29 KB | None | 0 0
  1. <?php
  2. /*
  3.  * http://wordpress.org/extend/plugins/events-manager/
  4.  *
  5.  * Modified 30/03/13 by David Churchill
  6.  * This changes the Full Calendar into a Monthly List of Events, with Next/Previous Month Links. Also excludes days with no events.
  7.  * Replaced Tables with div/class and removed code the show empty dates
  8.  *
  9.  * Copy to YOURTHEMEFOLDER > plugins > events-manager > calendar-full.php
  10.  *
  11.  * There are two variables made available to you:
  12.  *
  13.  *  $calendar - contains an array of information regarding the calendar and is used to generate the content
  14.  *  $args - the arguments passed to EM_Calendar::output()
  15.  *
  16.  * Note that leaving the class names for the previous/next links will keep the AJAX navigation working.
  17.  */
  18.  
  19. $cal_count = count($calendar['cells']); //to prevent an extra tr
  20. $col_count = $tot_count = 1; //this counts collumns in the $calendar_array['cells'] array
  21. $col_max = count($calendar['row_headers']); //each time this collumn number is reached, we create a new collumn, the number of cells should divide evenly by the number of row_headers
  22. ?>
  23. <div class="cal-list-month"><a class="em-calnav full-link em-calnav-prev" href="<?php echo $calendar['links']['previous_url']; ?>">&lt;&lt;</a> | <?php echo ucfirst(date_i18n('F Y', $calendar['month_start'])); ?> | <a class="em-calnav full-link em-calnav-next" href="<?php echo $calendar['links']['next_url']; ?>">&gt;&gt;</a></div>
  24.  
  25.             <?php
  26.             foreach($calendar['cells'] as $date => $cell_data ){
  27.                 $class = ( !empty($cell_data['events']) && count($cell_data['events']) > 0 ) ? 'eventful':'eventless';
  28.                 if(!empty($cell_data['type'])){
  29.                     $class .= "-".$cell_data['type'];
  30.                 }
  31.                 ?>
  32.                     <?php if( !empty($cell_data['events']) && count($cell_data['events']) > 0 ): ?>
  33.                     <div class="cal-list-day">
  34.                     <h2 class="cal-list-date"><?php echo date('jS',$cell_data['date']); ?></h2>
  35.                         <?php
  36.                         $cell_events = array();
  37.                         if( get_option('dbem_display_calendar_events_limit') ){
  38.                             $count = 0;
  39.                             foreach($cell_data['events'] as $cell_event){
  40.                                 $cell_events[] = $cell_event;
  41.                                 $count++;
  42.                                 if($count > get_option('dbem_display_calendar_events_limit')) break;
  43.                             }
  44.                         }else{
  45.                             $cell_events = $cell_data['events'];
  46.                         }
  47.                         ?>
  48.                         <?php echo EM_Events::output($cell_events,array('format'=>get_option('dbem_full_calendar_event_format'))); ?>
  49.                         <?php if( count($cell_events) > get_option('dbem_display_calendar_events_limit',3) && get_option('dbem_display_calendar_events_limit_msg') != '' ): ?>
  50.                         <a href="<?php echo esc_url($cell_data['link']); ?>"><?php echo get_option('dbem_display_calendar_events_limit_msg'); ?></a>
  51.                         <?php endif; ?>
  52.                         </div>
  53.                     <?php else:?>
  54.                     <?php endif; ?>
  55.  
  56.                 <?php
  57.                 //create a new row once we reach the end of a table collumn
  58.                 $col_count= ($col_count == $col_max ) ? 1 : $col_count+1;
  59.                 echo ($col_count == 1 && $tot_count < $cal_count) ? '':'';
  60.                 $tot_count ++;
  61.             }
  62.             ?>
  63.            
  64. <div class="cal-list-month"><a class="em-calnav full-link em-calnav-prev" href="<?php echo $calendar['links']['previous_url']; ?>">&lt;&lt;</a> | <?php echo ucfirst(date_i18n('F Y', $calendar['month_start'])); ?> | <a class="em-calnav full-link em-calnav-next" href="<?php echo $calendar['links']['next_url']; ?>">&gt;&gt;</a></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement