From 8249bd0ddc7851b37f3bbe25e7dd3f7be8e9157e Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Wed, 6 Sep 2017 15:14:20 -0400 Subject: [PATCH] Removed references to admin debug code. Added more functionality in registrations admin for account, requests, and events. --- classes/data/dataRegRequest.php | 26 +- config/plugin.ini | 2 + models/admin/management/registrations.php | 11 +- models/admin/management/regterms.php | 6 +- models/admin/registrations/accounts.php | 18 +- models/admin/registrations/index-SAVE.php | 105 +++++ models/admin/registrations/index.php | 288 ++++++++++++- models/admin/registrations/list.php | 383 ------------------ models/admin/registrations/requests.php | 67 ++- models/admin/settings/registrationsMisc.php | 9 +- .../settings/registrationsPaymentCode.php | 6 - setup/adminMenus.php | 12 +- setup/validActions.php | 1 - .../admin/registrations/accountDashboard.html | 170 ++++---- views/admin/registrations/accountHeader.html | 2 +- .../registrations/accountsDashboard.html | 13 +- views/admin/registrations/event.html | 52 ++- views/admin/registrations/index.html | 152 ++++++- views/admin/registrations/list-save.html | 8 - views/admin/registrations/list.html | 146 ------- .../admin/registrations/requestDashboard.html | 46 +++ views/admin/registrations/requestHeader.html | 7 + .../{requests.html => requestsDashboard.html} | 8 +- 23 files changed, 815 insertions(+), 723 deletions(-) create mode 100644 models/admin/registrations/index-SAVE.php delete mode 100644 models/admin/registrations/list.php delete mode 100644 views/admin/registrations/list-save.html delete mode 100644 views/admin/registrations/list.html create mode 100644 views/admin/registrations/requestDashboard.html create mode 100644 views/admin/registrations/requestHeader.html rename views/admin/registrations/{requests.html => requestsDashboard.html} (76%) diff --git a/classes/data/dataRegRequest.php b/classes/data/dataRegRequest.php index caed6e2..c459b2c 100644 --- a/classes/data/dataRegRequest.php +++ b/classes/data/dataRegRequest.php @@ -124,6 +124,30 @@ class GlmDataRegistrationsRequest extends GlmDataAbstract 'use' => 'lgneud' ), + // Account First Name + 'account_fname' => array ( + 'field' => 'account', + 'as' => 'account_fname', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'account', + 'p_field' => 'fname', + 'p_static' => true, + 'required' => true, + 'use' => 'gle' + ), + + // Account Last Name + 'account_lname' => array ( + 'field' => 'account', + 'as' => 'account_lname', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'account', + 'p_field' => 'lname', + 'p_static' => true, + 'required' => true, + 'use' => 'gle' + ), + // Flag that indicates if request passed last validation with checkRegistrationRequest() 'validated' => array ( 'field' => 'validated', @@ -219,7 +243,7 @@ class GlmDataRegistrationsRequest extends GlmDataAbstract 'field' => 'pay_method', 'type' => 'list', 'list' => $this->config['payment_method'], - 'default' => $this->config['payment_method_numb']['Not Yet Defined'], + 'default' => $this->config['payment_method_numb']['Undefined'], 'use' => 'a' ), diff --git a/config/plugin.ini b/config/plugin.ini index f8cc7f3..7771061 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -36,6 +36,7 @@ payment_method[3] = 'Cash' payment_method[4] = 'Check' payment_method[5] = 'Credit Card' payment_method[6] = 'Call from Merchant' +payment_method[99] = 'Undefined' payment_method_numb['No Charge'] = 1 payment_method_numb['Comp Code'] = 2 @@ -43,6 +44,7 @@ payment_method_numb['Cash'] = 3 payment_method_numb['Check'] = 4 payment_method_numb['Credit Card'] = 5 payment_method_numb['Call from Merchant'] = 6 +payment_method_numb['Undefined'] = 99 ; ; Payment Code Types - List only diff --git a/models/admin/management/registrations.php b/models/admin/management/registrations.php index 81d64df..69a39d5 100644 --- a/models/admin/management/registrations.php +++ b/models/admin/management/registrations.php @@ -146,11 +146,6 @@ class GlmMembersAdmin_management_registrations extends GlmDataRegistrationsManag // Check if we were successful if ($regSettings['status']) { - - if ( GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE ) { - glmMembersAdmin::addNotice( $misc, 'DataBlock', 'Misc Registrations Settings' ); - } - $settingsUpdated = true; $regSettings = $this->editEntry( $id ); @@ -174,10 +169,8 @@ class GlmMembersAdmin_management_registrations extends GlmDataRegistrationsManag $errorMsg = "Unable to load the Registrations management settings"; - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - glmMembersAdmin::addNotice("/models/admin/settings/terms.php: $errorMsg", 'Alert'); - } - + trigger_error($errorMsg, E_USER_NOTICE); + return array( 'status' => false, 'menuItemRedirect' => 'error', diff --git a/models/admin/management/regterms.php b/models/admin/management/regterms.php index db98478..446a76e 100644 --- a/models/admin/management/regterms.php +++ b/models/admin/management/regterms.php @@ -155,10 +155,8 @@ class GlmMembersAdmin_management_regterms extends GlmDataRegistrationsSettingsTe // Check that we actually have the terms if ($termsSettings === false) { - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - glmMembersAdmin::addNotice("/models/admin/settings/terms.php: Unable to load Terms Settings.", 'Alert'); - } - + trigger_error("Unable to load Terms Settings: /models/admin/settings/terms.php", E_USER_NOTICE); + return array( 'status' => false, 'menuItemRedirect' => 'error', diff --git a/models/admin/registrations/accounts.php b/models/admin/registrations/accounts.php index 612779a..d7f4cc0 100644 --- a/models/admin/registrations/accounts.php +++ b/models/admin/registrations/accounts.php @@ -112,8 +112,8 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount $namesList = false; $numbDisplayed = false; $lastDisplayed = false; - $registrations = false; - $haveRegistrations = false; + $requests = false; + $haveRequests = false; $registered = false; $haveRegistered = false; @@ -123,10 +123,10 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount } // Get account ID if supplied - if (isset($_REQUEST['account'])) { + if (isset($_REQUEST['accountID'])) { // Make sure it's numeric - $accountID = ($_REQUEST['account'] - 0); + $accountID = ($_REQUEST['accountID'] - 0); } else { @@ -204,9 +204,9 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount $haveAccount = true; // Get any registrations submitted - $registrations = $RegRequest->getList("T.account = $accountID"); - if (is_array($registrations) && count($registrations) > 0) { - $haveRegistrations = true; + $requests = $RegRequest->getList("T.account = $accountID"); + if (is_array($requests) && count($requests) > 0) { + $haveRequests = true; } // Get any events registered @@ -327,8 +327,8 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount 'namesList' => $namesList, 'numbDisplayed' => $numbDisplayed, 'lastDisplayed' => $lastDisplayed, - 'registrations' => $registrations, - 'haveRegistrations' => $haveRegistrations, + 'requests' => $requests, + 'haveRequests' => $haveRequests, 'registered' => $registered, 'haveRegistered' => $haveRegistered, 'reason' => $reason diff --git a/models/admin/registrations/index-SAVE.php b/models/admin/registrations/index-SAVE.php new file mode 100644 index 0000000..0e2fa5f --- /dev/null +++ b/models/admin/registrations/index-SAVE.php @@ -0,0 +1,105 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +// Load Registrations data abstract +// require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegistrations.php'; + +class GlmMembersAdmin_registrations_index // extends GlmDataRegistrations +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Registrations Event ID + * + * @var $eventID + * @access public + */ + public $regEventID = false; + + /** + * Constructor + * + * This contructor performs the work for this model. This model returns + * an array containing the following. + * + * 'status' + * + * True if successfull and false if there was a fatal failure. + * + * 'view' + * + * A suggested view name that the contoller should use instead of the + * default view for this model or false to indicate that the default view + * should be used. + * + * 'data' + * + * Data that the model is returning for use in merging with the view to + * produce output. + * + * @wpdb object WordPress database object + * + * @return array Array containing status, suggested view, and any data + */ + public function __construct ($wpdb, $config) + { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + /* + * Run constructor for the REgistrations data class + * + * Note, the third parameter is a flag that indicates to the Contacts + * data class that it should flag a group of fields as 'view_only'. + */ +// parent::__construct(false, false, true); + + } + + public function modelAction($actionData = false) + { + + // Compile template data + $templateData = array( + ); + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'admin/registrations/index.html', + 'data' => $templateData + ); + + } + + +} diff --git a/models/admin/registrations/index.php b/models/admin/registrations/index.php index 0e2fa5f..9c43253 100644 --- a/models/admin/registrations/index.php +++ b/models/admin/registrations/index.php @@ -1,7 +1,7 @@ getAlphaList(' AND '.$where, $alphaSelected); + + // Get count of reg event listed + $regEventsCount = $this->getStats($where); + + // Get stats for number of registration events found matching current selection criteria (includes alpha selection) + $filteredRegEventsFound = $this->getStats(str_replace('T.', '', $where.$alphaWhere)); + + // Get a current list of reg events + $listResult = $this->getSimpleRegEventsList($where.$alphaWhere, 'event_name', true, 'id', $start, $limit, true); + // Get paging results + $numbDisplayed = $listResult['returned']; + $lastDisplayed = $listResult['last']; + if ($start == 1) { + $prevStart = false; + } else { + $prevStart = $start - $limit; + if ($start < 1) { + $start = 1; + } + } + if ($listResult['returned'] == $limit) { + $nextStart = $start + $limit; + } + + // since we're doing paging, we have to break out just the event data + $list = $listResult['list']; + unset($listResult); + + // If we have list entries - even if it's an empty list + $success = true; + $haveRegEvents = false; + if ($list !== false) { + + $success = true; + + // If we have any entries + if (count($list) > 0) { + $haveRegEvents = true; + } + } + + // Get full list of event names matching the current where clause for text search box + $namesList = $this->getSimpleRegEventsList($where); + + + + $template = 'index.html'; + +/* + + // Check for a text search + if (isset($_REQUEST['text_search']) && trim($_REQUEST['text_search']) != '') { + + $textSearch = addslashes(filter_input(INPUT_POST, 'text_search', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES)); + $where .= " AND T.id in ( + SELECT DISTINCT(member) + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info + WHERE member_name like '%$textSearch%' + )"; + } + + // Check for "Pending Only + if (isset($_REQUEST['filterPending'])) { + + // Refine search only to members with pending Info data + $where .= " AND ( + SELECT COUNT(id) + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info I + WHERE I.status = ".$this->config['status_numb']['Pending']." + AND I.member = T.id + )"; + + $filterPending = true; + $haveFilter = true; + } + + // Check for "Featured Only + if (isset($_REQUEST['filterFeatured'])) { + + // Refine search only to members with pending Info data + $where .= " AND ( + SELECT COUNT(id) + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."members I + WHERE I.featured = 1 + AND I.id = T.id + + )"; + $filterFeatured = true; + $haveFilter = true; + } + + // If doing alpha list + if (isset($_REQUEST['alpha'])) { + $actionData['request']['alpha'] = $_REQUEST['alpha']; + } + + $alphaList = false; + $alphaWhere = ''; + + $alphaSelected = false; + + // If user clicked a page request then we need to check the savedAlpha value + if (isset($_REQUEST['savedAlpha']) && isset($_REQUEST['pageSelect'])) { + $actionData['request']['alpha'] = $_REQUEST['savedAlpha']; + } + + if ($actionData['request']['alpha'] && strlen($actionData['request']['alpha']) == 1) { + $alphaSelected = strtoupper($actionData['request']['alpha']); + $alphaWhere .= " AND T.name LIKE '$alphaSelected%'"; + } + + // Get full list for all other filters, but not filtered by alpha (that would be silly) + $alphaList = $this->getAlphaList(' AND '.$where, $alphaSelected); + + $whereParts = apply_filters('glm-member-db-admin-search-query', $where); + if ( is_array( $whereParts ) && count( $whereParts ) > 0 ) { + $where .= ' AND '.implode(" AND ", $whereParts); + $whereSep = ' AND '; + } + + // Get count of members listed + $memberCount = $this->getStats($where); + + // If the number of members is less than a page, don't do paging + if ($memberCount <= $limit) { + $paging = false; + } + + // Get full list of names matching this where clause for search box + $namesList = $this->getIdName($where); + + // Check if we're doing paging + if (isset($_REQUEST['pageSelect'])) { + + // If request is for Next + if ($_REQUEST['pageSelect'][0] == 'N') { + $newStart = $_REQUEST['nextStart'] - 0; + + // Otherwise it must be Previous + } else { + $newStart = $_REQUEST['prevStart'] - 0; + } + + if ($newStart > 0) { + $start = $newStart; + } + } + + // Get stats for number of members found matching current selection criteria (includes alpha selection) + $filteredMembersFound = $this->getStats(str_replace('T.', '', $where.$alphaWhere)); + + // Get a current list of members + $listResult = $this->getSimpleMembersList($where.$alphaWhere, 'name', true, 'id', $start, $limit); + + // Get paging results + $numbDisplayed = $listResult['returned']; + $lastDisplayed = $listResult['last']; + if ($start == 1) { + $prevStart = false; + } else { + $prevStart = $start - $limit; + if ($start < 1) { + $start = 1; + } + } + if ($listResult['returned'] == $limit) { + $nextStart = $start + $limit; + } + + // since we're doing paging, we have to break out just the member data + $list = $listResult['list']; + unset($listResult); + + // If we have list entries - even if it's an empty list + $success = true; + $haveMembers = false; + if ($list !== false) { + + $success = true; + + // If we have any entries + if (count($list) > 0) { + $haveMembers = true; + } + } + + // Determine if current user can add, edit, delete member data + // $canEdit = current_user_can('glm_members_edit'); + + // Add a url for each member + if ( isset( $list) && is_array( $list ) ) { + foreach ($list as $member) { + $list[$member['id']]['member_slug'] = sanitize_title($member['name']); + } + } + + // Compile template data + $templateData = array( + 'enable_members' => $enable_members, + 'haveMembers' => $haveMembers, + 'members' => $list, + 'memberCount' => $memberCount, + 'categories' => $categories, + 'haveFilter' => $haveFilter, + 'filterArchived' => $filterArchived, + 'filterFeatured' => $filterFeatured, + 'filterPending' => $filterPending, + 'catSelected' => $catSelected, + 'catSearchSelected' => $catSelectedString, + 'alphaList' => $alphaList, + 'alphaSelected' => $alphaSelected, + 'numbDisplayed' => $numbDisplayed, + 'lastDisplayed' => $lastDisplayed, + 'paging' => $paging, + 'prevStart' => $prevStart, + 'nextStart' => $nextStart, + 'start' => $start, + 'limit' => $limit, + 'namesList' => $namesList, + 'textSearch' => $textSearch + ); +*/ + // Compile template data $templateData = array( + 'regEventsCount' => $regEventsCount, + 'haveRegEvents' => $haveRegEvents, + 'regEvents' => $list, + 'alphaList' => $alphaList, + 'alphaSelected' => $alphaSelected, + 'numbDisplayed' => $numbDisplayed, + 'lastDisplayed' => $lastDisplayed, + 'paging' => $paging, + 'prevStart' => $prevStart, + 'nextStart' => $nextStart, + 'start' => $start, + 'limit' => $limit, + 'namesList' => $namesList, + 'textSearch' => $textSearch ); - // Return status, any suggested view, and any data to controller + + // Return status, any suggested view, and any data to controller return array( 'status' => true, 'modelRedirect' => false, - 'view' => 'admin/registrations/index.html', + 'view' => 'admin/registrations/'.$template, 'data' => $templateData ); diff --git a/models/admin/registrations/list.php b/models/admin/registrations/list.php deleted file mode 100644 index 62ed55f..0000000 --- a/models/admin/registrations/list.php +++ /dev/null @@ -1,383 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @release index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ - * @link http://dev.gaslightmedia.com/ - */ - -// Load Registrations data abstract -require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php'; - -class GlmMembersAdmin_registrations_list extends GlmDataRegistrationsRegEvent -{ - - /** - * WordPress Database Object - * - * @var $wpdb - * @access public - */ - public $wpdb; - /** - * Plugin Configuration Data - * - * @var $config - * @access public - */ - public $config; - /** - * Registrations Event ID - * - * @var $eventID - * @access public - */ - public $regEventID = false; - - /** - * Constructor - * - * This contructor performs the work for this model. This model returns - * an array containing the following. - * - * 'status' - * - * True if successfull and false if there was a fatal failure. - * - * 'view' - * - * A suggested view name that the contoller should use instead of the - * default view for this model or false to indicate that the default view - * should be used. - * - * 'data' - * - * Data that the model is returning for use in merging with the view to - * produce output. - * - * @wpdb object WordPress database object - * - * @return array Array containing status, suggested view, and any data - */ - public function __construct ($wpdb, $config) - { - - // Save WordPress Database object - $this->wpdb = $wpdb; - - // Save plugin configuration object - $this->config = $config; - - /* - * Run constructor for the REgistrations data class - * - * Note, the third parameter is a flag that indicates to the Contacts - * data class that it should flag a group of fields as 'view_only'. - */ - parent::__construct(false, false, true); - - } - - public function modelAction($actionData = false) - { - - $where = ' true '; - $alphaWhere = ' true '; - $numbDisplayed = false; - $lastDisplayed = false; - $paging = true; - $prevStart = false; - $nextStart = false; - $start = 1; - $limit = 20; // Set to the number of listings per page - $textSearch = false; - $where = "TRUE"; - $alphaList = false; - $alphaWhere = ''; - $alphaSelected = false; - $haveRegEvents = false; - $regEventsCount = false; - $namesList = false; - - // If doing alpha list - if (isset($_REQUEST['alpha'])) { - $actionData['request']['alpha'] = $_REQUEST['alpha']; - } - - // If user clicked a page request then we need to check the savedAlpha value - if (isset($_REQUEST['savedAlpha']) && isset($_REQUEST['pageSelect'])) { - $actionData['request']['alpha'] = $_REQUEST['savedAlpha']; - } - - if ($actionData['request']['alpha'] && strlen($actionData['request']['alpha']) == 1) { - $alphaSelected = strtoupper($actionData['request']['alpha']); - $alphaWhere .= " AND T.event_name LIKE '$alphaSelected%'"; - } - - // Get full list for all other filters, but not filtered by alpha (that would be silly) - $alphaList = $this->getAlphaList(' AND '.$where, $alphaSelected); - - // Get count of reg event listed - $regEventsCount = $this->getStats($where); - - // Get stats for number of registration events found matching current selection criteria (includes alpha selection) - $filteredRegEventsFound = $this->getStats(str_replace('T.', '', $where.$alphaWhere)); - - // Get a current list of reg events - $listResult = $this->getSimpleRegEventsList($where.$alphaWhere, 'event_name', true, 'id', $start, $limit, true); - - // Get paging results - $numbDisplayed = $listResult['returned']; - $lastDisplayed = $listResult['last']; - if ($start == 1) { - $prevStart = false; - } else { - $prevStart = $start - $limit; - if ($start < 1) { - $start = 1; - } - } - if ($listResult['returned'] == $limit) { - $nextStart = $start + $limit; - } - - // since we're doing paging, we have to break out just the event data - $list = $listResult['list']; - unset($listResult); - - // If we have list entries - even if it's an empty list - $success = true; - $haveRegEvents = false; - if ($list !== false) { - - $success = true; - - // If we have any entries - if (count($list) > 0) { - $haveRegEvents = true; - } - } - - // Get full list of event names matching the current where clause for text search box - $namesList = $this->getSimpleRegEventsList($where); - - - - $template = 'list.html'; - -/* - - // Check for a text search - if (isset($_REQUEST['text_search']) && trim($_REQUEST['text_search']) != '') { - - $textSearch = addslashes(filter_input(INPUT_POST, 'text_search', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES)); - $where .= " AND T.id in ( - SELECT DISTINCT(member) - FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info - WHERE member_name like '%$textSearch%' - )"; - } - - // Check for "Pending Only - if (isset($_REQUEST['filterPending'])) { - - // Refine search only to members with pending Info data - $where .= " AND ( - SELECT COUNT(id) - FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info I - WHERE I.status = ".$this->config['status_numb']['Pending']." - AND I.member = T.id - )"; - - $filterPending = true; - $haveFilter = true; - } - - // Check for "Featured Only - if (isset($_REQUEST['filterFeatured'])) { - - // Refine search only to members with pending Info data - $where .= " AND ( - SELECT COUNT(id) - FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."members I - WHERE I.featured = 1 - AND I.id = T.id - - )"; - $filterFeatured = true; - $haveFilter = true; - } - - // If doing alpha list - if (isset($_REQUEST['alpha'])) { - $actionData['request']['alpha'] = $_REQUEST['alpha']; - } - - $alphaList = false; - $alphaWhere = ''; - - $alphaSelected = false; - - // If user clicked a page request then we need to check the savedAlpha value - if (isset($_REQUEST['savedAlpha']) && isset($_REQUEST['pageSelect'])) { - $actionData['request']['alpha'] = $_REQUEST['savedAlpha']; - } - - if ($actionData['request']['alpha'] && strlen($actionData['request']['alpha']) == 1) { - $alphaSelected = strtoupper($actionData['request']['alpha']); - $alphaWhere .= " AND T.name LIKE '$alphaSelected%'"; - } - - // Get full list for all other filters, but not filtered by alpha (that would be silly) - $alphaList = $this->getAlphaList(' AND '.$where, $alphaSelected); - - $whereParts = apply_filters('glm-member-db-admin-search-query', $where); - if ( is_array( $whereParts ) && count( $whereParts ) > 0 ) { - $where .= ' AND '.implode(" AND ", $whereParts); - $whereSep = ' AND '; - } - - // Get count of members listed - $memberCount = $this->getStats($where); - - // If the number of members is less than a page, don't do paging - if ($memberCount <= $limit) { - $paging = false; - } - - // Get full list of names matching this where clause for search box - $namesList = $this->getIdName($where); - - // Check if we're doing paging - if (isset($_REQUEST['pageSelect'])) { - - // If request is for Next - if ($_REQUEST['pageSelect'][0] == 'N') { - $newStart = $_REQUEST['nextStart'] - 0; - - // Otherwise it must be Previous - } else { - $newStart = $_REQUEST['prevStart'] - 0; - } - - if ($newStart > 0) { - $start = $newStart; - } - } - - // Get stats for number of members found matching current selection criteria (includes alpha selection) - $filteredMembersFound = $this->getStats(str_replace('T.', '', $where.$alphaWhere)); - - // Get a current list of members - $listResult = $this->getSimpleMembersList($where.$alphaWhere, 'name', true, 'id', $start, $limit); - - // Get paging results - $numbDisplayed = $listResult['returned']; - $lastDisplayed = $listResult['last']; - if ($start == 1) { - $prevStart = false; - } else { - $prevStart = $start - $limit; - if ($start < 1) { - $start = 1; - } - } - if ($listResult['returned'] == $limit) { - $nextStart = $start + $limit; - } - - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice($list, 'DataBlock', 'Member Data'); - } - - // since we're doing paging, we have to break out just the member data - $list = $listResult['list']; - unset($listResult); - - // If we have list entries - even if it's an empty list - $success = true; - $haveMembers = false; - if ($list !== false) { - - $success = true; - - // If we have any entries - if (count($list) > 0) { - $haveMembers = true; - } - } - - // Determine if current user can add, edit, delete member data - // $canEdit = current_user_can('glm_members_edit'); - - // Add a url for each member - if ( isset( $list) && is_array( $list ) ) { - foreach ($list as $member) { - $list[$member['id']]['member_slug'] = sanitize_title($member['name']); - } - } - - // Compile template data - $templateData = array( - 'enable_members' => $enable_members, - 'haveMembers' => $haveMembers, - 'members' => $list, - 'memberCount' => $memberCount, - 'categories' => $categories, - 'haveFilter' => $haveFilter, - 'filterArchived' => $filterArchived, - 'filterFeatured' => $filterFeatured, - 'filterPending' => $filterPending, - 'catSelected' => $catSelected, - 'catSearchSelected' => $catSelectedString, - 'alphaList' => $alphaList, - 'alphaSelected' => $alphaSelected, - 'numbDisplayed' => $numbDisplayed, - 'lastDisplayed' => $lastDisplayed, - 'paging' => $paging, - 'prevStart' => $prevStart, - 'nextStart' => $nextStart, - 'start' => $start, - 'limit' => $limit, - 'namesList' => $namesList, - 'textSearch' => $textSearch - ); -*/ - - // Compile template data - $templateData = array( - 'regEventsCount' => $regEventsCount, - 'haveRegEvents' => $haveRegEvents, - 'regEvents' => $list, - 'alphaList' => $alphaList, - 'alphaSelected' => $alphaSelected, - 'numbDisplayed' => $numbDisplayed, - 'lastDisplayed' => $lastDisplayed, - 'paging' => $paging, - 'prevStart' => $prevStart, - 'nextStart' => $nextStart, - 'start' => $start, - 'limit' => $limit, - 'namesList' => $namesList, - 'textSearch' => $textSearch - ); - - // Return status, any suggested view, and any data to controller - return array( - 'status' => true, - 'modelRedirect' => false, - 'view' => 'admin/registrations/'.$template, - 'data' => $templateData - ); - - } - - -} diff --git a/models/admin/registrations/requests.php b/models/admin/registrations/requests.php index e1cf5aa..376ecfa 100644 --- a/models/admin/registrations/requests.php +++ b/models/admin/registrations/requests.php @@ -83,10 +83,11 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRequest $haveRequests = false; $requests = false; + $requestID = false; $haveRequest = false; - $requestId = false; - $requestCart = false; - $option = 'list'; + $cart = false; + $haveCart = false; + $option = 'dashboard'; $errorMsg = false; // Load registrations support class @@ -106,34 +107,62 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRequest if (isset($_REQUEST['option']) && $_REQUEST['option'] != '') { $option = $_REQUEST['option']; } - - // Check for registration request ID submitted - if (isset($_REQUEST['requestID']) && $_REQUEST['requestID'] != '') { - $requestId = ($_REQUEST['requestID'] - 0); + + + // Get request ID if supplied + if (isset($_REQUEST['requestID'])) { + + // Make sure it's numeric + $requestID = ($_REQUEST['requestID'] - 0); + + } else { + + // Try to get saved + $requestID = get_option('glmMembersDatabaseRegistrationsRequestID'); + } - + + if (!$requestID || $requestID <= 0) { + $requestID = false; + } + // Perform selected option switch ($option) { // Check request and update holds case 'check': - $requestCart = $regCartSupport->checkRegistrationRequest($requestId); + $cart = $regCartSupport->checkRegistrationRequest($requestID); + + break; + + // Display selected registration request dashboard + case 'requestDashboard': + + $cart = $regCartSupport->getRegistrationCart($requestID); + + if ($cart) { + $haveCart = true; + } + + $view = 'requestDashboard.html'; + + break; // Display/Edit a registration request case 'edit': // If a request ID has been supplied - if ($requestId) { + if ($requestID) { // Try to get the complete cart for this request - $requestCart = $regCartSupport->getRegistrationCart($requestId); + $cart = $regCartSupport->getRegistrationCart($requestID); // If a valid cart was returned - if ($requestCart && $requestCart['status']) { + if ($cart && $requestCart['status']) { $haveRequest = true; } else { - $errorMsg = $requestCart['errorMsg']; + $errorMsg = $cart['errorMsg']; } $view = 'requestEdit.html'; @@ -147,6 +176,7 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRequest // Fall through to list if no requestID submitted // Default is to list requests + case 'dashboard': default: // Get list of requests @@ -155,18 +185,25 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRequest $haveRequests = true; } - $view = 'requests.html'; + $view = 'requestsDashboard.html'; break; } + // If we have a valid request ID, save that for future use + if ($requestID > 0) { + update_option('glmMembersDatabaseRegistrationsRequestID', $requestID); + } + // Compile template data $templateData = array( 'haveRequests' => $haveRequests, 'requests' => $requests, 'haveRequest' => $haveRequest, - 'cart' => $requestCart, + 'requestID' => $requestID, + 'cart' => $cart, + 'haveCart' => $haveCart, 'errorMsg' => $errorMsg, 'option' => $option ); diff --git a/models/admin/settings/registrationsMisc.php b/models/admin/settings/registrationsMisc.php index 2ade88b..df11b46 100644 --- a/models/admin/settings/registrationsMisc.php +++ b/models/admin/settings/registrationsMisc.php @@ -133,10 +133,6 @@ class GlmMembersAdmin_settings_registrationsMisc extends GlmDataRegistrationsMis // Check if we were successful if ($regMisc['status']) { - if ( GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE ) { - glmMembersAdmin::addNotice( $regMisc, 'DataBlock', 'Misc Registrations Settings' ); - } - $miscUpdated = true; $success = true; @@ -160,10 +156,7 @@ class GlmMembersAdmin_settings_registrationsMisc extends GlmDataRegistrationsMis // If we didn't get the misc settings if ($regMisc == false) { - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - glmMembersAdmin::addNotice("/models/admin/settings/registrationsMisc.php: Unable to load Misc Settings.", 'Alert'); - } - + trigger_error("Unable to load Misc Settings: /models/admin/settings/registrationsMisc.php", E_USER_NOTICE); return array( 'status' => false, 'menuItemRedirect' => 'error', diff --git a/models/admin/settings/registrationsPaymentCode.php b/models/admin/settings/registrationsPaymentCode.php index f128382..5c7ffb9 100644 --- a/models/admin/settings/registrationsPaymentCode.php +++ b/models/admin/settings/registrationsPaymentCode.php @@ -147,9 +147,6 @@ class GlmMembersAdmin_settings_registrationsPaymentCode extends GlmDataRegistrat // Get a current list of payment_codes $payment_codes = $this->getList('ref_type = 10'); - if ( GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE ) { - glmMembersAdmin::addNotice( $payment_codes, 'DataBlock', 'Payment Code Data' ); - } // If we have list entries - even if it's an empty list if ( $payment_codes !== false ) { @@ -171,9 +168,6 @@ class GlmMembersAdmin_settings_registrationsPaymentCode extends GlmDataRegistrat ); } - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { - glmMembersAdmin::addNotice( $payment_codes, 'DataBlock', 'Payment Code Data' ); - } // Compile template data $templateData = array( 'enable_members' => $enable_members, diff --git a/setup/adminMenus.php b/setup/adminMenus.php index b653cff..62c2e99 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -58,16 +58,16 @@ add_submenu_page( 'glm-members-admin-menu-registrations-index', function() {$this->controller('registrations');} ); - +/* add_submenu_page( 'glm-members-admin-menu-members', - 'Registration Events List', - '    List', + 'Registration Events Dashboard', + '    Dashboard', 'glm_members_members', - 'glm-members-admin-menu-registrations-list', - function() {$this->controller('registrations', 'list');} + 'glm-members-admin-menu-registrations-index', + function() {$this->controller('registrations', 'index');} ); - +*/ add_submenu_page( 'glm-members-admin-menu-members', 'Selected Event', diff --git a/setup/validActions.php b/setup/validActions.php index ac9f491..b9d73ff 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -64,7 +64,6 @@ $glmMembersRegistrationsAddOnValidActions = array( ), 'registrations' => array( 'index' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'list' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, 'event' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, 'requests' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, 'accounts' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG diff --git a/views/admin/registrations/accountDashboard.html b/views/admin/registrations/accountDashboard.html index 15cfca6..99303f0 100644 --- a/views/admin/registrations/accountDashboard.html +++ b/views/admin/registrations/accountDashboard.html @@ -1,64 +1,59 @@ {include file='admin/registrations/accountHeader.html'} -

