From c9c2714f681e621c7c0501d4201b309b50ddd154 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Mon, 15 Feb 2016 09:31:22 -0500 Subject: [PATCH] Saving current state of feature branch to test on development server --- classes/data/dataAccommodationTypes.php | 151 ---- classes/data/dataMemberInfo.php | 166 +--- classes/data/dataMembers.php | 220 +++++- controllers/admin.php | 86 +- css/admin.css | 13 +- css/front.css | 4 +- glm-member-db.php | 5 +- lib/GlmDataAbstract/DataAbstract.php | 14 +- models/admin/configure/accommodationTypes.php | 193 ----- models/admin/dashboardWidget/index.php | 13 +- models/admin/management/index.php | 1 + models/admin/member/memberEdit.php | 471 +++++++++++ models/admin/member/memberInfo.php | 181 +---- models/admin/members/index.php | 17 +- models/admin/members/list.php | 2 +- ...V1.0.43.sql => create_database_V1.1.0.sql} | 345 +-------- setup/databaseScripts/dbVersions.php | 3 +- .../update_database_V1.1.0.sql | 203 +++++ setup/validActions.php | 7 +- views/admin/configure/accommodationTypes.html | 172 ---- views/admin/configure/amenities.html | 4 +- views/admin/configure/header.html | 1 - views/admin/dashboardWidget/index.html | 8 +- views/admin/management/header.html | 4 + views/admin/member/header.html | 12 +- views/admin/member/index.html | 145 ++-- views/admin/member/memberEdit.html | 733 ++++++++++++++++++ views/admin/member/memberInfo.html | 694 ++--------------- views/admin/members/index.html | 30 +- views/admin/members/list.html | 11 +- 30 files changed, 1910 insertions(+), 1999 deletions(-) delete mode 100644 classes/data/dataAccommodationTypes.php delete mode 100644 models/admin/configure/accommodationTypes.php create mode 100644 models/admin/member/memberEdit.php rename setup/databaseScripts/{create_database_V1.0.43.sql => create_database_V1.1.0.sql} (55%) create mode 100644 setup/databaseScripts/update_database_V1.1.0.sql delete mode 100644 views/admin/configure/accommodationTypes.html create mode 100644 views/admin/member/memberEdit.html diff --git a/classes/data/dataAccommodationTypes.php b/classes/data/dataAccommodationTypes.php deleted file mode 100644 index 230fde5a..00000000 --- a/classes/data/dataAccommodationTypes.php +++ /dev/null @@ -1,151 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @release SVN: $Id: dataMemberType.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ - */ - -/** - * EventManagementDataAccommodationTypes 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 GlmDataAccommodationTypes 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 . 'accommodation_types'; - - /* - * Table Data Fields - */ - $this->fields = array( - - 'id' => array( - 'field' => 'id', - 'type' => 'integer', - 'view_only' => true, - 'use' => 'a' - ), - - // Name - 'name' => array( - 'field' => 'name', - 'type' => 'text', - 'required' => true, - 'unique' => true, - 'use' => 'a' - ), - - // Description - 'descr' => array( - 'field' => 'descr', - 'type' => 'text', - 'use' => 'a' - ), - - // Short Description - 'short_descr' => array( - 'field' => 'short_descr', - 'type' => 'text', - '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 diff --git a/classes/data/dataMemberInfo.php b/classes/data/dataMemberInfo.php index d6e5169c..63c1658f 100644 --- a/classes/data/dataMemberInfo.php +++ b/classes/data/dataMemberInfo.php @@ -178,20 +178,6 @@ class GlmDataMemberInfo extends GlmDataAbstract 'use' => 'a' ), - // Create Time - 'create_time' => array ( - 'field' => 'create_time', - 'type' => 'datetime', - 'use' => 'lgie' - ), - - // Last Modify Time - 'modify_time' => array ( - 'field' => 'modify_time', - 'type' => 'datetime', - 'use' => 'a' - ), - // Description 'descr' => array( 'field' => 'descr', @@ -206,132 +192,25 @@ class GlmDataMemberInfo extends GlmDataAbstract 'use' => 'a' ), - // Address Line 1 - 'addr1' => array ( - 'field' => 'addr1', - 'type' => 'text', - 'use' => 'a' - ), - - // Address Line 2 - 'addr2' => array ( - 'field' => 'addr2', - 'type' => 'text', - 'use' => 'a' - ), - - // City - 'city' => array ( - 'field' => 'city', - 'type' => 'pointer', - 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'cities', - 'p_field' => 'name', - 'p_orderby' => 'name', - 'use' => 'a' - ), - - // State - 'state' => array ( - 'field' => 'state', - 'type' => 'list', - 'list' => $this->config['states'], - 'default' => 'MI', - 'use' => 'a' - ), - - // ZIP / Postal Code - 'zip' => array ( - 'field' => 'zip', - 'type' => 'text', - 'use' => 'a' - ), - - // Country - 'country' => array ( - 'field' => 'country', - 'type' => 'list', - 'list' => $this->config['countries'], - 'default' => 'US', - 'use' => 'a' - ), - - // Latitude - 'lat' => array( - 'field' => 'lat', - 'type' => 'float', - 'default' => $this->config['settings']['maps_default_lat'], - 'use' => 'a' - ), - - // Longitude - 'lon' => array( - 'field' => 'lon', - 'type' => 'float', - 'default' => $this->config['settings']['maps_default_lon'], - 'use' => 'a' - ), - - // Region - 'region' => array ( - 'field' => 'region', - 'type' => 'pointer', - 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'regions', - 'p_field' => 'name', - 'p_orderby' => 'name', - 'p_blank' => true, - // 'force_list' => true, - 'use' => 'a' - ), - - // Phone - 'phone' => array( - 'field' => 'phone', - 'type' => 'phone', - 'use' => 'a' - ), - - // Toll Free - 'toll_free' => array( - 'field' => 'toll_free', - 'type' => 'phone', - 'use' => 'a' - ), - - // E-Mail Address - 'email' => array( - 'field' => 'email', - 'type' => 'email', - 'use' => 'a' - ), - - // URL - 'url' => array( - 'field' => 'url', - 'type' => 'text', - 'use' => 'a' - ), - - // Logo - 'logo' => array( - 'field' => 'logo', - 'type' => 'image', - 'use' => 'a' - ), - - // Credit Cards Accepted - multi-pick - 'cc_type' => array( - 'field' => 'cc_type', - 'type' => 'bitmap', - 'bitmap' => $this->config['credit_card'], - 'default' => 0, // no cards selected - 'use' => 'a' - ), - // Notes 'notes' => array ( 'field' => 'notes', 'type' => 'text', 'use' => 'a' + ), + + // Create Time + 'create_time' => array ( + 'field' => 'create_time', + 'type' => 'datetime', + 'use' => 'lgie' + ), + + // Last Modify Time + 'modify_time' => array ( + 'field' => 'modify_time', + 'type' => 'datetime', + 'use' => 'a' ) ); @@ -364,23 +243,6 @@ class GlmDataMemberInfo extends GlmDataAbstract return $r; } - // Get Member Category data for this entry - $sql = " - SELECT CMI.member_info AS member_info_id, C.id, C.name, C.descr, C.short_descr, - COALESCE ( - ( - SELECT name - FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories - WHERE id = C.parent - ), '' - ) AS parent_name - FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories AS C, - ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "category_member_info AS CMI - WHERE C.id = CMI.category - AND CMI.member_info = ".$r['id']." - ;"; - $r['categories'] = $this->wpdb->get_results($sql, ARRAY_A); - // Get Amenity Data for this entry $sql = " SELECT A.* diff --git a/classes/data/dataMembers.php b/classes/data/dataMembers.php index 3b779c26..45757709 100644 --- a/classes/data/dataMembers.php +++ b/classes/data/dataMembers.php @@ -47,6 +47,13 @@ class GlmDataMembers extends GlmDataAbstract { * @access public */ public $table; + /** + * Do Post Processing flag + * + * @var $doPostProcessing + * @access public + */ + public $doPostProcessing = true; /** * Field definitions @@ -133,7 +140,7 @@ class GlmDataMembers extends GlmDataAbstract { 'l_blank' => true, 'required' => true, 'default' => 30, - 'force_list' => true, + 'force_list' => false, 'use' => 'lged' ), @@ -149,6 +156,26 @@ class GlmDataMembers extends GlmDataAbstract { 'use' => 'a' ), + // Member Type Display only short version + 'member_type_short' => array ( + 'field' => 'member_type', + 'as' => 'member_type_short', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_type', + 'p_field' => 'name', + 'p_orderby' => 'name', + 'force_list' => false, + 'use' => 'lged' + ), + + // Date created + 'created' => array ( + 'field' => 'created', + 'type' => 'date', + 'required' => true, + 'use' => 'a' + ), + // Member Name 'name' => array ( 'field' => 'name', @@ -165,14 +192,134 @@ class GlmDataMembers extends GlmDataAbstract { 'use' => 'gle' ), - // Date created - 'created' => array ( - 'field' => 'created', - 'type' => 'date', - 'required' => true, + // Address Line 1 + 'addr1' => array ( + 'field' => 'addr1', + 'type' => 'text', + 'use' => 'a' + ), + + // Address Line 2 + 'addr2' => array ( + 'field' => 'addr2', + 'type' => 'text', + 'use' => 'a' + ), + + // City + 'city' => array ( + 'field' => 'city', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'cities', + 'p_field' => 'name', + 'p_orderby' => 'name', + 'use' => 'a' + ), + + // State + 'state' => array ( + 'field' => 'state', + 'type' => 'list', + 'list' => $this->config['states'], + 'default' => 'MI', + 'use' => 'a' + ), + + // ZIP / Postal Code + 'zip' => array ( + 'field' => 'zip', + 'type' => 'text', 'use' => 'a' ), + // Country + 'country' => array ( + 'field' => 'country', + 'type' => 'list', + 'list' => $this->config['countries'], + 'default' => 'US', + 'use' => 'a' + ), + + // Latitude + 'lat' => array( + 'field' => 'lat', + 'type' => 'float', + 'default' => $this->config['settings']['maps_default_lat'], + 'use' => 'a' + ), + + // Longitude + 'lon' => array( + 'field' => 'lon', + 'type' => 'float', + 'default' => $this->config['settings']['maps_default_lon'], + 'use' => 'a' + ), + + // Region + 'region' => array ( + 'field' => 'region', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'regions', + 'p_field' => 'name', + 'p_orderby' => 'name', + 'p_blank' => true, + // 'force_list' => true, + 'use' => 'a' + ), + + // Phone + 'phone' => array( + 'field' => 'phone', + 'type' => 'phone', + 'use' => 'a' + ), + + // Toll Free + 'toll_free' => array( + 'field' => 'toll_free', + 'type' => 'phone', + 'use' => 'a' + ), + + // E-Mail Address + 'email' => array( + 'field' => 'email', + 'type' => 'email', + 'use' => 'a' + ), + + // URL + 'url' => array( + 'field' => 'url', + 'type' => 'text', + 'use' => 'a' + ), + + // Logo + 'logo' => array( + 'field' => 'logo', + 'type' => 'image', + 'use' => 'a' + ), + + // Credit Cards Accepted - multi-pick + 'cc_type' => array( + 'field' => 'cc_type', + 'type' => 'bitmap', + 'bitmap' => $this->config['credit_card'], + 'default' => 0, // no cards selected + 'use' => 'a' + ), + + // Notes + 'notes' => array ( + 'field' => 'notes', + 'type' => 'text', + 'use' => 'a' + ), + // Active Version 'active_id' => array ( 'field' => 'id', @@ -218,6 +365,48 @@ class GlmDataMembers extends GlmDataAbstract { } + /* + * Entry Post Processing Call-Back Method + * + * Perform post-processing for all result entries. + * + * In this case we're using it to append an array of category + * data to each member result and also sort by member name. + * + * @param array $r Array of field result data for a single entry + * @param string $a Action being performed (l, i, g, ...) + * + * @return object Class object + * + */ + public function entryPostProcessing($r, $a) + { + + // Only run these tests for 'l' (getList), 'g' (getEntry), 'e' (editEntry) + if (!$this->doPostProcessing || ($a != 'l' && $a != 'g' && $a != 'e')) { + return $r; + } + + // Get Member Category data for this entry + $sql = " + SELECT CMI.member_info AS member_info_id, C.id, C.name, C.descr, C.short_descr, + COALESCE ( + ( + SELECT name + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories + WHERE id = C.parent + ), '' + ) AS parent_name + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories AS C, + ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "category_member_info AS CMI + WHERE C.id = CMI.category + AND CMI.member_info = ".$r['id']." + ;"; + $r['categories'] = $this->wpdb->get_results($sql, ARRAY_A); + + return $r; + } + /* * Update member slug - should be called after a member record is added or updated * @@ -247,23 +436,30 @@ class GlmDataMembers extends GlmDataAbstract { } + /* * Get a simple members list - Name and ID only * * @return array Array of Name and ID for all members * @access public */ - public function getSimpleMembersList() + public function getSimpleMembersList($where = '') { // Save the current fields array and make a copy $fSave = $this->fields; - $f = $fSave; - // Remove what we don't want form the copy and get the list - unset($f['access'], $f['member_type'], $f['created']); - $this->fields = $f; - $memberList = $this->getList(); + // Remove what we don't want from the copy and get the list + $this->fields = array( + 'id' => $fSave['id'], + 'name' => $fSave['name'], + 'created' => $fSave['created'], + 'access_short' => $fSave['access_short'], + 'member_type_short' => $fSave['member_type_short'], + 'active_id' => $fSave['active_id'] + ); + + $memberList = $this->getList($where); // Restore the fields list $this->fields = $fSave; diff --git a/controllers/admin.php b/controllers/admin.php index 0e69c3e0..a6c22d53 100644 --- a/controllers/admin.php +++ b/controllers/admin.php @@ -105,6 +105,13 @@ class glmMembersAdmin extends GlmPluginSupport * @access public */ public $config; + /** + * Current Git Branch + * + * @var $gitBranch + * @access public + */ + public $gitBranch; /** * Admin Controller Constructor @@ -183,6 +190,12 @@ class glmMembersAdmin extends GlmPluginSupport ) ); + // Check the current Git branch and if it's not 'master' then display admin warning + $this->getGitBranch(); + if (count($this->gitBranch) > 0) { + add_action('admin_notices', array($this, 'glmMembersGitNotice')); + } + // Create hook for add-ons to create menus do_action('glm-member-db-add-menu'); @@ -211,6 +224,77 @@ class glmMembersAdmin extends GlmPluginSupport } + + /** + * Get Git Branch + * + * @return void + * @access public + */ + public function getGitBranch() + { + $gitBranch = array(); + + foreach ($this->config['addOns'] as $a) { + + // Git branch should be stored in .git/HEAD file + $gitFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.'/'.$a['slug'].'/.git/HEAD'; + + // Check if the file exists + if (file_exists($gitFile)) { + + // Read in the file + $gitString = file_get_contents($gitFile); + + // Parse the branch string by '/' + $gitParts = explode('/', $gitString); + + if (trim($gitParts[2]) != 'master') { + + $gitBranch[$a['slug']]['slug'] = $a['slug']; + + // [2] should be branch name or type + if (isset($gitParts[2])) { + $gitBranch[$a['slug']]['branch'] = $gitParts[2]; + } + + // [3] should be name of feature + if (isset($gitParts[3])) { + $gitBranch[$a['slug']]['feature'] = $gitParts[3]; + } + + } + + } + + } + + $this->gitBranch = $gitBranch; + return; + + } + + /** + * Display Git Branch as an admin warning + * + * @return void + * @access public + */ + function glmMembersGitNotice() { + + echo '

Plugin Git Branch Warning:

'; + foreach ($this->gitBranch as $b) { + + echo ''; + + } + echo "
'.$b['slug'].''.$b['branch']; + if (isset($b['feature'])) { + echo '/'.$b['feature']; + } + echo '
"; + } + /** * Admin Ajax Target * @@ -612,7 +696,7 @@ class glmMembersAdmin extends GlmPluginSupport if (!isset($this->config['validActions']['adminActions'][$menuItem])) { if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - $this->addNotice('Error in Admin Controller: Menu Item not specified!', 'Alert'); + $this->addNotice('Error in Admin Controller: Menu Item not included in validActions.php!', 'Alert'); } $modelRedirect = true; diff --git a/css/admin.css b/css/admin.css index d6c690fe..80e0f3ec 100644 --- a/css/admin.css +++ b/css/admin.css @@ -41,6 +41,9 @@ .glm-clear { clear: both; } +.glm-hidden { + display: none !important; +} .glm-button { margin-left: 4px !important; margin-right: 4px !important; @@ -74,6 +77,9 @@ } /* Admin Forms */ +.glm-bad-input-area { + background: #FFaBa9; +} .glm-form-bad-input { background: #FFaBa9; padding: .2em; @@ -91,7 +97,7 @@ width: 50em; } .glm-form-textarea { - width: 90%; + width: 100%; } /* Admin table additions */ @@ -119,6 +125,11 @@ .glm-admin-table-active { background: #99FFFF; } +.glm-admin-table-large-bold-text { + font-size: 1.4em; + font-weight: bold; + margin: 0px; +} .glm-admin-table-medium-text { font-size: 0.9em; margin: 0px; diff --git a/css/front.css b/css/front.css index c2d6cb7c..8b7dcd7d 100644 --- a/css/front.css +++ b/css/front.css @@ -4,10 +4,10 @@ */ .glm-right { - float: right; + float: right; } .glm-left { - float: left; + float: left; } .glm-hidden { display: none; diff --git a/glm-member-db.php b/glm-member-db.php index 50fd72ad..1ba06e98 100644 --- a/glm-member-db.php +++ b/glm-member-db.php @@ -25,9 +25,6 @@ /* * Plugin and Database Versions * - * Note that the database version matches the version of the last - * plugin version where there was a change in the database. - * * 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 @@ -42,7 +39,7 @@ */ define('GLM_MEMBERS_PLUGIN_VERSION', '1.0.57'); -define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.0.43'); +define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.0'); // Check if plugin version is not current in WordPress option and if needed updated it if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) { diff --git a/lib/GlmDataAbstract/DataAbstract.php b/lib/GlmDataAbstract/DataAbstract.php index 1463c910..60896c10 100755 --- a/lib/GlmDataAbstract/DataAbstract.php +++ b/lib/GlmDataAbstract/DataAbstract.php @@ -587,7 +587,8 @@ abstract class GlmDataAbstract $pSum = (isset($f['p_sum']) && $f['p_sum']); if (($this->optionIncludeSelectListData || $alwaysList || $forEdit || $pSum) && !$pStatic ) { - $p_value = $d; + // Get pointer value, ensure it's an integer + $p_value = ($d - 0); // Check for ORDER BY option $order_by = $f['p_field']; @@ -685,11 +686,14 @@ abstract class GlmDataAbstract // Not doing list so get value only } else { + // Get pointer value, ensure that's it's an integer + $p_value = ($d - 0); + $sql = " SELECT ".$f['p_field']." FROM ".$f['p_table']." $where - AND $p_id = $d + AND $p_id = $p_value "; $res = $this->wpdb->get_row($sql, ARRAY_A); @@ -2675,7 +2679,7 @@ abstract class GlmDataAbstract while (list($k, $v) = each($this->fields )) { // If this field is selected for the current operation - if (strstr($v['use'], $op) || strstr($v['use'], 'a')) { + if (isset($v['use']) && (strstr($v['use'], $op) || strstr($v['use'], 'a'))) { $type = $v['type']; @@ -2756,7 +2760,7 @@ abstract class GlmDataAbstract while (list($k, $v) = each($this->fields )) { // If this field is selected for the current operation - if (strstr($v['use'], $op) || strstr($v['use'], 'a')) { + if (isset($v['use']) && (strstr($v['use'], $op) || strstr($v['use'], 'a'))) { // Is there a separate output type? $type = $v['type']; @@ -2840,7 +2844,7 @@ abstract class GlmDataAbstract $this->inputFieldStatus = true; // If this field is selected for the current operation - if (strstr($v['use'], $op) || strstr($v['use'], 'a')) { + if (isset($v['use']) && (strstr($v['use'], $op) || strstr($v['use'], 'a'))) { // Check for good field type if (!in_array($v['type'], $this->knownFieldTypes)) { diff --git a/models/admin/configure/accommodationTypes.php b/models/admin/configure/accommodationTypes.php deleted file mode 100644 index 0eb9ddf3..00000000 --- a/models/admin/configure/accommodationTypes.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/dataAccommodationTypes.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_accommodationTypes extends GlmDataAccommodationTypes -{ - - /** - * 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; - $haveAccommodationTypes = false; - $accommodationTypes = false; - $error = false; - - // Check for accommodation 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 accommodation types - $accommodationTypes = $this->getList(); - - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice($accommodationTypes, 'DataBlock', 'Accommodation Type Data'); - } - - // If we have list entries - even if it's an empty list - $success = true; - $haveAccommodationTypes = false; - if ($accommodationTypes !== false) { - - $success = true; - - // If we have any entries - if (count($accommodationTypes) > 0) { - $haveAccommodationTypes = 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($accommodationTypes, 'DataBlock', 'Accommodation Types Data'); - } - - // Compile template data - $templateData = array( - 'haveAccommodationTypes' => $haveAccommodationTypes, - 'accommodationTypes' => $accommodationTypes - ); - - // Return status, suggested view, and data to controller - return array( - 'status' => $success, - 'menuItemRedirect' => false, - 'modelRedirect' => false, - 'view' => 'admin/configure/accommodationTypes.html', - 'data' => $templateData - ); - - } - - -} - -?> \ No newline at end of file diff --git a/models/admin/dashboardWidget/index.php b/models/admin/dashboardWidget/index.php index 38290d55..f80e3181 100644 --- a/models/admin/dashboardWidget/index.php +++ b/models/admin/dashboardWidget/index.php @@ -119,12 +119,6 @@ class GlmMembersAdmin_dashboardWidget_index extends GlmDataMembers $categoriesStats = $Categories->getStats(); $haveCategories = ($categoriesStats > 0); - // Check for required Accommodation Types - require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAccommodationTypes.php'); - $AccommodationTypes = new GlmDataAccommodationTypes($this->wpdb, $this->config); - $accommodationTypesStats = $AccommodationTypes->getStats(); - $haveAccommodationTypes = ($accommodationTypesStats > 0); - // Check for required Amenities require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php'); $Amenities = new GlmDataAmenities($this->wpdb, $this->config); @@ -148,9 +142,9 @@ class GlmMembersAdmin_dashboardWidget_index extends GlmDataMembers $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config); $membersPending = $MemberInfo->getStats('status = '.$this->config['status_numb']['Pending']); - // Get member information records with bad or no lat/lon - $hideArchived = " T.status != ".$this->config['status_numb']['Archived']; - $badLatLonList = $MemberInfo->getSimpleMemberInfoList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)'); + // Get member records with bad or no lat/lon + $hideArchived = " T.access != ".$this->config['access_numb']['Archived']; + $badLatLonList = $this->getSimpleMembersList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)'); $haveBadLatLon = (is_array($badLatLonList) && count($badLatLonList) > 0); // If there's members with pending information, list them @@ -168,7 +162,6 @@ class GlmMembersAdmin_dashboardWidget_index extends GlmDataMembers 'badLatLonList' => $badLatLonList, 'haveMemberTypes' => $haveMemberTypes, 'haveCategories' => $haveCategories, - 'haveAccommodationTypes' => $haveAccommodationTypes, 'haveAmenities' => $haveAmenities, 'haveRegions' => $haveRegions, 'haveCities' => $haveCities, diff --git a/models/admin/management/index.php b/models/admin/management/index.php index 09e36f28..878d8f05 100644 --- a/models/admin/management/index.php +++ b/models/admin/management/index.php @@ -168,6 +168,7 @@ class GlmMembersAdmin_management_index extends GlmDataSettingsGeneral // Compile template data $templateData = array( + 'gitBranch' => $gitBranch, 'reason' => '', 'genSettings' => $generalSettings, 'timezones' => DateTimeZone::listIdentifiers(), diff --git a/models/admin/member/memberEdit.php b/models/admin/member/memberEdit.php new file mode 100644 index 00000000..76c56998 --- /dev/null +++ b/models/admin/member/memberEdit.php @@ -0,0 +1,471 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +// Load Members data abstract +require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php'); + +/* + * This class performs the work for the default action of the "Members" menu + * option, which is to display the members dashboard. + * + */ +class GlmMembersAdmin_member_memberEdit extends GlmDataMembers +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Memeber ID + * + * @var $memberID + * @access public + */ + public $memberID; + + /* + * 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; + $option = false; + $haveMemberTypes = false; + $categories = false; + $this->memberID = false; + $memberUpdated = false; + $memberData = false; + $haveMember = false; + $addingMember = false; + $memberUpdated = false; + + /* + * Get some data we're going to need + */ + + // Check for required Member Types + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.php'); + $MemberTypes = new GlmDataMemberTypes($this->wpdb, $this->config); + $memberTypesStats = $MemberTypes->getStats(); + $haveMemberTypes = ($memberTypesStats > 0); + + /* + * Get a sorted list of categories to use for picklists. + * These will be sorted so sub-categories fall under their + * respective category. + */ + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php'); + $Categories = new GlmDataCategories($this->wpdb, $this->config); + $categories = $Categories->getListSortedParentChild(); + + // Check for action option - Should be one of the values in the "switch" statement below + if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') { + $option = $_REQUEST['option']; + } + + /* + * Determine member ID to use + */ + + // Check if there's a logged in user who is locked to their own entity + $lockedToMember = apply_filters('glm_members_locked_to_member_id', false); + if ($lockedToMember) { + $this->memberID = $lockedToMember; + + // Otherwise Check for other member selection options + } else { + + if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'add') { + + delete_option('glmMembersDatabaseMemberID'); + $this->memberID = 0; + + // Check if a redirecting model supplied the member ID + } elseif (isset($actionData['memberID'])) { + + $this->memberID = $actionData['memberID']; + + // Otherwise check if one was supplied by the user or passed from somewhere else + } elseif (isset($_REQUEST['member'])) { + + // Make sure it's a number + $this->memberID = $_REQUEST['member']-0; + + } else { + + $this->memberID = get_option('glmMembersDatabaseMemberID'); + + } + } + + // If member ID not supplied and we're not adding a new member - we shouldn't be here, so redirect to an error page + if ($this->memberID <= 0 && $option != 'add' && $option != 'addNew') { + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + glmMembersAdmin::addNotice("  Member ID expected but no ID was supplied.", 'Alert'); + } + + return array( + 'status' => true, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => false + ); + + } + + /* + * Perform requested action + */ + switch ($option) { + + // Add new member + case 'add': + + $memberData = $this->newEntry(); + + $addingMember = true; + + break; + + // Submit a member update + case 'submit': + + // Check for new cities being submitted + $this->checkNewCities(); + + // Update submitted categories + $this->updateCategories(); + + $memberData = $this->updateEntry($this->memberID); + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + glmMembersAdmin::addNotice("  Member Update: $this->memberID", 'Process'); + } + + // If update was successful then use editEntry() to setup for the edit again. + if ($memberData['status']) { + + $slug = $this->updateSlug($this->memberID); + + $memberData = $this->editEntry($this->memberID); + $memberUpdated = true; + + // Also update all member info records with any possible name change + $sql = " + UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info + SET member_name = '".addslashes($memberData['fieldData']['name'])."' + WHERE member = $this->memberID + ;"; + $this->wpdb->query($sql); + + $memberName = $memberData['fieldData']['name']; + + } + + $haveMember = true; + + break; + + // Add the new member + case 'addNew': + + // Check for new cities being submitted + $this->checkNewCities(); + + // Update submitted categories + $this->updateCategories(); +echo "------------------------------------asd+"; + $memberData = $this->insertEntry(); + + // If update was successful then use editEntry() to setup for the edit again. + if ($memberData['status']) { + + $slug = $this->updateSlug($this->memberID); + + $memberData = $this->editEntry($this->memberID); + $memberUpdated = true; + + // Also update all member info records with any possible name change + $sql = " + UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info + SET member_name = '".addslashes($memberData['fieldData']['name'])."' + WHERE member = $this->memberID + ;"; + $this->wpdb->query($sql); + + $memberName = $memberData['fieldData']['name']; + + } + + break; + + // Delete this member + case 'delete': + + break; + + // Default is to edit the member + case 'edit': + default: + + // Try to get existing member data + $memberData = $this->editEntry($this->memberID); + if ($memberData) { + $haveMember = true; + $memberName = $memberData['fieldData']['name']; + } else { + $success = false; + } + + break; + + } + + // Compile template data + $templateData = array( + 'success' => $success, + 'haveMemberTypes' => $haveMemberTypes, + 'availableCategories' => $categories, + 'memberID' => $this->memberID, + 'haveMember' => $haveMember, + 'member' => $memberData, + 'memberName' => $memberName, + 'addingMember' => $addingMember, + 'memberUpdated' => $memberUpdated + +/* + 'addingMember' => $addingMember, + 'member' => $memberData, + 'memberName' => $memberName, + 'haveInfoRecords' => $haveInfoRecords, + 'memberInfoRecords' => $memberInfoRecords, + 'noActive' => $noActive, + 'showArchived' => $showArchived, + 'haveMemberInfo' => $haveMemberInfo, + 'memberUpdated' => $memberUpdated, + 'statusTypeNumbers' => $this->config['status_numb'], + 'statusPending' => $this->config['status_numb']['Pending'] +*/ + ); + + // Return status, suggested view, and data to controller + return array( + 'status' => $success, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => 'admin/member/memberEdit.html', + 'data' => $templateData + ); + + } + + /* + * Check for new Cities being submitted + * + * @return void + */ + public function checkNewCities() + { + + // If we have a member ID and this was a submission with a new city (id < 0) + if ($this->memberID && isset($_REQUEST['city']) && $_REQUEST['city'] == -1 && isset($_REQUEST['newCityName']) && trim($_REQUEST['newCityName']) != '') { + + // Clean up city name + $cName = trim(filter_var($_REQUEST['newCityName'])); + + // Try to add the city + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php'); + $Cities = new GlmDataCities($this->wpdb, $this->config); + $cID = $Cities->addCity($cName); + + // If we got a city id back + if (is_int($cID) && $cID > 0) { + + // Update the city selected for this member record + $sql = " + UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member + SET city = $cID + WHERE id = ".$this->memberID." + ;"; + $this->wpdb->query($sql); + + // Update submitted city value to use the new ID + $_REQUEST['city'] = $cID; + + } + } + } + + /* + * Update categories for the current submission + * + * @return void + */ + public function updateCategories() + { + + // Instatiate the dataCategories class + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php'); + $Categories = new GlmDataCategories($this->wpdb, $this->config); + + // Instatiate categoryMemberInfo class + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategoryMemberInfo.php'); + $CategoryMemberInfo = new GlmDataCategoryMemberInfo($this->wpdb, $this->config); + + // Get any selected categories + $selectedCategories = array(); + $newCategory = false; + if (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && count($_REQUEST['category']) > 0) { + + /* + * For each selected category + * + * Note that categories are submitted with either a positive key, which indicates + * that it represents an existing category, or a negative key, which indicates + * that the user is trying to add it to the list of categories. + * + */ + foreach ($_REQUEST['category'] as $key) { + + // Make sure key is an integer + $key = intval($key -0); + + // If negative, this is a new category that needs to be added to the category table + if ($key < 0) { + + $newCategory = true; + + // Check if a parent is specified + $parent = 0; + if ($_REQUEST['newCatParent'][$key] != '') { + $parent = $_REQUEST['newCatParent'][$key] -0; + } elseif ($_REQUEST['newCatParentName'][$key]) { + $parent = $_REQUEST['newCatParentName'][$key]; + } + + // Clean up the category name + $category = filter_var($_REQUEST['newCategory'][$key]); + + // Add it to the category table and get the new category ID + $categoryID = $Categories->addCategory($category, $parent); + + // If we got a new category ID, add it to the array of currently selected categoryMember records + if ($categoryID) { + $selectedCategories[$categoryID] = $categoryID; + } + + // Otherwise if it's positive, the category is an existing one + } else if ($key > 0) { + + $selectedCategories[$key] = $key; + + } + + // If there's selected categories + if (count($selectedCategories) > 0) { + + // Update the selected categories for this member information record, returns new list + $CategoryMemberInfo->setMemberInfoCategories($this->memberID, $selectedCategories); + + } + + // If there's been a new category + if ($newCategory) { + + // Get the full category list again + $this->categories = $Categories->getListSortedParentChild(); + + } + + } // For each category being submitted + + // Otherwise if this is a submission and there's no categories submitted, so make sure there's none stored + } elseif (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') { + $CategoryMemberInfo->clearMemberInfoCategories($this->memberID); + } + + } + +} + +?> \ No newline at end of file diff --git a/models/admin/member/memberInfo.php b/models/admin/member/memberInfo.php index c7600028..70037d68 100644 --- a/models/admin/member/memberInfo.php +++ b/models/admin/member/memberInfo.php @@ -87,27 +87,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo * @access public */ public $isActive = false; - /** - * Category data for current member info record - * - * @var $categoryMemberInfo - * @access public - */ - public $categoryMemberInfo = false; - /** - * Full list of categories - * - * @var $categories - * @access public - */ - public $categories = false; - /** - * Have categories? - * - * @var $haveCategories - * @access public - */ - public $haveCategories = false; /** * Have image gallery contents * @@ -301,23 +280,9 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo // Process submission of a member information record update case 'submit': - // Check for new cities being submitted - $this->checkNewCities(); - - // Update submitted categories - $this->updateCategories(); - // Update submitted amenities $this->updateAmenities(); - // Load Image data class - require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataImages.php'); - $Images = new GlmDataImages($this->wpdb, $this->config); - - // Update image gallery titles, descriptions, and image positions then return current image gallery - $this->imageGallery = $Images->galleryImageDataUpdate($this->config['ref_type_numb']['MemberInfo'], $this->memberInfoID, 'galleryPositionOrder'); - $this->haveImageGallery = ($this->imageGallery != false); - if ($this->haveMemberInfo) { // Update the member Info data @@ -349,12 +314,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo $this->memberInfoID = $this->memberInfo['fieldData']['id']; $this->haveMemberInfo = true; - // Check for new cities being submitted - $this->checkNewCities(); - - // Update submitted categories - $this->updateCategories(); - // Update submitted amenities $this->updateAmenities(); @@ -406,15 +365,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo ); } - /* - * Get a sorted list of categories to use for picklists. - * These will be sorted so sub-categories fall under their - * respective category. - */ - require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php'); - $Categories = new GlmDataCategories($this->wpdb, $this->config); - $this->categories = $Categories->getListSortedParentChild(); - // Get list of Available Member Amenities to use for picklists require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php'); $Amenities = new GlmDataAmenities($this->wpdb, $this->config); @@ -464,7 +414,7 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo } else { if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - glmMembersAdmin::addNotice("  Specified Member Information Record ID is invalid: $this->memberInfoID", 'Alert'); + glmMembersAdmin::addNotice("  Member ID is invalid or Status not success: Member ID = $this->memberInfoID", 'Alert'); } $this->error = true; @@ -486,7 +436,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo 'memberInfoID' => $this->memberInfoID, 'memberInfo' => $this->memberInfo, 'memberUpdated' => $memberUpdated, - 'availableCategories' => $this->categories, 'availableAmenities' => $this->amenities, 'haveImageGallery' => $this->haveImageGallery, 'imageGallery' => $this->imageGallery, @@ -506,42 +455,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo } - /* - * Check for new Cities being submitted - * - * @return void - */ - public function checkNewCities() - { - - // If we have a member ID and this was a submission with a new city (id < 0) - if ($this->memberInfoID && isset($_REQUEST['city']) && $_REQUEST['city'] == -1 && isset($_REQUEST['newCityName']) && trim($_REQUEST['newCityName']) != '') { - - // Clean up city name - $cName = trim(filter_var($_REQUEST['newCityName'])); - - // Try to add the city - require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php'); - $Cities = new GlmDataCities($this->wpdb, $this->config); - $cID = $Cities->addCity($cName); - - // If we got a city id back - if (is_int($cID) && $cID > 0) { - - // Update the city selected for this memberInfo record - $sql = " - UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info - SET city = $cID - WHERE id = ".$this->memberInfoID." - ;"; - $this->wpdb->query($sql); - - // Update submitted city value to use the new ID - $_REQUEST['city'] = $cID; - - } - } - } /* * Check it there's no active information record @@ -603,98 +516,6 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo } - - /* - * Update categories for the current submission - * - * @return void - */ - public function updateCategories() - { - - // Instatiate the dataCategories class - require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php'); - $Categories = new GlmDataCategories($this->wpdb, $this->config); - - // Instatiate categoryMemberInfo class - require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategoryMemberInfo.php'); - $CategoryMemberInfo = new GlmDataCategoryMemberInfo($this->wpdb, $this->config); - - // Get any selected categories - $selectedCategories = array(); - $newCategory = false; - if (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && count($_REQUEST['category']) > 0) { - - /* - * For each selected category - * - * Note that categories are submitted with either a positive key, which indicates - * that it represents an existing category, or a negative key, which indicates - * that the user is trying to add it to the list of categories. - * - */ - foreach ($_REQUEST['category'] as $key) { - - // Make sure key is an integer - $key = intval($key -0); - - // If negative, this is a new category that needs to be added to the category table - if ($key < 0) { - - $newCategory = true; - - // Check if a parent is specified - $parent = 0; - if ($_REQUEST['newCatParent'][$key] != '') { - $parent = $_REQUEST['newCatParent'][$key] -0; - } elseif ($_REQUEST['newCatParentName'][$key]) { - $parent = $_REQUEST['newCatParentName'][$key]; - } - - // Clean up the category name - $category = filter_var($_REQUEST['newCategory'][$key]); - - // Add it to the category table and get the new category ID - $categoryID = $Categories->addCategory($category, $parent); - - // If we got a new category ID, add it to the array of currently selected categoryMemberInfo records - if ($categoryID) { - $selectedCategories[$categoryID] = $categoryID; - } - - // Otherwise if it's positive, the category is an existing one - } else if ($key > 0) { - - $selectedCategories[$key] = $key; - - } - - // If there's selected categories - if (count($selectedCategories) > 0) { - - // Update the selected categories for this member information record, returns new list - $CategoryMemberInfo->setMemberInfoCategories($this->memberInfoID, $selectedCategories); - - } - - // If there's been a new category - if ($newCategory) { - - // Get the full category list again - $this->categories = $Categories->getListSortedParentChild(); - - } - - } // For each category being submitted - - // Otherwise if this is a submission and there's no categories submitted, so make sure there's none stored - } elseif (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') { - $CategoryMemberInfo->clearMemberInfoCategories($this->memberInfoID); - } - - } - - /* * Update amenities for the current submission * diff --git a/models/admin/members/index.php b/models/admin/members/index.php index 4510f9b3..3d82ee31 100644 --- a/models/admin/members/index.php +++ b/models/admin/members/index.php @@ -118,12 +118,6 @@ class GlmMembersAdmin_members_index extends GlmDataMembers $categoriesStats = $Categories->getStats(); $haveCategories = ($categoriesStats > 0); - // Check for required Accommodation Types - require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAccommodationTypes.php'); - $AccommodationTypes = new GlmDataAccommodationTypes($this->wpdb, $this->config); - $accommodationTypesStats = $AccommodationTypes->getStats(); - $haveAccommodationTypes = ($accommodationTypesStats > 0); - // Check for required Amenities require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php'); $Amenities = new GlmDataAmenities($this->wpdb, $this->config); @@ -142,16 +136,16 @@ class GlmMembersAdmin_members_index extends GlmDataMembers $regionsStats = $Regions->getStats(); $haveRegions = ($regionsStats > 0); + // Get member records with bad or no lat/lon + $hideArchived = " T.access != ".$this->config['access_numb']['Archived']; + $badLatLonList = $this->getSimpleMembersList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)'); + $haveBadLatLon = (is_array($badLatLonList) && count($badLatLonList) > 0); + // Get number of member information records with pending updates require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php'); $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config); $membersPending = $MemberInfo->getStats('status = '.$this->config['status_numb']['Pending']); - // Get member information records with bad or no lat/lon - $hideArchived = " T.status != ".$this->config['status_numb']['Archived']; - $badLatLonList = $MemberInfo->getSimpleMemberInfoList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)'); - $haveBadLatLon = (is_array($badLatLonList) && count($badLatLonList) > 0); - // If there's members with pending information, list them $pendingList = false; if ($membersPending > 0) { @@ -168,7 +162,6 @@ class GlmMembersAdmin_members_index extends GlmDataMembers 'badLatLonList' => $badLatLonList, 'haveMemberTypes' => $haveMemberTypes, 'haveCategories' => $haveCategories, - 'haveAccommodationTypes' => $haveAccommodationTypes, 'haveAmenities' => $haveAmenities, 'haveRegions' => $haveRegions, 'haveCities' => $haveCities, diff --git a/models/admin/members/list.php b/models/admin/members/list.php index 3a154f90..cc81f7cc 100644 --- a/models/admin/members/list.php +++ b/models/admin/members/list.php @@ -143,7 +143,7 @@ class GlmMembersAdmin_members_list extends GlmDataMembers // Get a current list of members - $list = $this->getList($where); + $list = $this->getSimpleMembersList($where); /* * Check for list filters diff --git a/setup/databaseScripts/create_database_V1.0.43.sql b/setup/databaseScripts/create_database_V1.1.0.sql similarity index 55% rename from setup/databaseScripts/create_database_V1.0.43.sql rename to setup/databaseScripts/create_database_V1.1.0.sql index 30917282..a14a337b 100644 --- a/setup/databaseScripts/create_database_V1.0.43.sql +++ b/setup/databaseScripts/create_database_V1.1.0.sql @@ -6,83 +6,6 @@ -- To permit each query below to be executed separately, -- all queries must be separated by a line with four dashes --- Accommodation Types -CREATE TABLE {prefix}accommodation_types ( - id INT NOT NULL AUTO_INCREMENT, - facility_type INT NULL, -- See "Facility Types" in config/plugin.ini - name TINYTEXT NULL, -- Name of accommodation type - descr TEXT NULL, -- Description of accommodation type - short_descr TINYTEXT NULL, -- Short description of accommodation type - PRIMARY KEY (id), - INDEX(facility_type), - INDEX(name(20)) -); - ----- - --- Accommodations -CREATE TABLE {prefix}accommodations ( - id INT NOT NULL AUTO_INCREMENT, - active BOOLEAN NULL, -- Accommodation record is active flag - name TINYTEXT NULL, -- Name of the accommodation record - accommodation_type INT NULL, -- Pointer to Accommodation type in accommodation_types table - descr TEXT NULL, -- Description of accommodation - short_descr TINYTEXT NULL, -- Short description of accommodation - url TINYTEXT NULL, -- URL for info regarding this accommodation - notes TEXT NULL, -- Notes regarding this accommodation - Not displayed on front-end - create_time TIMESTAMP NULL, -- Date/time this accommondation was created - modify_time TIMESTAMP NULL, -- Date/time this accommodation was last updated - quant INT NULL, -- Quantity of this accommodation - reservation_url TINYTEXT NULL, -- URL to use for making reservaionn - reservation_id TINYTEXT NULL, -- ID to use as a reference to this accommodation when making reservations - year_round TINYINT(1) NULL, -- Accommodation is available year-round - ref_type INT NULL, -- Type of entity this accommodation is associated with - ref_dest INT NULL, -- Pointer to the specific entity of ref_type this accommodation is associated with - PRIMARY KEY (id), - INDEX(accommodation_type), - INDEX(name(20)), - INDEX(ref_type), - INDEX(ref_dest) -); - ----- - --- Accounts -CREATE TABLE {prefix}accounts ( - id INT NOT NULL AUTO_INCREMENT, - member INT NULL, - payment_type INT NULL, - invoice_delivery INT NULL, - PRIMARY KEY (id), - INDEX(member) -); - ----- - --- Activities -CREATE TABLE {prefix}activities ( - id INT NOT NULL AUTO_INCREMENT, - active BOOLEAN NULL, -- Activity is active flag - activity_type INT NULL, -- ***** NEED TO ADD ACTIVITY_TYPES TABLE AND SUPPORT FOR THAT ***** - name TINYTEXT NULL, -- Activity name - descr TEXT NULL, -- Description of activity - short_descr TINYTEXT NULL, -- Shot description of activity - phone TINYTEXT NULL, -- Phone number to contact someone regarding this activity - url TINYTEXT NULL, -- URL for info regarding this activity - notes TEXT NULL, -- Notes regarding this activity - Not displayed on front-end - create_time TIMESTAMP NULL, -- Date/time this activity was created - modify_time TIMESTAMP NULL, -- Date/time this activity was last updated - ref_type INT NULL, -- Type of entity this activity is associated with - ref_dest INT NULL, -- Pointer to the specific entity of type ref_type - PRIMARY KEY (id), - INDEX(activity_type), - INDEX(name(20)), - INDEX(ref_type), - INDEX(ref_dest) -); - ----- - -- Amenities CREATE TABLE {prefix}amenities ( id INT NOT NULL AUTO_INCREMENT, @@ -197,87 +120,6 @@ CREATE TABLE {prefix}contacts ( ---- --- Facilities - Facilities are separate functional units of a member, either physically or operationally --- For example, separate facilities could be individual properties (hotels, motels) or could be operationally --- separate hotel and restaurant at the same location. A facility is an entity under a member "location". -CREATE TABLE {prefix}facilities ( - id INT NOT NULL AUTO_INCREMENT, - active BOOLEAN NULL, -- Facility is active flag - facility_type INT NULL, -- Facility type - see plugin.ini facility type - location INT NULL, -- Pointer to one of the member's locations - see locations table - name TINYTEXT NULL, -- Name of this facility - descr TEXT NULL, -- Description - short_descr TINYTEXT NULL, -- Short description - addr1 TINYTEXT NULL, -- 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 facility - lon FLOAT NULL, -- Longitude of facility - phone TINYTEXT NULL, -- Primary phone number - toll_free TINYTEXT NULL, -- Toll Free phone number - url TINYTEXT NULL, -- URL for information specifically regarding this facility - logo TINYTEXT NULL, -- Logo - notes TEXT NULL, -- Notes - Not displayed on front-end - create_time TIMESTAMP NULL, -- Create date/time - modify_time TIMESTAMP NULL, -- Last modified date/time - PRIMARY KEY (id), - INDEX(name(20)), - INDEX(city), - INDEX(zip(10)), - INDEX(lat), - INDEX(lon) -); - ----- - --- Donwloadable 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, -- Name of this file - file_name TINYTEXT NULL, -- Physical file name for this file - descr TEXT NULL, -- Description - short_descr TINYTEXT NULL, -- Short descroption - size INT NULL, -- Download size of this file - pending BOOLEAN NULL, -- File is pending review flag - create_date DATE NULL, -- Date file was uploaded - ref_type INT NULL, -- Type of entity this file is associated with - ref_dest INT NULL, -- Pointer to the specific entity of ref_type this file is associated with - PRIMARY KEY (id), - INDEX(name(20)), - INDEX(file_name(20)), - INDEX(ref_type), - INDEX(ref_dest) -); - ----- - --- Detail on golf courses -CREATE TABLE {prefix}golf ( - id INT NOT NULL AUTO_INCREMENT, - active BOOLEAN NULL, -- This golf course is active flag - name TINYTEXT NULL, -- Name of Golf course - descr TEXT NULL, -- Description - short_descr TINYTEXT NULL, -- Short Description - rating TINYTEXT NULL, -- Rating - par TINYTEXT NULL, -- Par - yardage TINYTEXT NULL, -- Total yardage - slope TINYTEXT NULL, -- Slope rating - walking TINYINT(1) NULL, -- Walking course - holes INT NULL, -- Number of holes - reservation_url TINYTEXT NULL, -- URL for making reservations for this course - ref_type INT NULL, -- Type of entity this golf course is associated with - ref_dest INT NULL, -- Pointer to the specific entity of ref_type this golf course is associated with - PRIMARY KEY (id), - INDEX(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, @@ -300,98 +142,6 @@ CREATE TABLE {prefix}images ( ---- --- Member locations - Locations are physically separate campuses where facilities exist -CREATE TABLE {prefix}locations ( - id INT NOT NULL AUTO_INCREMENT, - active BOOLEAN NULL, -- This location is active flag - member INT NULL, -- Pointer to main member record - member_info INT NULL, -- Pointer to associated member info record - name TINYTEXT NULL, -- Name of location - descr TEXT NULL, -- Description - short_descr TINYTEXT NULL, -- Short Description - addr1 TINYTEXT NULL, -- Address line 1 - Main address for this location - 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 location - lon FLOAT NULL, -- Longitude of location - region INT NULL, -- Pointer to region where location exists - phone TINYTEXT NULL, -- Primary phone number - toll_free TINYTEXT NULL, -- Toll Free phone number - url TINYTEXT NULL, -- URL for information regarding this location - logo TINYTEXT NULL, -- Logo - notes TEXT NULL, -- Notes - not displayed on front-end - create_time TIMESTAMP NULL, -- Create date/time - modify_time TIMESTAMP NULL, -- Last Update date/time - PRIMARY KEY (id), - INDEX(name(20)), - INDEX(city), - INDEX(zip(10)), - INDEX(lat), - INDEX(lon), - INDEX(region) -); - ----- - --- Meals offered by a restaurant -CREATE TABLE {prefix}meals ( - id INT NOT NULL AUTO_INCREMENT, - active BOOLEAN NULL, -- Meal is active flag - name TINYTEXT NULL, -- Name of this meal (typically Breakfast, Lunch, Dinner, Brunch, ...) - descr TEXT NULL, -- Description of the meal - short_descr TINYTEXT NULL, -- Short description - menu TEXT NULL, -- Text menu for this meal - menu_file TINYTEXT NULL, -- File name of downloadable menu file (PDF, etc.) - daily BOOLEAN NULL, -- Flag indicating if meal is available daily - daily_start_time TIME NULL, -- Daily meal - Time of day this meal starts - daily_end_time TIME NULL, -- Daily meal - Time of day this meal ends - daily_res_req BOOLEAN NULL, -- Daily meal - Reservations requested - sunday BOOLEAN NULL, -- Flag indicating if meal is available Sunday - sun_menu TEXT NULL, -- Optional menu text for Sunday - sun_start_time TIME NULL, -- Sunday - Time of day this meal starts - sun_end_time TIME NULL, -- Sunday - Time of day this meal ends - sun_res_req BOOLEAN NULL, -- Sunday - Reservations requested - monday BOOLEAN NULL, -- Flag indicating if meal is available Monday - mon_menu TEXT NULL, -- Optional menu text for Monday - mon_start_time TIME NULL, -- Monday - Time of day this meal starts - mon_end_time TIME NULL, -- Monday - Time of day this meal ends - mon_res_req BOOLEAN NULL, -- Monday - Reservations requested - tuesday BOOLEAN NULL, -- Flag indicating if meal is available Tuesday - tue_menu TEXT NULL, -- Optional menu text for Tuesday - tue_start_time TIME NULL, -- Tuesday - Time of day this meal starts - tue_end_time TIME NULL, -- Tuesday - Time of day this meal ends - tue_res_req BOOLEAN NULL, -- Tuesday - Reservations requested - wednesday BOOLEAN NULL, -- Flag indicating if meal is available Wednesday - wed_menu TEXT NULL, -- Optional menu text for Wednesday - wed_start_time TIME NULL, -- Wednesday - Time of day this meal starts - wed_end_time TIME NULL, -- Wednesday - Time of day this meal ends - wed_res_req BOOLEAN NULL, -- Wednesday - Reservations requested - thursday BOOLEAN NULL, -- Flag indicating if meal is available Thursday - thu_menu TEXT NULL, -- Optional menu text for Thursday - thu_start_time TIME NULL, -- Thursday - Time of day this meal starts - thu_end_time TIME NULL, -- Thursday - Time of day this meal ends - thu_res_req BOOLEAN NULL, -- Thursday - Reservations requested - friday BOOLEAN NULL, -- Flag indicating if meal is available Friday - fri_menu TEXT NULL, -- Optional menu text for Friday - fri_start_time TIME NULL, -- Friday - Time of day this meal starts - fri_end_time TIME NULL, -- Friday - Time of day this meal ends - fri_res_req BOOLEAN NULL, -- Friday - Reservations requested - saturday BOOLEAN NULL, -- Flag indicating if meal is available Saturday - sat_menu TEXT NULL, -- Optional menu text for Saturday - sat_start_time TIME NULL, -- Saturday - Time of day this meal starts - sat_end_time TIME NULL, -- Saturday - Time of day this meal ends - sat_res_req BOOLEAN NULL, -- Saturday - Reservations requested - restaurant INT NULL, -- Pointer to restaurant that has this meal - PRIMARY KEY (id), - INDEX(name(20)), - INDEX(restaurant) -); - ----- - -- Primary member records - One for each member CREATE TABLE {prefix}members ( id INT NOT NULL AUTO_INCREMENT, @@ -400,6 +150,22 @@ CREATE TABLE {prefix}members ( 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) + 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 PRIMARY KEY (id), INDEX(name(20)), INDEX(member_slug(20)), @@ -417,21 +183,6 @@ CREATE TABLE {prefix}member_info ( 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, -- Address line 1 - Main member address (main location) or - 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 @@ -468,44 +219,6 @@ CREATE TABLE {prefix}regions ( ---- --- Resturaunt Types - Various general types of restaurants (i.e. Fast Food, Ethnic, Fine food, ...) -CREATE TABLE {prefix}restaurant_types ( - id INT NOT NULL AUTO_INCREMENT, - name TINYTEXT NULL, -- Name of restaurant type - descr TEXT NULL, -- Description - short_descr TINYTEXT NULL, -- Short Description - PRIMARY KEY (id), - INDEX(name(20)) -); - ----- - --- Restaurants -CREATE TABLE {prefix}restaurants ( - id INT NOT NULL AUTO_INCREMENT, - active BOOLEAN NULL, -- This restaurant is active flag - name TINYTEXT NULL, -- Name of restaurant - restaurant_type INT NULL, -- Pointer to restaurant_types table entry - descr TEXT NULL, -- Description - short_descr TINYTEXT NULL, -- Short Description - url TINYTEXT NULL, -- URL of Web page about this restaurant - reservation_url TINYTEXT NULL, -- Reservations URL - phone TINYTEXT NULL, -- Phone number / reservations number - hours_descr TINYTEXT NULL, -- Description of restaurant hours - alcohol BOOLEAN NULL, -- Flag indicating whether restaurant serves alcohol - non_smoking BOOLEAN NULL, -- Flag indicating whether restaurant is non-smoking only - notes TEXT NULL, -- General notes - ref_type INT NULL, -- Type of entity this restaurant is associated with - ref_dest INT NULL, -- Pointer to the specific entity of ref_type this restaurant is associated with - PRIMARY KEY (id), - INDEX(restaurant_type), - INDEX(name(20)), - INDEX(ref_type), - INDEX(ref_dest) -); - ----- - -- 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 ( @@ -767,29 +480,3 @@ INSERT INTO {prefix}settings_terms 'Contacts' ) ; - ----- - --- Social Media types (i.e. Facebook, Twitter, ...) -CREATE TABLE {prefix}social_media ( - id INT NOT NULL AUTO_INCREMENT, - name TINYTEXT NULL, -- Name of this social media service - descr TEXT NULL, -- Description - short_descr TINYTEXT NULL, -- Short Description - PRIMARY KEY (id) -); - ----- - --- Social media to entity cross-reference table -CREATE TABLE {prefix}social_media_ref ( - id INT NOT NULL AUTO_INCREMENT, - ref_type INT NULL, -- Type of entity this entry is associated with - ref_dest INT NULL, -- Pointer to the specific entity of ref_type - social_media INT NULL, -- Pointer to entry in social_media table - url TINYTEXT NULL, -- URL to this social media service - PRIMARY KEY (id), - INDEX(ref_type), - INDEX(ref_dest), - INDEX(social_media) -); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 2819fd88..81b61970 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -27,7 +27,8 @@ $glmMembersDbVersions = array( '0.1' => array('version' => '0.1', 'tables' => 26), '1.0.28' => array('version' => '1.0.28', 'tables' => 26), '1.0.30' => array('version' => '1.0.30', 'tables' => 26), - '1.0.43' => array('version' => '1.0.43', 'tables' => 26) + '1.0.43' => array('version' => '1.0.43', 'tables' => 26), + '1.1.0' => array('version' => '1.1.0', 'tables' => 13) ); diff --git a/setup/databaseScripts/update_database_V1.1.0.sql b/setup/databaseScripts/update_database_V1.1.0.sql new file mode 100644 index 00000000..e6519d87 --- /dev/null +++ b/setup/databaseScripts/update_database_V1.1.0.sql @@ -0,0 +1,203 @@ +-- Gaslight Media Members Database +-- File Created: 12/09/14 15:27:15 +-- Database Version: 1.0.28 +-- 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 + +DROP TABLE IF EXISTS + {prefix}accommodation_types, + {prefix}accommodations, + {prefix}accounts, + {prefix}activities, + {prefix}facilities, + {prefix}files, + {prefix}golf, + {prefix}locations, + {prefix}meals, + {prefix}restaurant_types, + {prefix}restaurants, + {prefix}social_media, + {prefix}social_media_ref +; + +---- + +ALTER TABLE {prefix}members ADD COLUMN addr1 TINYTEXT; + +---- + +UPDATE {prefix}members M SET addr1 = (SELECT addr1 FROM {prefix}member_info WHERE member = M.id AND addr1 > '' AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN addr2 TINYTEXT; + +---- + +UPDATE {prefix}members M SET addr2 = (SELECT addr2 FROM {prefix}member_info WHERE member = M.id AND addr2 > '' AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN city INT; + +---- + +UPDATE {prefix}members M SET city = (SELECT city FROM {prefix}member_info WHERE member = M.id AND city > 0 AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN state TINYTEXT; + +---- + +UPDATE {prefix}members M SET state = (SELECT state FROM {prefix}member_info WHERE member = M.id AND state > '' AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN zip TINYTEXT; + +---- + +UPDATE {prefix}members M SET zip = (SELECT zip FROM {prefix}member_info WHERE member = M.id AND zip > '' AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN country TINYTEXT; + +---- + +UPDATE {prefix}members M SET country = (SELECT country FROM {prefix}member_info WHERE member = M.id AND country > '' AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN lat FLOAT; + +---- + +UPDATE {prefix}members M SET lat = (SELECT lat FROM {prefix}member_info WHERE member = M.id AND lat != 0 AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN lon FLOAT; + +---- + +UPDATE {prefix}members M SET lon = (SELECT lon FROM {prefix}member_info WHERE member = M.id AND lon != 0 AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN region INT; + +---- + +UPDATE {prefix}members M SET region = (SELECT region FROM {prefix}member_info WHERE member = M.id AND region > 0 AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN phone TINYTEXT; + +---- + +UPDATE {prefix}members M SET phone = (SELECT phone FROM {prefix}member_info WHERE member = M.id AND phone > '' AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN toll_free TINYTEXT; + +---- + +UPDATE {prefix}members M SET toll_free = (SELECT toll_free FROM {prefix}member_info WHERE member = M.id AND toll_free > '' AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN email TINYTEXT; + +---- + +UPDATE {prefix}members M SET email = (SELECT email FROM {prefix}member_info WHERE member = M.id AND email > '' AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN url TINYTEXT; + +---- + +UPDATE {prefix}members M SET url = (SELECT url FROM {prefix}member_info WHERE member = M.id AND url > '' AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN logo TINYTEXT; + +---- + +UPDATE {prefix}members M SET logo = (SELECT logo FROM {prefix}member_info WHERE member = M.id AND logo > '' AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN cc_type INT; + +---- + +UPDATE {prefix}members M SET cc_type = (SELECT cc_type FROM {prefix}member_info WHERE member = M.id AND cc_type > 0 AND status in (30, 20, 10) LIMIT 1); + +---- + +ALTER TABLE {prefix}members ADD COLUMN notes TEXT; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN addr1; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN addr2; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN city; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN state; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN zip; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN country; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN lat; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN lon; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN region; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN phone; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN toll_free; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN url; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN logo; + +---- + +ALTER TABLE {prefix}member_info DROP COLUMN cc_type; diff --git a/setup/validActions.php b/setup/validActions.php index 3b493b98..9d459272 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -47,10 +47,8 @@ $glmMembersValidActions = array( 'member' => array( 'index' => 'glm-member-db', // Member Dashboard 'memberInfo' => 'glm-member-db', - 'locations' => 'glm-member-db', - 'facilities' => 'glm-member-db', - 'activities' => 'glm-member-db', - 'accommodations' => 'glm-member-db' + 'memberEdit' => 'glm-member-db', + 'locations' => 'glm-member-db' ) , 'configure' => array( @@ -58,7 +56,6 @@ $glmMembersValidActions = array( 'categories' => 'glm-member-db', 'cities' => 'glm-member-db', 'regions' => 'glm-member-db', - 'accommodationTypes' => 'glm-member-db', 'amenities' => 'glm-member-db' ), 'management' => array( diff --git a/views/admin/configure/accommodationTypes.html b/views/admin/configure/accommodationTypes.html deleted file mode 100644 index a57c7e64..00000000 --- a/views/admin/configure/accommodationTypes.html +++ /dev/null @@ -1,172 +0,0 @@ -{include file='admin/configure/header.html'} - - -
Add a Accommodation Type
-
-
- - - - - - - - - - - - - - - -
Accommodation Type Name: - -
Description: - -
Description: - -
-

* Required

- Cancel - -
-
- - -
-
-

Are you sure you want to delete this accommodation type?

-

Yes, delete this accommodation type

-

Cancel

-
-
- - -
-
- - - - - - - - - - - - - - - - -
Accommodation Type Name: - -
Description: - -
Short Description: - -
-

* Required

- Cancel - -
-
- -

Accommodation Types

- - - - - - - - - - - -{if $haveAccommodationTypes} - {assign var="i" value="0"} - {foreach $accommodationTypes as $t} - {if $i++ is odd by 1} - - {else} - - {/if} - - - - - - {/foreach} -{else} - -{/if} - -
Accommodation TypeDescriptionShort Description 
- {$t.name} - - {$t.descr} - - {$t.short_descr} - -
Delete
-
(no accommodationTypes listed)
- - - -{include file='admin/footer.html'} diff --git a/views/admin/configure/amenities.html b/views/admin/configure/amenities.html index 7115bef3..eab6747b 100644 --- a/views/admin/configure/amenities.html +++ b/views/admin/configure/amenities.html @@ -51,8 +51,8 @@
-

Are you sure you want to delete this accommodation type?

-

Yes, delete this accommodation type

+

Are you sure you want to delete this amenity?

+

Yes, delete this amenity

Cancel

diff --git a/views/admin/configure/header.html b/views/admin/configure/header.html index cb224eed..f57fdb96 100644 --- a/views/admin/configure/header.html +++ b/views/admin/configure/header.html @@ -5,7 +5,6 @@

{$glmPluginName} Configuration

+{if $gitBranch != 'master'} +

Current git branch: {$gitBranch}

+{/if} +
diff --git a/views/admin/member/index.html b/views/admin/member/index.html index e6a8b71f..70f07bd8 100644 --- a/views/admin/member/index.html +++ b/views/admin/member/index.html @@ -4,106 +4,53 @@ {if $haveMemberTypes} -

- {if $addingMember} - Add New Member - {else} - General Member Information - {/if} -

- {if $memberUpdated}

Member Updated

{/if} - - {if apply_filters('glm_members_permit_admin_member_index_edit_member', true)} -
- - {if $addingMember} - - - {else} - - - - {/if} - - - - - - - - {if !$addingMember} - - - - - {/if} - - - - - - - - - - {if !$addingMember} - - {/if} - -
Member Name: - - {if $member.fieldFail.name}

{$member.fieldFail.name}

{/if} -
Name for URLs: - {$member.fieldData.member_slug} -
Member Display & Access: - - {if $member.fieldFail.access}

{$member.fieldFail.access}

{/if} -
Member Type: - - {if $member.fieldFail.member_type}

{$member.fieldFail.member_type}

{/if} -
Date created:{$member.fieldData.created.date}
-

* Required

- {if $addingMember} - - {else} - - {/if} -
+ + {if $haveMember} + + + + + + +
+ {$member.fieldData.name}
+ {if $member.fieldData.addr1}{$member.fieldData.addr1}
{/if} + {if $member.fieldData.addr2}{$member.fieldData.addr2}
{/if} + {if $member.fieldData.city.name}{$member.fieldData.city.name}{if $member.fieldData.state.name}, {/if}{/if} + {if $member.fieldData.state.name}{$member.fieldData.state.name}{/if} + {if $member.fieldData.zip}{$member.fieldData.zip}{/if} + {if $member.fieldData.country.name}{$member.fieldData.country.name}{/if} +
+ {if $member.fieldData.phone}Phone: {$member.fieldData.phone}
{/if} + {if $member.fieldData.toll_free}Toll Free: {$member.fieldData.toll_free}
{/if} + {if $member.fieldData.email}E-Mail Address: {$member.fieldData.email}
{/if} + {if $member.fieldData.url}{$member.fieldData.url}
{/if} + + +
+ + + + + + + + + + + + + + +
Member Slug:{$member.fieldData.member_slug}
Member Display & Access:{$member.fieldData.access.name}
Member Type:{$member.fieldData.member_type.name}
Date created:{$member.fieldData.created.date}
+
+ Edit Base Member Information +
{else} - {if $haveMember} - - - - - - - - - - - - - - - - - - -
Member Name:{$member.fieldData.name}
Name for URLs:{$member.fieldData.member_slug}
Member Display & Access:{$member.fieldData.access.name}
Member Type:{$member.fieldData.member_type.name}
Date created:{$member.fieldData.created.date}
- {else}

No member information available.

- {/if} {/if}

 

@@ -112,14 +59,14 @@ {if apply_filters('glm_members_permit_admin_member_index_view_member_info_version', true)} {if apply_filters('glm_members_permit_admin_member_index_add_member_info_version', true)} - Add New Member Information Version {/if}

-

Member Information Versions

+

Member Profile Versions

Show archived information   + Add New Member Information Version

@@ -127,7 +74,7 @@ - + @@ -177,7 +124,7 @@ {/if} {else} -

No current member.

+

No member currently selected.

{/if} diff --git a/views/admin/member/memberEdit.html b/views/admin/member/memberEdit.html new file mode 100644 index 00000000..c212a6a7 --- /dev/null +++ b/views/admin/member/memberEdit.html @@ -0,0 +1,733 @@ +{include file='admin/member/header.html'} + + + + + + +{if $haveMember || $addingMember} + {if $haveMemberTypes} + + +

+ {if $addingMember} + Add New Member + {else} + Edit Member Information + {/if} +

+ + {if $memberUpdated} +

Member Updated

+ {/if} + + {if apply_filters('glm_members_permit_admin_member_index_edit_member', true)} + + + {if $addingMember} + + + {else} + + + + {/if} + + + + + +
AccessStatus Reference Name Created Last UpdateClick here to add Member Types.
+ + + + + + {if !$addingMember} + + + + + {/if} + + + + + + + + + + {if !$addingMember} + + {/if} + + + + +
Member Name: + + {if $member.fieldFail.name}

{$member.fieldFail.name}

{/if} +
Name for URLs: + {$member.fieldData.member_slug} +
Member Display & Access: + + {if $member.fieldFail.access}

{$member.fieldFail.access}

{/if} +
Member Type: + + {if $member.fieldFail.member_type}

{$member.fieldFail.member_type}

{/if} +
Date created:{$member.fieldData.created.date}
Notes: + + {if $member.fieldFail.notes}

{$member.fieldFail.notes}

{/if}
+ This "Notes" field is not displayed anywhere else. It is strictly for making and keeping + notes related to this member profile. +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {if $member.fieldRequired.lat} + + +
Address Line 1: + + {if $member.fieldFail.addr1}

{$member.fieldFail.addr1}

{/if} +
Address Line 2: + + {if $member.fieldFail.addr2}

{$member.fieldFail.addr2}

{/if} +
City + +
Add a new City
+
+ + + + + +
City Name: + +
+
+

* Required

+ Cancel + +
+ + + +
State: + + {if $member.fieldFail.state}

{$member.fieldFail.state}

{/if} +
ZIP / Postal Code: + + {if $member.fieldFail.zip}

{$member.fieldFail.zip}

{/if} +
Country: + + {if $member.fieldFail.country}

{$member.fieldFail.country}

{/if} +
{else}{/if}Location: + + +
Map Location Using Above Address
+

+ MAP USE: Drag the pointer to the desired location for this member. + Use + and - buttons or the mouse wheel to zoom in or out. + Click and drag anywhere else on the map to move to another area. +

+
(map loads here)
+ Selected Position: Lat {$member.fieldData.lat}, Lon {$member.fieldData.lon} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Categories + +
Add a new Category
+
+ + + + + + + + + +
Category Name: + +
+
Parent Category: + +
OR
+ +
+

* Required

+ Cancel + +
+ +    Select a category to add to box below.
+
+ + {if isset($member.fieldData.categories) && $member.fieldData.categories} + {foreach from=$member.fieldData.categories item=c} +
+ {if $c.parent_name != ''}{$c.parent_name}: {/if}{$c.name} + X + +
+ {/foreach} + {/if} +
+
Region: + + {if $member.fieldFail.region}

{$member.fieldFail.region}

{/if} +
Phone #: + + {if $member.fieldFail.phone}

{$member.fieldFail.phone}

{/if} +
Toll Free #: + + {if $member.fieldFail.toll_free}

{$member.fieldFail.toll_free}

{/if} +
Web Address (URL): + {if $member.fieldData.url} + Test Link + {/if} + + {if $member.fieldFail.url}

{$member.fieldFail.url}

{/if} +
Credit Cards Accepted: + {foreach from=$member.fieldData.cc_type.bitmap item=v} + {$v.name}
+ {/foreach} + {if $member.fieldFail.cc_type}

{$member.fieldFail.cc_type}

{/if} +
Logo: + + {if $member.fieldData.logo} + + + + + {/if} + +
+
+ +
+
+ Delete Image
+ {$member.fieldData.logo}
+
New image:
+ + {if $member.fieldFail.logo}

{$member.fieldFail.logo}

{/if} +
+

* Required

+ {if $addingMember} + + {else} + + {/if} + + {else} + {if $haveMember} + + + + + + + + + + + + + + + + + + +
Member Name:{$member.fieldData.name}
Name for URLs:{$member.fieldData.member_slug}
Member Display & Access:{$member.fieldData.access.name}
Member Type:{$member.fieldData.member_type.name}
Date created:{$member.fieldData.created.date}
+ {else} +

No member information available.

+ {/if} + {/if} + + {else} +

You do not have any Member Types setup.

+

You must have at least one Member Type to add a new member.

+ Click here to add Member Types. + {/if} +{else} +

No member currently selected.

+{/if} + + + + + +{include file='admin/footer.html'} diff --git a/views/admin/member/memberInfo.html b/views/admin/member/memberInfo.html index 436c1adf..b6569343 100644 --- a/views/admin/member/memberInfo.html +++ b/views/admin/member/memberInfo.html @@ -1,9 +1,6 @@ {include file='admin/member/header.html'} - - - - {if $memberUpdated}

Member Information Updated

{/if} + {if $memberUpdated}

Member Profile Updated

{/if} -
Delete this Member Information Version
-
+ +
Delete this Member Profile Version
+
{if $memberInfo.fieldData.status.value == 10}

Cancel

- NOTE: This member information is the currently active version! You may not delete an active version. - To delete this version, please select another version to be active or change the "Member Info Status" on this page to something + NOTE: This member profile is the currently active version! You may not delete an active profile version. + To delete this version, please select another version to be active or change the "Profile Status" on this page to something other than "Active".

If you change this version to something other than "Active" without selecting another version as active, there will be no active - information for this member. Members without an active information version will not be displayed on the front-end of this Web site. + profile for this member. Members without an active profile will not be displayed on the front-end of this Web site.

- Click the "Member Dashboard" tab above to see all information versions for this member and optionally to select another version to + Click the "Member Dashboard" tab above to see all profile versions for this member and optionally to select another version to be active.

{else}

Cancel

-

+

WARNING:

- Clicking the "Delete this Member Information Version" button above will - delete all of the data and images displayed on this page and any other information in the tabs that may show to the right of the "Member Info" + Clicking the "Delete this Member Profile Version" button above will + delete all of the data and images displayed on this page and any other information in the tabs that may show to the right of the "Member Profile" tab above.

@@ -47,24 +44,24 @@

- This member may also have other member information records. Click the "Member Dashboard" Tab above to view a list of all information + This member may also have other member profile records. Click the "Member Dashboard" Tab above to view a list of all profile version records for this member.

- Only this member information version will be deleted. Other member information versions listed under the "Member Dashboard" tab + Only this member profile version will be deleted. Other member profile versions listed under the "Member Dashboard" tab above will not be deleted.

There may also be "Archived" versions that will not normally show up in the "Member Dashboard". Click the - "Show Archiived Versions" checkbox at the top right of the versions list on that page to include archived versions. + "Show Archiived Profile Versions" checkbox at the top right of the versions list on that page to include archived versions.

{/if}
-

Edit Member Information

+

Edit Member Profile

{else} -

Add New Member Information

+

Add New Member Profile

{/if}
@@ -84,31 +81,33 @@ Member Name: {$member.name} - - Member Type: - {$member.member_type.name} - {if $memberInfoID && $memberInfo} Access: {$member.access.name} {/if} - {if $noActive} -

You do not have any active information for this member.

- {/if} - {if $memberInfoID && $memberInfo} - - Created: - {$memberInfo.fieldData.create_time.datetime} - + + + + + - - + + - {/if} - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {if $memberInfo.fieldRequired.lat} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
Last Updated:{$memberInfo.fieldData.modify_time.datetime}Profile Name: + + {if $memberInfo.fieldFail.reference_name}

{$memberInfo.fieldFail.reference_name}

{/if}
+ The "Profile Name" field is used to help identify this particular member profile. Members may have multiple profiles, + only one of which can be active at a time. Multiple profiles make it easy to manage separate sets of information that may be + used at different times, for example seasons of the year or for special events (i.e. "Winter Profile"). +
Member Info Status:
Profile Status:
Reference Name: - - {if $memberInfo.fieldFail.reference_name}

{$memberInfo.fieldFail.reference_name}

{/if} -
  -

Descriptions

-
Description: + {php} wp_editor('{$memberInfo.fieldData.descr|escape:quotes}', 'glm_descr', array( // 'media_buttons' => true, @@ -149,179 +135,11 @@
Short Description: + {if $memberInfo.fieldFail.short_descr}

{$memberInfo.fieldFail.short_descr}

{/if}
  -

Member Address

-

The map below will display the likely location as you enter or edit the address.

-
Address Line 1: - - {if $memberInfo.fieldFail.addr1}

{$memberInfo.fieldFail.addr1}

{/if} -
Address Line 2: - - {if $memberInfo.fieldFail.addr2}

{$memberInfo.fieldFail.addr2}

{/if} -
City - -
Add a new City
-
- - - - - -
City Name: - -
-
-

* Required

- Cancel - -
- - - -
State: - - {if $memberInfo.fieldFail.state}

{$memberInfo.fieldFail.state}

{/if} -
ZIP / Postal Code: - - {if $memberInfo.fieldFail.zip}

{$memberInfo.fieldFail.zip}

{/if} -
Country: - - {if $memberInfo.fieldFail.country}

{$memberInfo.fieldFail.country}

{/if} -
{else}{/if}Location: - - -

- MAP USE: Drag the pointer to the desired location for this member. - Use + and - buttons or the mouse wheel to zoom in or out. - Click and drag anywhere else on the map to move to another area. -

-
(map loads here)
- Selected Position: Lat {$memberInfo.fieldData.lat}, Lon {$memberInfo.fieldData.lon} -
  -

Other Information

-
Categories - -
Add a new Category
-
- - - - - - - - - -
Category Name: - -
-
Parent Category: - -
OR
- -
-

* Required

- Cancel - -
- -    Select a category to add to box below.
-
- - {if isset($memberInfo.fieldData.categories) && $memberInfo.fieldData.categories} - {foreach from=$memberInfo.fieldData.categories item=c} -
- {if $c.parent_name != ''}{$c.parent_name}: {/if}{$c.name} - X - -
- {/foreach} - {/if} -
-
Amenities @@ -351,96 +169,17 @@
Region: - - {if $memberInfo.fieldFail.region}

{$memberInfo.fieldFail.region}

{/if} -
Phone #: - - {if $memberInfo.fieldFail.phone}

{$memberInfo.fieldFail.phone}

{/if} -
Toll Free #: - - {if $memberInfo.fieldFail.toll_free}

{$memberInfo.fieldFail.toll_free}

{/if} -
Web Address (URL): - {if $memberInfo.fieldData.url} - Test Link - {/if} - - {if $memberInfo.fieldFail.url}

{$memberInfo.fieldFail.url}

{/if} -
E-Mail Address: - - {if $memberInfo.fieldFail.email}

{$memberInfo.fieldFail.email}

{/if} -
Logo: - - {if $memberInfo.fieldData.logo} - - - - - {/if} - -
-
- -
-
- Delete Image
- {$memberInfo.fieldData.logo}
-
New image:
- - {if $memberInfo.fieldFail.logo}

{$memberInfo.fieldFail.logo}

{/if} -
Credit Cards Accepted: - {foreach from=$memberInfo.fieldData.cc_type.bitmap item=v} - {$v.name}
- {/foreach} - {if $memberInfo.fieldFail.cc_type}

{$memberInfo.fieldFail.cc_type}

{/if} -
Notes: - {php} - wp_editor('{$memberInfo.fieldData.notes}', 'glm_notes', array( - 'quicktags' => false, - 'media_buttons' => false, - 'wpautop' => false, - 'textarea_name' => 'notes', - 'editor_height' => 100, // Height in px, overrides editor_rows - // 'textarea_rows' => 4, - )); - {/php} - {if $memberInfo.fieldFail.notes}

{$memberInfo.fieldFail.notes}

{/if} +
+ + {if $memberInfo.fieldFail.notes}

{$memberInfo.fieldFail.notes}

{/if}
+ This "Notes" field is not displayed anywhere else. It is strictly for making and keeping + notes related to this member profile.
+

* Required

- +
@@ -599,7 +338,7 @@ Short Description:{$memberInfo.fieldData.short_descr}   - +

Member Address

The map below will display the likely location as you enter or edit the address.

@@ -717,123 +456,22 @@ diff --git a/views/admin/members/index.html b/views/admin/members/index.html index 065e96d6..eaf7dd5e 100644 --- a/views/admin/members/index.html +++ b/views/admin/members/index.html @@ -1,7 +1,7 @@ {include file='admin/members/header.html'} {if apply_filters('glm_members_permit_admin_members_index_add_member', true)} - Add A New Member + Add A New Member {/if}

Main Dashboard

@@ -26,12 +26,6 @@ Click here to add Member Categories. {/if} - {if !$haveAccommodationTypes} - - You do not have any Accommodation Types setup. - Click here to add Accommodation Types. - - {/if} {if !$haveAmenities} You do not have any Amenities setup. @@ -56,7 +50,7 @@   You do not have any members listed. - Click here to create your first member. + Click here to create your first member. {/if} @@ -66,15 +60,13 @@ {if $haveBadLatLon} -

Member Information with Bad Map Location Information

+

 
Member Profile with Bad Map Location Information

- - - + @@ -86,16 +78,10 @@ {/if} - - {/foreach} @@ -104,7 +90,7 @@ {/if} {if $membersPending} -

Pending Member Information

+

 
Pending Member Profile

Member NameLast UpdatedReference Name Created
- {$p.member} - - {$p.modify_time.datetime} - - {$p.reference_name} + {$p.name} - Manage + {$p.created.date}
@@ -123,7 +109,7 @@ {/if} - - @@ -42,6 +40,7 @@ {/if} - - {/foreach} {else} -- 2.17.1
- {$p.member} + {$p.member} {$p.modify_time.datetime} diff --git a/views/admin/members/list.html b/views/admin/members/list.html index bfa4ced9..fbecd96a 100644 --- a/views/admin/members/list.html +++ b/views/admin/members/list.html @@ -27,8 +27,6 @@ Access Member Type Date CreatedPending 
{$m.id} + Active Profile {$m.name} @@ -50,17 +49,11 @@ {$m.access_short.name} - {$m.member_type.name} + {$m.member_type_short} {$m.created.date} - {if $m.pending > 0}{$m.pending} Pending{/if} - - Active Info -