From: Anthony Talarico Date: Fri, 28 Dec 2018 17:34:11 +0000 (-0500) Subject: creating new memberManagement ajax model X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=6927bfa3b692432bc49dfd33b93a704cc9eca47e;p=WP-Plugins%2Fglm-member-db.git creating new memberManagement ajax model --- diff --git a/models/admin/ajax/adminSearch.php b/models/admin/ajax/adminSearch.php index 48adaa6c..add69882 100644 --- a/models/admin/ajax/adminSearch.php +++ b/models/admin/ajax/adminSearch.php @@ -12,13 +12,13 @@ * @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_adminSearch +class GlmMembersAdmin_ajax_adminSearch extends glmMembersAdmin { /** @@ -88,7 +88,8 @@ class GlmMembersAdmin_ajax_adminSearch $limit = 20; $status = $this->config['status_numb']['Active']; - $list = apply_filters('glm-member-db-admin-search', ''); + // $list = apply_filters('glm-member-db-admin-search', ''); + $list = $this->controller( 'manageDashboard', 'members', false, true, true); $return = array( diff --git a/models/admin/ajax/memberEdit.php b/models/admin/ajax/memberEdit.php deleted file mode 100644 index 0a0260c8..00000000 --- a/models/admin/ajax/memberEdit.php +++ /dev/null @@ -1,88 +0,0 @@ - - * @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/ajax/memberManagement.php b/models/admin/ajax/memberManagement.php new file mode 100644 index 00000000..e2a6bcae --- /dev/null +++ b/models/admin/ajax/memberManagement.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_memberManagement 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/setup/validActions.php b/setup/validActions.php index 8b12d5bd..760e1ff9 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -50,7 +50,7 @@ $glmMembersValidActions = array( 'countiesMapData' => 'glm-member-db', 'glmTextSearch' => 'glm-member-db', 'adminSearch' => 'glm-member-db', - 'memberEdit' => 'glm-member-db', + 'memberManagement' => 'glm-member-db', ), 'manageDashboard' => array( 'members' => 'glm-member-db', diff --git a/views/admin/manageDashboard/index.html b/views/admin/manageDashboard/index.html index f7f03fe3..5a5990c4 100644 --- a/views/admin/manageDashboard/index.html +++ b/views/admin/manageDashboard/index.html @@ -200,7 +200,7 @@ $(".edit-screen").html(''); var editData = { action : 'glm_members_admin_ajax', - glm_action : 'memberEdit', + glm_action : 'memberManagement', form_action : 'index', view : "index", option : 'index',