From 3f6dd8916e3daff185cc695851864d7bb6a19cb4 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Thu, 27 Dec 2018 13:55:40 -0500 Subject: [PATCH] adding member index view file to the flyout, adding editMember action and ajax model --- models/admin/ajax/adminSearch.php | 2 +- models/admin/ajax/memberEdit.php | 88 +++++++++++++++++++ models/admin/manageDashboard/members.php | 2 +- models/admin/member/memberEdit.php | 1 + setup/validActions.php | 1 + views/admin/manageDashboard/index.html | 106 +++++++++++++++-------- views/admin/manageDashboard/list.html | 1 + views/admin/members/index.html | 3 +- 8 files changed, 166 insertions(+), 38 deletions(-) create mode 100644 models/admin/ajax/memberEdit.php diff --git a/models/admin/ajax/adminSearch.php b/models/admin/ajax/adminSearch.php index 53b0339d..48adaa6c 100644 --- a/models/admin/ajax/adminSearch.php +++ b/models/admin/ajax/adminSearch.php @@ -89,7 +89,7 @@ class GlmMembersAdmin_ajax_adminSearch $status = $this->config['status_numb']['Active']; $list = apply_filters('glm-member-db-admin-search', ''); - $this->write_log("LIST: ". $list); + $return = array( 'searchData' => $list // Where our events list will go diff --git a/models/admin/ajax/memberEdit.php b/models/admin/ajax/memberEdit.php new file mode 100644 index 00000000..0a0260c8 --- /dev/null +++ b/models/admin/ajax/memberEdit.php @@ -0,0 +1,88 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ +require_once GLM_MEMBERS_PLUGIN_PATH . '/controllers/admin.php'; +/** + * + * This class exports the currently selected members list + * to a printable HTML file, to a CSV file, or otherwise. + */ +class GlmMembersAdmin_ajax_memberEdit extends glmMembersAdmin +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + + /** + * Constructor + * + * This constructor 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; + + //parent::__construct(false, false); + + } + + /** + * Perform Model Action + * + * This modelAction takes an AJAX image upload and stores the image in the + * media/images directory of the plugin. + * + * This model action does not return, it simply does it's work then calls die(); + * + * @param $actionData + * + * Echos JSON string as response and does not return + */ + public function modelAction ($actionData = false) + { + global $wpdb; + $memberID = $_REQUEST['memberID']; + $editData = $this->controller( 'member', 'index', array("memberID" => $memberID), true, true); + + $return = array( + "test" => $sql, + 'searchData' => $editData // Where our events list will go + ); + + header('Content-type:application/json;charset=utf-8', true); + echo json_encode($return); + wp_die(); + } +} diff --git a/models/admin/manageDashboard/members.php b/models/admin/manageDashboard/members.php index f603da0c..a4d378db 100644 --- a/models/admin/manageDashboard/members.php +++ b/models/admin/manageDashboard/members.php @@ -111,7 +111,7 @@ class GlmMembersAdmin_manageDashboard_members extends GlmDataMembers */ public function modelAction ($actionData = false) { - $this->writes_log($_REQUEST); + // $this->writes_log($_REQUEST); $view = "index"; if($_REQUEST['view'] == "list") $view = 'list'; diff --git a/models/admin/member/memberEdit.php b/models/admin/member/memberEdit.php index b92b8ea4..bb1049cb 100644 --- a/models/admin/member/memberEdit.php +++ b/models/admin/member/memberEdit.php @@ -117,6 +117,7 @@ class GlmMembersAdmin_member_memberEdit extends GlmDataMembers $haveMember = false; $memberName = false; $addingMember = false; + // Check for action option - Should be one of the values in the "switch" statement below $option = false; diff --git a/setup/validActions.php b/setup/validActions.php index 134af7a3..8b12d5bd 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -50,6 +50,7 @@ $glmMembersValidActions = array( 'countiesMapData' => 'glm-member-db', 'glmTextSearch' => 'glm-member-db', 'adminSearch' => 'glm-member-db', + 'memberEdit' => 'glm-member-db', ), 'manageDashboard' => array( 'members' => 'glm-member-db', diff --git a/views/admin/manageDashboard/index.html b/views/admin/manageDashboard/index.html index acb2c10c..52f483f5 100644 --- a/views/admin/manageDashboard/index.html +++ b/views/admin/manageDashboard/index.html @@ -16,38 +16,67 @@
- {/if} -{include file='admin/footer.html'} - +{include file='admin/footer.html'} \ No newline at end of file -- 2.17.1