Account Dashboard - Edit Account -

- +

Selected Account Dashboard

-{if $paging && $numAccounts} - - -{/if} - -
-
-
-
-
-
-

Account:

-
-
- {$account.fname} {$account.lname}{if $account.title}, {$account.title}{/if} -
-
- {$account.org} -
-
- {$account.addr1} -
- {if $account.addr2} -
- {$account.addr2} -
- {/if} -
- {$account.city}, {$account.state} {$account.zip} -
-
- {$account.country} +
+ + Edit Account +

Account

+ +
+
+
+
+
+
+ {$account.fname} {$account.lname}{if $account.title}, {$account.title}{/if} +
+
+ {$account.org} +
+
+ {$account.addr1} +
+ {if $account.addr2} +
+ {$account.addr2} +
+ {/if} +
+ {$account.city}, {$account.state} {$account.zip} +
+
+ {$account.country} +
-
-
-
-
-
-

Active:

-
-
- {if $account.active}Yes{/if} +
+
+
+
+

Active:

+
+
+ {if $account.active}Yes{/if} +
-
-
-
-
-

Login Validated:

-
-
- {if $account.validated}Yes{/if} +
+
+
+

Login Validated:

+
+
+ {if $account.validated}Yes{/if} +
@@ -66,36 +61,43 @@
-
-

