From 42624ba30e3edf51056d9468b50b0ab0581a7317 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Tue, 9 Jun 2015 14:00:09 -0400 Subject: [PATCH] Added test for glm_members_info capability to display dashboard widget. Work in progress on restructuring settings. --- classes/data/dataAccommodationTypes.php | 1 - classes/data/dataAmenities.php | 1 - classes/data/dataCategories.php | 1 - classes/data/dataCategoryMemberInfo.php | 1 - classes/data/dataCities.php | 1 - classes/data/dataMemberInfo.php | 1 - classes/data/dataMemberTypes.php | 1 - classes/data/dataMembers.php | 1 - classes/data/dataRegions.php | 1 - classes/data/settings/dataSettingsGeneral.php | 391 ++++++++++++++++++ classes/glmPluginSupport.php | 1 + config/plugin.ini | 5 + controllers/admin.php | 56 ++- glm-member-db.php | 2 + misc/databaseScripts/create_database_V0.1.sql | 45 ++ misc/databaseScripts/drop_database_V0.1.sql | 2 + ...bc6c9474f73121a83d59b.file.header.html.php | 20 +- ...645f3c977b0b1dc2a9e718.file.index.html.php | 190 ++++++++- models/admin/configure/index.php | 88 +++- models/admin/configure/memberTypes.php | 193 --------- .../{configure => settings}/development.php | 16 +- models/admin/settings/index.php | 117 ++++++ views/admin/configure/header.html | 8 +- views/admin/configure/index.html | 156 ++++++- views/admin/configure/memberTypes.html | 155 ------- .../{configure => settings}/development.html | 4 +- views/admin/settings/header.html | 10 + views/admin/settings/index.html | 7 + views/admin/settingsPage/index.html | 14 + 29 files changed, 1074 insertions(+), 415 deletions(-) create mode 100644 classes/data/settings/dataSettingsGeneral.php delete mode 100644 models/admin/configure/memberTypes.php rename models/admin/{configure => settings}/development.php (94%) create mode 100644 models/admin/settings/index.php delete mode 100644 views/admin/configure/memberTypes.html rename views/admin/{configure => settings}/development.html (98%) create mode 100644 views/admin/settings/header.html create mode 100644 views/admin/settings/index.html create mode 100644 views/admin/settingsPage/index.html diff --git a/classes/data/dataAccommodationTypes.php b/classes/data/dataAccommodationTypes.php index 9c6f81a4..c87ab977 100644 --- a/classes/data/dataAccommodationTypes.php +++ b/classes/data/dataAccommodationTypes.php @@ -24,7 +24,6 @@ * @license http://www.gaslightmedia.com Gaslightmedia * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott * Exp $ - * @link http://www.visitgreatlakesbay.org/ */ class GlmDataAccommodationTypes extends GlmDataAbstract { diff --git a/classes/data/dataAmenities.php b/classes/data/dataAmenities.php index 4f2ba294..ee49098c 100644 --- a/classes/data/dataAmenities.php +++ b/classes/data/dataAmenities.php @@ -24,7 +24,6 @@ * @license http://www.gaslightmedia.com Gaslightmedia * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott * Exp $ - * @link http://www.visitgreatlakesbay.org/ */ class GlmDataAmenities extends GlmDataAbstract { diff --git a/classes/data/dataCategories.php b/classes/data/dataCategories.php index dca59b47..5f1062e3 100644 --- a/classes/data/dataCategories.php +++ b/classes/data/dataCategories.php @@ -24,7 +24,6 @@ * @license http://www.gaslightmedia.com Gaslightmedia * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott * Exp $ - * @link http://www.visitgreatlakesbay.org/ */ class GlmDataCategories extends GlmDataAbstract { diff --git a/classes/data/dataCategoryMemberInfo.php b/classes/data/dataCategoryMemberInfo.php index b2d25479..447d0ee4 100644 --- a/classes/data/dataCategoryMemberInfo.php +++ b/classes/data/dataCategoryMemberInfo.php @@ -24,7 +24,6 @@ * @license http://www.gaslightmedia.com Gaslightmedia * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott * Exp $ - * @link http://www.visitgreatlakesbay.org/ */ class GlmDataCategoryMemberInfo extends GlmDataAbstract { diff --git a/classes/data/dataCities.php b/classes/data/dataCities.php index 8ff06514..35396aaf 100644 --- a/classes/data/dataCities.php +++ b/classes/data/dataCities.php @@ -24,7 +24,6 @@ * @license http://www.gaslightmedia.com Gaslightmedia * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott * Exp $ - * @link http://www.visitgreatlakesbay.org/ */ class GlmDataCities extends GlmDataAbstract { diff --git a/classes/data/dataMemberInfo.php b/classes/data/dataMemberInfo.php index 893725cd..ced7e2ec 100644 --- a/classes/data/dataMemberInfo.php +++ b/classes/data/dataMemberInfo.php @@ -23,7 +23,6 @@ * @license http://www.gaslightmedia.com Gaslightmedia * @release SVN: $Id: dataMemberInfo.php,v 1.0 2011/01/25 19:31:47 cscott * Exp $ - * @link http://www.visitgreatlakesbay.org/ */ class GlmDataMemberInfo extends GlmDataAbstract { diff --git a/classes/data/dataMemberTypes.php b/classes/data/dataMemberTypes.php index def4de57..92cd7976 100644 --- a/classes/data/dataMemberTypes.php +++ b/classes/data/dataMemberTypes.php @@ -24,7 +24,6 @@ * @license http://www.gaslightmedia.com Gaslightmedia * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott * Exp $ - * @link http://www.visitgreatlakesbay.org/ */ class GlmDataMemberTypes extends GlmDataAbstract { diff --git a/classes/data/dataMembers.php b/classes/data/dataMembers.php index 6929d50f..753c5728 100644 --- a/classes/data/dataMembers.php +++ b/classes/data/dataMembers.php @@ -23,7 +23,6 @@ * @license http://www.gaslightmedia.com Gaslightmedia * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott * Exp $ - * @link http://www.visitgreatlakesbay.org/ */ class GlmDataMembers extends GlmDataAbstract { diff --git a/classes/data/dataRegions.php b/classes/data/dataRegions.php index be26b2c1..571df300 100644 --- a/classes/data/dataRegions.php +++ b/classes/data/dataRegions.php @@ -24,7 +24,6 @@ * @license http://www.gaslightmedia.com Gaslightmedia * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott * Exp $ - * @link http://www.visitgreatlakesbay.org/ */ class GlmDataRegions extends GlmDataAbstract { diff --git a/classes/data/settings/dataSettingsGeneral.php b/classes/data/settings/dataSettingsGeneral.php new file mode 100644 index 00000000..37100b18 --- /dev/null +++ b/classes/data/settings/dataSettingsGeneral.php @@ -0,0 +1,391 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataSettingsGeneral.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + */ + +/** + * EventManagementDataSettingsGeneral class + * + * PHP version 5 + * + * @category Data + * @package EventManagement + * @author Chuck Scott + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott + * Exp $ + */ +class GlmDataSettingsGeneral 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_general'; + + /* + * Table Data Fields + */ + $this->fields = array( + + 'id' => array( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + + /* + * Debug Options + */ + + // Adming Debug + 'admin_debug' => array( + 'field' => 'admin_debug', + 'type' => 'boolean', + 'use' => 'a' + ), + + // Adming Debug Verbose + 'admin_debug_verbose' => array( + 'field' => 'admin_debug_verbose', + 'type' => 'boolean', + 'use' => 'a' + ), + + // Front-end Debug + 'front_debug' => array( + 'field' => 'front_debug', + 'type' => 'boolean', + 'use' => 'a' + ), + + // Front-end Debug Verbose + 'front_debug_verbose' => array( + 'field' => 'front_debug_verbose', + 'type' => 'checkbox', + 'use' => 'a' + ), + + /* + * Google Maps + */ + + // Google Maps API Key + 'google_maps_api_key' => array( + 'field' => 'google_maps_api_key', + 'type' => 'text', + 'use' => 'lg' + ), + + // Google Maps Default Latitude + 'maps_default_lat' => array( + 'field' => 'maps_default_lat', + 'type' => 'float', + 'use' => 'a' + ), + + // Google Maps Default Longitude + 'maps_default_lon' => array( + 'field' => 'maps_default_lon', + 'type' => 'float', + 'use' => 'a' + ), + + /* + * Misc Settings + */ + + // Time Zone + 'time_zone' => array( + 'field' => 'time_zone', + 'type' => 'text', + 'use' => 'lg' + ), + + /* + * Front-end Member Search Options + */ + + // Front-end Listings - Show Map + 'list_show_map' => array( + 'field' => 'list_show_map', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show List + 'list_show_list' => array( + 'field' => 'list_show_list', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show Search Form + 'list_show_search' => array( + 'field' => 'list_show_search', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show Search Text + 'list_show_search_text' => array( + 'field' => 'list_show_search_text', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show Search Category + 'list_show_search_category' => array( + 'field' => 'list_show_search_category', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show Search Amenities + 'list_show_search_amenities' => array( + 'field' => 'list_show_search_amenities', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'lg' + ), + + // Front-end Listings - Show Search Alpha + 'list_show_search_alpha' => array( + 'field' => 'list_show_search_alpha', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + /* + * Front-end Member Listing Options + */ + + // Front-end Listings - Show Detail Link + 'list_show_detail_link' => array( + 'field' => 'list_show_detail_link', + 'type' => 'checkbox', + 'use' => 'lg' + ), + + // Front-end Listings - Show Logo + 'list_show_logo' => array( + 'field' => 'list_show_logo', + 'type' => 'checkbox', + 'use' => 'lg' + ), + + // Front-end Listings - Logo Size + 'list_logo_size' => array( + 'field' => 'list_logo_size', + 'type' => 'list', + 'list' => $this->config['image_sizes'], + 'required' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show Address + 'list_show_address' => array( + 'field' => 'list_show_address', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show Street + 'list_show_street' => array( + 'field' => 'list_show_Street', + 'type' => 'checkbox', + 'use' => 'lg' + ), + + // Front-end Listings - Show City, State, ZIP + 'list_show_citystatezip' => array( + 'field' => 'list_show_citystatezip', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show country + 'list_show_country' => array( + 'field' => 'list_show_country', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show Region + 'list_show_region' => array( + 'field' => 'list_show_region', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show Description + 'list_show_descr' => array( + 'field' => 'list_show_descr', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'lg' + ), + + // Front-end Listings - Show Short Description + 'list_show_short_descr' => array( + 'field' => 'list_show_short_descr', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show phone + 'list_show_phone' => array( + 'field' => 'list_show_phone', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show Toll Free + 'list_show_tollfree' => array( + 'field' => 'list_show_tollfree', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show URL + 'list_show_url' => array( + 'field' => 'list_show_url', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show Categories + 'list_show_categories' => array( + 'field' => 'list_show_categories', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show Credit Cards + 'list_show_logo' => array( + 'field' => 'list_show_creditcards', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'lg' + ), + + // Front-end Listings - Show Amenities + 'list_show_amenities' => array( + 'field' => 'list_show_amenities', + 'type' => 'checkbox', + 'default' => false, + 'use' => 'lg' + ), + + + + + + + + ); + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table); + } + + } +} + +?> \ No newline at end of file diff --git a/classes/glmPluginSupport.php b/classes/glmPluginSupport.php index 71e599e3..43b1775c 100644 --- a/classes/glmPluginSupport.php +++ b/classes/glmPluginSupport.php @@ -89,6 +89,7 @@ class GlmPluginSupport default; $notices = get_option('glmMembersAdminNotices'); $notices[] = $message; +//$notices = array(); update_option('glmMembersAdminNotices', $notices); break; diff --git a/config/plugin.ini b/config/plugin.ini index cb379d64..328ded26 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -34,6 +34,11 @@ thumb['crop'] = null [common] +image_sizes['large'] = 'Large' +image_sizes['medium'] = 'Medium' +image_sizes['small'] = 'Small' +image_sizes['thumb'] = 'Thumbnail' + ; ; Site Configuration Options ; diff --git a/controllers/admin.php b/controllers/admin.php index f1c9e93a..1868820b 100644 --- a/controllers/admin.php +++ b/controllers/admin.php @@ -30,13 +30,13 @@ $GLOBALS['glmMembersAdminValidActions'] = array( 'index' ), 'members' => array( - 'index', // member list + 'index', // member list 'list', 'reports', 'other' ), 'member' => array( - 'index', // Member Dashboard + 'index', // Member Dashboard 'memberInfo', 'locations', 'facilities', @@ -45,13 +45,15 @@ $GLOBALS['glmMembersAdminValidActions'] = array( ) , 'configure' => array( - 'index', - 'memberTypes', + 'index', // Member Types 'categories', 'cities', 'regions', 'accommodationTypes', 'amenities', + ), + 'settings' => array( + 'index', // General Options 'development' ), 'shortcodes' => array( @@ -66,6 +68,9 @@ $GLOBALS['glmMembersAdminValidActions'] = array( // Load glmPluginSupport class require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php'); +// Load Smarty Template Support +require (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php'); + /** * Admin Controller Class * @@ -214,6 +219,13 @@ class glmMembersAdmin extends GlmPluginSupport )); +/* + add_action( 'admin_init', + array( + $this, + 'glmMembersAdminSettingsInit' + )); +*/ } /** @@ -325,6 +337,15 @@ class glmMembersAdmin extends GlmPluginSupport 'glmMembersAdminMenuConfigure' )); + // Add a submenu for the "Settings" section + add_submenu_page('glm-members-admin-menu-members', + 'Member DB Settings', 'Settings', + 'glm_members_settings', 'glm-members-admin-menu-settings', + array( + $this, + 'glmMembersAdminMenuSettings' + )); + // Add a submenu for the "Shortcode Reference" section add_submenu_page('glm-members-admin-menu-members', 'Shortcode Reference', 'Shortcodes', @@ -349,15 +370,18 @@ class glmMembersAdmin extends GlmPluginSupport public function glmMembersAdminDashboardWidget () { - wp_add_dashboard_widget( - 'glm_members_admin_dashboard_widget', - 'Member DB Summary', - array( - $this, - 'glmMembersAdminDashboardContent' - ) - ); + if ( current_user_can( 'glm_members_info' ) ) { + wp_add_dashboard_widget( + 'glm_members_admin_dashboard_widget', + 'Member DB Summary', + array( + $this, + 'glmMembersAdminDashboardContent' + ) + ); + + } } /** @@ -412,6 +436,11 @@ class glmMembersAdmin extends GlmPluginSupport $this->controller('configure'); } + public function glmMembersAdminMenuSettings () + { + $this->controller('settings'); + } + public function glmMembersAdminMenuShortcodes () { $this->controller('shortcodes'); @@ -679,7 +708,6 @@ class glmMembersAdmin extends GlmPluginSupport */ // Load Smarty Template support - require (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php'); $smarty = new smartyTemplateSupport(); // Add standard template parameters @@ -723,9 +751,11 @@ class glmMembersAdmin extends GlmPluginSupport $templateVars = '
' . print_r($x, 1) . '
'; glmMembersAdmin::addNotice($templateVars, 'Template Parameters', 'Process'); + } // Generate output from model data and view + $smarty->template->display($view); // Restore timezone that was set before our code was called diff --git a/glm-member-db.php b/glm-member-db.php index 1faa4713..c89d96d9 100644 --- a/glm-member-db.php +++ b/glm-member-db.php @@ -336,6 +336,7 @@ function glmMembersAdminNotices($windowed = true) $output .= '
  • '.$d['title'].'
  • '; } } + $output .= '
    '; if (is_array($dataBlocks)) { reset($dataBlocks); @@ -350,6 +351,7 @@ function glmMembersAdminNotices($windowed = true) '; } } + delete_option('glmMembersAdminNoticeDataBlocks'); echo $output.' diff --git a/misc/databaseScripts/create_database_V0.1.sql b/misc/databaseScripts/create_database_V0.1.sql index cef9e18f..85dd1b12 100644 --- a/misc/databaseScripts/create_database_V0.1.sql +++ b/misc/databaseScripts/create_database_V0.1.sql @@ -473,6 +473,51 @@ CREATE TABLE {prefix}restaurants ( ---- +CREATE TABLE {prefix}settings_general ( + id INT NOT NULL AUTO_INCREMENT, + admin_debug BOOLEAN NULL, + admin_debug_verbose BOOLEAN NULL, + front_debug BOOLEAN NULL, + front_debug_verbose BOOLEAN NULL, + google_maps_api_key TINYTEXT NULL, + maps_default_lat FLOAT NULL, + maps_default_lon FLOAT NULL, + time_zone TINYTEXT NULL, + list_show_map BOOLEAN NULL, + list_show_list BOOLEAN NULL, + list_show_search BOOLEAN NULL, + list_show_search_category BOOLEAN NULL, + list_show_search_amenities BOOLEAN NULL, + list_show_search_alphja BOOLEAN NULL, + list_show_detail_link BOOLEAN NULL, + list_show_logo BOOLEAN NULL, + list_logo_size TINYTEXT NULL, + list_show_address BOOLEAN NULL, + list_show_street BOOLEAN NULL, + list_show_citystatezip BOOLEAN NULL, + list_show_country BOOLEAN NULL, + list_show_region BOOLEAN NULL, + list_show_descr BOOLEAN NULL, + list_show_short_descr BOOLEAN NULL, + list_show_phone BOOLEAN NULL, + list_show_tollfree BOOLEAN NULL, + list_show_url BOOLEAN NULL, + list_show_categories BOOLEAN NULL, + list_show_creditcards BOOLEAN NULL, + list_show_amenities BOOLEAN NULL, + + PRIMARY KEY (id) +); + +---- + +CREATE TABLE {prefix}settings_terms ( + id INT NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) +); + +---- + CREATE TABLE {prefix}social_media ( id INT NOT NULL AUTO_INCREMENT, name TINYTEXT NULL, diff --git a/misc/databaseScripts/drop_database_V0.1.sql b/misc/databaseScripts/drop_database_V0.1.sql index 45cbfe3c..2c792d88 100644 --- a/misc/databaseScripts/drop_database_V0.1.sql +++ b/misc/databaseScripts/drop_database_V0.1.sql @@ -27,6 +27,8 @@ DROP TABLE {prefix}regions, {prefix}restaurant_types, {prefix}restaurants, + {prefix}settings_general, + {prefix}settings_terms, {prefix}social_media, {prefix}social_media_ref ; diff --git a/misc/smarty/templates_c/3ec5bcbe581d6335e06bc6c9474f73121a83d59b.file.header.html.php b/misc/smarty/templates_c/3ec5bcbe581d6335e06bc6c9474f73121a83d59b.file.header.html.php index fb4f3655..ed517532 100644 --- a/misc/smarty/templates_c/3ec5bcbe581d6335e06bc6c9474f73121a83d59b.file.header.html.php +++ b/misc/smarty/templates_c/3ec5bcbe581d6335e06bc6c9474f73121a83d59b.file.header.html.php @@ -1,4 +1,4 @@ - decodeProperties(array ( @@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( '3ec5bcbe581d6335e06bc6c9474f73121a83d59b' => array ( 0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/configure/header.html', - 1 => 1422326142, + 1 => 1433353557, 2 => 'file', ), ), @@ -34,28 +34,22 @@ $_valid = $_smarty_tpl->decodeProperties(array (
    diff --git a/misc/smarty/templates_c/47fb9b803e7138d215645f3c977b0b1dc2a9e718.file.index.html.php b/misc/smarty/templates_c/47fb9b803e7138d215645f3c977b0b1dc2a9e718.file.index.html.php index 04744489..8c5bfbf3 100644 --- a/misc/smarty/templates_c/47fb9b803e7138d215645f3c977b0b1dc2a9e718.file.index.html.php +++ b/misc/smarty/templates_c/47fb9b803e7138d215645f3c977b0b1dc2a9e718.file.index.html.php @@ -1,4 +1,4 @@ - decodeProperties(array ( @@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array ( '47fb9b803e7138d215645f3c977b0b1dc2a9e718' => array ( 0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/configure/index.html', - 1 => 1421691086, + 1 => 1433354735, 2 => 'file', ), ), @@ -15,17 +15,193 @@ $_valid = $_smarty_tpl->decodeProperties(array ( 'function' => array ( ), - 'has_nocache_code' => false, 'version' => 'Smarty-3.1.21-dev', 'unifunc' => 'content_54c0496da75c57_83289225', + 'variables' => + array ( + 'thisURL' => 0, + 'thisPage' => 0, + 'haveMemberTypes' => 0, + 'memberTypes' => 0, + 'i' => 0, + 't' => 0, + ), + 'has_nocache_code' => false, ),false); /*/%%SmartyHeaderCode%%*/?> getSubTemplate ('admin/configure/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?> + + +
    Add a Member Type
    +
    +
    + + + + + + + + + + + + +
    Member Type Name: + +
    Description: + +
    +

    * Required

    + Cancel + +
    +
    + + +
    +
    +

    Are you sure you want to delete this member type?

    +

    Yes, delete this member type

    +

    Cancel

    +
    +
    + + +
    +
    + + + + + + + + + + + + +
    Member Type Name: + +
    Description: + +
    +

    * Required

    + Cancel + +
    +
    -

    General Configuration

    - -

    General configuration options go here.

    - +

    Member Types

    + + + + + + + + + + +tpl_vars['haveMemberTypes']->value) {?> + tpl_vars["i"])) {$_smarty_tpl->tpl_vars["i"] = clone $_smarty_tpl->tpl_vars["i"]; +$_smarty_tpl->tpl_vars["i"]->value = "0"; $_smarty_tpl->tpl_vars["i"]->nocache = null; $_smarty_tpl->tpl_vars["i"]->scope = 0; +} else $_smarty_tpl->tpl_vars["i"] = new Smarty_variable("0", null, 0);?> + tpl_vars['t'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['t']->_loop = false; + $_from = $_smarty_tpl->tpl_vars['memberTypes']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');} +foreach ($_from as $_smarty_tpl->tpl_vars['t']->key => $_smarty_tpl->tpl_vars['t']->value) { +$_smarty_tpl->tpl_vars['t']->_loop = true; +?> + tpl_vars['i']->value++ / 1)) {?> + + + + + + + + + + + + + +
    Member TypeDescription 
    + tpl_vars['t']->value['name'];?> + + + tpl_vars['t']->value['descr'];?> + + +
    Delete
    +
    (no member types listed)
    + + + type="text/javascript"> + jQuery(document).ready(function($) { + + $("#newMemberTypeDialog").dialog({ + autoOpen: false, + minWidth: 400, + dialogClass: "glm-dialog-no-close" + }); + $("#editMemberTypeDialog").dialog({ + autoOpen: false, + minWidth: 400, + dialogClass: "glm-dialog-no-close" + }); + $("#deleteMemberTypeDialog").dialog({ + autoOpen: false, + minWidth: 400, + dialogClass: "glm-dialog-no-close" + }); + + $('#newMemberTypeButton').click( function() { + $("#newMemberTypeDialog").dialog("open"); + }); + $('.editMemberType').click( function() { + var typeID = $(this).attr('data-memberTypeID'); + var typeName = $(this).text(); + var typeDescr = $('#editMemberTypeDescr_' + typeID).html(); + $('#editMemberTypeID').val(typeID); + $('#editMemberTypeName').val(typeName.trim()); + $('#editMemberTypeDescr').val(typeDescr.trim()); + $("#editMemberTypeDialog").dialog("open"); + }); + $('#editMemberTypeCancel').click( function() { + $("#editMemberTypeDialog").dialog("close"); + }); + $('#newMemberTypeCancel').click( function() { + $("#newMemberTypeDialog").dialog("close"); + }); + + var id = false; + $('.deleteMemberTypeButton').click( function() { + id = $(this).attr('data-memberTypeID'); + $("#deleteMemberTypeDialog").dialog("open"); + }); + $('#deleteMemberTypeConfirm').click( function() { + $("#deleteMemberTypeDialog").dialog("close"); + window.location.href = "tpl_vars['thisURL']->value;?> +?page=tpl_vars['thisPage']->value;?> +&glm_action=index&option=delete&id=" + id; + }); + $('#deleteMemberTypeCancel').click( function() { + $("#deleteMemberTypeDialog").dialog("close"); + }); + + }); + +> + getSubTemplate ('admin/footer.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?> diff --git a/models/admin/configure/index.php b/models/admin/configure/index.php index 3d236634..4b42f0da 100644 --- a/models/admin/configure/index.php +++ b/models/admin/configure/index.php @@ -2,7 +2,7 @@ /** * Gaslight Media Members Database - * Admin Configure + * Admin Member Type List * * PHP version 5.5 * @@ -13,12 +13,15 @@ * @version 0.1 */ +// Load Member Types data abstract +require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.php'); + /* * This class performs the work for the default action of the "Members" menu * option, which is to display the members dashboard. * */ -class GlmMembersAdmin_configure_index +class GlmMembersAdmin_configure_index extends GlmDataMemberTypes { /** @@ -54,6 +57,9 @@ class GlmMembersAdmin_configure_index // Save plugin configuration object $this->config = $config; + // Run constructor for members data class + parent::__construct(false, false); + } /* @@ -93,17 +99,86 @@ class GlmMembersAdmin_configure_index public function modelAction ($actionData = false) { - // Determine if current user can add, edit, delete member data - $canEdit = current_user_can('glm_members_edit'); + $success = true; + $haveMemberTypes = false; + $memberTypes = false; + $error = false; + + // Check for member type id + $id = 0; + if (isset($_REQUEST['id'])) { + $id = $_REQUEST['id']-0; + } + + // If there's an action option + if (isset($_REQUEST['option'])) { + + switch($_REQUEST['option']) { + + case 'addNew': + $this->insertEntry(); + break; + + case 'update': + if ($id > 0) { + $this->updateEntry($id); + } + break; + + case 'delete': + if ($id > 0) { + $this->deleteEntry($id, true); + } + break; + + } + + } + + // Get a current list of member types + $memberTypes = $this->getList(); + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Type Data'); + } + + // If we have list entries - even if it's an empty list + $success = true; + $haveMemberTypes = false; + if ($memberTypes !== false) { + + $success = true; + + // If we have any entries + if (count($memberTypes) > 0) { + $haveMemberTypes = true; + } + } + + // If we had a fatal error, redirect to the error page + if ($error) { + return array( + 'status' => $success, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => false + ); + } + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { + glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Types Data'); + } // Compile template data $templateData = array( - 'canEdit' => $canEdit + 'haveMemberTypes' => $haveMemberTypes, + 'memberTypes' => $memberTypes ); // Return status, suggested view, and data to controller return array( - 'status' => true, + 'status' => $success, 'menuItemRedirect' => false, 'modelRedirect' => false, 'view' => 'admin/configure/index.html', @@ -112,6 +187,7 @@ class GlmMembersAdmin_configure_index } + } ?> \ No newline at end of file diff --git a/models/admin/configure/memberTypes.php b/models/admin/configure/memberTypes.php deleted file mode 100644 index 524fa468..00000000 --- a/models/admin/configure/memberTypes.php +++ /dev/null @@ -1,193 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @version 0.1 - */ - -// Load Member Types data abstract -require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.php'); - -/* - * This class performs the work for the default action of the "Members" menu - * option, which is to display the members dashboard. - * - */ -class GlmMembersAdmin_configure_memberTypes extends GlmDataMemberTypes -{ - - /** - * 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) - { - - $success = true; - $haveMemberTypes = false; - $memberTypes = false; - $error = false; - - // Check for member type id - $id = 0; - if (isset($_REQUEST['id'])) { - $id = $_REQUEST['id']-0; - } - - // If there's an action option - if (isset($_REQUEST['option'])) { - - switch($_REQUEST['option']) { - - case 'addNew': - $this->insertEntry(); - break; - - case 'update': - if ($id > 0) { - $this->updateEntry($id); - } - break; - - case 'delete': - if ($id > 0) { - $this->deleteEntry($id, true); - } - break; - - } - - } - - // Get a current list of member types - $memberTypes = $this->getList(); - - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Type Data'); - } - - // If we have list entries - even if it's an empty list - $success = true; - $haveMemberTypes = false; - if ($memberTypes !== false) { - - $success = true; - - // If we have any entries - if (count($memberTypes) > 0) { - $haveMemberTypes = true; - } - } - - // If we had a fatal error, redirect to the error page - if ($error) { - return array( - 'status' => $success, - 'menuItemRedirect' => 'error', - 'modelRedirect' => 'index', - 'view' => 'admin/error/index.html', - 'data' => false - ); - } - - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Types Data'); - } - - // Compile template data - $templateData = array( - 'haveMemberTypes' => $haveMemberTypes, - 'memberTypes' => $memberTypes - ); - - // Return status, suggested view, and data to controller - return array( - 'status' => $success, - 'menuItemRedirect' => false, - 'modelRedirect' => false, - 'view' => 'admin/configure/memberTypes.html', - 'data' => $templateData - ); - - } - - -} - -?> \ No newline at end of file diff --git a/models/admin/configure/development.php b/models/admin/settings/development.php similarity index 94% rename from models/admin/configure/development.php rename to models/admin/settings/development.php index bcf34310..bded5bda 100644 --- a/models/admin/configure/development.php +++ b/models/admin/settings/development.php @@ -18,7 +18,7 @@ * option, which is to display the members dashboard. * */ -class GlmMembersAdmin_configure_development +class GlmMembersAdmin_settings_development { /** @@ -211,7 +211,7 @@ class GlmMembersAdmin_configure_development // Check if the database version set for this plugin is invalid. if (!isset($activate->dbVersions[$dbVersion])) { - $resultMessage .= "The last database version set for the ".GLM_MEMBERS_PLUGIN_NAME." (V$dbVersion) isn't valid.
    "; + $templateData['resultMessage'] .= "The last database version set for the ".GLM_MEMBERS_PLUGIN_NAME." (V$dbVersion) isn't valid.
    "; break; } @@ -227,16 +227,16 @@ class GlmMembersAdmin_configure_development if (is_array($existingTables)) { - $ - $resultMessage .= 'Current database tables
      '; + + $templateData['resultMessage'] .= 'Current database tables
        '; foreach($existingTables as $t){ - $resultMessage .= "
      • ".$t['table_name'].'

      • '; + $templateData['resultMessage'] .= "
      • ".$t['table_name'].'

      • '; } - $resultMessage .= '
      '; + $templateData['resultMessage'] .= '
    '; } else { - $resultMessage .= 'No tables currently exist
    '; + $templateData['resultMessage'] .= 'No tables currently exist
    '; } break; @@ -252,7 +252,7 @@ class GlmMembersAdmin_configure_development 'status' => true, 'menuItemRedirect' => false, 'modelRedirect' => false, - 'view' => 'admin/configure/development.html', + 'view' => 'admin/settings/development.html', 'data' => $templateData ); diff --git a/models/admin/settings/index.php b/models/admin/settings/index.php new file mode 100644 index 00000000..e5645f52 --- /dev/null +++ b/models/admin/settings/index.php @@ -0,0 +1,117 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +/* + * This class performs the work for the default action of the "Members" menu + * option, which is to display the members dashboard. + * + */ +class GlmMembersAdmin_settings_index +{ + + /** + * 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; + + } + + /* + * 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) + { + + // Determine if current user can add, edit, delete member data + $canEdit = current_user_can('glm_members_edit'); + + // Compile template data + $templateData = array( + 'canEdit' => $canEdit + ); + + // Return status, suggested view, and data to controller + return array( + 'status' => true, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => 'admin/settings/index.html', + 'data' => $templateData + ); + + } + +} + +?> \ No newline at end of file diff --git a/views/admin/configure/header.html b/views/admin/configure/header.html index be5e15a1..5ce2e0c2 100644 --- a/views/admin/configure/header.html +++ b/views/admin/configure/header.html @@ -3,14 +3,12 @@

    {$glmPluginName} Configuration

    \ No newline at end of file diff --git a/views/admin/configure/index.html b/views/admin/configure/index.html index 6ac1fe55..0cbedb6d 100644 --- a/views/admin/configure/index.html +++ b/views/admin/configure/index.html @@ -1,7 +1,155 @@ {include file='admin/configure/header.html'} + + +
    Add a Member Type
    +
    +
    + + + + + + + + + + + + +
    Member Type Name: + +
    Description: + +
    +

    * Required

    + Cancel + +
    +
    + + +
    +
    +

    Are you sure you want to delete this member type?

    +

    Yes, delete this member type

    +

    Cancel

    +
    +
    + + +
    +
    + + + + + + + + + + + + +
    Member Type Name: + +
    Description: + +
    +

    * Required

    + Cancel + +
    +
    -

    General Configuration

    - -

    General configuration options go here.

    - +

    Member Types

    + + + + + + + + + + +{if $haveMemberTypes} + {assign var="i" value="0"} + {foreach $memberTypes as $t} + {if $i++ is odd by 1} + + {else} + + {/if} + + + + + {/foreach} +{else} + +{/if} + +
    Member TypeDescription 
    + {$t.name} + + {$t.descr} + +
    Delete
    +
    (no member types listed)
    + + + {include file='admin/footer.html'} diff --git a/views/admin/configure/memberTypes.html b/views/admin/configure/memberTypes.html deleted file mode 100644 index 1756e4d9..00000000 --- a/views/admin/configure/memberTypes.html +++ /dev/null @@ -1,155 +0,0 @@ -{include file='admin/configure/header.html'} - - -
    Add a Member Type
    -
    -
    - - - - - - - - - - - - -
    Member Type Name: - -
    Description: - -
    -

    * Required

    - Cancel - -
    -
    - - -
    -
    -

    Are you sure you want to delete this member type?

    -

    Yes, delete this member type

    -

    Cancel

    -
    -
    - - -
    -
    - - - - - - - - - - - - -
    Member Type Name: - -
    Description: - -
    -

    * Required

    - Cancel - -
    -
    - -

    Member Types

    - - - - - - - - - - -{if $haveMemberTypes} - {assign var="i" value="0"} - {foreach $memberTypes as $t} - {if $i++ is odd by 1} - - {else} - - {/if} - - - - - {/foreach} -{else} - -{/if} - -
    Member TypeDescription 
    - {$t.name} - - {$t.descr} - -
    Delete
    -
    (no member types listed)
    - - - -{include file='admin/footer.html'} diff --git a/views/admin/configure/development.html b/views/admin/settings/development.html similarity index 98% rename from views/admin/configure/development.html rename to views/admin/settings/development.html index 75e64211..87ef9dd5 100644 --- a/views/admin/configure/development.html +++ b/views/admin/settings/development.html @@ -1,4 +1,4 @@ -{include file='admin/configure/header.html'} +{include file='admin/settings/header.html'}

    Note: Customers will not have access to this tab.

    @@ -104,7 +104,7 @@
    {if $resultMessage}
    -

    Results

    +
    {$resultMessage}
    {/if} diff --git a/views/admin/settings/header.html b/views/admin/settings/header.html new file mode 100644 index 00000000..a2ac3396 --- /dev/null +++ b/views/admin/settings/header.html @@ -0,0 +1,10 @@ +
    + +

    {$glmPluginName} Configuration

    + + +
    + \ No newline at end of file diff --git a/views/admin/settings/index.html b/views/admin/settings/index.html new file mode 100644 index 00000000..27995976 --- /dev/null +++ b/views/admin/settings/index.html @@ -0,0 +1,7 @@ +{include file='admin/settings/header.html'} + +

    General Settings

    + +

    General settings go here.

    + +{include file='admin/footer.html'} diff --git a/views/admin/settingsPage/index.html b/views/admin/settingsPage/index.html new file mode 100644 index 00000000..de804cf0 --- /dev/null +++ b/views/admin/settingsPage/index.html @@ -0,0 +1,14 @@ + +

    + +
    +

    My Plugin Options

    +
    + {php} settings_fields( 'glm-member-db-settings-group' ); {/php} + {php} do_settings_sections( 'glm-member-db-settings' ); {/php} + {php} submit_button(); {/php} +
    +
    -- 2.17.1