Events near done, menu resturctur
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 20 Apr 2016 21:03:21 +0000 (17:03 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 20 Apr 2016 21:03:21 +0000 (17:03 -0400)
27 files changed:
classes/data/dataMembers.php
classes/data/settings/dataSettingsGeneral.php
classes/data/settings/dataSettingsTerms.php
classes/data/settings/dataSettingsTheme.php [new file with mode: 0644]
classes/glmPluginSupport.php
controllers/admin.php
css/admin.css
glm-member-db.php [deleted file]
index.php
lib/GlmDataAbstract/DataAbstract.php
lib/GlmDataAbstract/documentation.odt
models/admin/management/theme.php [new file with mode: 0644]
models/admin/member/memberInfo.php
models/admin/members/list.php
setup/adminMenus.php
setup/databaseScripts/create_database_V1.1.2.sql [deleted file]
setup/databaseScripts/create_database_V1.1.4.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/drop_database_V1.1.2.sql [deleted file]
setup/databaseScripts/drop_database_V1.1.3.sql [new file with mode: 0644]
setup/databaseScripts/update_database_V1.1.3.php [new file with mode: 0644]
setup/databaseScripts/update_database_V1.1.3.sql [new file with mode: 0644]
setup/databaseScripts/update_database_V1.1.4.sql [new file with mode: 0644]
setup/validActions.php
views/admin/management/header.html
views/admin/management/theme.html [new file with mode: 0644]
views/admin/members/list.html

index ab54783..925ea7d 100644 (file)
@@ -304,7 +304,7 @@ class GlmDataMembers extends GlmDataAbstract {
      * @return array Array of Name and ID for all members
      * @access public
      */
-    public function getSimpleMembersList($where = '')
+    public function getSimpleMembersList($where = '', $order = '', $fieldVals = true, $idField = 'id', $start = false, $limit = false)
     {
 
         // Save the current fields array and make a copy
@@ -320,7 +320,7 @@ class GlmDataMembers extends GlmDataAbstract {
             'active_id' => $fSave['active_id']
         );
 
-        $memberList = $this->getList($where);
+        $memberList = $this->getList($where, $order, $fieldVals, $idField, $start, $limit);
 
         // Restore the fields list
         $this->fields = $fSave;
@@ -328,6 +328,30 @@ class GlmDataMembers extends GlmDataAbstract {
         return $memberList;
     }
 
+    /**
+     * Get ID/Name list
+     *
+     * @param string $where
+     *
+     * @return array ID/Name pairs
+     */
+    public function getIdName($where = 'true')
+    {
+        $savedFields = $this->fields;
+
+        $this->fields = array(
+            'id' => $savedFields['id'],
+            'name' => $savedFields['name']
+        );
+
+        $r = $this->getList($where);
+
+        $this->fields = $savedFields;
+
+        return $r;
+
+    }
+
 }
 
 ?>
\ No newline at end of file
index c803295..d90028c 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 /**
- * EventManagementDataSettingsGeneral class
+ * GlmDataSettingsGeneral class
  *
  * PHP version 5
  *
index 4a05295..d379f96 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 /**
- * EventManagementDataSettingsGeneral class
+ * GlmDataSettingsTerms class
  *
  * PHP version 5
  *
diff --git a/classes/data/settings/dataSettingsTheme.php b/classes/data/settings/dataSettingsTheme.php
new file mode 100644 (file)
index 0000000..e9b19a0
--- /dev/null
@@ -0,0 +1,127 @@
+<?php
+
+/**
+ * GLM Member-DB WordPress Plugin
+ * Theme Settings data class
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package  GLM Member-DB
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: dataSettingsTerms.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * GlmDataSettingsTheme class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *          @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ */
+class GlmDataSettingsTheme extends GlmDataAbstract
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Field definitions
+     *
+     * @var $ini
+     * @access public
+     */
+    public $table;
+
+    /**
+     * Field definitions
+     *
+     * 'type' is type of field as defined by the application
+     * text Regular text field
+     * pointer Pointer to an entry in another table
+     * 'filters' is the filter name for a particular filter ID in PHP filter
+     * functions
+     * See PHP filter_id()
+     *
+     * 'use' is when to use the field
+     * l = List
+     * g = Get
+     * n = New
+     * i = Insert
+     * e = Edit
+     * u = Update
+     * d = Delete
+     * a = All
+     *
+     * @var $ini
+     * @access public
+     */
+    public $fields = false;
+
+    /**
+     * Constructor
+     *
+     * @param object $d
+     *            database connection
+     *
+     * @return void
+     * @access public
+     */
+    function __construct ($wpdb, $config)
+    {
+
+        // If this class is not being extended along with existing $wpdb and $config
+           if (!$this->wpdb) {
+
+           // Save WordPress Database object
+           $this->wpdb = $wpdb;
+
+           // Save plugin configuration object
+           $this->config = $config;
+
+           }
+
+        /*
+         * Table Name
+         */
+        $this->table = GLM_MEMBERS_PLUGIN_DB_PREFIX . 'settings_theme';
+
+        /*
+         * Table Data Fields
+         */
+        $this->fields = array(
+
+                'id' => array(
+                        'field' => 'id',
+                        'type' => 'integer',
+                        'view_only' => true,
+                        'use' => 'a'
+                )
+
+        );
+
+        if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
+        }
+
+    }
+}
+
+?>
\ No newline at end of file
index 34a01d6..d4fa986 100644 (file)
@@ -184,7 +184,15 @@ class GlmPluginSupport
             // Has this plug-in registered any database versions
             if ($a['database']) {
 
-                $dbVersion = get_option($a['database']['dbActiveVersionOption']);
+                if (!isset($a['database']['dbActiveVersionOption'])) {
+                    $startupNotices .= '<p>There is missing database information for plugin/add-on '.$a['name']."."
+                            ."<br>Incorrect plugin/add-on configuration is suspected. Check add-on registration data array for this add-on.</p>";
+                    $db_error = true;
+                    $dbVersion = false;
+
+                } else {
+                    $dbVersion = get_option($a['database']['dbActiveVersionOption']);
+                }
 
 /*
                 // Do a sanity check on the database version
@@ -248,40 +256,60 @@ class GlmPluginSupport
                     // Get current database version
                     $dbVersion = $a['database']['dbCurrentVersion'];
 
-                    // Read in Database creation script
-                    $sqlFile = $a['database']['dbScriptPath'].'/create_database_V'.$dbVersion.'.sql';
-                    $sql = file_get_contents($sqlFile);
+                    // Check for a version string
+                    if (trim($dbVersion == '')) {
 
-                    // Replace {prefix} with table name prefix
-                    $sql = str_replace('{prefix}', $a['database']['dbPrefix'], $sql);
+                        $startupNotices .= '<P>Failure installing database tables for the '.$a['name']
+                            .'<br><b>No database version set:</b></p>';
 
-                    // Split script into separate queries by looking for lines with only "----"
-                    $queries = preg_split('/^----$/m', $sql);
+                    } else {
 
-                    // Try executing all queries to build database
-                    do {
-                        $q = current($queries);
-                        $this->wpdb->query($q);
-                        $queryError = $this->wpdb->last_error;
-                    } while ($queryError == '' && next($queries));
+                        // Create name for Database creation script
+                        $sqlFile = $a['database']['dbScriptPath'].'/create_database_V'.$dbVersion.'.sql';
 
-                    // If there were no errors
-                    if (trim($queryError) == '') {
+                        // Make sure it exists
+                        if (!is_file($sqlFile)) {
 
-                        // Notify the user that the database has been installed
-                        $startupNotices .= '<P>New database tables installed for the '.$a['name'].' plugin.</P>';
+                            $startupNotices .= '<P>Failure installing database tables for the '.$a['name']
+                                .'<br><b>Database Creation Script not found:</b> '.$sqlFile.'</p>';
 
-                        // Save the version of the installed database
-                        update_option($a['database']['dbActiveVersionOption'], $dbVersion);
+                        } else {
+                            $sql = file_get_contents($sqlFile);
 
-                        // Indicate that we were successfull
-                        $db_setup_status = true;
+                            // Replace {prefix} with table name prefix
+                            $sql = str_replace('{prefix}', $a['database']['dbPrefix'], $sql);
 
-                    } else {
-                        $startupNotices .= '<P>Failure installing database tables for the '.$a['name']
-                                .'<br><b>Database Installation Error:</b> '.print_r($queryError,1)
-                                .'<br><pre>'.$q.'</pre></P>';
-                    }
+                            // Split script into separate queries by looking for lines with only "----"
+                            $queries = preg_split('/^----$/m', $sql);
+
+                            // Try executing all queries to build database
+                            do {
+                                $q = current($queries);
+                                $this->wpdb->query($q);
+                                $queryError = $this->wpdb->last_error;
+                            } while ($queryError == '' && next($queries));
+
+                            // If there were no errors
+                            if (trim($queryError) == '') {
+
+                                // Notify the user that the database has been installed
+                                $startupNotices .= '<P>New database tables installed for the '.$a['name'].' plugin.</P>';
+
+                                // Save the version of the installed database
+                                update_option($a['database']['dbActiveVersionOption'], $dbVersion);
+
+                                // Indicate that we were successfull
+                                $db_setup_status = true;
+
+                            } else {
+                                $startupNotices .= '<P>Failure installing database tables for the '.$a['name']
+                                        .'<br><b>Database Installation Error:</b> '.print_r($queryError,1)
+                                        .'<br><pre>'.$q.'</pre></P>';
+                            }
+
+                        } // db creation file check
+
+                    } // db version check
 
                 // Otherwise, check if we need to update the database
                 } elseif ($dbVersion != $a['database']['dbCurrentVersion']) {
index f149658..fab3f2c 100644 (file)
@@ -696,7 +696,11 @@ class glmMembersAdmin extends GlmPluginSupport
         do {
 
             if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-                $this->addNotice("<b>Requested Action:</b> Menu item = $menuItem, Action = $action", 'Process');
+                $option = '';
+                if (isset($_REQUEST['option'])) {
+                    $option = ', Option = '.$_REQUEST['option'];
+                }
+                $this->addNotice("<b>Requested Action:</b> Menu item = $menuItem, Action = $action".$option, 'Process');
             }
 
             $modelRedirect = false;
index 99a9472..5c3d988 100644 (file)
@@ -41,6 +41,9 @@
 .glm-clear {
     clear: both;
 }
+.glm-nowrap {
+    white-space: nowrap;
+}
 .glm-hidden {
     display: none !important;    
 }
diff --git a/glm-member-db.php b/glm-member-db.php
deleted file mode 100644 (file)
index 704dab0..0000000
+++ /dev/null
@@ -1,441 +0,0 @@
-<?php
-/**
- * Plugin Name: GLM Members Database
- * Plugin URI: http://www.gaslightmedia.com/
- * Description: Gaslight Media Members Database.
- * Version: 1.0.58
- * Author: Chuck Scott
- * Author URI: http://www.gaslightmedia.com/
- * License: GPL2
- */
-
-/**
- * Gaslight Media Members Database
- * Index
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package glmMembersDatabase
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.0.47
- */
-
-/*
- *  Plugin and Database Versions
- *
- *  Database updates for the main plugin and add-ons must also be
- *  listed in the /setup/databaseScripts/dbVersions.php file of
- *  the corresponding plugin/add-on. The table in that file
- *  determines which version is installed for a new activation
- *  and which update scrips are run to bring the database up to
- *  the current version.
- *
- *  We check the plugin version stored in the WordPress option below
- *  so that we're sure the other add-ons see an up to date
- *  version from this plugin.
- *
- */
-
-define('GLM_MEMBERS_PLUGIN_VERSION', '1.0.58');
-define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.2');
-
-// Check if plugin version is not current in WordPress option and if needed updated it
-if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) {
-    update_option('glmMembersDatabasePluginVersion', GLM_MEMBERS_PLUGIN_VERSION);
-}
-
-/*
- * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * *******************************************************************************
- *
- * *** Directory and File Structure ***
- *
- * index.php
- *
- * Index file for this plugin. All plugin processing starts here. (See
- * "Process Flow" below.)
- *
- * controllers
- *
- * Directory containing any controllers. Typically there
- * would be admin and front controllers in this directory.
- * These controllers do the general setup for the plugin,
- * determine and call the appropriate model, determine the
- * appropriate view, then merge any data returned by the model
- * with the view and output the result as appropriate.
- *
- * When executed, a model may determine that it cannot handle
- * the current request and return such a notice to the controller
- * possibly with a suggested model to execute. Models may also
- * return a desired view back to the controller based on the
- * result of processing, but should do so in a generic way so
- * as to permit multi-lingual output and use of multiple "skins"
- * (but not to the exception of appropriate use of WordPress
- * Themes).
- *
- * css
- *
- * Directory containing any css files specific to this plugin.
- * The use of additional styling should be kept to a minimum
- * so as to not interfere with the application of WordPress
- * default styling and Themes.
- *
- * js
- *
- * Directory containing any JAVAscript files specific to this
- * Plugin. This directory should be reserved for general script
- * files that provide functionality that can be used in various
- * views. Any JAVAscript that is specific to a view should be
- * located along with the associated view as it is logically
- * part of the view.
- *
- * lib
- *
- * Directory containing any class or function libraries that
- * are used generally by this plugin. Any class or other code
- * that is specific to a particular model should be located
- * in, or along with, that model since it is logically
- * associated only with that model.
- *
- * misc
- *
- * Directory containing ancillary directories and files. This
- * might be used for things like cach directories. An example
- * might be the "smarty" directory for Smaarty Templates.
- *
- * models
- *
- * Directory containing model files that execute a specific
- * process in this plugin. If this is a simple plugin, then
- * the model files can be placed directly in this directory.
- * If it's a more complex plugin, then there should be sub-
- * directories for various groupings of related model files.
- *
- * An individual model may consist of a grouping of files,
- * such as additional class files, that are specific only to
- * that model. In that case, these should be located in a
- * subdirectory under where the model file called by the
- * controller is located and that directory should be named
- * so as to be obviously associated with that model.
- *
- * There are three special files in the models directory. These
- * are activate.php, deactivate.php, and uninstall.php. These
- * are called via hooks setup in this file and should always
- * be here. If they do not provide any real functionality, they
- * should at least be a shell that can be called for those
- * situations.
- *
- * views
- *
- * Directory containing view files for producing output upon
- * request of a model file in the models directory. If this
- * is a simply plugin, then the view files can be placed
- * directly in this directory. If it's a more complex plugin,
- * then there should be sub-directories for the various
- * groupings of related view files. If using sub-directories,
- * those should generally match the associated model directories.
- * It may also be wise to use separate front and admin
- * directories under views to keep things organized.
- *
- * Additionally, views may be grouped in such a way that they
- * support the selection of various "skins" that output in
- * different ways, although any styling should be provided by
- * WordPress Themes or use default WordPress styling.
- *
- * *** Process Flow ***
- *
- * WordPress calls the plugin index file. All plugin processing starts here.
- *
- * The plugin index file performs the following operations ...
- * - Sets-up any required plugin-wide defines and data
- * - Instatiates any plugin-wide classes and objects
- * - Sets-up any plugin-wide WordPress hooks
- * - Determines which controller is to be executed
- * - Executes the selected controller
- *
- * The selected controller performs the following operations ...
- * - Sets-up any controller specific defines and data
- * - Instatiates any controller specific classes and objects
- * - Sets-up any controller specific WordPress hooks
- * - Determines which model process is to be executed
- * - Executes the selected model
- *
- * The selected model performs the following operations ...
- * - Sets-up any model specific defines and data
- * - Instatiates any model specific classes and objects
- * - Sets-up any model specific WordPress hooks
- * - Performs any specific processing required of the model
- * - Determines which view is to be used to generate output
- * - Generates output based on model data and the selected view
- *
- * WordPress wraps everything up
- *
- * ********************************************************************************
- */
-
-// Check that we're being called by WordPress.
-if (!defined('ABSPATH')) {
-    die("Please do not call this code directly!");
-}
-
-/*
- *
- * Some initial setup and tests
- *
- */
-
-$startupNotices = '';
-
-// Get standard defined parameters
-require_once('defines.php');
-
-// Get configuration
-require_once('config.php');
-
-// Try to set the DB version option to false (new plugin) - If it's already set this won't do anything.
-add_option('glmMembersDatabaseDbVersion', false);
-
-/*
- *
- * Hook in add-ons and integrate their actions
- *
- * Each add-on should add an array element to the supplied array using the following structure.
- *
- * $addOns[{slug for add-on}] = array(
- *      'dir' => {path to add-on directory},
- *      'name' => {text name for add-on},
- *      'short_name' => {an abreviated name for the add-on},
- *      'slug' => {slug for add-on},
- *      'config' => {optional array of config data to be merged into $config},
- *      'actions' => array(
- *          'adminActions => array(
- *              '{menu name}' => array(
- *                  '{action}' => '{add-on slug}',
- *                  ... additional actions ...
- *              ),
- *              ... additional menu names ...
- *          'frontActions' => array(
- *              '{page}' => array(
- *                  '{action name}' => '{add-on slug}',
- *                  ... addional actions ---
- *              ),
- *              ... additional pages ...
- *          )
- *      ),
- *      'shortcodes' => array(
- *          '{shortcode} => array(
- *              'plugin' => {plugin slug},
- *              'menu' => '{menu},
- *              'action' => '{action}',
- *              'table' => {table name where default values for 'attributes' are stored},
- *              'adttributes' => array({array of attributes that might be in the shortcode})
- *          ),
- *          ... additional shortcodes ...
- *      ),
- *          // if the add-on is adding database tables use this, otherwise FALSE
- *      'database' => array(
- *          'dbPrefix' => '{database prefix to use}',
- *          'dbCurrentVersion' => '{current add-on database version number}',
- *          'dbActiveVersionOption' => '{option name used to get current active database version}',
- *          'dbScriptPath' => '{full path to add-on database scripts directory}',
- *          'dbVersions' => array(
- *              '{version#}' => array('version' => '{version#}', 'tables' => {# of tables},
- *           ... additional versions in order of version number - highest is last ---
- *      )
- *
- * )
- *
- * Note that the database prefix must not start with 'glm_members_'. It can however be something
- * like 'glm_membersPackaging_', otherwise the tables will be counted along with those of the main
- * plugin and database checks will fail.
- *
- * Also note that the default array includes information on the main member db plugin. This is
- * done for consistency, particularly for database maintenance
- */
-require_once(GLM_MEMBERS_PLUGIN_SETUP_PATH.'/validActions.php');
-require_once(GLM_MEMBERS_PLUGIN_SETUP_PATH.'/shortcodes.php');
-require_once(GLM_MEMBERS_PLUGIN_DB_SCRIPTS.'/dbVersions.php');
-$config['addOns'] = array(
-    GLM_MEMBERS_PLUGIN_SLUG => array(
-        'dir' => GLM_MEMBERS_PLUGIN_PATH,
-        'name' =>  GLM_MEMBERS_PLUGIN_NAME,
-        'short_name' => GLM_MEMBERS_PLUGIN_SHORT_NAME,
-        'slug' => GLM_MEMBERS_PLUGIN_SLUG,
-        'actions' => $glmMembersValidActions,
-        'shortcodes' => $glmMembersShortcodes,
-        'shortcodesDescription' => $glmMembersShortcodesDescription,
-        'database' => array(
-            'dbPrefix' => GLM_MEMBERS_PLUGIN_DB_PREFIX,
-            'dbCurrentVersion' => GLM_MEMBERS_PLUGIN_DB_VERSION,
-            'dbActiveVersionOption' => GLM_MEMBERS_PLUGIN_ACTIVE_DB_OPTION,
-            'dbScriptPath' => GLM_MEMBERS_PLUGIN_DB_SCRIPTS,
-            'dbVersions' => $glmMembersDbVersions
-        )
-    )
-);
-
-// Create hook for registering add-on plugins and their features
-$config['addOns'] = apply_filters('glm-member-db-register-addon', $config['addOns']);
-
-// If any add-ons have registered
-$config['validActions'] = array();
-$config['shortcodes'] = array();
-if (count($config['addOns']) > 0) {
-
-    // For each add-on that's registered
-    foreach ($config['addOns'] as $a) {
-
-        // Add their valid actions to the main validActions config array
-        if (isset($a['actions'])) {
-            $config['validActions'] = array_merge_recursive($config['validActions'], $a['actions']);
-        }
-
-        // Add their shortcodes to the main shortcodes config array
-        if (isset($a['shortcodes'])) {
-            $config['shortcodes'] = array_merge_recursive($config['shortcodes'], $a['shortcodes']);
-        }
-
-        // If the add-on has supplied additional config parameters when registering
-        if (isset($a['config'])) {
-            $config = array_merge_recursive($config, $a['config']);
-        }
-
-        // If the add-on has additional config parameters in a plugin.ini file
-        $iniFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.'/'.$a['slug'].'/config/plugin.ini';
-        if (isset($iniFile)) {
-
-            // Parse the add-on's configuration file
-            $addOnIni = parse_ini_file($iniFile);
-
-            // Replace parameters that are in the theme ini file
-            $config = array_replace($config, $addOnIni);
-
-        }
-    }
-}
-
-/*
- *
- * Activate and Deactivate hooks
- *
- */
-
-// Activate
-function glmMembersPluginActivate ()
-{
-    global $wpdb, $config;
-    require_once (GLM_MEMBERS_PLUGIN_PATH . '/activate.php');
-    new glmMembersPluginActivate($wpdb, $config);
-}
-register_activation_hook(__FILE__, 'glmMembersPluginActivate');
-
-// Deactivate
-function glmMembersPluginDeactivate ()
-{
-    global $wpdb, $config;
-    require_once (GLM_MEMBERS_PLUGIN_PATH . '/deactivate.php');
-    $x = new glmMembersPluginDeactivate($wpdb, $config);
-    return false;
-}
-register_deactivation_hook(__FILE__, 'glmMembersPluginDeactivate');
-
-/*
- *
- * Load any other common files needed
- *
- */
-
-// Load data abstract
-require_once(GLM_MEMBERS_PLUGIN_LIB_PATH.'/GlmDataAbstract/DataAbstract.php');
-
-// Load glmPluginSupport class
-require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
-
-// Load Smarty Template Support
-require_once (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
-
-/*
- *  Hook through which an add-on may supply additional logged in user information and
- *  have that data stored in the config array. Typically it would be the
- *  glm-members-db-contacts add-on supplying the information.
- *
- *  This hook provides default data with the current WordPress user 'data' object
- *  as a 'wpUser' sub-array if a WordPress user is logged in. If not 'wpUser' will
- *  be false. The supplied data is the basic information on the WordPress user
- *  provided by the 'data' object from wp_get_current_user().
- *
- *  To permit more than one routine to access this filter and therefore to supply
- *  additional information on the logged in user, code may merge it's own data or may
- *  add another sub-array containing user information specific to an add-on (i.e.
- *  contacts add-on might supply a 'contactUser' sub-array).
- *
- */
-if (function_exists('is_user_logged_in')) {
-    $config['loggedInUser'] = array(
-        'wpUser' => false
-    );
-    if (is_user_logged_in()) {
-        $config['loggedInUser']['wpUser'] = (array) wp_get_current_user()->data;
-    }
-    $config['loggedInUser'] = apply_filters('glm_members_current_logged_in_user', $config['loggedInUser']);
-}
-
-/*
- *
- * Determine which controller to load
- *
- */
-
-// If the call to this code is to display a separate debug window
-if (isset($_REQUEST['glmDebugWindow']) && $_REQUEST['glmDebugWindow'] == true) {
-    glmMembersAdminNotices(true);
-    exit;
-
-// Otherwise select appropriate controller
-} elseif (is_admin()) {
-    require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/admin.php');
-    new glmMembersAdmin($wpdb, $config);
-} else {
-    require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/front.php');
-    new glmMembersFront($wpdb, $config);
-}
-
-/*
- * Display any notices?
- */
-
-// Display any notices that need to be displayed at the top of the admin content area
-function glmMembersWordpressAdminNotices() {
-    global $startupNotices;
-    echo '<div class="updated">'.GLM_MEMBERS_PLUGIN_NAME.' Plugin Notice<br>'.$startupNotices.'</div>';
-}
-if ($startupNotices != '') {
-    add_action('admin_notices','glmMembersWordpressAdminNotices');
-}
-
-// If not doing debug, then clear all of the debug messages
-if (!GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-    delete_option('glmMembersAdminNoticeAlerts');
-    delete_option('glmMembersAdminNotices');
-    delete_option('glmMembersAdminNoticeProcess');
-    delete_option('glmMembersAdminNoticeDataBlocks');
-}
-
index 7e91415..b9ccc3d 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,2 +1,441 @@
 <?php
-// Silence is golden.
\ No newline at end of file
+/**
+ * Plugin Name: GLM Members Database
+ * Plugin URI: http://www.gaslightmedia.com/
+ * Description: Gaslight Media Members Database.
+ * Version: 1.0.58
+ * Author: Chuck Scott
+ * Author URI: http://www.gaslightmedia.com/
+ * License: GPL2
+ */
+
+/**
+ * Gaslight Media Members Database
+ * Index
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 1.0.47
+ */
+
+/*
+ *  Plugin and Database Versions
+ *
+ *  Database updates for the main plugin and add-ons must also be
+ *  listed in the /setup/databaseScripts/dbVersions.php file of
+ *  the corresponding plugin/add-on. The table in that file
+ *  determines which version is installed for a new activation
+ *  and which update scrips are run to bring the database up to
+ *  the current version.
+ *
+ *  We check the plugin version stored in the WordPress option below
+ *  so that we're sure the other add-ons see an up to date
+ *  version from this plugin.
+ *
+ */
+
+define('GLM_MEMBERS_PLUGIN_VERSION', '1.0.58');
+define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.4');
+
+// Check if plugin version is not current in WordPress option and if needed updated it
+if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) {
+    update_option('glmMembersDatabasePluginVersion', GLM_MEMBERS_PLUGIN_VERSION);
+}
+
+/*
+ * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * *******************************************************************************
+ *
+ * *** Directory and File Structure ***
+ *
+ * index.php
+ *
+ * Index file for this plugin. All plugin processing starts here. (See
+ * "Process Flow" below.)
+ *
+ * controllers
+ *
+ * Directory containing any controllers. Typically there
+ * would be admin and front controllers in this directory.
+ * These controllers do the general setup for the plugin,
+ * determine and call the appropriate model, determine the
+ * appropriate view, then merge any data returned by the model
+ * with the view and output the result as appropriate.
+ *
+ * When executed, a model may determine that it cannot handle
+ * the current request and return such a notice to the controller
+ * possibly with a suggested model to execute. Models may also
+ * return a desired view back to the controller based on the
+ * result of processing, but should do so in a generic way so
+ * as to permit multi-lingual output and use of multiple "skins"
+ * (but not to the exception of appropriate use of WordPress
+ * Themes).
+ *
+ * css
+ *
+ * Directory containing any css files specific to this plugin.
+ * The use of additional styling should be kept to a minimum
+ * so as to not interfere with the application of WordPress
+ * default styling and Themes.
+ *
+ * js
+ *
+ * Directory containing any JAVAscript files specific to this
+ * Plugin. This directory should be reserved for general script
+ * files that provide functionality that can be used in various
+ * views. Any JAVAscript that is specific to a view should be
+ * located along with the associated view as it is logically
+ * part of the view.
+ *
+ * lib
+ *
+ * Directory containing any class or function libraries that
+ * are used generally by this plugin. Any class or other code
+ * that is specific to a particular model should be located
+ * in, or along with, that model since it is logically
+ * associated only with that model.
+ *
+ * misc
+ *
+ * Directory containing ancillary directories and files. This
+ * might be used for things like cach directories. An example
+ * might be the "smarty" directory for Smaarty Templates.
+ *
+ * models
+ *
+ * Directory containing model files that execute a specific
+ * process in this plugin. If this is a simple plugin, then
+ * the model files can be placed directly in this directory.
+ * If it's a more complex plugin, then there should be sub-
+ * directories for various groupings of related model files.
+ *
+ * An individual model may consist of a grouping of files,
+ * such as additional class files, that are specific only to
+ * that model. In that case, these should be located in a
+ * subdirectory under where the model file called by the
+ * controller is located and that directory should be named
+ * so as to be obviously associated with that model.
+ *
+ * There are three special files in the models directory. These
+ * are activate.php, deactivate.php, and uninstall.php. These
+ * are called via hooks setup in this file and should always
+ * be here. If they do not provide any real functionality, they
+ * should at least be a shell that can be called for those
+ * situations.
+ *
+ * views
+ *
+ * Directory containing view files for producing output upon
+ * request of a model file in the models directory. If this
+ * is a simply plugin, then the view files can be placed
+ * directly in this directory. If it's a more complex plugin,
+ * then there should be sub-directories for the various
+ * groupings of related view files. If using sub-directories,
+ * those should generally match the associated model directories.
+ * It may also be wise to use separate front and admin
+ * directories under views to keep things organized.
+ *
+ * Additionally, views may be grouped in such a way that they
+ * support the selection of various "skins" that output in
+ * different ways, although any styling should be provided by
+ * WordPress Themes or use default WordPress styling.
+ *
+ * *** Process Flow ***
+ *
+ * WordPress calls the plugin index file. All plugin processing starts here.
+ *
+ * The plugin index file performs the following operations ...
+ * - Sets-up any required plugin-wide defines and data
+ * - Instatiates any plugin-wide classes and objects
+ * - Sets-up any plugin-wide WordPress hooks
+ * - Determines which controller is to be executed
+ * - Executes the selected controller
+ *
+ * The selected controller performs the following operations ...
+ * - Sets-up any controller specific defines and data
+ * - Instatiates any controller specific classes and objects
+ * - Sets-up any controller specific WordPress hooks
+ * - Determines which model process is to be executed
+ * - Executes the selected model
+ *
+ * The selected model performs the following operations ...
+ * - Sets-up any model specific defines and data
+ * - Instatiates any model specific classes and objects
+ * - Sets-up any model specific WordPress hooks
+ * - Performs any specific processing required of the model
+ * - Determines which view is to be used to generate output
+ * - Generates output based on model data and the selected view
+ *
+ * WordPress wraps everything up
+ *
+ * ********************************************************************************
+ */
+
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+    die("Please do not call this code directly!");
+}
+
+/*
+ *
+ * Some initial setup and tests
+ *
+ */
+
+$startupNotices = '';
+
+// Get standard defined parameters
+require_once('defines.php');
+
+// Get configuration
+require_once('config.php');
+
+// Try to set the DB version option to false (new plugin) - If it's already set this won't do anything.
+add_option('glmMembersDatabaseDbVersion', false);
+
+/*
+ *
+ * Hook in add-ons and integrate their actions
+ *
+ * Each add-on should add an array element to the supplied array using the following structure.
+ *
+ * $addOns[{slug for add-on}] = array(
+ *      'dir' => {path to add-on directory},
+ *      'name' => {text name for add-on},
+ *      'short_name' => {an abreviated name for the add-on},
+ *      'slug' => {slug for add-on},
+ *      'config' => {optional array of config data to be merged into $config},
+ *      'actions' => array(
+ *          'adminActions => array(
+ *              '{menu name}' => array(
+ *                  '{action}' => '{add-on slug}',
+ *                  ... additional actions ...
+ *              ),
+ *              ... additional menu names ...
+ *          'frontActions' => array(
+ *              '{page}' => array(
+ *                  '{action name}' => '{add-on slug}',
+ *                  ... addional actions ---
+ *              ),
+ *              ... additional pages ...
+ *          )
+ *      ),
+ *      'shortcodes' => array(
+ *          '{shortcode} => array(
+ *              'plugin' => {plugin slug},
+ *              'menu' => '{menu},
+ *              'action' => '{action}',
+ *              'table' => {table name where default values for 'attributes' are stored},
+ *              'adttributes' => array({array of attributes that might be in the shortcode})
+ *          ),
+ *          ... additional shortcodes ...
+ *      ),
+ *          // if the add-on is adding database tables use this, otherwise FALSE
+ *      'database' => array(
+ *          'dbPrefix' => '{database prefix to use}',
+ *          'dbCurrentVersion' => '{current add-on database version number}',
+ *          'dbActiveVersionOption' => '{option name used to get current active database version}',
+ *          'dbScriptPath' => '{full path to add-on database scripts directory}',
+ *          'dbVersions' => array(
+ *              '{version#}' => array('version' => '{version#}', 'tables' => {# of tables},
+ *           ... additional versions in order of version number - highest is last ---
+ *      )
+ *
+ * )
+ *
+ * Note that the database prefix must not start with 'glm_members_'. It can however be something
+ * like 'glm_membersPackaging_', otherwise the tables will be counted along with those of the main
+ * plugin and database checks will fail.
+ *
+ * Also note that the default array includes information on the main member db plugin. This is
+ * done for consistency, particularly for database maintenance
+ */
+require_once(GLM_MEMBERS_PLUGIN_SETUP_PATH.'/validActions.php');
+require_once(GLM_MEMBERS_PLUGIN_SETUP_PATH.'/shortcodes.php');
+require_once(GLM_MEMBERS_PLUGIN_DB_SCRIPTS.'/dbVersions.php');
+$config['addOns'] = array(
+    GLM_MEMBERS_PLUGIN_SLUG => array(
+        'dir' => GLM_MEMBERS_PLUGIN_PATH,
+        'name' =>  GLM_MEMBERS_PLUGIN_NAME,
+        'short_name' => GLM_MEMBERS_PLUGIN_SHORT_NAME,
+        'slug' => GLM_MEMBERS_PLUGIN_SLUG,
+        'actions' => $glmMembersValidActions,
+        'shortcodes' => $glmMembersShortcodes,
+        'shortcodesDescription' => $glmMembersShortcodesDescription,
+        'database' => array(
+            'dbPrefix' => GLM_MEMBERS_PLUGIN_DB_PREFIX,
+            'dbCurrentVersion' => GLM_MEMBERS_PLUGIN_DB_VERSION,
+            'dbActiveVersionOption' => GLM_MEMBERS_PLUGIN_ACTIVE_DB_OPTION,
+            'dbScriptPath' => GLM_MEMBERS_PLUGIN_DB_SCRIPTS,
+            'dbVersions' => $glmMembersDbVersions
+        )
+    )
+);
+
+// Create hook for registering add-on plugins and their features
+$config['addOns'] = apply_filters('glm-member-db-register-addon', $config['addOns']);
+
+// If any add-ons have registered
+$config['validActions'] = array();
+$config['shortcodes'] = array();
+if (count($config['addOns']) > 0) {
+
+    // For each add-on that's registered
+    foreach ($config['addOns'] as $a) {
+
+        // Add their valid actions to the main validActions config array
+        if (isset($a['actions'])) {
+            $config['validActions'] = array_merge_recursive($config['validActions'], $a['actions']);
+        }
+
+        // Add their shortcodes to the main shortcodes config array
+        if (isset($a['shortcodes'])) {
+            $config['shortcodes'] = array_merge_recursive($config['shortcodes'], $a['shortcodes']);
+        }
+
+        // If the add-on has supplied additional config parameters when registering
+        if (isset($a['config'])) {
+            $config = array_merge_recursive($config, $a['config']);
+        }
+
+        // If the add-on has additional config parameters in a plugin.ini file
+        $iniFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.'/'.$a['slug'].'/config/plugin.ini';
+        if (isset($iniFile)) {
+
+            // Parse the add-on's configuration file
+            $addOnIni = parse_ini_file($iniFile);
+
+            // Replace parameters that are in the theme ini file
+            $config = array_replace($config, $addOnIni);
+
+        }
+    }
+}
+
+/*
+ *
+ * Activate and Deactivate hooks
+ *
+ */
+
+// Activate
+function glmMembersPluginActivate ()
+{
+    global $wpdb, $config;
+    require_once (GLM_MEMBERS_PLUGIN_PATH . '/activate.php');
+    new glmMembersPluginActivate($wpdb, $config);
+}
+register_activation_hook(__FILE__, 'glmMembersPluginActivate');
+
+// Deactivate
+function glmMembersPluginDeactivate ()
+{
+    global $wpdb, $config;
+    require_once (GLM_MEMBERS_PLUGIN_PATH . '/deactivate.php');
+    $x = new glmMembersPluginDeactivate($wpdb, $config);
+    return false;
+}
+register_deactivation_hook(__FILE__, 'glmMembersPluginDeactivate');
+
+/*
+ *
+ * Load any other common files needed
+ *
+ */
+
+// Load data abstract
+require_once(GLM_MEMBERS_PLUGIN_LIB_PATH.'/GlmDataAbstract/DataAbstract.php');
+
+// Load glmPluginSupport class
+require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
+
+// Load Smarty Template Support
+require_once (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
+
+/*
+ *  Hook through which an add-on may supply additional logged in user information and
+ *  have that data stored in the config array. Typically it would be the
+ *  glm-members-db-contacts add-on supplying the information.
+ *
+ *  This hook provides default data with the current WordPress user 'data' object
+ *  as a 'wpUser' sub-array if a WordPress user is logged in. If not 'wpUser' will
+ *  be false. The supplied data is the basic information on the WordPress user
+ *  provided by the 'data' object from wp_get_current_user().
+ *
+ *  To permit more than one routine to access this filter and therefore to supply
+ *  additional information on the logged in user, code may merge it's own data or may
+ *  add another sub-array containing user information specific to an add-on (i.e.
+ *  contacts add-on might supply a 'contactUser' sub-array).
+ *
+ */
+if (function_exists('is_user_logged_in')) {
+    $config['loggedInUser'] = array(
+        'wpUser' => false
+    );
+    if (is_user_logged_in()) {
+        $config['loggedInUser']['wpUser'] = (array) wp_get_current_user()->data;
+    }
+    $config['loggedInUser'] = apply_filters('glm_members_current_logged_in_user', $config['loggedInUser']);
+}
+
+/*
+ *
+ * Determine which controller to load
+ *
+ */
+
+// If the call to this code is to display a separate debug window
+if (isset($_REQUEST['glmDebugWindow']) && $_REQUEST['glmDebugWindow'] == true) {
+    glmMembersAdminNotices(true);
+    exit;
+
+// Otherwise select appropriate controller
+} elseif (is_admin()) {
+    require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/admin.php');
+    new glmMembersAdmin($wpdb, $config);
+} else {
+    require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/front.php');
+    new glmMembersFront($wpdb, $config);
+}
+
+/*
+ * Display any notices?
+ */
+
+// Display any notices that need to be displayed at the top of the admin content area
+function glmMembersWordpressAdminNotices() {
+    global $startupNotices;
+    echo '<div class="updated">'.GLM_MEMBERS_PLUGIN_NAME.' Plugin Notice<br>'.$startupNotices.'</div>';
+}
+if ($startupNotices != '') {
+    add_action('admin_notices','glmMembersWordpressAdminNotices');
+}
+
+// If not doing debug, then clear all of the debug messages
+if (!GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+    delete_option('glmMembersAdminNoticeAlerts');
+    delete_option('glmMembersAdminNotices');
+    delete_option('glmMembersAdminNoticeProcess');
+    delete_option('glmMembersAdminNoticeDataBlocks');
+}
+
index e39de52..d2486e8 100755 (executable)
@@ -1879,12 +1879,6 @@ abstract class GlmDataAbstract
             $time = date( $f['time_format'], strtotime($time));
         }
 
