Working on the plugin management
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 3 Oct 2019 20:56:20 +0000 (16:56 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 3 Oct 2019 20:56:20 +0000 (16:56 -0400)
import of plugins management tables.

16 files changed:
classes/data/dataPlugins.php
classes/data/dataServers.php
classes/data/dataSites.php
models/admin/plugins/import.php [new file with mode: 0644]
models/admin/plugins/index.php
models/admin/plugins/plugins.php [new file with mode: 0644]
models/admin/plugins/servers.php [new file with mode: 0644]
models/admin/plugins/sites.php [new file with mode: 0644]
setup/databaseScripts/create_database_V0.0.1.sql
setup/validActions.php
views/admin/header.html
views/admin/plugins/import.html [new file with mode: 0644]
views/admin/plugins/index.html
views/admin/plugins/plugins.html [new file with mode: 0644]
views/admin/plugins/servers.html [new file with mode: 0644]
views/admin/plugins/sites.html [new file with mode: 0644]

index df4ef24..0c7e746 100644 (file)
@@ -142,6 +142,14 @@ class GlmDataPlugins extends GlmDataAbstract
                 'use'      => 'a'
             ),
 
+            // Glm Associate Site
+            'glm_associate' => array(
+                'field'    => 'glm_associate',
+                'type'     => 'checkbox',
+                'required' => false,
+                'use'      => 'a'
+            ),
+
          );
 
     }
index 7199327..6341cd1 100644 (file)
@@ -118,6 +118,13 @@ class GlmDataServers extends GlmDataAbstract
                 'use' => 'a'
             ),
 
