Added live sample menus and tabs and a few other minor things.
authorChuck Scott <cscott@gaslightmedia.com>
Fri, 12 Feb 2016 19:05:24 +0000 (14:05 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Fri, 12 Feb 2016 19:05:24 +0000 (14:05 -0500)
12 files changed:
assets/readme.txt [new file with mode: 0644]
models/admin/info/index.php [new file with mode: 0644]
models/admin/members/sample.php [new file with mode: 0644]
models/admin/sample/index.php [new file with mode: 0644]
models/admin/sample/more.php [new file with mode: 0644]
setup/adminMenus.php
setup/adminTabs.php
setup/validActions.php
views/admin/info/index.html [new file with mode: 0644]
views/admin/members/sample.html [new file with mode: 0644]
views/admin/sample/index.html [new file with mode: 0644]
views/admin/sample/more.html [new file with mode: 0644]

diff --git a/assets/readme.txt b/assets/readme.txt
new file mode 100644 (file)
index 0000000..34a6135
--- /dev/null
@@ -0,0 +1,2 @@
+Assets folder for things like images and other 
+files that might need to be read directly.
\ No newline at end of file
diff --git a/models/admin/info/index.php b/models/admin/info/index.php
new file mode 100644 (file)
index 0000000..4c61edb
--- /dev/null
@@ -0,0 +1,125 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Member User Profile
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @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_info_index // 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 = 'This is the Sample Add-On "Info" model 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/info/index.html',
+                'data' => $templateData
+        );
+
+    }
+
+
+}
diff --git a/models/admin/members/sample.php b/models/admin/members/sample.php
new file mode 100644 (file)
index 0000000..ed2fac9
--- /dev/null
@@ -0,0 +1,125 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Member User Profile
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @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_members_sample // 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 = 'This is the Sample "Members" "Sample" model 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/members/sample.html',
+                'data' => $templateData
+        );
+
+    }
+
+
+}
diff --git a/models/admin/sample/index.php b/models/admin/sample/index.php
new file mode 100644 (file)
index 0000000..5c321df
--- /dev/null
@@ -0,0 +1,125 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Member User Profile
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @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_sample_index // 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 = 'Hello, World! This is the Sample Add-On "sample" model 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/sample/index.html',
+                'data' => $templateData
+        );
+
+    }
+
+
+}
diff --git a/models/admin/sample/more.php b/models/admin/sample/more.php
new file mode 100644 (file)
index 0000000..b814759
--- /dev/null
@@ -0,0 +1,125 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Member User Profile
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @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_sample_more // 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!<br>This is the Sample Add-On "sample" 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/sample/more.html',
+                'data' => $templateData
+        );
+
+    }
+
+
+}
index 0853084..6a1932a 100644 (file)
 /*
  * Added menus or sub-menus examples
  *
+ * // Add a main menu item
+ * add_menu_page(
+ *     'GLM Sample',                                       // Page Title
+ *     'GLM Sample',                                       // Menu Title
+ *     'glm-members-members',                              // Capability
+ *     'glm-members-admin-menu-glm-sample',                // Menu Slug
+ *     function() {$this->controller('sample');},          // Called function
+ *     false,                                              // Icon URL
+ *     '92'                                                // Menu Position
+ * );
+ *
+ * // Add a sub-menu item
  * add_submenu_page(
- *     'glm-members-admin-menu-members',                   // Parent slug
+ *     'glm-members-admin-menu-sample',                    // Parent slug
  *     'Sample',                                           // Page title
  *     'Sample',                                           // Menu Title
  *     'glm_members_edit',                                 // Capability required
  * If creating a main menu item with add_menu_page(), please document
  * that structure here.
  *
+ * NOTE: The menu slug is the link for the page. It is also parsed by
+ * the controller and used to find the model to load. The
+ * "glm-members-admin-menu-" portion should not change, the last
+ * segment is the model directory name. By default the "index.php" file
+ * in that directory is executed. If the URL includes a "glm_action"
+ * parameter, then the model file called is in the same directory but
+ * is named the same as the "glm_action" parameter.
+ *
  */
