Update pdf
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 29 May 2019 18:20:30 +0000 (14:20 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 29 May 2019 20:26:52 +0000 (16:26 -0400)
Only output event schedules if they are within the date range search.

index.php
models/front/events/pdfCreator.php

index b286ea2..4974065 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Associate - Events Add-On
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: Gaslight Media Members Database.
- * Version: 1.7.23
+ * Version: 1.7.24
  * Author: Chuck Scott
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -19,7 +19,7 @@
  * @package glmMembersDatabaseEventsAddOn
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.7.23
+ * @version 1.7.24
  */
 
 // Check that we're being called by WordPress.
@@ -43,7 +43,7 @@ if (!defined('ABSPATH')) {
  *  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.7.23');
+define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.7.24');
 define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.14');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
index 9763652..58952bb 100644 (file)
@@ -64,6 +64,7 @@ $totalEvents = count($events);
 $index = 0;
 $pdf->ezSetY( $this->pdf_top_y );
 
+// echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
 foreach ( $events as $eventId => $event ) {
     $lineCount = 1;
     $eventTopY = $pdfY;
@@ -72,6 +73,23 @@ foreach ( $events as $eventId => $event ) {
     $eventDates = '';
     $recCounter = 0;
     foreach ( $event['recurrences'] as $rec ) {
+        if ( isset( $_REQUEST['glm_event_from'] ) ) {
+            $startingTime = strtotime( $_REQUEST['glm_event_from'] );
+        }
+        // echo '<pre>$startingTime: ' . print_r( $startingTime, true ) . '</pre>';
+        if ( isset( $_REQUEST['glm_event_from'] )  ) {
+            $endingTime = strtotime( $_REQUEST['glm_event_to'] );
+        }
+        // echo '<pre>$endingTime: ' . print_r( $endingTime, true ) . '</pre>';
+        if ( $startingTime && $endingTime && ( $rec['from_date']['timestamp'] > $endingTime || $rec['to_date']['timestamp'] < $startingTime ) ) {
+            continue;
+        }
+        if ( $startingTime && !$endingTime && $rec['to_date']['timestamp'] < $startingTime ) {
+            continue;
+        }
+        if ( !$startingTime && $endingTime && $rec['from_date']['timestamp'] > $endingTime ) {
+            continue;
+        }
         if ( $rec['name'] && !in_array( $rec['name'], array( 'Imported', 'Imported Event Schedule') ) ) {
             $eventDates .= $rec['name'] . ' ';
         }