refactoring and style changes for output
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 9 Mar 2016 19:44:01 +0000 (14:44 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 9 Mar 2016 19:44:01 +0000 (14:44 -0500)
Re factor the models
update style classes for forms

models/front/events/baseAction.php [new file with mode: 0644]
models/front/events/detail.php
models/front/events/list.php
views/front/events/shortCuts.html

diff --git a/models/front/events/baseAction.php b/models/front/events/baseAction.php
new file mode 100644 (file)
index 0000000..c9985bd
--- /dev/null
@@ -0,0 +1,79 @@
+<?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   0.0.1
+ * @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}
+ */
+abstract class GlmMembersFront_events_baseAction 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;
+        $this->config = $config;
+
+        parent::__construct(false, false);
+    }
+
+    public function getCategories()
+    {
+        include GLM_MEMBERS_EVENTS_PLUGIN_PATH. '/models/front/events/testCategoryData.php';
+        return $categories;
+    }
+
+    public function getModelEventsData($categoryId = null)
+    {
+        include GLM_MEMBERS_EVENTS_PLUGIN_PATH. '/models/front/events/testEventsData.php';
+        if ($categoryId) {
+            return array_filter($events, function($data) use($categoryId) {
+                return ($data['category'] == $categoryId) ? 1 : 0;
+            });
+        }
+        return $events;
+    }
+
+    public function getModelEventData($eventId)
+    {
+        $events = $this->getModelEventsData();
+        return array_filter($events, function($data) use($eventId) {
+             return $data['id'] == $eventId;
+        });
+    }
+
+    /**
+     * modelAction
+     *
+     * @param bool $actionData Action Data passed to the modelAction
+     *
+     * @access public
+     * @return void
+     */
+    abstract public function modelAction($actionData = false);
+
+}
index f87aa25..7b284fb 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEvents.php';
+require_once GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/models/front/events/baseAction.php';
 
 /**
  * GLmMembersFront_event_detail
@@ -18,50 +19,8 @@ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEvents.php';
  * @author    Steve Sutton <steve@gaslightmedia.com>
  * @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
  */
-class GLmMembersFront_events_detail extends GlmDataEvents
+class GLmMembersFront_events_detail extends GlmMembersFront_events_baseAction
 {
-    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;
-        $this->config = $config;
-
-        parent::__construct(false, false);
-    }
-
-    private function getModelEventData($eventId)
-    {
-        $events = $this->getModelEventsData();
-        return array_filter($events, function($data) use($eventId) {
-            return $data['id'] == $eventId;
-        });
-    }
-    private function getCategories()
-    {
-        include GLM_MEMBERS_EVENTS_PLUGIN_PATH. '/models/front/events/testCategoryData.php';
-        return $categories;
-    }
-    private function getModelEventsData($categoryId = null)
-    {
-        include GLM_MEMBERS_EVENTS_PLUGIN_PATH. '/models/front/events/testEventsData.php';
-        if ($categoryId) {
-            return array_filter($events, function($data) use($categoryId) {
-                return ($data['category'] == $categoryId) ? 1 : 0;
-            });
-        }
-        return $events;
-    }
     /**
      * modelAction
      *
index 0aca1d9..067ef72 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEvents.php';
+require_once GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/models/front/events/baseAction.php';
 
 /**
  * GlmMembersFront_events_list
@@ -19,58 +20,8 @@ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEvents.php';
  * @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
+class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction
 {
-    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;
-        $this->config = $config;
-
-        parent::__construct(false, false);
-    }
-
-    private function getCategories()
-    {
-        include GLM_MEMBERS_EVENTS_PLUGIN_PATH. '/models/front/events/testCategoryData.php';
-        return $categories;
-    }
-
-    private function getModelEventsData($categoryId = null)
-    {
-        include GLM_MEMBERS_EVENTS_PLUGIN_PATH. '/models/front/events/testEventsData.php';
-        if ($categoryId) {
-            return array_filter($events, function($data) use($categoryId) {
-                return ($data['category'] == $categoryId) ? 1 : 0;
-            });
-        }
-        return $events;
-    }
-
-    private function getModelEventData()
-    {
-        return array(
-            'id'          => 14,
-            'slug'        => '?eventId=14',
-            'title'       => 'Project Snowstorm: Snowy Owls in Michigan',
-            'starting'    => '03/01/2016',
-            'ending'      => '03/01/2016',
-            'description' => '<p>Test event description text here!</p>',
-            'category'    => 7
-        );
-    }
-
     /**
      * modelAction
      *
index c06fbef..04f9842 100644 (file)
@@ -1,9 +1,9 @@
     <div id="glm-events-shortcuts" class="small-12 medium-4 columns">
         <h1 class="text-center">Shortcuts</h1>
-        <ul class="stack button-group radius">
-            <li><a href="#" class="button">Today's Events</a></li>
-            <li><a href="#" class="button">Tomorrow's Events</a></li>
-            <li><a href="#" class="button">Next 7 Days</a></li>
+        <ul class="shortcuts-button-group">
+            <li><a href="#" class="shortcuts-button">Today's Events</a></li>
+            <li><a href="#" class="shortcuts-button">Tomorrow's Events</a></li>
+            <li><a href="#" class="shortcuts-button">Next 7 Days</a></li>
         </ul>
     </div>