+            // Name
+            'name' => array (
+                'field'    => 'name',
+                'type'     => 'text',
+                'required' => true,
+                'use'      => 'a'
+            ),
             // Location
             'location' => array (
                 'field'    => 'location',
index feb08de..0cee0a2 100644 (file)
@@ -73,9 +73,6 @@ class GlmDataSites extends GlmDataAbstract
      */
     public $fields = false;
 
-    public $postStats = false;
-    public $postSent = false;
-
     /**
      * Constructor
      *
@@ -112,10 +109,18 @@ class GlmDataSites extends GlmDataAbstract
         $this->fields = array (
 
             'id' => array (
-                'field' => 'id',
-                'type' => 'integer',
+                'field'     => 'id',
+                'type'      => 'integer',
                 'view_only' => true,
-                'use' => 'a'
+                'use'       => 'a'
+            ),
+
+            // Active
+            'active' => array(
+                'field'    => 'active',
+                'type'     => 'checkbox',
+                'required' => false,
+                'use'      => 'a'
             ),
 
             // Production Server
@@ -173,6 +178,22 @@ class GlmDataSites extends GlmDataAbstract
                 'use'      => 'a'
             ),
 
+            // Have Contacts
+            'has_contacts' => array(
+                'field'    => 'has_contacts',
+                'type'     => 'checkbox',
+                'required' => false,
+                'use'      => 'a'
+            ),
+
+            // Have Members
+            'has_members' => array(
+                'field'    => 'has_members',
+                'type'     => 'checkbox',
+                'required' => false,
+                'use'      => 'a'
+            ),
+
          );
 
     }
@@ -193,30 +214,6 @@ class GlmDataSites extends GlmDataAbstract
      */
     public function entryPostProcessing($r, $a)
     {
-        if ( $this->postStats ) {
-            // get number of queued emails for this message.
-            $queued = $this->wpdb->get_var(
-                $this->wpdb->prepare(
-                    "SELECT max( queue_date )
-                       FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "email_queue
-                      WHERE message_id = %d",
-                    $r['id']
-                )
-            );
-            $r['stats'] = ( $queued ) ? strtotime( $queued ) : '';
-        }
-        if ( $this->postSent ) {
-            // get number of queued emails for this message.
-            $queued = $this->wpdb->get_var(
-                $this->wpdb->prepare(
-                    "SELECT max( send_date )
-                       FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "email_logs
-                      WHERE message_id = %d",
-                    $r['id']
-                )
-            );
-            $r['sent'] = ( $queued ) ? strtotime( $queued ) : '';
-        }
         return $r;
     }
 
diff --git a/models/admin/plugins/import.php b/models/admin/plugins/import.php
new file mode 100644 (file)
index 0000000..e28d3ba
--- /dev/null
@@ -0,0 +1,267 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Members Dashboard
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+// Load Members data abstract
+require_once GLM_MEMBERS_PLUGINS_PLUGIN_CLASS_PATH.'/data/dataPlugins.php';
+require_once GLM_MEMBERS_PLUGINS_PLUGIN_CLASS_PATH.'/data/dataServers.php';
+require_once GLM_MEMBERS_PLUGINS_PLUGIN_CLASS_PATH.'/data/dataSites.php';
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_plugins_import
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /**
+     * Database Connection for the plugin server.
+     */
+    public $pdb;
+
+    /*
+     * 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;
+
+    }
+
+    /*
+     * 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 successfull 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 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.
+     *
+     */
+    public function modelAction ( $actionData = false )
+    {
+        $view     = 'import';
+        $success  = true;
+        $option   = '';
+        $option2  = false;
+        $viewPath = 'admin/plugins/';
+
+        // Setup Foundation 6
+        wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'css/foundation-6.min.css' );
+        wp_enqueue_script( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'js/foundation-6.min.js' );
+
+        if ( isset( $_REQUEST['option'] ) ) {
+            $option = $_REQUEST['option'];
+        }
+
+        if ( isset( $_REQUEST['option2'] ) ) {
+            $option2 = $_REQUEST['option2'];
+        }
+
+        $tData        = array();
+        $templateData = array(
+            'newEntry'   => false,
+            'thisOption' => $option,
+        );
+
+        switch ( $option ) {
+
+        case 'import':
+            $this->connectToPluginsDatabase();
+
+            // Get all servers.
+            $servers = array();
+            $res = $this->pdb->query(
+                "SELECT *
+                   FROM servers"
+            );
+            while ( $row = $res->fetch_assoc() ) {
+                $servers[] = $row;
+            }
+
+            if ( $servers ) {
+                foreach ( $servers as $server ) {
+                    // $this->wpdb->insert(
+                    //     GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . 'servers',
+                    //     array(
+                    //         'id'            => $server['id'],
+                    //         'name'          => $server['name'],
+                    //         'location'      => $server['location'],
+                    //         'php_version'   => $server['php_version'],
+                    //         'mysql_version' => $server['mysql_version'],
+                    //     )
+                    // );
+                }
+            }
+
+            // Get all Plugins
+            $plugins = array();
+            $res2 = $this->pdb->query(
+                "SELECT *
+                   FROM plugins"
+            );
+            while ( $row2 = $res2->fetch_assoc() ) {
+                $plugins[] = $row2;
+            }
+            // echo '<pre>$plugins: ' . print_r( $plugins, true ) . '</pre>';
+            if ( $plugins ) {
+                foreach ( $plugins as $plugin ) {
+                    // $this->wpdb->insert(
+                    //     GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . 'plugins',
+                    //     array(
+                    //         'id'             => $plugin['id'],
+                    //         'name'           => $plugin['name'],
+                    //         'latest_version' => $plugin['latest_version'],
+                    //         'notes'          => $plugin['notes'],
+                    //         'glm_associate'  => ( ( $plugin['glm_associate'] ) ? $plugins['glm_associate'] : 0 ),
+                    //     )
+                    // );
+
+                }
+            }
+
+            // Get all Sites.
+            $sites = array();
+            $res3 = $this->pdb->query(
+                "SELECT *
+                   FROM sites"
+            );
+            while ( $row3 = $res3->fetch_assoc() ) {
+                $sites[] = $row3;
+            }
+            // echo '<pre>$sites: ' . print_r( $sites, true ) . '</pre>';
+            if ( $sites ) {
+                foreach ( $sites as $site ) {
+                    // $this->wpdb->insert(
+                    //     GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . 'sites',
+                    //     array(
+                    //         'id'           => $site['id'],
+                    //         'name'         => $site['name'],
+                    //         'prod_url'     => $site['prod_url'],
+                    //         'dev_url'      => $site['dev_url'],
+                    //         'prod_server'  => $site['prod_server'],
+                    //         'dev_server'   => $site['dev_server'],
+                    //         'map_key'      => $site['map_key'],
+                    //         'has_contacts' => ( ( $site['has_contacts'] ) ? $site['has_contacts'] : 0 ),
+                    //         'has_members'  => ( ( $site['has_members'] ) ? $site['has_members'] : 0 ),
+                    //         'active'       => 1,
+                    //     )
+                    // );
+                }
+            }
+
+            // Get all site to plugins records.
+            $sitesPlugins = array();
+            $res4 = $this->pdb->query(
+                "SELECT *
+                   FROM site_plugins"
+            );
+            while ( $row4 = $res4->fetch_assoc() ) {
+                $sitesPlugins[] = $row4;
+            }
+            // echo '<pre>$sitesPlugins: ' . print_r( $sitesPlugins, true ) . '</pre>';
+            if ( $sitesPlugins ) {
+                foreach ( $sitesPlugins as $sitePlugin ) {
+                    // $this->wpdb->insert(
+                    //     GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . 'site_plugins',
+                    //     array(
+                    //         'id'           => $sitePlugin['id'],
+                    //         'site'         => $sitePlugin['site'],
+                    //         'plugin'       => $sitePlugin['plugin'],
+                    //         'prod_version' => $sitePlugin['prod_version'],
+                    //         'dev_version'  => $sitePlugin['dev_version'],
+                    //     )
+                    // );
+                }
+            }
+
+            break;
+
+        default:
+            break;
+        }
+
+        $templateData = array_merge( $templateData, $tData );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status'           => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect'    => false,
+            'view'             => $viewPath . $view . '.html',
+            'data'             => $templateData
+        );
+
+    }
+
+    public function connectToPluginsDatabase()
+    {
+        $this->pdb = new mysqli( 'dev.gaslightmedia.com', 'plugins', 'Plugins15Keep!', 'plugins' );
+        if ( $this->pdb->connect_errno ) {
+            wp_die('failed to connect');
+        }
+    }
+
+}
index c8ca597..781e992 100644 (file)
@@ -105,6 +105,10 @@ class GlmMembersAdmin_plugins_index // extends GlmDataEmailMessages
         $option2  = false;
         $viewPath = 'admin/plugins/';
 
