From 86dff5e76578a1dec15bc406a9eca48f5a06e9db Mon Sep 17 00:00:00 2001
From: Anthony Talarico 
This is the Events Add-On "events" model with action "more" talking to you from inside WordPress.';
+
+        // Compile template data
+        $templateData = array(
+            'displayData' => $displayData
+        );
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+                'status' => true,
+                'modelRedirect' => false,
+                'view' => 'admin/events/add.html',
+                'data' => $templateData
+        );
+
+    }
+
+
+}
+
+
diff --git a/models/admin/events/categories.php b/models/admin/events/categories.php
new file mode 100644
index 0000000..b099cbf
--- /dev/null
+++ b/models/admin/events/categories.php
@@ -0,0 +1,125 @@
+
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load Contacts data abstract
+//require_once(GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php');
+
+class GlmMembersAdmin_events_categories // extends GlmDataContacts
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Contact Info
+     *
+     * @var $contactInfo
+     * @access public
+     */
+    public $contactInfo = false;
+    /**
+     * Member ID
+     *
+     * @var $memberID
+     * @access public
+     */
+    public $memberID = false;
+    /**
+     * Contact ID
+     *
+     * @var $contactID
+     * @access public
+     */
+    public $contactID = false;
+
+
+    /*
+     * Constructor
+     *
+     * This contructor performs the work for this model. This model returns
+     * an array containing the following.
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * 'view'
+     *
+     * A suggested view name that the contoller should use instead of the
+     * default view for this model or false to indicate that the default view
+     * should be used.
+     *
+     * 'data'
+     *
+     * Data that the model is returning for use in merging with the view to
+     * produce output.
+     *
+     * @wpdb object WordPress database object
+     *
+     * @return array Array containing status, suggested view, and any data
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        /*
+         * Run constructor for the Contacts data class
+         *
+         * Note, the third parameter is a flag that indicates to the Contacts
+         * data class that it should flag a group of fields as 'view_only'.
+         */
+//        parent::__construct(false, false, true);
+
+
+    }
+
+    public function modelAction($actionData = false)
+    {
+
+        $displayData = 'Welcome to more information!
This is the Events Add-On "events" model with action "more" talking to you from inside WordPress.';
+
+        // Compile template data
+        $templateData = array(
+            'displayData' => $displayData
+        );
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+                'status' => true,
+                'modelRedirect' => false,
+                'view' => 'admin/events/categories.html',
+                'data' => $templateData
+        );
+
+    }
+
+
+}
diff --git a/models/admin/events/index.php b/models/admin/events/index.php
index 5c43a53..e33a297 100644
--- a/models/admin/events/index.php
+++ b/models/admin/events/index.php
@@ -118,6 +118,38 @@ class GlmMembersAdmin_events_index // extends GlmDataContacts
                 'view' => 'admin/events/index.html',
                 'data' => $templateData
         );
+        
+          // Check for required Categories
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
+        $Categories = new GlmDataCategories($this->wpdb, $this->config);
+        $categoriesStats = $Categories->getStats();
+        $haveCategories = ($categoriesStats > 0);
+        
+          // Check for required Event Categories
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataEventCategories.php');
+        $eventCategories = new GlmDataEventsEventCategories($this->wpdb, $this->config);
+        $eventCategoriesStats = $eventCategories->getStats();
+        $eventHaveCategories = ($eventCategoriesStats > 0);
+        
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataEvents.php');
+        $Events = new GlmDataEvents($this->wpdb, $this->config);
+        $eventsStats = $Events->getStats();
+        $haveEvents = ($eventsStats > 0);
+        
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataLocations.php');
+        $Locations = new GlmDataEventsLocations($this->wpdb, $this->config);
+        $locationsStats = $Locations->getStats();
+        $haveLocations = ($locationsStats > 0);
+        
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/Recurrences.php');
+        $Recurrences = new GlmDataEventsRecurrences($this->wpdb, $this->config);
+        $recurrencesStats = $Recurrences->getStats();
+        $haveRecurrences = ($recurrencesStats > 0);
+        
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/Times.php');
+        $Times = new GlmDataEventsTimes($this->wpdb, $this->config);
+        $timesStats = $Times->getStats();
+        $haveTimes = ($timesStats > 0);
 
     }
 
diff --git a/models/admin/info/index.php b/models/admin/member/events.php
similarity index 92%
rename from models/admin/info/index.php
rename to models/admin/member/events.php
index 4c61edb..f27ef43 100644
--- a/models/admin/info/index.php
+++ b/models/admin/member/events.php
@@ -16,9 +16,8 @@
 // Load Contacts data abstract
 //require_once(GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php');
 
