Start on dashboard for packaging.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 8 Sep 2016 20:52:54 +0000 (16:52 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 8 Sep 2016 20:52:54 +0000 (16:52 -0400)
Adding files to start for the dashboard widget for this plugin.

models/admin/dashboard/packaging.php [new file with mode: 0644]
setup/adminHooks.php
setup/validActions.php
views/admin/dashboard/packaging.html [new file with mode: 0644]

diff --git a/models/admin/dashboard/packaging.php b/models/admin/dashboard/packaging.php
new file mode 100644 (file)
index 0000000..dd11aa7
--- /dev/null
@@ -0,0 +1,128 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Members Dashboard
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Steve Sutton <steve@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEvents.php';
+
+/**
+ * Dashboard Class Model
+ *
+ * Each Add-On can have one or more dashboards.
+ */
+
+class GlmMembersAdmin_dashboard_packaging // extends GlmDataEvents
+{
+    /**
+     * Word Press Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /**
+     * Constructor
+     *
+     * This contructor sets up this model. At this time that only includes
+     * storing away the WordPress data object.
+     *
+     * @return object Class object
+     *
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Run constructor for members data class
+        //parent::__construct(false, false);
+
+    }
+
+    /**
+     * Perform Model Action
+     *
+     * This method does the work for this model and returns any resulting data
+     *
+     * @return array Status and data array
+     *
+     * 'status'
+     *
+     * True if successful and false if there was a fatal failure.
+     *
+     * 'menuItemRedirect'
+     *
+     * If not false, provides a menu item the controller should
+     * execute after this one. Normally if this is used, there would also be a
+     * modelRedirect value supplied as well.
+     *
+     * 'modelRedirect'
+     *
+     * If not false, provides an action the controller should execute after
+     * this one.
+     *
+     * 'view'
+     *
+     * A suggested view name that the controller 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.
+     *
+     */
+    public function modelAction ( $actionData = false )
+    {
+
+        $success         = true;
+        $hasLastDownload = false;
+        $lastSearchDate  = '';
+
+        // Get list of member events.
+        if ( isset( $this->config['loggedInUser']['contactUser']['ref_dest'] )
+            && $memberID = filter_var( $this->config['loggedInUser']['contactUser']['ref_dest'], FILTER_VALIDATE_INT)
+        ) {
+
+        }
+
+        // Compile template data.
+        $templateData = array(
+            'memberID'        => $memberID,
+        );
+
+        // Return status, suggested view, and data to controller.
+        return array(
+            'status'           => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect'    => false,
+            'view'             => 'admin/dashboard/packaging.html',
+            'data'             => $templateData
+        );
+
+    }
+
+}
index 85608b0..07676cb 100644 (file)
@@ -44,4 +44,13 @@ add_filter('glm-member-db-admin-management-hooksHelp', function($content) {
     2
 );
 
-?>
\ No newline at end of file
+
+add_filter(
+    'glm-member-db-dashboard-member-widgets',
+    function ( $member = null ) {
+        $content .= $this->controller( 'dashboard', 'packaging', $member );
+        return $content;
+    },
+    11,
+    1
+);
index d700301..69e636d 100644 (file)
@@ -32,6 +32,9 @@
 
 $glmMembersPackagingAddOnValidActions = array(
     'adminActions' => array(
+        'dashboard' => array(
+            'packaging' => GLM_MEMBERS_PACKAGING_PLUGIN_SLUG,
+        ),
         'members' => array(
             'packaging' => GLM_MEMBERS_PACKAGING_PLUGIN_SLUG
         ),
@@ -53,4 +56,4 @@ $glmMembersPackagingAddOnValidActions = array(
     )
 );
 
-?>
\ No newline at end of file
+?>
diff --git a/views/admin/dashboard/packaging.html b/views/admin/dashboard/packaging.html
new file mode 100644 (file)
index 0000000..2f61a14
--- /dev/null
@@ -0,0 +1,10 @@
+<div class="glm-widget-container">
+    <div class="glm-widget">
+        <h2>
+            <span>Packages</span>
+        </h2>
+        <div class="glm-widget-content">
+            here
+        </div>
+    </div>
+</div>