+        // Setup Foundation 6
+        wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'css/foundation-6.min.css' );
+        wp_enqueue_script( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'js/foundation-6.min.js' );
+
         if ( isset( $_REQUEST['option'] ) ) {
             $option = $_REQUEST['option'];
         }
@@ -121,6 +125,69 @@ class GlmMembersAdmin_plugins_index // extends GlmDataEmailMessages
 
         switch ( $option ) {
 
+        case 'plugins':
+            $view = 'plugins';
+            // Get list of plugins.
+            $plugins = [
+                [
+                    'id'   => 1,
+                    'name' => 'glm-member-db',
+                ],
+                [
+                    'id'   => 2,
+                    'name' => 'glm-member-db-contacts',
+                ],
+                [
+                    'id'   => 3,
+                    'name' => 'glm-member-db-events',
+                ],
+            ];
+            $tData['plugins'] = $plugins;
+            break;
+
+        case 'sites':
+            $view = 'sites';
+            // Get list of Sites.
+            $sites = [
+                [
+                    'id'   => 1,
+                    'name' => 'Baraga County',
+                ],
+                [
+                    'id'   => 2,
+                    'name' => 'Uptravel',
+                ],
+                [
+                    'id'   => 3,
+                    'name' => 'WMTA',
+                ],
+            ];
+            $tData['sites'] = $sites;
+            break;
+
+        case 'servers':
+            $view = 'servers';
+            $servers = [
+                [
+                    'id'   => 1,
+                    'name' => 'dev55',
+                ],
+                [
+                    'id'   => 2,
+                    'name' => 'dev70',
+                ],
+                [
+                    'id'   => 3,
+                    'name' => 'eleusis',
+                ],
+                [
+                    'id'   => 4,
+                    'name' => 'norax',
+                ],
+            ];
+            $tData['servers'] = $servers;
+            break;
+
         default:
             break;
         }