-class GlmMembersAdmin_info_index // extends GlmDataContacts
+class GlmMembersAdmin_member_events // extends GlmDataContacts
 {
-
     /**
      * WordPress Database Object
      *
@@ -104,7 +103,7 @@ class GlmMembersAdmin_info_index // extends GlmDataContacts
     public function modelAction($actionData = false)
     {
 
-        $displayData = 'This is the Sample Add-On "Info" model talking to you from inside WordPress.';
+        $displayData = 'This is the Events "Members" "Events" model talking to you from inside WordPress.';
 
         // Compile template data
         $templateData = array(
@@ -115,10 +114,9 @@ class GlmMembersAdmin_info_index // extends GlmDataContacts
         return array(
                 'status' => true,
                 'modelRedirect' => false,
-                'view' => 'admin/info/index.html',
+                'view' => 'admin/member/events.html',
                 'data' => $templateData
         );
-
     }
 
 
diff --git a/models/admin/members/events.php b/models/admin/members/events.php
index 9f69514..b57b1bf 100644
--- a/models/admin/members/events.php
+++ b/models/admin/members/events.php
@@ -18,7 +18,6 @@
 
 class GlmMembersAdmin_members_events // extends GlmDataContacts
 {
-
     /**
      * WordPress Database Object
      *
diff --git a/setup/adminMenus.php b/setup/adminMenus.php
index 94e95e1..4749178 100644
--- a/setup/adminMenus.php
+++ b/setup/adminMenus.php
@@ -72,29 +72,36 @@
 
 // Add a main menu item
 add_menu_page(
-    'GLM events',                                       // Page Title
-    'GLM events',                                       // Menu Title
+    'GLM Events',                                       // Page Title
+    'GLM Events',                                       // Menu Title
     'glm-members-members',                              // Capability
     'glm-members-admin-menu-events',                    // Menu Slug
     function() {$this->controller('events');},          // Called function
     false,                                              // Icon URL
     '92'                                                // Menu Position
 );
-
-add_submenu_page(
+    add_submenu_page(
     'glm-members-admin-menu-events',                    // Parent slug
-    'events',                                           // Page title
-    'events',                                           // Menu Title
+    'Add Event',                                             // Page title
+    'Add Event',                                             // Menu Title
     'glm_members_members',                              // Capability required
-    'glm-members-admin-menu-events-events',             // Menu slug
-    function() {$this->controller('events');}
+    'glm-members-admin-menu-events-add',               // Menu slug
+    function() {$this->controller('add');}
+);
+    add_submenu_page(
+    'glm-members-admin-menu-events',                    // Parent slug
+    'Event Categories',                                           // Page title
+    'Event Categories',                                           // Menu Title
+    'glm_members_members',                              // Capability required
+    'glm-members-admin-menu-events-categories',             // Menu slug
+    function() {$this->controller('categories');}
 );
 
 add_submenu_page(
-    'glm-members-admin-menu-events',                    // Parent slug
-    'Info',                                             // Page title
-    'Info',                                             // Menu Title
+    'glm-members-admin-menu-members',                    // Parent slug
+    'Events',                                             // Page title
+    'Events',                                             // Menu Title
     'glm_members_members',                              // Capability required
-    'glm-members-admin-menu-events-info',               // Menu slug
-    function() {$this->controller('info');}
+    'glm-members-admin-menu-members-events',               // Menu slug
+    function() {$this->controller('events');}
 );
diff --git a/setup/adminTabs.php b/setup/adminTabs.php
index e3cb1a7..e90461d 100644
--- a/setup/adminTabs.php
+++ b/setup/adminTabs.php
@@ -33,17 +33,60 @@
  *
  */
 
-add_filter('glm-member-db-add-tab-for-members',
+//add_filter('glm-member-db-add-tab-for-members',
+//    function($addOnTabs) {
+//        $newTabs = array(
+//            array(
+//                'text' => 'Events',
+//                'menu' => 'members',
+//                'action' => 'events'
+//            ),
+//        );
+//        $addOnTabs = array_merge($addOnTabs, $newTabs);
+//        return $addOnTabs;
+//    }
+//);
+add_filter('glm-member-db-add-tab-for-member',
     function($addOnTabs) {
         $newTabs = array(
             array(
                 'text' => 'Events',
-                'menu' => 'members',
+                'menu' => 'member',
                 'action' => 'events'
-            )
+            ),
+          
         );
         $addOnTabs = array_merge($addOnTabs, $newTabs);
         return $addOnTabs;
     }
 );
 
+add_filter('glm-member-db-add-tab-for-events',
+    function($addOnTabs) {
+        $newTabs = array(
+            array(
+                'text' => 'Add Event',
+                'menu' => 'events',
+                'action' => 'add'
+            ),
+          
+        );
+        $addOnTabs = array_merge($addOnTabs, $newTabs);
+        return $addOnTabs;
+    }
+);
+
+add_filter('glm-member-db-add-tab-for-events',
+    function($addOnTabs) {
+        $newTabs = array(
+            array(
+                'text' => 'Event Categories',
+                'menu' => 'events',
+                'action' => 'categories'
+            ),
+          
+        );
+        $addOnTabs = array_merge($addOnTabs, $newTabs);
+        return $addOnTabs;
+    }
+);
\ No newline at end of file
diff --git a/setup/validActions.php b/setup/validActions.php
index c3c218d..50b75f0 100644
--- a/setup/validActions.php
+++ b/setup/validActions.php
@@ -32,16 +32,17 @@
 
 $glmMembersEventsAddOnValidActions = array(
     'adminActions' => array(
-        'members' => array(
+        'members' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
+        'event'=> GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
+        'member' => array(
             'events' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
         ),
         'events' => array(
             'index' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
             'more' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
+            'add' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
+            'categories' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG
         ),
-        'info' => array(
-            'index' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG
-        )
     ),
     'frontActions' => array(
 /*
diff --git a/views/admin/events/add.html b/views/admin/events/add.html
new file mode 100644
index 0000000..2a39099
--- /dev/null
+++ b/views/admin/events/add.html
@@ -0,0 +1,57 @@
+{include file='admin/events/header.html'}
+   
+                Date and Time 
+                    
+ + diff --git a/views/admin/events/categories.html b/views/admin/events/categories.html new file mode 100644 index 0000000..c627c24 --- /dev/null +++ b/views/admin/events/categories.html @@ -0,0 +1,16 @@ + + + +
+
+ + + +
+