Registration Requests

- {assign var="i" value="0"} - - - - - - - +
+

Registration Requests

+ {assign var="i" value="0"} +
SubmittedPayment ByTotal PaymentStatus
+ + + + + + + + + + + {foreach $requests as $req} + {if $i++ is odd by 1} + + {else} + + {/if} + + + + + - - - {foreach $registrations as $reg} - {if $i++ is odd by 1} - - {else} - - {/if} - - - - - - {/foreach} -
IDSubmittedPayment ByTotal PaymentStatus
+ + {$req.id} + + {$req.date_submitted.datetime}{$req.pay_method.name}{$req.total}{$req.status.name}
{$reg.date_submitted.datetime}{$reg.pay_method.name}{$reg.total}{$reg.status.name}
-
+ {/foreach} + + +
-
-

Registered for Events

+
+

Registered for Events

{assign var="i" value="0"} @@ -111,7 +113,10 @@ {else} {/if} - + {/foreach} @@ -119,6 +124,5 @@ - {include file='admin/footer.html'} diff --git a/views/admin/registrations/accountHeader.html b/views/admin/registrations/accountHeader.html index 2cc4960..d89063d 100644 --- a/views/admin/registrations/accountHeader.html +++ b/views/admin/registrations/accountHeader.html @@ -1,5 +1,5 @@
-