+
+// Add a main menu item
+add_menu_page(
+    'GLM Sample',                                       // Page Title
+    'GLM Sample',                                       // Menu Title
+    'glm-members-members',                              // Capability
+    'glm-members-admin-menu-sample',                    // Menu Slug
+    function() {$this->controller('sample');},          // Called function
+    false,                                              // Icon URL
+    '92'                                                // Menu Position
+);
+
+add_submenu_page(
+    'glm-members-admin-menu-sample',                    // Parent slug
+    'Sample',                                           // Page title
+    'Sample',                                           // Menu Title
+    'glm_members_members',                              // Capability required
+    'glm-members-admin-menu-sample-sample',             // Menu slug
+    function() {$this->controller('sample');}
+);
+
+add_submenu_page(
+    'glm-members-admin-menu-sample',                    // Parent slug
+    'Info',                                             // Page title
+    'Info',                                             // Menu Title
+    'glm_members_members',                              // Capability required
+    'glm-members-admin-menu-sample-info',               // Menu slug
+    function() {$this->controller('info');}
+);
index 850f8fd..9f22164 100644 (file)
  *
  */
 
+add_filter('glm-member-db-add-tab-for-members',
+    function($addOnTabs) {
+        $newTabs = array(
+            array(
+                'text' => 'Sample',
+                'menu' => 'members',
+                'action' => 'sample'
+            )
+        );
+        $addOnTabs = array_merge($addOnTabs, $newTabs);
+        return $addOnTabs;
+    }
+);
 
index 5f5b3a2..658d1d6 100644 (file)
 
 $glmMembersSampleAddOnValidActions = array(
     'adminActions' => array(
-/*
         'members' => array(
-            'sample' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG
+            'sample' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG,
         ),
-        'member' => array(
-            'sample' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG
+        'sample' => array(
+            'index' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG,
+            'more' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG,
         ),
-        'management' => array(
-            'sample' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG
+        'info' => array(
+            'index' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG
         )
-*/
     ),
     'frontActions' => array(
 /*
diff --git a/views/admin/info/index.html b/views/admin/info/index.html
new file mode 100644 (file)
index 0000000..eab9b97
--- /dev/null
@@ -0,0 +1,6 @@
+<div class="wrap">
+    <div id="glm-admin-content-container">
+        <h3>Info Sub-menu Model</h3>
+        <p>{$displayData}</p>
+    </div>
+</div>
\ No newline at end of file
diff --git a/views/admin/members/sample.html b/views/admin/members/sample.html
new file mode 100644 (file)
index 0000000..22f4d71
--- /dev/null
@@ -0,0 +1,6 @@
+{include file='admin/members/header.html'}
+    
+    <h3>Members Sample Tab</h3>
+    <p>{$displayData}</p>
+        
+{include file='admin/footer.html'}
\ No newline at end of file
diff --git a/views/admin/sample/index.html b/views/admin/sample/index.html
new file mode 100644 (file)
index 0000000..4588ef0
--- /dev/null
@@ -0,0 +1,7 @@
+<div class="wrap">
+    <div id="glm-admin-content-container">
+        <h3>Sample Model</h3>
+        <p>{$displayData}</p>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=more">Click me to see more!</a>
+    </div>
+</div>
\ No newline at end of file
diff --git a/views/admin/sample/more.html b/views/admin/sample/more.html
new file mode 100644 (file)
index 0000000..5e1c19a
--- /dev/null
@@ -0,0 +1,6 @@
+<div class="wrap">
+    <div id="glm-admin-content-container">
+        <h3>Sample Model - More Information</h3>
+        <p>{$displayData}</p>
+    </div>
+</div>
\ No newline at end of file