-/* NEED TO LOOK AT THIS
-        if (!$this->optionIncludeSelectListData && !$forEdit) {
-               $time_list = false;
-        }
-*/
-
         $r = array(
             'time'      => $time,
             'time_list' => $time_list
@@ -1907,8 +1901,26 @@ abstract class GlmDataAbstract
 
             $time = '';
 
+            // Get default - Needs to be in format "00:00:00" 24 hour time
             if (isset($f['default'])) {
-                $time = $f['default'];
+                $def = explode(':', $f['default']);
+                $ampm = 'AM';
+                if (isset($def[0])) {
+                    if ($def[0] >= 12) {
+                        $ampm = 'PM';
+                    }
+                    if ($def[0] > 12) {
+                        $hour = $def[0] -12;
+                    } else {
+                        $hour = $def[0];
+                    }
+                }
+                if (isset($def[1])) {
+                    $min = $def[1];
+                } else {
+                    $min = 00;
+                }
+
             }
 
             // Otherwise we should be getting input from the user
@@ -3090,7 +3102,7 @@ abstract class GlmDataAbstract
      * @return array Array containing results
      * @access public
      */
-    public function getList($where = '', $order = '', $fieldVals = true, $idField = 'id')
+    public function getList($where = '', $order = '', $fieldVals = true, $idField = 'id', $start = false, $limit = false)
     {
 
         // NOTE: $fieldVals not yet implemented
@@ -3111,7 +3123,14 @@ abstract class GlmDataAbstract
             $sql .= "ORDER BY $order
             ";
         }
-// echo "<pre>".print_r($sql,1)."</pre>";
+
+        // If $start and $limit, we're doing paging
+        $paging = false;
+        if ($start !== false && $limit > 0) {
+            $sql .= "limit ".($start-1).", $limit";
+            $paging = true;
+        }
+
         if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
             $this->addDataAbstractNotice($sql, 'DataBlock', "DataAbstract - getList() query");
         }
