Fix for the agenda view dates shown.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 27 Oct 2016 18:31:29 +0000 (14:31 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 27 Oct 2016 18:31:29 +0000 (14:31 -0400)
Looping through each recurrence and finding the correct one to output
the date.

index.php
models/front/events/list.php
views/front/events/agenda.html

index 6c067fe..413dff4 100644 (file)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Members Database Events
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: Gaslight Media Members Database.
- * Version: 1.5.1
+ * Version: 1.5.2
  * Author: Chuck Scott
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -20,7 +20,7 @@
  * @package glmMembersDatabaseEventsAddOn
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.5.1
+ * @version 1.5.2
  */
 
 /*
@@ -38,7 +38,7 @@
  *  so that we're sure the other add-ons see an up to date
  *  version from this plugin.
  */
-define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.5.1');
+define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.5.2');
 define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.22');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
index 96fb993..00d3c39 100644 (file)
@@ -644,7 +644,6 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction
         } else {
             $calendar_view = $calendar_view[0]['calendar_view'];
         }
-        
         // Compile template data
         $templateData = array(
             'assetsUrl'    => GLM_MEMBERS_EVENTS_PLUGIN_URL . 'assets/',
index 24835d9..444f671 100644 (file)
                             <div class="row glm-event-day-event">
                                 <div class="small-12 columns">
                                         <h2 class="agenda-event-name">{$event.name}</h2>
-                                        <div class='date-range-container'>
-                                            ( Occurring {$event.recurrences.0.from_date.date} <span class="agenda-event-recur-dates"> 
-                                              {if $event.recurrences.0.from_date.date != $event.recurrences.0.to_date.date}  
-                                                - {$event.recurrences.0.to_date.date} 
-                                               {else if $event.recurrences.0.specific_dates}
-                                                - {$event.recurrences.0.specific_dates|@end|date_format:"%m/%d/%Y"} 
-                                              {/if}
-                                            </span> 
-       
-                                        {if $event.recurrences.0.day_of_week.names|@count < 7 && $event.recurrences.0.day_of_week.names|@count > 0 }
-                                        <span class="agenda-days-of-week">
-                                            on
-                                            {foreach $event.recurrences.0.day_of_week.names as $day}
-                                            {if $day == "Thursday"}
-                                                <span class="agenda-event-weekday"> {$day|substr:0:4} </span>
-                                             {else}
-                                                <span class="agenda-event-weekday"> {$day|substr:0:3} </span>
-                                             {/if}
-                                             {/foreach}
-                                            
-                                        </span>
-                                        {/if}
-                                         )
-                                        </div>
+                                        {foreach $event.recurrences as $rec}
+                                            {if ($rec.from_date.timestamp == $rec.to_date.timestamp && $rec.from_date.timestamp == $date)
+                                            or ($date <= $rec.to_date.timestamp && $date >= $rec.from_date.timestamp )}
+                                                <div class='date-range-container'>
+                                                    ( Occurring {$rec.from_date.date} <span class="agenda-event-recur-dates">
+                                                      {if $rec.from_date.date != $rec.to_date.date}
+                                                        - {$rec.to_date.date}
+                                                       {else if $rec.specific_dates}
+                                                        - {$rec.specific_dates|@end|date_format:"%m/%d/%Y"}
+                                                      {/if}
+                                                    </span>
+
+                                                {if $rec.day_of_week.names|@count < 7 && $rec.day_of_week.names|@count > 0 }
+                                                <span class="agenda-days-of-week">
+                                                    on
+                                                    {foreach $rec.day_of_week.names as $day}
+                                                    {if $day == "Thursday"}
+                                                        <span class="agenda-event-weekday"> {$day|substr:0:4} </span>
+                                                     {else}
+                                                        <span class="agenda-event-weekday"> {$day|substr:0:3} </span>
+                                                     {/if}
+                                                     {/foreach}
+
+                                                </span>
+                                                {/if}
+                                                 )
+                                                </div>
+                                            {/if}
+                                        {/foreach}
                                     <div class="day-times-wrapper">
                                         {if !$event.all_day}
                                             {if $event.starting_date|date_format:"%l:%M %P" == $event.ending_date|date_format:"%l:%M %P"}
                 type: 'POST',
                 url: '{$ajaxUrl}',
                 data: dat,
-                beforeSend: function(){ 
+                beforeSend: function(){
                     $(".event-overlay").show();
                     $(".loading").show();
                 },
-                complete: function(){ 
+                complete: function(){
                     $(".event-overlay").hide();
                     $(".loading").hide();
                 },
                 calendar.fullCalendar('render');
 
             } else if ( $("#glm-event-view-select option:selected").val() === "agenda"){
-                agenda.css("display", "block");  
+                agenda.css("display", "block");
                 calendar.fadeOut('slow', function(){});
             }
         });
         $(document).on("click", "button.fc-button", function () {
             eventsCalMonthAJAX(month_obj);
         });
-        
+
         var dates = $(".agenda-event-recur-dates");
         dates.each( function (){
            if( $(this).text().indexOf('-') < 0 ){
                $(this).remove();
            }
         });
-        
+
     });
 </script>