Starting setup of new plugin.
authorChuck Scott <cscott@gaslightmedia.com>
Fri, 2 Mar 2018 21:07:23 +0000 (16:07 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Fri, 2 Mar 2018 21:07:23 +0000 (16:07 -0500)
Admin assets index model and view creted and added to menu and valid actions.
Added initial database tables for management and settings.

index.php
models/admin/assets/index.php [new file with mode: 0644]
setup/adminMenus.php
setup/databaseScripts/create_database_V0.0.1.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php [new file with mode: 0644]
setup/validActions.php
views/admin/assets/index.html [new file with mode: 0644]

index 391096d..9a4b661 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * Plugin Name: Gaslight Media Members Database Asset Management Add-On Plugin
+ * Plugin Name: Gaslight Media Members Database Asset Management
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: Provides management of various assets (i.e. room assignments).
  * Version: 0.0.1
@@ -44,10 +44,10 @@ if (!defined('ABSPATH')) {
  *  version from this plugin.
  */
 define('GLM_MEMBERS_ASSETS_PLUGIN_VERSION', '0.0.1');
-//define('GLM_MEMBERS_ASSETS_PLUGIN_DB_VERSION', '0.0.1');
+define('GLM_MEMBERS_ASSETS_PLUGIN_DB_VERSION', '0.0.1');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
-define('GLM_MEMBERS_ASSETS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0');
+define('GLM_MEMBERS_ASSETS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.10.24');
 
 // Check if plugin version is not current in WordPress option and if needed updated it
 if (GLM_MEMBERS_ASSETS_PLUGIN_VERSION != get_option('glmMembersAssetsPluginVersion')) {
diff --git a/models/admin/assets/index.php b/models/admin/assets/index.php
new file mode 100644 (file)
index 0000000..43b6677
--- /dev/null
@@ -0,0 +1,97 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Asset Management Dashboard
+ *
+ * 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 2018/03/02 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load Assets data abstract
+// require_once GLM_MEMBERS_ASSETS_PLUGIN_CLASS_PATH.'/data/dataAssets.php';
+
+class GlmMembersAdmin_assets_index // extends GlmDataAssetsIndex
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /**
+     * 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 Assets data class
+         */
+        // parent::__construct(false, false, true);
+
+    }
+
+    public function modelAction($actionData = false)
+    {
+        $view = 'index';
+
+
+        // Compile template data
+        $templateData = array(
+        );
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+            'status'        => true,
+            'modelRedirect' => false,
+            'view'          => 'admin/assets/'.$view.'.html',
+            'data'          => $templateData
+        );
+
+    }
+
+}
\ No newline at end of file
index 5ec3f55..de27354 100644 (file)
  *
  */
 
+add_submenu_page(
+    'glm-members-admin-menu-members',
+    'Asset Management',
+    'Asset Mgt',
+    'glm_members_members',
+    'glm-members-admin-menu-assets-index',
+    function() {$this->controller('assets', 'index');}
+    );
+
diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql
new file mode 100644 (file)
index 0000000..65ab5c6
--- /dev/null
@@ -0,0 +1,68 @@
+-- Gaslight Media Assets Database
+-- File Created: 03/02/2018 14:40:00
+-- Database Version: 0.0.19
+-- Database Creation Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+--
+/*
+ * General Database Organization
+ * -----------------------------
+ *
+ */
+
+-- Management Options
+-- General configurationm parameters for the Asset Management application
+-- Only one entry in this table!
+CREATE TABLE {prefix}management (
+    id INT NOT NULL AUTO_INCREMENT,
+    canonical_asset_page TINYTEXT NULL,                             -- Canonical page slug for assets
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Terms used in site modifiable on Management page in admin - Only 1 entry in this table
+-- Terms in this table should be all self-explanatory
+CREATE TABLE {prefix}settings_terms (
+    id INT NOT NULL AUTO_INCREMENT,
+    assets_term_assets_name TINYTEXT NULL,                      -- Term "Asset Management"
+    assets_term_asset TINYTEXT NULL,
+    assets_term_asset_cap TINYTEXT NULL,
+    assets_term_asset_plur TINYTEXT NULL,
+    assets_term_asset_plur_cap TINYTEXT NULL,
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Insert into management table
+INSERT INTO {prefix}management
+    (
+    canonical_asset_page
+    )
+    VALUES
+    (
+    'assets'                                                    -- assets_canonical_assets_page
+    );
+
+----
+
+-- Insert into settings_terms table
+INSERT INTO {prefix}settings_terms
+    (
+    assets_term_assets_name,
+    assets_term_asset,
+    assets_term_asset_cap,
+    assets_term_asset_plur,
+    assets_term_asset_plur_cap
+    )
+    VALUES
+    (
+    'Asset Management',                                         -- assets_term_assets_name
+    'asset',                                                    -- assets_term_asset
+    'Asset',                                                    -- assets_term_asset_cap
+    'assets',                                                   -- assets_term_asset_plur
+    'Assets'                                                    -- assets_term_asset_plur_cap
+    );
diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php
new file mode 100644 (file)
index 0000000..ac27d09
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Asset Management DB Versions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMemberEventAssetsDatabase
+ * @author   Steve Sutton <steve@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  dbVersions.php $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+$glmMembersAssetsDbVersions = array(
+    '0.0.1' => array('version' => '0.0.1', 'tables' => 2, 'date' => '03/2/2018')
+);
+
+
index a3fc0ef..d473d8e 100644 (file)
@@ -59,6 +59,9 @@
 
 $glmMembersAssetsAddOnValidActions = array(
     'adminActions' => array(
+        'assets' => array(
+            'index' => GLM_MEMBERS_ASSETS_PLUGIN_SLUG
+        )
     ),
     'frontActions' => array(
     )
diff --git a/views/admin/assets/index.html b/views/admin/assets/index.html
new file mode 100644 (file)
index 0000000..ae11402
--- /dev/null
@@ -0,0 +1,15 @@
+<h1 class="glm-admin-table-header">Asset Management Dashboard</h1>
+
+<div>
+    <h3>Pending Actions</h3>
+</div>
+
+<div>
+    <h3>Assets List</h3>
+</div>
+
+
+<div>
+    <h3>Assets Calendar</h3>
+</div>
+