@@ -3121,8 +3140,10 @@ abstract class GlmDataAbstract
             return false;
         }
 
-        // Process field output data for each result - use ID field as key
+        // Setup result array
         $newList = array();
+
+        // Process field output data for each result - use ID field as key
         while (list($k, $v) = each($list)) {
             $newList[$v['id']] = $this->processOutputData($v, 'l');
         }
@@ -3131,6 +3152,20 @@ abstract class GlmDataAbstract
             $this->addDataAbstractNotice($newList, 'DataBlock', "getList() data");
         }
 
+
+        // If we're doing paging, return that data along with the list
+        if ($paging) {
+            $c = count($list);
+            return array(
+                'start' => $start,
+                'limit' => $limit,
+                'returned' => $c,
+                'last' => $start + count($list) - 1,
+                'list' => $newList
+            );
+        }
+
+        // Since we're not doing paging, return the list only
         return $newList;
     }
 
@@ -3140,29 +3175,37 @@ abstract class GlmDataAbstract
      * @return void
      * @access public
      */
-    public function getEntry($id, $idfield = 'id', $where = '', $fieldVals = false)
+    public function getEntry($id, $idfield = 'id', $where = 'true', $fieldVals = false)
     {
 
-       if ($id-0 == 0) {
-//             echo "DataAbstract.php - getEntry() called with invalid ID";
-               return false;
-       }
+        // If there's an ID supplied, add that to the query
+        $idWhere = '';
+        if ($id-0 > 0) {
+            $idWhere = "AND $idfield = $id";
+        }
 
-       $this->buildFieldsList('g');
+        // If there's no ID supplied and there's no where clause, what are we doing here?
+        if ($idWhere == '' and $where == 'true') {
+            return false;
+        }
+
+        $this->buildFieldsList('g');
 
+        // Get only the first result
         $sql = "SELECT $this->select
                 FROM $this->table T
-                WHERE $idfield = $id
-                       $where
+                WHERE $where
+                $idWhere
+                LIMIT 1
                 ;";
         $detail = $this->wpdb->get_row($sql, ARRAY_A);
 
         $this->addDataAbstractNotice($sql, 'DataBlock', "DataAbstract - getEntry() query");
 
         // If nothing was found, simply return false
-               if ($detail == false) {
-                       return false;
-               }
+        if ($detail == false) {
+            return false;
+        }
 
         // Process individual fields
         $detail = $this->processOutputData($detail, 'g', $fieldVals);
index 21f30b1..033ff2c 100644 (file)
Binary files a/lib/GlmDataAbstract/documentation.odt and b/lib/GlmDataAbstract/documentation.odt differ
diff --git a/models/admin/management/theme.php b/models/admin/management/theme.php
new file mode 100644 (file)
index 0000000..c57a4ff
--- /dev/null
@@ -0,0 +1,184 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Settings Theme
+ *
+ * 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_PLUGIN_CLASS_PATH.'/data/settings/dataSettingsTheme.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_management_theme extends GlmDataSettingsTheme
+{
+
+    /**
+     * 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)
+    {
+        // General settings are always stored in a record with ID=1.
+        $id = 1;
+
+        // Determine if current user can edit configurations
+        if (!current_user_can('glm_members_settings')) {
+            return array(
+                    'status' => false,
+                    'menuItemRedirect' => 'error',
+                    'modelRedirect' => 'index',
+                    'view' => 'admin/error/index.html',
+                    'data' => array(
+                            'reason' => 'User does not have rights to make configuration changes.'
+                    )
+            );
+        }
+
+        // Check for submission option
+        $option = '';
+        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
+            $option = $_REQUEST['option'];
+        }
+
+        switch($option) {
+
+            // Update the settings and redisplay the form
+            case 'submit':
+
+                // Update the general settings
+                $themeSettings = $this->updateEntry(1);
+
+                // Display admin message that the data has been updated
+                glmMembersAdmin::addNotice('Theme Settings for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin have been updated.', 'AdminNotice');
+
+                break;
+
+            // Default is to get the current settings and display the form
+            default:
+
+                // Try to get the first (should be only) entry for general settings.
+                $themeSettings = $this->editEntry($id);
+
+                // Check that we actually have the theme
+                if ($themeSettings === false) {
+
+                    if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                        glmMembersAdmin::addNotice("<b>/modesl/admin/settings/theme.php:</b> Unable to load Theme Settings.", 'Alert');
+                    }
+
+                    return array(
+                        'status' => false,
+                        'menuItemRedirect' => 'error',
+                        'modelRedirect' => 'index',
+                        'view' => 'admin/error/index.html',
+                        'data' => array(
+                            'reason' => 'Unable to create theme settings entry in database.'
+                        )
+                    );
+                }
+
+                break;
+
+        }
+
+        // Compile template data
+        $templateData = array(
+            'reason' => '',
+            'themeSettings' => $themeSettings,
+//            'canEdit' => $canEdit
+        );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status' => true,
+            'menuItemRedirect' => false,
+            'modelRedirect' => false,
+            'view' => 'admin/management/theme.html',
+            'data' => $templateData
+        );
+
+    }
+
+}
+
+?>
\ No newline at end of file
index 5ab5b79..d23b73f 100644 (file)
@@ -256,6 +256,7 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
         $this->memberData = $Members->getEntry($this->memberID);
         $this->fields['logo']['i_prefix'] = 'memb_'.$this->memberID.'_';
         $this->haveMember = true;
+
         $memberName = $this->memberData['name'];
 
         // If no member info record, assume that we need to create a new one
index b46a274..c2995b1 100644 (file)
@@ -108,6 +108,15 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
         $filterPending = false;
         $filterArchived = false;
         $haveFilter = false;
+        $numbDisplayed = false;
+        $lastDisplayed = false;
+        $paging = true;
+        $prevStart = false;
+        $nextStart = false;
+        $start = 1;
+        $limit = 20;        // Set to the number of listings per page
+        $namesList = false;
+
 
         // Check if this is a request to show archived members
         if (isset($_REQUEST['filterArchived'])) {
@@ -117,7 +126,7 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
 
         // If not, don't show them
         } else {
-            $where .= " AND T.access != ".$this->config['access_numb']['Archived'];
+            $where .= " AND access != ".$this->config['access_numb']['Archived'];
         }
 
         // Get a list of categories for filtering
@@ -172,13 +181,60 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
             $haveFilter = true;
         }
 
+        // Get count of members listed
+        $memberCount = $this->getStats($where);
+
+        // If the number of members is less than a page, don't do paging
+        if ($memberCount <= $limit) {
+            $paging = false;
+        }
+
+        // Get full list of names matching this where clause for search box
+        $namesList = $this->getIdName($where);
+
+        // Check if we're doing paging
+        if (isset($_REQUEST['pageSelect'])) {
+
+            // If request is for Next
+            if ($_REQUEST['pageSelect'][0] == 'N') {
+                $newStart = $_REQUEST['nextStart'] - 0;
+
+            // Otherwise it must be Previous
+            } else {
+                $newStart = $_REQUEST['prevStart'] - 0;
+            }
+
+            if ($newStart > 0) {
+                $start = $newStart;
+            }
+        }
+
         // Get a current list of members
-        $list = $this->getSimpleMembersList($where);
+        $listResult = $this->getSimpleMembersList($where, 'name', true, 'id', $start, $limit);
+
+        // Get paging results
+        $numbDisplayed = $listResult['returned'];
+        $lastDisplayed = $listResult['last'];
+        if ($start == 1) {
+            $prevStart = false;
+        } else {
+            $prevStart = $start - $limit;
+            if ($start < 1) {
+                $start = 1;
+            }
+        }
+        if ($listResult['returned'] == $limit) {
+            $nextStart = $start + $limit;
+        }
 
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
             glmMembersAdmin::addNotice($list, 'DataBlock', 'Member Data');
         }
 
+        // since we're doing paging, we have to break out just the member data
+        $list = $listResult['list'];
+        unset($listResult);
+
         // If we have list entries - even if it's an empty list
         $success = true;
         $haveMembers = false;
@@ -205,7 +261,15 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
             'categories' => $categories,
             'haveFilter' => $haveFilter,
             'filterArchived' => $filterArchived,
-            'filterPending' => $filterPending
+            'filterPending' => $filterPending,
+            'numbDisplayed' => $numbDisplayed,
+            'lastDisplayed' => $lastDisplayed,
+            'paging' => $paging,
+            'prevStart' => $prevStart,
+            'nextStart' => $nextStart,
+            'start' => $start,
+            'limit' => $limit,
+            'namesList' => $namesList
         );
 
         // Return status, suggested view, and data to controller
index 9cb7c9e..570852a 100644 (file)
@@ -38,12 +38,22 @@ if (apply_filters('glm_members_menu_members', true)) {
 
     add_menu_page(
         'Members',
-        'Members',
+        'GLM Associate',
         'glm_members_main_menu',
         'glm-members-admin-menu-members',
-        function() {$this->controller('members');},
+        function() {},
         false,
-        '91.123'
+        '3.100'
+    );
+
+    // Add a sub-submenu for the "Member" "List" page
+    add_submenu_page(
+        'glm-members-admin-menu-members',
+        'Members List',
+        'Members',
+        'glm_members_main_menu',
+        'glm-members-admin-menu-members',
+        function() {$this->controller('members', 'index');}
     );
 
     // Add a sub-submenu for the "Member" "List" page
diff --git a/setup/databaseScripts/create_database_V1.1.2.sql b/setup/databaseScripts/create_database_V1.1.2.sql
deleted file mode 100644 (file)
index 0d2d1b5..0000000
+++ /dev/null
@@ -1,505 +0,0 @@
--- Gaslight Media Members Database 
--- File Created: 12/09/14 15:27:15
--- Database Version: 1.0.43
--- Database Creation Script
--- 
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
--- 
--- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
--- 
-
--- Amenities
-CREATE TABLE {prefix}amenities (
-  id INT NOT NULL AUTO_INCREMENT,
-  active TINYINT(1) NULL,                   -- Amenity is active flag
-  name TINYTEXT NULL,                       -- Name of amenity
-  descr TEXT NULL,                          -- Description of amenity
-  short_descr TINYTEXT NULL,                -- Short description of amenity
-  ref_type INT NULL,                        -- Type of entity these amenitites are associated with - see plugin.ini ref_type tables
-  uses_value BOOLEAN NULL,                  -- Flag indicating whether the amenity requires a quantity number
-  PRIMARY KEY (id),
-  INDEX(name(20))
-);
-
-----
-
--- Amenity Reference - Links a specific amenity to a specific entity of type ref_type
-CREATE TABLE {prefix}amenity_ref (
-  id INT NOT NULL AUTO_INCREMENT,
-  amenity INT NULL,                         -- Pointer to amenity in amenities table
-  ref_type INT NULL,                        -- Copy of ref_type from matching ameities table entry - to simplify searches
-  ref_dest INT NULL,                        -- Pointer to the specific entity of type ref_type
-  amenity_value TINYTEXT NULL,              -- Quanity if amenity uses values
-  PRIMARY KEY (id),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- Member Cateogries - used with member information records
-CREATE TABLE {prefix}categories (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of this category
-  descr TEXT NULL,                          -- Description of this category
-  short_descr TINYTEXT NULL,                -- Short description of this category 
-  parent INT NULL,                          -- Pointer to parent category in this table - if there is one
-  PRIMARY KEY (id)
-);
-
-----
-
--- Mapping of categories to speific member information records
-CREATE TABLE {prefix}category_member_info (
-  id INT NOT NULL AUTO_INCREMENT,
-  category INT NULL,                        -- Pointer to category in categories table
-  member_info INT NULL,                     -- Pointer to member infomation record
-  PRIMARY KEY (id),
-  CONSTRAINT {prefix}categories_fk_1
-    FOREIGN KEY (category)
-    REFERENCES {prefix}categories (id)
-    ON DELETE CASCADE,
-  INDEX(category),
-  INDEX(member_info)
-);
-
-----
-
--- Cities
-CREATE TABLE {prefix}cities (
-  id INT NOT NULL AUTO_INCREMENT,           
-  name TINYTEXT NULL,                       -- Name of city
-  PRIMARY KEY (id)
-);
-
-----
-
--- Contacts - used by various entities
-CREATE TABLE {prefix}contacts (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,                      -- Contact is active flag
-  access INT NULL,                          -- Access type - See access table in plugin.ini
-  fname TINYTEXT NULL,                      -- First name of contact
-  lname TINYTEXT NULL,                      -- Last name of contact
-  contact_type INT NULL,                    -- Contact type - see contact_type table (individual, role, ...)
-  contact_role INT NULL,                    -- Contact WordPress user Role
-  org TINYTEXT NULL,                        -- Organization name
-  title TINYTEXT NULL,                      -- Title/Position
-  descr TEXT NULL,                          -- Description of position/responsibilities - Displayed
-  image TINYTEXT NULL,                      -- Image
-  addr1 TINYTEXT NULL,                      -- Address line 1 - Address is for contact, not necessarily for organization
-  addr2 TINYTEXT NULL,                      -- Address line 2 
-  city INT NULL,                            -- Pointer to city in cities table
-  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
-  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries 
-  zip TINYTEXT NULL,                        -- ZIP/Postal Code     
-  lat FLOAT NULL,                           -- Latitude of contact location
-  lon FLOAT NULL,                           -- Longitude of contact location
-  url TINYTEXT NULL,                        -- URL to information regarding this contact
-  office_phone TINYTEXT NULL,               -- Office phone number
-  home_phone TINYTEXT NULL,                 -- Home phone number - or after-hours phone number
-  mobile_phone TINYTEXT NULL,               -- Mobile phone number
-  alt_phone TINYTEXT NULL,                  -- An alternate phone number
-  fax TINYTEXT NULL,                        -- FAX number (do people still use these?) 
-  email TINYTEXT NULL,                      -- E-Mail address
-  alt_email TINYTEXT NULL,                  -- Alternate E-Mail address - Also used to log-in 
-  username TINYTEXT NULL,                   -- Optional username to use for login
-  password TINYTEXT NULL,                   -- Encrypted password
-  notes TEXT NULL,                          -- Notes - Not displayed on front-end
-  create_time TIMESTAMP NULL,               -- Create date/time
-  modify_time TIMESTAMP NULL,               -- Last modified date/time
-  ref_type INT NULL,                        -- Type of entity this contact is associated with                        
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this contact is associated with
-  PRIMARY KEY (id),
-  INDEX(fname(20)),
-  INDEX(lname(20)),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon),
-  INDEX(email(20))
-);
-
-----
-
--- Files - Files are stored under /wp-content/uploads/glm-member-db/files/
-CREATE TABLE {prefix}files (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Original name of the file - might be URL if copied via HTTP
-  status TINYINT(1) NULL,                   -- Display/Use status - See plugin.ini status table
-  file_name TINYTEXT NULL,                  -- Stored file name for the file
-  descr TEXT NULL,                          -- Description 
-  position INT NULL,                        -- Numeric position for sequence of display
-  ref_type INT NULL,                        -- Type of entity this image is associated with
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this image is associated with
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(file_name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- Images - Images are stored under /wp-content/uploads/glm-member-db/images/{size}/
-CREATE TABLE {prefix}images (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Original name of the image - might be URL if copied via HTTP
-  status TINYINT(1) NULL,                   -- Display/Use status - See plugin.ini status table
-  selected BOOLEAN NULL,                    -- A single special image in the current gallery for this entity
-  featured BOOLEAN null,                    -- Image is a member of a group of featured images
-  file_name TINYTEXT NULL,                  -- Stored file name for the image
-  descr TEXT NULL,                          -- Description 
-  caption TINYTEXT NULL,                    -- Caption for the image
-  position INT NULL,                        -- Numeric position for sequence of display
-  ref_type INT NULL,                        -- Type of entity this image is associated with
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this image is associated with
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(file_name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- Primary member records - One for each member
-CREATE TABLE {prefix}members (
-  id INT NOT NULL AUTO_INCREMENT,
-  access INT NULL,                          -- Access type - See access table in plugin.ini
-  member_type INT NULL,                     -- Pointer to member type in member_type table
-  created DATE NULL,                        -- Date member record was created
-  name TINYTEXT NULL,                       -- Member name
-  member_slug TINYTEXT NULL,                -- Member name slug for canonical URLs (lowercase, "-" for spaces, no punctuation)
-  notes TEXT NULL,                          -- General notes - Not displayed in front-end
-  old_member_id INT NULL,                   -- Old member ID if imported from old database
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(member_slug(20)),
-  INDEX(created)
-);
-
-----
-
--- Member information version record - May be multiples per member - Only one with stauts "Active" for a distinct date range
-CREATE TABLE {prefix}member_info (
-  id INT NOT NULL AUTO_INCREMENT,
-  member INT NULL,                          -- Pointer to member record in table members
-  member_name TINYTEXT NULL,                -- Copy of member name from members table entry for fast reference
-  status INT NULL,                          -- Status of this member information record - See plugin.ini status table
-  reference_name TINYTEXT NULL,             -- Refernce name for this member information record - Not displayed on front-end
-  descr TEXT NULL,                          -- Description
-  short_descr TEXT NULL,                    -- Short description
-  addr1 TINYTEXT NULL,                      -- Main member location address line 1
-  addr2 TINYTEXT NULL,                      -- Address line 2
-  city INT NULL,                            -- Pointer to City in cities table
-  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
-  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries
-  zip TINYTEXT NULL,                        -- ZIP/Postal code
-  lat FLOAT NULL,                           -- Latitude of member's location
-  lon FLOAT NULL,                           -- Longitude of member's location
-  region INT NULL,                          -- Pointer to entry in regions table
-  phone TINYTEXT NULL,                      -- Primary phone number
-  toll_free TINYTEXT NULL,                  -- Toll Free phone number
-  url TINYTEXT NULL,                        -- URL with information about this member
-  email TINYTEXT NULL,                      -- Main E-Mail address for this member
-  logo TINYTEXT NULL,                       -- Member logo
-  cc_type INT NULL,                         -- Bitmap of credit card types accepted - See credit_card array in plugin.ini
-  notes TEXT NULL,                          -- General notes - Not displayed in front-end
-  create_time TIMESTAMP NULL,               -- Create date/time
-  modify_time TIMESTAMP NULL,               -- Last update date/time
-  PRIMARY KEY (id),
-  INDEX(status),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon),
-  INDEX(region)
-);
-
-----
-
--- Member type - Can be used to assign members to different "classes" of membership (i.e. Full, Associate, Premium)
--- Mostly for internal use by the member organization, but could be displayed - Consider a short_description if they are. 
-CREATE TABLE {prefix}member_type (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of member type
-  descr TINYTEXT NULL,                      -- Description of member type
-  PRIMARY KEY (id)
-);
-
-----
-
--- Regions - Used to segment members into various geographical regions - can be cities, counties, or other logical regions
-CREATE TABLE {prefix}regions (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of region
-  descr TEXT NULL,                          -- Descrption of region
-  short_descr TINYTEXT NULL,                -- Short descroption of region
-  PRIMARY KEY (id)
-);
-
-----
-
--- General settings available on Management page in admin - Only 1 entry in this table
--- Items in this table should be all self-explanatory
-CREATE TABLE {prefix}settings_general (
-  id INT NOT NULL AUTO_INCREMENT,
-  admin_debug BOOLEAN DEFAULT '1',
-  admin_debug_verbose BOOLEAN DEFAULT '0',
-  front_debug BOOLEAN DEFAULT '0',
-  front_debug_verbose BOOLEAN DEFAULT '0',
-  google_maps_api_key TINYTEXT DEFAULT '',
-  maps_default_lat FLOAT DEFAULT '45.3749',
-  maps_default_lon FLOAT DEFAULT '-84.9592',
-  maps_default_zoom INTEGER DEFAULT '10',
-  time_zone TINYTEXT DEFAULT NULL,
-  canonical_member_page TINYTEXT DEFAULT NULL,
-  list_show_map BOOLEAN DEFAULT '1',
-  list_show_list BOOLEAN DEFAULT '1',
-  list_show_search BOOLEAN DEFAULT '1',
-  list_show_search_text BOOLEAN DEFAULT '1',
-  list_show_search_category BOOLEAN DEFAULT '1',
-  list_show_search_amenities BOOLEAN DEFAULT '1',
-  list_show_search_alpha BOOLEAN DEFAULT '1',
-  list_show_detail_link BOOLEAN DEFAULT '1',
-  list_show_logo BOOLEAN DEFAULT '1',
-  list_logo_size TINYTEXT NULL,
-  list_show_address BOOLEAN DEFAULT '1',
-  list_show_street BOOLEAN DEFAULT '1',
-  list_show_citystatezip BOOLEAN DEFAULT '1',
-  list_show_country BOOLEAN DEFAULT '1',
-  list_show_region BOOLEAN DEFAULT '1',
-  list_show_descr BOOLEAN DEFAULT '0',
-  list_show_short_descr BOOLEAN DEFAULT '1',
-  list_show_phone BOOLEAN DEFAULT '1',
-  list_show_tollfree BOOLEAN DEFAULT '1',
-  list_show_url BOOLEAN DEFAULT '1',
-  list_show_url_newtarget BOOLEAN DEFAULT '1',
-  list_show_email BOOLEAN DEFAULT '1',
-  list_show_categories BOOLEAN DEFAULT '0',
-  list_show_creditcards BOOLEAN DEFAULT '0',
-  list_show_amenities BOOLEAN DEFAULT '0',
-  list_map_show_detaillink BOOLEAN DEFAULT '1',
-  list_map_show_logo BOOLEAN DEFAULT '0',
-  list_map_logo_size TINYTEXT NULL,
-  list_map_show_descr BOOLEAN DEFAULT '0',
-  list_map_show_short_descr BOOLEAN DEFAULT '1',
-  list_map_show_address BOOLEAN DEFAULT '1',
-  list_map_show_street BOOLEAN DEFAULT '1',
-  list_map_show_citystatezip BOOLEAN DEFAULT '1',
-  list_map_show_country BOOLEAN DEFAULT '1',
-  list_map_show_region BOOLEAN DEFAULT '1',
-  list_map_show_phone BOOLEAN DEFAULT '1',
-  list_map_show_tollfree BOOLEAN DEFAULT '1',
-  list_map_show_url BOOLEAN DEFAULT '1',
-  list_map_show_url_newtarget BOOLEAN DEFAULT '1',
-  list_map_show_email BOOLEAN DEFAULT '1',
-  list_map_show_categories BOOLEAN DEFAULT '0',
-  list_map_show_creditcards BOOLEAN DEFAULT '0',
-  list_map_show_amenities BOOLEAN DEFAULT '0',
-  detail_show_map BOOLEAN DEFAULT '1',
-  detail_show_directions BOOLEAN DEFAULT '1',
-  detail_show_logo BOOLEAN DEFAULT '1',
-  detail_logo_size TINYTEXT NULL,
-  detail_show_descr BOOLEAN DEFAULT '1',
-  detail_show_short_descr BOOLEAN DEFAULT '0',
-  detail_show_address BOOLEAN DEFAULT '1',
-  detail_show_street BOOLEAN DEFAULT '1',
-  detail_show_citystatezip BOOLEAN DEFAULT '1',
-  detail_show_country BOOLEAN DEFAULT '1',
-  detail_show_region BOOLEAN DEFAULT '1',
-  detail_show_phone BOOLEAN DEFAULT '1',
-  detail_show_tollfree BOOLEAN DEFAULT '1',
-  detail_show_url BOOLEAN DEFAULT '1',
-  detail_show_url_newtarget BOOLEAN DEFAULT '1',
-  detail_show_email BOOLEAN DEFAULT '1',
-  detail_show_categories BOOLEAN DEFAULT '0',
-  detail_show_creditcards BOOLEAN DEFAULT '0',
-  detail_show_amenities BOOLEAN DEFAULT '1',
-  detail_show_imagegallery BOOLEAN DEFAULT '1',
-  detail_show_coupons BOOLEAN DEFAULT '0',
-  detail_show_packages BOOLEAN DEFAULT '0',
-  detail_map_show_logo BOOLEAN DEFAULT '0',
-  detail_map_logo_size TINYTEXT NULL,
-  detail_map_show_descr BOOLEAN DEFAULT '0',
-  detail_map_show_short_descr BOOLEAN DEFAULT '1',
-  detail_map_show_address BOOLEAN DEFAULT '1',
-  detail_map_show_street BOOLEAN DEFAULT '1',
-  detail_map_show_citystatezip BOOLEAN DEFAULT '1',
-  detail_map_show_country BOOLEAN DEFAULT '1',
-  detail_map_show_region BOOLEAN DEFAULT '1',
-  detail_map_show_phone BOOLEAN DEFAULT '1',
-  detail_map_show_tollfree BOOLEAN DEFAULT '1',
-  detail_map_show_url BOOLEAN DEFAULT '1',
-  detail_map_show_url_newtarget BOOLEAN DEFAULT '1',
-  detail_map_show_email BOOLEAN DEFAULT '1',
-  detail_map_show_categories BOOLEAN DEFAULT '0',
-  detail_map_show_creditcards BOOLEAN DEFAULT '0',
-  detail_map_show_amenities BOOLEAN DEFAULT '0',
-  PRIMARY KEY (id)
-);
-
-----
-
--- Set default entry
-INSERT INTO {prefix}settings_general
-    ( id, time_zone, canonical_member_page, list_logo_size, list_map_logo_size, detail_logo_size, detail_map_logo_size )
-   VALUES
-    ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb' )
-;
-
-----
-
--- Terms used in site modifiable on Management page in admin - Only 1 entry in this table
--- Tems in this table should be all self-explanatory
-CREATE TABLE {prefix}settings_terms (
-  id INT NOT NULL AUTO_INCREMENT,
-  term_admin_menu_members TINYTEXT NULL,
-  term_admin_menu_member_list TINYTEXT NULL,
-  term_admin_menu_member TINYTEXT NULL,
-  term_admin_menu_configure TINYTEXT NULL,
-  term_admin_menu_settings TINYTEXT NULL,
-  term_admin_menu_shortcodes TINYTEXT NULL,
-  term_admin_menu_members_dashboard TINYTEXT NULL,
-  term_admin_menu_members_list TINYTEXT NULL,
-  term_admin_menu_members_reports TINYTEXT NULL,
-  term_admin_menu_member_dashboard TINYTEXT NULL,
-  term_admin_menu_member_info TINYTEXT NULL,
-  term_admin_menu_member_locations TINYTEXT NULL,
-  term_admin_menu_member_facilities TINYTEXT NULL,
-  term_admin_menu_member_attractions TINYTEXT NULL,
-  term_admin_menu_member_contacts TINYTEXT NULL,
-  term_admin_menu_configure_member_types TINYTEXT NULL,
-  term_admin_menu_configure_member_cats TINYTEXT NULL,
-  term_admin_menu_configure_accom_types TINYTEXT NULL,
-  term_admin_menu_configure_amenities TINYTEXT NULL,
-  term_admin_menu_configure_cities TINYTEXT NULL,
-  term_admin_menu_configure_regions TINYTEXT NULL,
-  term_admin_menu_settings_general TINYTEXT NULL,
-  term_admin_menu_settings_terms TINYTEXT NULL,
-  term_admin_menu_settings_development TINYTEXT NULL,
-  term_member TINYTEXT NULL,
-  term_member_cap TINYTEXT NULL,
-  term_member_plur TINYTEXT NULL,
-  term_member_plur_cap TINYTEXT NULL,
-  term_location TINYTEXT NULL,
-  term_location_cap TINYTEXT NULL,
-  term_location_plur TINYTEXT NULL,
-  term_location_plur_cap TINYTEXT NULL,
-  term_facility TINYTEXT NULL,
-  term_facility_cap TINYTEXT NULL,
-  term_facility_plur TINYTEXT NULL,
-  term_facility_plur_cap TINYTEXT NULL,
-  term_attraction TINYTEXT NULL,
-  term_attraction_cap TINYTEXT NULL,
-  term_attraction_plur TINYTEXT NULL,
-  term_attraction_plur_cap TINYTEXT NULL,
-  term_contact TINYTEXT NULL,
-  term_contact_cap TINYTEXT NULL,
-  term_contact_plur TINYTEXT NULL,
-  term_contact_plur_cap TINYTEXT NULL,
-  PRIMARY KEY (id)
-);
-
-----
-
--- Default terms entry
-INSERT INTO {prefix}settings_terms
-    (
-    id,
-    term_admin_menu_members,                        
-    term_admin_menu_member_list,                    
-    term_admin_menu_member,                     
-    term_admin_menu_configure,                      
-    term_admin_menu_settings,                       
-    term_admin_menu_shortcodes,                     
-    term_admin_menu_members_dashboard,         
-    term_admin_menu_members_list,                   
-    term_admin_menu_members_reports,                
-    term_admin_menu_member_dashboard,
-    term_admin_menu_member_info,
-    term_admin_menu_member_locations,               
-    term_admin_menu_member_facilities,              
-    term_admin_menu_member_attractions,             
-    term_admin_menu_member_contacts,                
-    term_admin_menu_configure_member_types,         
-    term_admin_menu_configure_member_cats,          
-    term_admin_menu_configure_accom_types,          
-    term_admin_menu_configure_amenities,     
-    term_admin_menu_configure_cities,               
-    term_admin_menu_configure_regions,              
-    term_admin_menu_settings_general,               
-    term_admin_menu_settings_terms,                 
-    term_admin_menu_settings_development,           
-    term_member,                                    
-    term_member_cap,                                
-    term_member_plur,                               
-    term_member_plur_cap,                           
-    term_location,                                  
-    term_location_cap,
-    term_location_plur,                             
-    term_location_plur_cap,                         
-    term_facility,                                  
-    term_facility_cap,                              
-    term_facility_plur,                             
-    term_facility_plur_cap,                         
-    term_attraction,                                
-    term_attraction_cap,                            
-    term_attraction_plur,                           
-    term_attraction_plur_cap,                       
-    term_contact,                                   
-    term_contact_cap,                               
-    term_contact_plur,                              
-    term_contact_plur_cap                           
-    )
-   VALUES
-    (
-    1,
-    'Members',            
-    'Member',             
-    'Member',         
-    'Configure',          
-    'Management',           
-    'Shortcodes',         
-    'Dashboard',          
-    'Member List',        
-    'Reports',            
-    'Member Dashboard',
-    'Member Info',        
-    'Locations',          
-    'Facilities',         
-    'Attractions',        
-    'Contacts',           
-    'Member Types',       
-    'Member Categories',  
-    'Accommodation Types',
-    'Amenities',          
-    'Cities',             
-    'Regions',            
-    'General Settings',   
-    'Terms & Phrases',    
-    'Development',        
-    'member',             
-    'Member',             
-    'members',            
-    'Members',            
-    'location',           
-    'Location',           
-    'locations',          
-    'Locations',          
-    'facility',           
-    'Facility',           
-    'facilities',         
-    'Facilities',         
-    'attraction',         
-    'Attraction',         
-    'attractions',        
-    'Attractions',        
-    'contact',            
-    'Contact',            
-    'contacts',           
-    'Contacts'
-    )
-;
diff --git a/setup/databaseScripts/create_database_V1.1.4.sql b/setup/databaseScripts/create_database_V1.1.4.sql
new file mode 100644 (file)
index 0000000..e3f61fa
--- /dev/null
@@ -0,0 +1,479 @@
+-- Gaslight Media Members Database 
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 1.1.4
+-- Database Creation Script
+-- 
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+-- 
+-- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
+-- 
+
+-- Amenities
+CREATE TABLE {prefix}amenities (
+  id INT NOT NULL AUTO_INCREMENT,
+  active TINYINT(1) NULL,                   -- Amenity is active flag
+  name TINYTEXT NULL,                       -- Name of amenity
+  descr TEXT NULL,                          -- Description of amenity
+  short_descr TINYTEXT NULL,                -- Short description of amenity
+  ref_type INT NULL,                        -- Type of entity these amenitites are associated with - see plugin.ini ref_type tables
+  uses_value BOOLEAN NULL,                  -- Flag indicating whether the amenity requires a quantity number
+  PRIMARY KEY (id),
+  INDEX(name(20))
+);
+
+----
+
+-- Amenity Reference - Links a specific amenity to a specific entity of type ref_type
+CREATE TABLE {prefix}amenity_ref (
+  id INT NOT NULL AUTO_INCREMENT,
+  amenity INT NULL,                         -- Pointer to amenity in amenities table
+  ref_type INT NULL,                        -- Copy of ref_type from matching ameities table entry - to simplify searches
+  ref_dest INT NULL,                        -- Pointer to the specific entity of type ref_type
+  amenity_value TINYTEXT NULL,              -- Quanity if amenity uses values
+  PRIMARY KEY (id),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+-- Member Cateogries - used with member information records
+CREATE TABLE {prefix}categories (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Name of this category
+  descr TEXT NULL,                          -- Description of this category
+  short_descr TINYTEXT NULL,                -- Short description of this category 
+  parent INT NULL,                          -- Pointer to parent category in this table - if there is one
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Mapping of categories to speific member information records
+CREATE TABLE {prefix}category_member_info (
+  id INT NOT NULL AUTO_INCREMENT,
+  category INT NULL,                        -- Pointer to category in categories table
+  member_info INT NULL,                     -- Pointer to member infomation record
+  PRIMARY KEY (id),
+  CONSTRAINT {prefix}categories_fk_1
+    FOREIGN KEY (category)
+    REFERENCES {prefix}categories (id)
+    ON DELETE CASCADE,
+  INDEX(category),
+  INDEX(member_info)
+);
+
+----
+
+-- Cities
+CREATE TABLE {prefix}cities (
+  id INT NOT NULL AUTO_INCREMENT,           
+  name TINYTEXT NULL,                       -- Name of city
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Files - Files are stored under /wp-content/uploads/glm-member-db/files/
+CREATE TABLE {prefix}files (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Original name of the file - might be URL if copied via HTTP
+  status TINYINT(1) NULL,                   -- Display/Use status - See plugin.ini status table
+  file_name TINYTEXT NULL,                  -- Stored file name for the file
+  descr TEXT NULL,                          -- Description 
+  position INT NULL,                        -- Numeric position for sequence of display
+  ref_type INT NULL,                        -- Type of entity this image is associated with
+  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this image is associated with
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(file_name(20)),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+-- Images - Images are stored under /wp-content/uploads/glm-member-db/images/{size}/
+CREATE TABLE {prefix}images (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Original name of the image - might be URL if copied via HTTP
+  status TINYINT(1) NULL,                   -- Display/Use status - See plugin.ini status table
+  selected BOOLEAN NULL,                    -- A single special image in the current gallery for this entity
+  featured BOOLEAN null,                    -- Image is a member of a group of featured images
+  file_name TINYTEXT NULL,                  -- Stored file name for the image
+  descr TEXT NULL,                          -- Description 
+  caption TINYTEXT NULL,                    -- Caption for the image
+  position INT NULL,                        -- Numeric position for sequence of display
+  ref_type INT NULL,                        -- Type of entity this image is associated with
+  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this image is associated with
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(file_name(20)),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+-- Primary member records - One for each member
+CREATE TABLE {prefix}members (
+  id INT NOT NULL AUTO_INCREMENT,
+  access INT NULL,                          -- Access type - See access table in plugin.ini
+  member_type INT NULL,                     -- Pointer to member type in member_type table
+  created DATE NULL,                        -- Date member record was created
+  name TINYTEXT NULL,                       -- Member name
+  member_slug TINYTEXT NULL,                -- Member name slug for canonical URLs (lowercase, "-" for spaces, no punctuation)
+  notes TEXT NULL,                          -- General notes - Not displayed in front-end
+  old_member_id INT NULL,                   -- Old member ID if imported from old database
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(member_slug(20)),
+  INDEX(created)
+);
+
+----
+
+-- Member information version record - May be multiples per member - Only one with stauts "Active" for a distinct date range
+CREATE TABLE {prefix}member_info (
+  id INT NOT NULL AUTO_INCREMENT,
+  member INT NULL,                          -- Pointer to member record in table members
+  member_name TINYTEXT NULL,                -- Copy of member name from members table entry for fast reference
+  status INT NULL,                          -- Status of this member information record - See plugin.ini status table
+  reference_name TINYTEXT NULL,             -- Refernce name for this member information record - Not displayed on front-end
+  descr TEXT NULL,                          -- Description
+  short_descr TEXT NULL,                    -- Short description
+  addr1 TINYTEXT NULL,                      -- Main member location address line 1
+  addr2 TINYTEXT NULL,                      -- Address line 2
+  city INT NULL,                            -- Pointer to City in cities table
+  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
+  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries
+  zip TINYTEXT NULL,                        -- ZIP/Postal code
+  lat FLOAT NULL,                           -- Latitude of member's location
+  lon FLOAT NULL,                           -- Longitude of member's location
+  region INT NULL,                          -- Pointer to entry in regions table
+  phone TINYTEXT NULL,                      -- Primary phone number
+  toll_free TINYTEXT NULL,                  -- Toll Free phone number
+  url TINYTEXT NULL,                        -- URL with information about this member
+  email TINYTEXT NULL,                      -- Main E-Mail address for this member
+  logo TINYTEXT NULL,                       -- Member logo
+  cc_type INT NULL,                         -- Bitmap of credit card types accepted - See credit_card array in plugin.ini
+  notes TEXT NULL,                          -- General notes - Not displayed in front-end
+  create_time TIMESTAMP NULL,               -- Create date/time
+  modify_time TIMESTAMP NULL,               -- Last update date/time
+  PRIMARY KEY (id),
+  INDEX(status),
+  INDEX(city),
+  INDEX(zip(10)),
+  INDEX(lat),
+  INDEX(lon),
+  INDEX(region)
+);
+
+----
+
+-- Member type - Can be used to assign members to different "classes" of membership (i.e. Full, Associate, Premium)
+-- Mostly for internal use by the member organization, but could be displayed - Consider a short_description if they are. 
+CREATE TABLE {prefix}member_type (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Name of member type
+  descr TINYTEXT NULL,                      -- Description of member type
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Regions - Used to segment members into various geographical regions - can be cities, counties, or other logical regions
+CREATE TABLE {prefix}regions (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Name of region
+  descr TEXT NULL,                          -- Descrption of region
+  short_descr TINYTEXT NULL,                -- Short descroption of region
+  PRIMARY KEY (id)
+);
+
+----
+
+-- General settings available on Management page in admin - Only 1 entry in this table
+-- Items in this table should be all self-explanatory
+CREATE TABLE {prefix}settings_general (
+  id INT NOT NULL AUTO_INCREMENT,
+  admin_debug BOOLEAN DEFAULT '1',
+  admin_debug_verbose BOOLEAN DEFAULT '0',
+  front_debug BOOLEAN DEFAULT '0',
+  front_debug_verbose BOOLEAN DEFAULT '0',
+  google_maps_api_key TINYTEXT DEFAULT '',
+  maps_default_lat FLOAT DEFAULT '45.3749',
+  maps_default_lon FLOAT DEFAULT '-84.9592',
+  maps_default_zoom INTEGER DEFAULT '10',
+  time_zone TINYTEXT DEFAULT NULL,
+  canonical_member_page TINYTEXT DEFAULT NULL,
+  list_show_map BOOLEAN DEFAULT '1',
+  list_show_list BOOLEAN DEFAULT '1',
+  list_show_search BOOLEAN DEFAULT '1',
+  list_show_search_text BOOLEAN DEFAULT '1',
+  list_show_search_category BOOLEAN DEFAULT '1',
+  list_show_search_amenities BOOLEAN DEFAULT '1',
+  list_show_search_alpha BOOLEAN DEFAULT '1',
+  list_show_detail_link BOOLEAN DEFAULT '1',
+  list_show_logo BOOLEAN DEFAULT '1',
+  list_logo_size TINYTEXT NULL,
+  list_show_address BOOLEAN DEFAULT '1',
+  list_show_street BOOLEAN DEFAULT '1',
+  list_show_citystatezip BOOLEAN DEFAULT '1',
+  list_show_country BOOLEAN DEFAULT '1',
+  list_show_region BOOLEAN DEFAULT '1',
+  list_show_descr BOOLEAN DEFAULT '0',
+  list_show_short_descr BOOLEAN DEFAULT '1',
+  list_show_phone BOOLEAN DEFAULT '1',
+  list_show_tollfree BOOLEAN DEFAULT '1',
+  list_show_url BOOLEAN DEFAULT '1',
+  list_show_url_newtarget BOOLEAN DEFAULT '1',
+  list_show_email BOOLEAN DEFAULT '1',
+  list_show_categories BOOLEAN DEFAULT '0',
+  list_show_creditcards BOOLEAN DEFAULT '0',
+  list_show_amenities BOOLEAN DEFAULT '0',
+  list_map_show_detaillink BOOLEAN DEFAULT '1',
+  list_map_show_logo BOOLEAN DEFAULT '0',
+  list_map_logo_size TINYTEXT NULL,
+  list_map_show_descr BOOLEAN DEFAULT '0',
+  list_map_show_short_descr BOOLEAN DEFAULT '1',
+  list_map_show_address BOOLEAN DEFAULT '1',
+  list_map_show_street BOOLEAN DEFAULT '1',
+  list_map_show_citystatezip BOOLEAN DEFAULT '1',
+  list_map_show_country BOOLEAN DEFAULT '1',
+  list_map_show_region BOOLEAN DEFAULT '1',
+  list_map_show_phone BOOLEAN DEFAULT '1',
+  list_map_show_tollfree BOOLEAN DEFAULT '1',
+  list_map_show_url BOOLEAN DEFAULT '1',
+  list_map_show_url_newtarget BOOLEAN DEFAULT '1',
+  list_map_show_email BOOLEAN DEFAULT '1',
+  list_map_show_categories BOOLEAN DEFAULT '0',
+  list_map_show_creditcards BOOLEAN DEFAULT '0',
+  list_map_show_amenities BOOLEAN DEFAULT '0',
+  detail_show_map BOOLEAN DEFAULT '1',
+  detail_show_directions BOOLEAN DEFAULT '1',
+  detail_show_logo BOOLEAN DEFAULT '1',
+  detail_logo_size TINYTEXT NULL,
+  detail_show_descr BOOLEAN DEFAULT '1',
+  detail_show_short_descr BOOLEAN DEFAULT '0',
+  detail_show_address BOOLEAN DEFAULT '1',
+  detail_show_street BOOLEAN DEFAULT '1',
+  detail_show_citystatezip BOOLEAN DEFAULT '1',
+  detail_show_country BOOLEAN DEFAULT '1',
+  detail_show_region BOOLEAN DEFAULT '1',
+  detail_show_phone BOOLEAN DEFAULT '1',
+  detail_show_tollfree BOOLEAN DEFAULT '1',
+  detail_show_url BOOLEAN DEFAULT '1',
+  detail_show_url_newtarget BOOLEAN DEFAULT '1',
+  detail_show_email BOOLEAN DEFAULT '1',
+  detail_show_categories BOOLEAN DEFAULT '0',
+  detail_show_creditcards BOOLEAN DEFAULT '0',
+  detail_show_amenities BOOLEAN DEFAULT '1',
+  detail_show_imagegallery BOOLEAN DEFAULT '1',
+  detail_show_coupons BOOLEAN DEFAULT '0',
+  detail_show_packages BOOLEAN DEFAULT '0',
+  detail_map_show_logo BOOLEAN DEFAULT '0',
+  detail_map_logo_size TINYTEXT NULL,
+  detail_map_show_descr BOOLEAN DEFAULT '0',
+  detail_map_show_short_descr BOOLEAN DEFAULT '1',
+  detail_map_show_address BOOLEAN DEFAULT '1',
+  detail_map_show_street BOOLEAN DEFAULT '1',
+  detail_map_show_citystatezip BOOLEAN DEFAULT '1',
+  detail_map_show_country BOOLEAN DEFAULT '1',
+  detail_map_show_region BOOLEAN DEFAULT '1',
+  detail_map_show_phone BOOLEAN DEFAULT '1',
+  detail_map_show_tollfree BOOLEAN DEFAULT '1',
+  detail_map_show_url BOOLEAN DEFAULT '1',
+  detail_map_show_url_newtarget BOOLEAN DEFAULT '1',
+  detail_map_show_email BOOLEAN DEFAULT '1',
+  detail_map_show_categories BOOLEAN DEFAULT '0',
+  detail_map_show_creditcards BOOLEAN DEFAULT '0',
+  detail_map_show_amenities BOOLEAN DEFAULT '0',
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Set default entry
+INSERT INTO {prefix}settings_general
+    ( id, time_zone, canonical_member_page, list_logo_size, list_map_logo_size, detail_logo_size, detail_map_logo_size )
+   VALUES
+    ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb' )
+;
+
+----
+
+-- Terms used in site modifiable on Management page in admin - Only 1 entry in this table
+-- Tems in this table should be all self-explanatory
+CREATE TABLE {prefix}settings_terms (
+  id INT NOT NULL AUTO_INCREMENT,
+  term_admin_menu_members TINYTEXT NULL,
+  term_admin_menu_member_list TINYTEXT NULL,
+  term_admin_menu_member TINYTEXT NULL,
+  term_admin_menu_configure TINYTEXT NULL,
+  term_admin_menu_settings TINYTEXT NULL,
+  term_admin_menu_shortcodes TINYTEXT NULL,
+  term_admin_menu_members_dashboard TINYTEXT NULL,
+  term_admin_menu_members_list TINYTEXT NULL,
+  term_admin_menu_members_reports TINYTEXT NULL,
+  term_admin_menu_member_dashboard TINYTEXT NULL,
+  term_admin_menu_member_info TINYTEXT NULL,
+  term_admin_menu_member_locations TINYTEXT NULL,
+  term_admin_menu_member_facilities TINYTEXT NULL,
+  term_admin_menu_member_attractions TINYTEXT NULL,
+  term_admin_menu_member_contacts TINYTEXT NULL,
+  term_admin_menu_configure_member_types TINYTEXT NULL,
+  term_admin_menu_configure_member_cats TINYTEXT NULL,
+  term_admin_menu_configure_accom_types TINYTEXT NULL,
+  term_admin_menu_configure_amenities TINYTEXT NULL,
+  term_admin_menu_configure_cities TINYTEXT NULL,
+  term_admin_menu_configure_regions TINYTEXT NULL,
+  term_admin_menu_settings_general TINYTEXT NULL,
+  term_admin_menu_settings_terms TINYTEXT NULL,
+  term_admin_menu_settings_development TINYTEXT NULL,
+  term_member TINYTEXT NULL,
+  term_member_cap TINYTEXT NULL,
+  term_member_plur TINYTEXT NULL,
+  term_member_plur_cap TINYTEXT NULL,
+  term_location TINYTEXT NULL,
+  term_location_cap TINYTEXT NULL,
+  term_location_plur TINYTEXT NULL,
+  term_location_plur_cap TINYTEXT NULL,
+  term_facility TINYTEXT NULL,
+  term_facility_cap TINYTEXT NULL,
+  term_facility_plur TINYTEXT NULL,
+  term_facility_plur_cap TINYTEXT NULL,
+  term_attraction TINYTEXT NULL,
+  term_attraction_cap TINYTEXT NULL,
+  term_attraction_plur TINYTEXT NULL,
+  term_attraction_plur_cap TINYTEXT NULL,
+  term_contact TINYTEXT NULL,
+  term_contact_cap TINYTEXT NULL,
+  term_contact_plur TINYTEXT NULL,
+  term_contact_plur_cap TINYTEXT NULL,
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Default terms entry
+INSERT INTO {prefix}settings_terms
+    (
+    id,
+    term_admin_menu_members,                        
+    term_admin_menu_member_list,                    
+    term_admin_menu_member,                     
+    term_admin_menu_configure,                      
+    term_admin_menu_settings,                       
+    term_admin_menu_shortcodes,                     
+    term_admin_menu_members_dashboard,         
+    term_admin_menu_members_list,                   
+    term_admin_menu_members_reports,                
+    term_admin_menu_member_dashboard,
+    term_admin_menu_member_info,
+    term_admin_menu_member_locations,               
+    term_admin_menu_member_facilities,              
+    term_admin_menu_member_attractions,             
+    term_admin_menu_member_contacts,                
+    term_admin_menu_configure_member_types,         
+    term_admin_menu_configure_member_cats,          
+    term_admin_menu_configure_accom_types,          
+    term_admin_menu_configure_amenities,     
+    term_admin_menu_configure_cities,               
+    term_admin_menu_configure_regions,              
+    term_admin_menu_settings_general,               
+    term_admin_menu_settings_terms,                 
+    term_admin_menu_settings_development,           
+    term_member,                                    
+    term_member_cap,                                
+    term_member_plur,                               
+    term_member_plur_cap,                           
+    term_location,                                  
+    term_location_cap,
+    term_location_plur,                             
+    term_location_plur_cap,                         
+    term_facility,                                  
+    term_facility_cap,                              
+    term_facility_plur,                             
+    term_facility_plur_cap,                         
+    term_attraction,                                
+    term_attraction_cap,                            
+    term_attraction_plur,                           
+    term_attraction_plur_cap,                       
+    term_contact,                                   
+    term_contact_cap,                               
+    term_contact_plur,                              
+    term_contact_plur_cap                           
+    )
+   VALUES
+    (
+    1,
+    'Members',            
+    'Member',             
+    'Member',         
+    'Configure',          
+    'Management',           
+    'Shortcodes',         
+    'Dashboard',          
+    'Member List',        
+    'Reports',            
+    'Member Dashboard',
+    'Member Info',        
+    'Locations',          
+    'Facilities',         
+    'Attractions',        
+    'Contacts',           
+    'Member Types',       
+    'Member Categories',  
+    'Accommodation Types',
+    'Amenities',          
+    'Cities',             
+    'Regions',            
+    'General Settings',   
+    'Terms & Phrases',    
+    'Development',        
+    'member',             
+    'Member',             
+    'members',            
+    'Members',            
+    'location',           
+    'Location',           
+    'locations',          
+    'Locations',          
+    'facility',           
+    'Facility',           
+    'facilities',         
+    'Facilities',         
+    'attraction',         
+    'Attraction',         
+    'attractions',        
+    'Attractions',        
+    'contact',            
+    'Contact',            
+    'contacts',           
+    'Contacts'
+    )
+;
+
+----
+
+-- Theme Settings - Only 1 entry in this table
+CREATE TABLE {prefix}settings_theme (
+    id INT NOT NULL AUTO_INCREMENT,
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Default Theme Settings entry
+INSERT INTO {prefix}settings_theme
+    (
+    id                           
+    )
+   VALUES
+    (
+    1
+    )
+;
+
index 1da28f8..2337d53 100644 (file)
@@ -33,7 +33,9 @@ $glmMembersDbVersions = array(
     '1.0.43' => array('version' => '1.0.43', 'tables' => 26),
     '1.1.0' => array('version' => '1.1.0', 'tables' => 13),
     '1.1.1' => array('version' => '1.1.1', 'tables' => 13),
-    '1.1.2' => array('version' => '1.1.2', 'tables' => 14, 'date' => '4/11/16')
+    '1.1.2' => array('version' => '1.1.2', 'tables' => 14, 'date' => '4/11/16'),
+    '1.1.3' => array('version' => '1.1.3', 'tables' => 13, 'date' => '4/13/16'),
+    '1.1.4' => array('version' => '1.1.4', 'tables' => 14, 'date' => '4/18/16')
 );
 
 
diff --git a/setup/databaseScripts/drop_database_V1.1.2.sql b/setup/databaseScripts/drop_database_V1.1.2.sql
deleted file mode 100644 (file)
index 78bacb5..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
--- Gaslight Media Members Database 
--- File Created: 12/09/14 15:27:15
--- Database Version: 1.1.1
--- Database Deletion Script
--- Note: Tables with DELETE CASCADE must appear before referenced table
-
-DROP TABLE IF EXISTS
-    {prefix}amenities,
-    {prefix}amenity_ref,
-    {prefix}category_member_info,
-    {prefix}cities,
-    {prefix}contacts,
-    {prefix}images,
-    {prefix}files,
-    {prefix}members,
-    {prefix}member_info,
-    {prefix}member_type,
-    {prefix}regions,
-    {prefix}settings_general,
-    {prefix}settings_terms,
-    {prefix}categories
-;
-
diff --git a/setup/databaseScripts/drop_database_V1.1.3.sql b/setup/databaseScripts/drop_database_V1.1.3.sql
new file mode 100644 (file)
index 0000000..17b02fd
--- /dev/null
@@ -0,0 +1,23 @@
+-- Gaslight Media Members Database 
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 1.1.1
+-- Database Deletion Script
+-- Note: Tables with DELETE CASCADE must appear before referenced table
+
+DROP TABLE IF EXISTS
+    {prefix}amenities,
+    {prefix}amenity_ref,
+    {prefix}category_member_info,
+    {prefix}cities,
+    {prefix}images,
+    {prefix}files,
+    {prefix}members,
+    {prefix}member_info,
+    {prefix}member_type,
+    {prefix}regions,
+    {prefix}settings_general,
+    {prefix}settings_terms,
+    {prefix}settings_theme,
+    {prefix}categories
+;
+
diff --git a/setup/databaseScripts/update_database_V1.1.3.php b/setup/databaseScripts/update_database_V1.1.3.php
new file mode 100644 (file)
index 0000000..a6fb85c
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+/*
+ * Gaslight Media Members Database
+ *
+ * Database Update Script for version 1.0.28
+ */
+
+// Set initial database version in WordPress option for the Contacts Add-On
+update_option('glmMembersContactsDbVersion', '0.0.1');
+
+// Set prefix for Contacts add-on - changes "{db_prefix}_glm_members_" to "{db_prefix}_glm_membersContacts_"
+$prefix = substr(GLM_MEMBERS_PLUGIN_DB_PREFIX, 0, -1)."Contacts_";
+
+// Rename contacts table to move it to Contacts add-on
+$this->wpdb->query("
+    RENAME TABLE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."contacts TO ".$prefix."contacts;
+");
diff --git a/setup/databaseScripts/update_database_V1.1.3.sql b/setup/databaseScripts/update_database_V1.1.3.sql
new file mode 100644 (file)
index 0000000..e748a97
--- /dev/null
@@ -0,0 +1,11 @@
+-- Gaslight Media Members Database 
+-- File Created: 11/11/16 15:27:15
+-- Database Version: 1.1.2
+-- Database Update From Previous Version Script
+-- 
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashses
+
+-- Move contacts table to contacts plugin - Rename prefix
+-- Doing nothing here - See update_database_V1.1.3.php
+
diff --git a/setup/databaseScripts/update_database_V1.1.4.sql b/setup/databaseScripts/update_database_V1.1.4.sql
new file mode 100644 (file)
index 0000000..7b80318
--- /dev/null
@@ -0,0 +1,31 @@
+-- Gaslight Media Members Database 
+-- File Created: 11/11/16 15:27:15
+-- Database Version: 1.1.4
+-- Database Update From Previous Version Script
+-- 
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashses
+
+-- Move contacts table to contacts plugin - Rename prefix
+-- Doing nothing here - See update_database_V1.1.3.php
+
+
+-- Theme Settings - Only 1 entry in this table
+CREATE TABLE {prefix}settings_theme (
+    id INT NOT NULL AUTO_INCREMENT,
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Default Theme Settings entry
+INSERT INTO {prefix}settings_theme
+    (
+    id                           
+    )
+   VALUES
+    (
+    1
+    )
+;
+
index f3b9208..651e954 100644 (file)
@@ -62,6 +62,7 @@ $glmMembersValidActions = array(
                 'index' => 'glm-member-db',            // General Options
                 'terms' => 'glm-member-db',
                 'development' => 'glm-member-db',
+                'theme' => 'glm-member-db',
                 'import' => 'glm-member-db',
                 'addons' => 'glm-member-db',
                 'hooks' => 'glm-member-db'
index 913b6f0..da74680 100644 (file)
@@ -5,8 +5,9 @@
     <h2 class="nav-tab-wrapper">
         <a href="{$thisUrl}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index} nav-tab-active{/if}">General Settings</a>
         <a href="{$thisUrl}?page={$thisPage}&glm_action=terms" class="nav-tab{if $thisAction==terms} nav-tab-active{/if}">Terms and Phrases</a>
+        <a href="{$thisUrl}?page={$thisPage}&glm_action=theme" class="nav-tab{if $thisAction==theme} nav-tab-active{/if}">Theme Settings</a>
         <a href="{$thisUrl}?page={$thisPage}&glm_action=development" class="nav-tab{if $thisAction==development} nav-tab-active{/if}">Development</a>
-        <a href="{$thisUrl}?page={$thisPage}&glm_action=import" class="nav-tab{if $thisAction==import} nav-tab-active{/if}">Data Import</a>
+        <a href="{$thisUrl}?page={$thisPage}&glm_action=import" class="nav-tab{if $thisAction==import} nav-tab-active{/if}">Import Members</a>
         <a href="{$thisUrl}?page={$thisPage}&glm_action=addons" class="nav-tab{if $thisAction==addons} nav-tab-active{/if}">Add-Ons</a>
         <a href="{$thisUrl}?page={$thisPage}&glm_action=hooks" class="nav-tab{if $thisAction==hooks} nav-tab-active{/if}">Hooks</a>
 {foreach $addOnTabs as $a}
diff --git a/views/admin/management/theme.html b/views/admin/management/theme.html
new file mode 100644 (file)
index 0000000..90fc4c0
--- /dev/null
@@ -0,0 +1,33 @@
+{include file='admin/management/header.html'}
+        
+        
+    <p>
+        <b>NOTE:</b> 
+        There are no actual theme settings added to the database yet. This tab has been setup as
+        a place where theme settings can be managed. <b>There will be a database error displayed
+        if this form is submitted because there are no fields other than ID in the "settings_theme"
+        table.</b> Please remove this message when data fields have been added to the database and 
+        this template has been updated with the new fields. 
+    </p>
+    
+        
+    <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+        <input type="hidden" name="glm_action" value="theme">
+        <input type="hidden" name="option" value="submit">
+        
+        <table class="glm-admin-table">
+        
+            <!-- Admin Menus -->
+        
+            <tr><td colspan="2"><h2>Theme Settings</h2></td></tr>
+            <tr>
+                <th {if $themeSettings.fieldRequired.some_theme_value}class="glm-required"{/if}>Some Theme Setting:</th>
+                <td {if $themeSettings.fieldFail.some_theme_value}class="glm-form-bad-input"{/if}>
+                    <input type="text" name="some_theme_value" value="{$themeSettings.fieldData.some_theme_value}" class="glm-form-text-input-medium">
+                    {if $themeSettings.fieldFail.some_theme_value}<p>{$themeSettings.fieldFail.some_theme_value}</p>{/if}
+                </td>
+            </tr>
+        </table>
+        <input type="submit" value="Update Settings" class="button button-primary">
+    </form>
+{include file='admin/footer.html'}
index 94ea6c2..c4abd3c 100644 (file)
@@ -1,8 +1,12 @@
 {include file='admin/members/header.html'}
     
-    <form action="{$thisUrl}?page={$thisPage}" method="post" id="searchForm" class="glm-right">
+    <form action="{$thisUrl}?page={$thisPage}" method="post" id="searchForm">
         <input type="hidden" name="glm_action" value="list">
-        <p>
+        <input type="hidden" name="prevStart" value="{$prevStart}">
+        <input type="hidden" name="nextStart" value="{$nextStart}">
+        <input type="hidden" name="limit" value="{$limit}">
+
+        <p class="glm-right">
 <!--                <th>Members Found:</th><td><span style="margin-right: 2em;">{$memberCount}</span></td> -->
                 <b>Categories: </b>
                 <select id="filterCategories" name="filterCategories[]" multiple="multiple" size="1">
                 </select>
                 <input type="submit" value="Submit" style="margin-right: 2em;">
                 <b>Show Archived: </b><input type="checkbox" id="filterArchived" class="listFilter"{if $filterArchived} checked{/if} style="margin-right: 1em;">
-                <b>Pending Only:</b><input type="checkbox" id="filterPending" class="listFilter"{if $filterPending} checked{/if} style="margin-right: 1em;">
-                <b>Text Search:</b><input  id="glmMembersSearch" type="text" id="autoTest">
+                <b>Pending Only: </b><input type="checkbox" id="filterPending" class="listFilter"{if $filterPending} checked{/if} style="margin-right: 1em;">
+                <b>Text Search: </b><input  id="glmMembersSearch" type="text" id="autoTest">
        </p>
+        <h2>List&nbsp;of&nbsp;Members</h2>
+        <br clear="all">
+        
+        {if $paging}
+            {if $prevStart}<input type="Submit" name="pageSelect" value="Previous {$limit} Members" class="button button-secondary glm-button">{/if}
+            {if $nextStart}<input type="Submit" name="pageSelect" value="Next {$limit} Members" class="button button-secondary glm-button">{/if}
+        {/if}    
+        
+        <table class="wp-list-table striped glm-admin-table">
+            <thead>
+                <tr>
+                    <th>ID</th>
+                    <th>Member Name</th>
+                    <th>Access</th>
+                    <th>Member Type</th>
+                </tr>
+            </thead>
+            <tbody>
+    {if $haveMembers}
+        {assign var="i" value="0"}
+        {foreach $members as $m}
+            {if $i++ is odd by 1} 
+                <tr>
+            {else}
+                <tr class="alternate">
+            {/if}
+                    <td>
+                        {$m.id}
+                        <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$m.id}&memberInfo={$m.active_id}" class="button button-secondary glm-button-small" style="margin: 0 .2em 0 .2em;">Edit Active Profile</a>
+                    </td>
+                    <td class="glm-nowrap">
+                        <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=index&member={$m.id}">{$m.name}</a>
+                    </td>
+                    <td class="glm-nowrap">
+                        {$m.access_short.name}
+                    </td>
+                    <td>
+                        {$m.member_type_short}
+                    </td>
+                </tr>
+        {/foreach}
+    {else}
+                <tr class="alternate"><td colspan="2">(no members listed)</td></tr>
+    {/if}
+            </tbody>
+        </table>
+
+        {if $paging}
+            {if $prevStart}<input type="Submit" name="pageSelect" value="Previous {$limit} Members" class="button button-secondary glm-button">{/if}
+            {if $nextStart}<input type="Submit" name="pageSelect" value="Next {$limit} Members" class="button button-secondary glm-button">{/if}
+        {/if}    
+
     </form>
-    <h2>List&nbsp;of&nbsp;Members</h2>
-    
-    <table class="wp-list-table striped glm-admin-table">
-        <thead>
-            <tr>
-                <th>ID</th>
-                <th>Member Name</th>
-                <th>Access</th>
-                <th>Member Type</th>
-                <th>Date Created</th>
-            </tr>
-        </thead>
-        <tbody>
-{if $haveMembers}
-    {assign var="i" value="0"}
-    {foreach $members as $m}
-        {if $i++ is odd by 1} 
-            <tr>
-        {else}
-            <tr class="alternate">
-        {/if}
-                <td>
-                    {$m.id}
-                    <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$m.id}&memberInfo={$m.active_id}" class="button button-secondary glm-button-small" style="margin: 0 .2em 0 .2em;">Active Profile</a>
-                </td>
-                <td class="glm-nowrap">
-                    <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=index&member={$m.id}">{$m.name}</a>
-                </td>
-                <td class="glm-nowrap">
-                    {$m.access_short.name}
-                </td>
-                <td>
-                    {$m.member_type_short}
-                </td>
-                <td>
-                    {$m.created.date}
-                </td>
-            </tr>
-    {/foreach}
-{else}
-            <tr class="alternate"><td colspan="2">(no members listed)</td></tr>
-{/if}
-        </tbody>
-    </table>
 
     <script type="text/javascript">
         jQuery(document).ready(function($) {
              */
 
              var availableTags = [
-    {foreach $members as $m}
+    {foreach $namesList as $m}
                 { label: "{$m.name|unescape:'html'}", value: "{$m.name|unescape:'html'}", id: '{$m.id}' },
     {/foreach}
              ];