diff --git a/models/admin/plugins/plugins.php b/models/admin/plugins/plugins.php
new file mode 100644 (file)
index 0000000..16ee6b3
--- /dev/null
@@ -0,0 +1,150 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Members Dashboard
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+// Load Members data abstract
+require_once GLM_MEMBERS_PLUGINS_PLUGIN_CLASS_PATH.'/data/dataPlugins.php';
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_plugins_plugins extends GlmDataPlugins
+{
+
+    /**
+     * WordPress 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 successfull 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 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.
+     *
+     */
+    public function modelAction ( $actionData = false )
+    {
+        $view     = 'plugins';
+        $success  = true;
+        $option   = '';
+        $option2  = false;
+        $viewPath = 'admin/plugins/';
+
+        // Setup Foundation 6
+        wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'css/foundation-6.min.css' );
+        wp_enqueue_script( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'js/foundation-6.min.js' );
+
+        if ( isset( $_REQUEST['option'] ) ) {
+            $option = $_REQUEST['option'];
+        }
+
+        if ( isset( $_REQUEST['option2'] ) ) {
+            $option2 = $_REQUEST['option2'];
+        }
+
+        $tData        = array();
+        $templateData = array(
+            'newEntry'   => false,
+            'thisOption' => $option,
+        );
+
+        switch ( $option ) {
+
+        default:
+            break;
+        }
+
+        // Get all plugins.
+        $plugins = $this->getList();
+
+        // Setup tData array.
+        $tData['plugins'] = $plugins;
+
+        $templateData = array_merge( $templateData, $tData );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status'           => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect'    => false,
+            'view'             => $viewPath . $view . '.html',
+            'data'             => $templateData
+        );
+
+    }
+
+}
diff --git a/models/admin/plugins/servers.php b/models/admin/plugins/servers.php
new file mode 100644 (file)
index 0000000..2e34853
--- /dev/null
@@ -0,0 +1,150 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Members Dashboard
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+// Load Members data abstract
+require_once GLM_MEMBERS_PLUGINS_PLUGIN_CLASS_PATH.'/data/dataServers.php';
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_plugins_servers extends GlmDataServers
+{
+
+    /**
+     * WordPress 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 successfull 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 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.
+     *
+     */
+    public function modelAction ( $actionData = false )
+    {
+        $view     = 'servers';
+        $success  = true;
+        $option   = '';
+        $option2  = false;
+        $viewPath = 'admin/plugins/';
+
+        // Setup Foundation 6
+        wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'css/foundation-6.min.css' );
+        wp_enqueue_script( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'js/foundation-6.min.js' );
+
+        if ( isset( $_REQUEST['option'] ) ) {
+            $option = $_REQUEST['option'];
+        }
+
+        if ( isset( $_REQUEST['option2'] ) ) {
+            $option2 = $_REQUEST['option2'];
+        }
+
+        $tData        = array();
+        $templateData = array(
+            'newEntry'   => false,
+            'thisOption' => $option,
+        );
+
+        switch ( $option ) {
+
+        default:
+            break;
+        }
+
+        // Get all plugins.
+        $servers = $this->getList();
+
+        // Setup tData array.
+        $tData['servers'] = $servers;
+
+        $templateData = array_merge( $templateData, $tData );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status'           => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect'    => false,
+            'view'             => $viewPath . $view . '.html',
+            'data'             => $templateData
+        );
+
+    }
+
+}
diff --git a/models/admin/plugins/sites.php b/models/admin/plugins/sites.php
new file mode 100644 (file)
index 0000000..5485529
--- /dev/null
@@ -0,0 +1,150 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Members Dashboard
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+// Load Members data abstract
+require_once GLM_MEMBERS_PLUGINS_PLUGIN_CLASS_PATH.'/data/dataSites.php';
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_plugins_sites extends GlmDataSites
+{
+
+    /**
+     * WordPress 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 successfull 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 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.
+     *
+     */
+    public function modelAction ( $actionData = false )
+    {
+        $view     = 'sites';
+        $success  = true;
+        $option   = '';
+        $option2  = false;
+        $viewPath = 'admin/plugins/';
+
+        // Setup Foundation 6
+        wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'css/foundation-6.min.css' );
+        wp_enqueue_script( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . 'js/foundation-6.min.js' );
+
+        if ( isset( $_REQUEST['option'] ) ) {
+            $option = $_REQUEST['option'];
+        }
+
+        if ( isset( $_REQUEST['option2'] ) ) {
+            $option2 = $_REQUEST['option2'];
+        }
+
+        $tData        = array();
+        $templateData = array(
+            'newEntry'   => false,
+            'thisOption' => $option,
+        );
+
+        switch ( $option ) {
+
+        default:
+            break;
+        }
+
+        // Get all plugins.
+        $sites = $this->getList();
+
+        // Setup tData array.
+        $tData['sites'] = $sites;
+
+        $templateData = array_merge( $templateData, $tData );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status'           => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect'    => false,
+            'view'             => $viewPath . $view . '.html',
+            'data'             => $templateData
+        );
+
+    }
+
+}
index 565c1c7..9b3bbb9 100644 (file)
@@ -24,19 +24,24 @@ CREATE TABLE {prefix}plugins (
     name TINYTEXT NOT NULL,
     latest_version TINYTEXT NOT NULL,
     notes TEXT NULL,
+    glm_associate BOOLEAN NOT NULL DEFAULT true,
     PRIMARY KEY (id)
 );
 
 ----
 
 -- Sites
