Update so the calendar links from home work
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 30 Jul 2014 20:29:04 +0000 (16:29 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 30 Jul 2014 20:29:04 +0000 (16:29 -0400)
build the start and end date for search if you get link from the
calendar on the home page.

static/10.phtml

index dcd0040..1258eee 100755 (executable)
@@ -1,5 +1,25 @@
 <?php
 if (defined('COMMON_EVENTS') && COMMON_EVENTS) {
+    $calendarDateArray = filter_var_array(
+        $_REQUEST,
+        array(
+            'day'   => array('filter' => FILTER_VALIDATE_INT, 'options' => array('min_range' => 1, 'max_range' => 31)),
+            'month' => array('filter' => FILTER_VALIDATE_INT, 'options' => array('min_range' => 1, 'max_range' => 12)),
+            'year'  => array('filter' => FILTER_VALIDATE_INT, 'options' => array('min_range' => date('Y'), 'max_range' => date('Y') + 2)),
+        )
+    );
+    if ($calendarDateArray['day'] && $calendarDateArray['month'] && $calendarDateArray['year']) {
+        $time = mktime(
+            0,
+            0,
+            0,
+            $calendarDateArray['month'],
+            $calendarDateArray['day'],
+            $calendarDateArray['year']
+        );
+        $_REQUEST['search'] = 1;
+        $_REQUEST['startMonth'] = $_REQUEST['endMonth'] = date('m/d/Y', $time);
+    }
     // set CommonApp define if not set
     if (!defined('COMMON_APP_BASE')) {
         define('COMMON_APP_BASE', '/var/www/server/CommonApps/');