--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Members List Export by AJAX
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+
+// Load Member Info data abstract
+require_once GLM_MEMBERS_PLUGIN_PATH.'/models/front/members/list.php';
+define( 'GLM_MEMBER_LIST_AJAX_LOADER', true );
+/**
+ *
+ * This class exports the currently selected members list
+ * to a printable HTML file, to a CSV file, or otherwise.
+ */
+class GlmMembersAdmin_ajax_membersList extends GlmMembersFront_members_list
+{
+
+ /**
+ * 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( $wpdb, $config );
+
+ }
+
+ // public function modelAction( $actionData = false ) {
+ //
+ // if ( isset( $_REQUEST['limit'] ) && filter_var( $_REQUEST['limit'], FILTER_VALIDATE_INT ) ) {
+ // $limit = filter_var( $_REQUEST['limit'], FILTER_VALIDATE_INT );
+ // }
+ //
+ // if ( isset( $_REQUEST['pageSelect'] ) && filter_var( $_REQUEST['pageSelect'], FILTER_SANITIZE_STRING ) ) {
+ // $pageSelect = filter_var( $_REQUEST['pageSelect'], FILTER_SANITIZE_STRING );
+ // }
+ // if ( isset( $_REQUEST['nextStart'] ) && filter_var( $_REQUEST['nextStart'], FILTER_VALIDATE_INT ) ) {
+ // $nextStart = filter_var( $_REQUEST['nextStart'], FILTER_VALIDATE_INT );
+ // }
+ // if ( $_SESSION['search_query'] ) {
+ // // $actionData = $_SESSION['actionData'];
+ // // $_REQUEST = $_SESSION['search_query'];
+ // // $_REQUEST['limit'] = $limit;
+ // // $_REQUEST['pageSelect'] = $pageSelect;
+ // // $_REQUEST['nextStart'] = $nextStart;
+ // }
+ //
+ // return parent::modelAction( $actionData );
+ //
+ // }
+
+}
$start = 1;
$limit = $this->config['settings']['list_pagination_count']; // Now this is in management
+ if ( isset( $_REQUEST['limit'] ) && filter_var( $_REQUEST['limit'], FILTER_VALIDATE_INT ) ) {
+ $limit = filter_var( $_REQUEST['limit'], FILTER_VALIDATE_INT );
+ }
+ if ( isset( $actionData['request']['limit'] ) && filter_var( $actionData['request']['limit'], FILTER_VALIDATE_INT ) ) {
+ $limit = filter_var( $actionData['request']['limit'], FILTER_VALIDATE_INT );
+ }
+
// Check if a multi-select for categories is being submitted. If so, assign that to the category selection
if (isset($_REQUEST['categorySearchMultiple']) && is_array($_REQUEST['categorySearchMultiple'])) {
$actionData['request']['category'] = implode(',', $_REQUEST['categorySearchMultiple']);
if (isset($actionData['request']['view']) && $actionData['request']['view'] != "" ) {
$view = strtolower($actionData['request']['view']);
}
+ if ( isset( $_REQUEST['view'] ) && $_REQUEST['view'] ) {
+ $view = $_REQUEST['view'];
+ }
/*
* Check for a blank start - No members selected, just search form
'', // prohibitListOptions
$appendSelect
);
+ // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
+ // echo '<pre>$where: ' . print_r( $where, true ) . '</pre>';
} else {
// Get member list sorted as specified
switch ($this->config['settings']['list_order_list']) {
$singleCategory = true;
}
+ // Setup ajax Request
+ $ajaxRequest = '';
+ if ( $memberType ) {
+ $ajaxRequest .= "&memberType=$memberType";
+ }
+ if ( $categorySearch ) {
+ $ajaxRequest .= "&categorySearch=$categorySearch";
+ }
+ if ( $citySearch ) {
+ $ajaxRequest .= "&citySearch=$citySearch";
+ }
+ if ( $ajaxRequest ) {
+ $ajaxRequest .= "&ajaxRequest=$ajaxRequest";
+ }
+ if ( $view ) {
+ $ajaxRequest .= "&view=$view";
+ }
+ if ( $blankStart ) {
+ $ajaxRequest .= "&blankStart=$blankStart";
+ }
+ if ( $catSelected ) {
+ $ajaxRequest .= "&catSelected=$catSelected";
+ }
+ if (isset($_REQUEST['textSearch'])) {
+ $ajaxRequest .= "&textSearch=" . urlencode( stripslashes( $textSearch ) );
+ }
+ if ( isset( $actionData['request']['category'] ) ) {
+ $catsRequested = explode( ',', $actionData['request']['category'] );
+ if ( $catsRequested ) {
+ foreach ( $catsRequested as $cats ) {
+ $ajaxRequest .= "&categorySearchMultiple[]=" . $cats;
+ }
+ }
+ // echo '<pre>$catsRequested: ' . print_r( $catsRequested, true ) . '</pre>';
+ }
+
// Compile template data
$templateData = array(
'haveMembers' => $haveMembers,
'start' => $start,
'limit' => $limit,
+ // Add for ajax
+ 'memberType' => $memberType,
+ 'categorySearch' => $categorySearch,
+ 'amenitySearch' => $amenitySearch,
+ 'citySearch' => $citySearch,
+ 'ajaxRequest' => $ajaxRequest,
+
+ 'ajaxLoader' => ( defined( 'GLM_MEMBER_LIST_AJAX_LOADER' ) && GLM_MEMBER_LIST_AJAX_LOADER ) ? true : false,
+ 'ajaxNext' => ( isset( $_REQUEST['ajaxNext'] ) ) ? true : false,
+
);
if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
trigger_error($membListTime." seconds ---", E_USER_NOTICE);
}
+ $viewFile = 'front/members/list.html';
+
+ if ( defined( 'GLM_MEMBER_LIST_AJAX_LOADER' ) && GLM_MEMBER_LIST_AJAX_LOADER ) {
+ $viewFile = 'front/members/listContainer.html';
+ }
+
// Return status, suggested view, and data to controller - also return any modified settings
return array(
'status' => $success,
'menuItemRedirect' => false,
'modelRedirect' => false,
- 'view' => "front/members/list.html",
+ 'view' => $viewFile,
'data' => $templateData,
'settings' => $settings
);