-CREATE TABLE {prefix}server (
+CREATE TABLE {prefix}sites (
     id INT NOT NULL AUTO_INCREMENT,
     name TINYTEXT NOT NULL,
     prod_url TINYTEXT NULL,
     dev_url TINYTEXT NULL,
     prod_server INT NULL,
     dev_server INT NULL,
+    map_key TINYTEXT NULL,
+    has_contacts BOOLEAN NOT NULL DEFAULT false,
+    has_members BOOLEAN NOT NULL DEFAULT false,
+    active BOOLEAN NOT NULL DEFAULT true,
     PRIMARY KEY (id)
 );
 
index 30cc68b..f08a238 100644 (file)
@@ -61,6 +61,10 @@ $glmMemberPluginsAddOnValidActions = array(
     'adminActions' => array(
         'plugins' => array(
             'index' => GLM_MEMBERS_PLUGINS_PLUGIN_SLUG,
+            'plugins' => GLM_MEMBERS_PLUGINS_PLUGIN_SLUG,
+            'sites'   => GLM_MEMBERS_PLUGINS_PLUGIN_SLUG,
+            'servers' => GLM_MEMBERS_PLUGINS_PLUGIN_SLUG,
+            'import'  => GLM_MEMBERS_PLUGINS_PLUGIN_SLUG,
         ),
     ),
     'frontActions' => array(
index dd460b4..37e444b 100644 (file)
@@ -1,8 +1,28 @@
 <div class="wrap" id="glm-member-db-messages-app">
     <h2>Plugin Manager</h2>
-    <h2 class="nav-tab-wrapper">
-        <a href="{$thisUrl}?page={$thisPage}&option=plugins" class="nav-tab{if $thisOption==plugins} nav-tab-active{/if}">Plugins</a>
-        <a href="{$thisUrl}?page={$thisPage}&option=sites" class="nav-tab{if $thisOption==sites} nav-tab-active{/if}">Sites</a>
-        <a href="{$thisUrl}?page={$thisPage}&option=servers" class="nav-tab{if $thisOption==servers} nav-tab-active{/if}">Servers</a>
-    </h2>
-    <div id="glm-admin-content-container" style="width: 1024px;">
+
+    <div id="glm-billing-nav" style="max-width: 1024px;">
+        <div class="top-bar stacked-for-small" id="responsive-menu">
+            <div class="top-bar-left">
+                <ul class=" menu">
+                    <li class="{if $thisAction == 'index' }is-active{/if}">
+                        <a href="{$thisUrl}?page={$thisPage}">Dashboard</a>
+                    </li>
+                    <li class="{if $thisAction == 'plugins'}is-active{/if}">
+                        <a href="{$thisUrl}?page={$thisPage}&glm_action=plugins">Plugins</a>
+                    </li>
+                    <li class="{if $thisAction == 'sites'}is-active{/if}">
+                        <a href="{$thisUrl}?page={$thisPage}&glm_action=sites">Sites</a>
+                    </li>
+                    <li class="{if $thisAction == 'servers'}is-active{/if}">
+                        <a href="{$thisUrl}?page={$thisPage}&glm_action=servers">Servers</a>
+                    </li>
+                    <li class="{if $thisAction == 'import'}is-active{/if}">
+                        <a href="{$thisUrl}?page={$thisPage}&glm_action=import">Import</a>
+                    </li>
+                </ul>
+            </div>
+        </div>
+    </div>
+
+    <div id="glm-admin-content-container" style="max-width: 1024px;">
diff --git a/views/admin/plugins/import.html b/views/admin/plugins/import.html
new file mode 100644 (file)
index 0000000..e56353c
--- /dev/null
@@ -0,0 +1,8 @@
+{* Import View *}
+{include file='admin/header.html'}
+
+<h3>Import from dev database</h3>
+
+<a href="{$thisUrl}?page={$thisPage}&glm_action=import&option=import" class="button primary">Import</a>
+
+{include file='admin/footer.html'}
index 9e75412..7b59e93 100644 (file)
@@ -1,18 +1,27 @@
 {include file='admin/header.html'}
 
-<h2>Plugins Dashboard</h2>
+<h3>Plugins Dashboard</h3>
+
+<div class="grid-x">
+    <div class="cell small-12 medium-4">
+        <div class="grid-x">
+            <div class="cell small-12">
+                <a href="{$thisUrl}?page={$thisPage}&option=editServer" class="button primary">Add Server</a>
+                <a href="{$thisUrl}?page={$thisPage}&option=editSite" class="button primary">Add Site</a>
+                <a href="{$thisUrl}?page={$thisPage}&option=editPlugin" class="button primary">Add Plugin</a>
+            </div>
+        </div>
+    </div>
+</div>
 
 <div class="glma-row">
     <div class="glma-small-4 glma-columns">
         <div class="glma-row">
             <div class="glma-small-5 glma-columns">
-                <a href="{$thisUrl}?page={$thisPage}&option=editServer" class="button button-primary">Add Server</a>
             </div>
             <div class="glma-small-5 glma-columns">
-                <a href="{$thisUrl}?page={$thisPage}&option=editSite" class="button button-primary">Add Site</a>
             </div>
             <div class="glma-small-5 glma-columns">
-                <a href="{$thisUrl}?page={$thisPage}&option=editPlugin" class="button button-primary">Add Plugin</a>
             </div>
         </div>
     </div>
diff --git a/views/admin/plugins/plugins.html b/views/admin/plugins/plugins.html
new file mode 100644 (file)
index 0000000..a987d03
--- /dev/null
@@ -0,0 +1,33 @@
+{* Plugins View File *}
+
+{* Header *}
+{include file="admin/header.html"}
+<h3>List Plugins</h3>
+
+<table class="stack hover">
+    <thead>
+        <tr>
+            <th width="10">ID</th>
+            <th>Name</th>
+            <th>Latest Version</th>
+            <th>GLMA</th>
+        </tr>
+    </thead>
+    <tbody>
+        {if $plugins}
+            {foreach $plugins as $plugin}
+                <tr>
+                    <td>{$plugin.id}</td>
+                    <td>{$plugin.name}</td>
+                    <td>{$plugin.latest_version}</td>
+                    <td>{if $plugin.glm_associate.value}Yes{else}No{/if}</td>
+                </tr>
+            {/foreach}
+        {/if}
+    </tbody>
+
+</table>
+
+
+{* Footer *}
+{include file="../../admin/footer.html"}
diff --git a/views/admin/plugins/servers.html b/views/admin/plugins/servers.html
new file mode 100644 (file)
index 0000000..9e5579a
--- /dev/null
@@ -0,0 +1,35 @@
+{* Servers View File *}
+
+{* Header *}
+{include file="admin/header.html"}
+<h3>List Servers</h3>
+
+<table class="stack hover">
+    <thead>
+        <tr>
+            <th width="10">ID</th>
+            <th>Name</th>
+            <th>Location</th>
+            <th>PHP Version</th>
+            <th>Mysql Version</th>
+        </tr>
+    </thead>
+    <tbody>
+        {if $servers}
+            {foreach $servers as $server}
+                <tr>
+                    <td>{$server.id}</td>
+                    <td>{$server.name}</td>
+                    <td>{$server.location}</td>
+                    <td>{$server.php_version}</td>
+                    <td>{$server.mysql_version}</td>
+                </tr>
+            {/foreach}
+        {/if}
+    </tbody>
+
+</table>
+
+
+{* Footer *}
+{include file="../../admin/footer.html"}
diff --git a/views/admin/plugins/sites.html b/views/admin/plugins/sites.html
new file mode 100644 (file)
index 0000000..b0ddc5c
--- /dev/null
@@ -0,0 +1,33 @@
+{* Sites View File *}
+
+{* Header *}
+{include file="admin/header.html"}
+<h3>List Sites</h3>
+
+<table class="stack hover">
+    <thead>
+        <tr>
+            <th width="10">ID</th>
+            <th>Name</th>
+            <th>Production Url</th>
+            <th>Dev Url</th>
+        </tr>
+    </thead>
+    <tbody>
+        {if $sites}
+            {foreach $sites as $site}
+                <tr>
+                    <td>{$site.id}</td>
+                    <td>{$site.name}</td>
+                    <td>{$site.prod_url}</td>
+                    <td>{$site.dev_url}</td>
+                </tr>
+            {/foreach}
+        {/if}
+    </tbody>
+
+</table>
+
+
+{* Footer *}
+{include file="../../admin/footer.html"}