Adding more data arrays for the templates
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 25 Feb 2016 16:07:08 +0000 (11:07 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 25 Feb 2016 16:07:08 +0000 (11:07 -0500)
models/front/events/list.php

index 75ac343..a46af87 100644 (file)
@@ -1,14 +1,38 @@
 <?php
 /**
+ * list.php
+ *
+ * This is the Members Event Plugin model for the front list shortcode.
+ * Handles the default and searching of the events. Then calls appropriate view
+ * files.
  */
 
 require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEvents.php';
 
+/**
+ * GlmMembersFront_events_list
+ *
+ * @uses      GlmDataEvents
+ * @package   GlmMemberEvents
+ * @version   //autogen//
+ * @copyright Copyright (c) 2010 All rights reserved.
+ * @author    Steve Sutton <steve@gaslightmedia.com>
+ * @license   PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
+ */
 class GlmMembersFront_events_list extends GlmDataEvents
 {
     public $wpdb;
     public $config;
 
+    /**
+     * __construct
+     *
+     * @param mixed $wpdb   The main Word Press DB Object
+     * @param mixed $config The main Config
+     *
+     * @access public
+     * @return void
+     */
     public function __construct($wpdb, $config)
     {
         $this->wpdb = $wpdb;
@@ -17,6 +41,171 @@ class GlmMembersFront_events_list extends GlmDataEvents
         parent::__construct(false, false);
     }
 
+    private function getCategories()
+    {
+        return array(
+            array(
+                'id'   => 1,
+                'name' => 'Arts & Crafts'
+            ),
+            array(
+                'id'   => 2,
+                'name' => 'Arts/Cultural/Live Theatre'
+            ),
+            array(
+                'id'   => 3,
+                'name' => 'Beer/Wine Focus'
+            ),
+            array(
+                'id'   => 4,
+                'name' => 'Concerts/Live Music'
+            ),
+            array(
+                'id'   => 5,
+                'name' => 'Educational'
+            ),
+            array(
+                'id'   => 6,
+                'name' => 'Festivals/Fairs/Parades'
+            ),
+            array(
+                'id'   => 7,
+                'name' => 'Outdoor/Nature'
+            ),
+            array(
+                'id'   => 8,
+                'name' => 'Special Event'
+            ),
+            array(
+                'id'   => 9,
+                'name' => 'Sports'
+            ),
+        );
+    }
+
+    private function getModelEventsData()
+    {
+        return array(
+            array(
+                'title'       => '20th Annual Garage Sale Art fair',
+                'starting'    => '02/27/2016',
+                'ending'      => '02/27/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Arts & Crafts'
+            ),
+            array(
+                'title'       => 'ARTbreak: Talk: The Art of Collaboration with artists Vicki VanAmeyden and Ginger Owen',
+                'starting'    => '03/01/2016',
+                'ending'      => '03/01/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Arts & Crafts'
+            ),
+            array(
+                'title'       => 'Easter Craft & Vendor Show',
+                'starting'    => '03/26/2016',
+                'ending'      => '03/26/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Arts & Crafts'
+            ),
+            array(
+                'title'       => 'Henderson Castle Tours',
+                'starting'    => '05/11/2016',
+                'ending'      => '05/11/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Arts/Cultural/Live Theatre'
+            ),
+            array(
+                'title'       => 'Colour Correction: British and American Screenprints, 1967-75',
+                'starting'    => '06/11/2015',
+                'ending'      => '06/10/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Arts/Cultural/Live Theatre'
+            ),
+            array(
+                'title'       => 'Suspended! Sculpture from ArtPrize 2015',
+                'starting'    => '12/12/2016',
+                'ending'      => '12/13/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Arts/Cultural/Live Theatre'
+            ),
+            array(
+                'title'       => '"Tasting on the Town"',
+                'starting'    => '04/21/2016',
+                'ending'      => '04/21/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Beer/Wine Focus'
+            ),
+            array(
+                'title'       => 'Patrick Henry Beer Collectibles Show',
+                'starting'    => '05/14/2016',
+                'ending'      => '05/14/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Beer/Wine Focus'
+            ),
+            array(
+                'title'       => '"Tasting on the Town"',
+                'starting'    => '05/20/2016',
+                'ending'      => '05/20/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Beer/Wine Focus'
+            ),
+            array(
+                'title'       => 'Owl Prowl: Barred Owls',
+                'starting'    => '02/25/2016',
+                'ending'      => '02/25/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Outdoor/Nature'
+            ),
+            array(
+                'title'       => 'Owls of Michigan',
+                'starting'    => '02/28/2016',
+                'ending'      => '02/28/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Outdoor/Nature'
+            ),
+            array(
+                'title'       => 'Bird Sanctuary Resource Center Re-Opening',
+                'starting'    => '02/29/2016',
+                'ending'      => '02/29/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Outdoor/Nature'
+            ),
+            array(
+                'title'       => 'Lead Day Hike',
+                'starting'    => '02/29/2016',
+                'ending'      => '02/29/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Outdoor/Nature'
+            ),
+            array(
+                'title'       => 'Project Snowstorm: Snowy Owls in Michigan',
+                'starting'    => '03/01/2016',
+                'ending'      => '03/01/2016',
+                'description' => '<p>Test event description text here!</p>',
+                'category'    => 'Outdoor/Nature'
+            )
+        );
+    }
+
+    private function getModelEventData()
+    {
+        return array(
+            'title'       => 'Owr Prowl: Barred Owls',
+            'starting'    => '02/25/2016',
+            'ending'      => '02/25/2016',
+            'description' => '<p>Test event description text here!</p>',
+            'category'    => 'Outdoor/Nature'
+        );
+    }
+
+    /**
+     * modelAction
+     *
+     * @param bool $actionData Action Data passed to the modelAction
+     *
+     * @access public
+     * @return void
+     */
     public function modelAction($actionData = false)
     {
         $action = '';
@@ -32,65 +221,27 @@ class GlmMembersFront_events_list extends GlmDataEvents
 
         switch ($action) {
         case 'event-detail':
-            $eventData = array(
-                'title'       => 'Owr Prowl: Barred Owls',
-                'starting'    => '02/25/2016',
-                'ending'      => '02/25/2016',
-                'description' => '<p>Test event description text here!</p>',
-                'category'    => 'Outdoor/Nature'
-            );
+            $event = $this->getModelEventData();
             break;
         case 'event-list':
-            $events = array(
-                array(
-                    'title'       => 'Owr Prowl: Barred Owls',
-                    'starting'    => '02/25/2016',
-                    'ending'      => '02/25/2016',
-                    'description' => '<p>Test event description text here!</p>',
-                    'category'    => 'Outdoor/Nature'
-                ),
-                array(
-                    'title'       => 'Owls of Michigan',
-                    'starting'    => '02/28/2016',
-                    'ending'      => '02/28/2016',
-                    'description' => '<p>Test event description text here!</p>',
-                    'category'    => 'Outdoor/Nature'
-                ),
-                array(
-                    'title'       => 'Bird Sanctuary Resource Center Re-Opening',
-                    'starting'    => '02/29/2016',
-                    'ending'      => '02/29/2016',
-                    'description' => '<p>Test event description text here!</p>',
-                    'category'    => 'Outdoor/Nature'
-                ),
-                array(
-                    'title'       => 'Lead Day Hike',
-                    'starting'    => '02/29/2016',
-                    'ending'      => '02/29/2016',
-                    'description' => '<p>Test event description text here!</p>',
-                    'category'    => 'Outdoor/Nature'
-                ),
-                array(
-                    'title'       => 'Project Snowstorm: Snowy Owls in Michigan',
-                    'starting'    => '03/01/2016',
-                    'ending'      => '03/01/2016',
-                    'description' => '<p>Test event description text here!</p>',
-                    'category'    => 'Outdoor/Nature'
-                ),
-            );
+            $events = $this->getModelEventsData();
             $view = 'list.html';
             break;
         default:
-
+            // for the dashboard need to get list of event categories and
+            // filter out the events
+            $events = $this->getModelEventsData();
             $view = 'dashboard.html';
             break;
         }
 
+        $categories = $this->getCategories();
 
 
         // Compile template data
         $templateData = array(
             'siteBaseUrl' => GLM_MEMBERS_SITE_BASE_URL,
+            'categories'  => $categories,
             'events'      => $events,
             'event'       => $event
         );