Registration Accounts

+

Event Registrations

Accounts Dashboard - Add A New Account -

+

Accounts Dashboard

+ +
+ +

Accounts List Add A New Account

@@ -49,7 +51,7 @@
@@ -64,6 +66,7 @@ {/if} + + + +{include file='admin/footer.html'} diff --git a/views/admin/registrations/list-save.html b/views/admin/registrations/list-save.html deleted file mode 100644 index fbf4367..0000000 --- a/views/admin/registrations/list-save.html +++ /dev/null @@ -1,8 +0,0 @@ -{include file='admin/registrations/header.html'} - -

Registrations Event List

- -

Not Built Yet

- -{include file='admin/footer.html'} - diff --git a/views/admin/registrations/list.html b/views/admin/registrations/list.html deleted file mode 100644 index 0e6c8b9..0000000 --- a/views/admin/registrations/list.html +++ /dev/null @@ -1,146 +0,0 @@ -{include file='admin/registrations/header.html'} - -
-
- - - - - - -

List of Registration Events

- -
- Text Search: - -
- -

Total found: {$regEventsCount}  

- -
- - - - {if $paging} - - - {/if} - - - -
{$reg.event_name} + + {$reg.event_name} + {$reg.event_datetime.datetime}
{$account.id} {$account.active.name} - {$account.fname} {$account.lname} + {$account.fname} {$account.lname} {$account.date_created.timestamp|date_format:"%D"} {$account.member_id}
- - - - - - - - {if $haveRegEvents} - {assign var="i" value="0"} - {foreach $regEvents as $r} - {if $i++ is odd by 1} - - {else} - - {/if} - - - - {/foreach} - {else} - - {/if} - -
IDEvent Name
- {$r.id} - - {$r.event_name} -
(no registration events listed)
- - {if $paging} - - - {/if} - - -
- - - -{include file='admin/footer.html'} diff --git a/views/admin/registrations/requestDashboard.html b/views/admin/registrations/requestDashboard.html new file mode 100644 index 0000000..d064641 --- /dev/null +++ b/views/admin/registrations/requestDashboard.html @@ -0,0 +1,46 @@ +{include file='admin/registrations/requestHeader.html'} + +

Selected Request Dashboard

+ +{$acct = $cart.request.account} + +
+ + Edit Request +

Request

+ +
+
+
+
+
+
+

Account Submitting Request:

+
+ +
+
+
+
+
+
+
+

Validated:

+
+
+ {if $cart.request.validated.value}Yes{else}{if $cart.request.validation_message}{$cart.request.validation_message}{else}(not yet validated){/if}{/if} +
+
+
+
+
+
+
+ + +{include file='admin/footer.html'} + diff --git a/views/admin/registrations/requestHeader.html b/views/admin/registrations/requestHeader.html new file mode 100644 index 0000000..4b33685 --- /dev/null +++ b/views/admin/registrations/requestHeader.html @@ -0,0 +1,7 @@ +
+

Event Registrations

+ +
diff --git a/views/admin/registrations/requests.html b/views/admin/registrations/requestsDashboard.html similarity index 76% rename from views/admin/registrations/requests.html rename to views/admin/registrations/requestsDashboard.html index b2931a0..7016f2b 100644 --- a/views/admin/registrations/requests.html +++ b/views/admin/registrations/requestsDashboard.html @@ -1,4 +1,4 @@ -{include file='admin/registrations/header.html'} +{include file='admin/registrations/requestHeader.html'} {if $errorMsg}

{$errorMsg}

@@ -22,9 +22,9 @@ {foreach $requests as $r} {$r.id} - {$r.bill_fname} - {$r.bill_lname} - {$r.bill_org} + {$r.bill_fname} + {$r.bill_lname} + {$r.bill_org} {$r.bill_city} {$r.bill_state} -- 2.17.1