From 8fa8cca94c36279f5b74624738150778e7be15e8 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Thu, 8 Mar 2018 08:59:49 -0500 Subject: [PATCH] Most of Asset Mgt admin dashboard coming up. --- models/admin/ajax/assetManagement.php | 108 ++++++++++++++++++++++++++ models/admin/assets/index.php | 13 +++- 2 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 models/admin/ajax/assetManagement.php diff --git a/models/admin/ajax/assetManagement.php b/models/admin/ajax/assetManagement.php new file mode 100644 index 0000000..3fa6dec --- /dev/null +++ b/models/admin/ajax/assetManagement.php @@ -0,0 +1,108 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +/* + * This class performs the work of handling images passed to it via + * an AJAX call that goes through the WorPress AJAX Handler. + * + */ +class GlmMembersAdmin_ajax_assetManagement +{ + + /** + * 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; + + } + + /* + * 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(); + * + * + */ + public function modelAction ($actionData = false) + { + +ini_set('log_errors_max_len', 20000); +trigger_error(print_r($_REQUEST,1),E_USER_NOTICE); + + require_once GLM_MEMBERS_ASSETS_PLUGIN_CLASS_PATH.'/data/dataFacilities.php'; + $Facilities = new GlmDataAssetsFacilities($this->wpdb, $this->config); + + if (!isset($_REQUEST) || !isset($_REQUEST['option'])) { + die('No option specified.'); + } + + switch($_REQUEST['option']) { + + case 'addNewFacility': + + $newFacility = $Facilities->insertEntry(); + + if (!is_array($newFacility) || trim($newFacility['fieldData']['id']) == '') { + $newFacility['status'] = 0; + } + + $response = json_encode($newFacility, JSON_FORCE_OBJECT); + die($response); + + break; + + default: + die('No valid option provided'); + break; + } +die('done'); + + + die('Nothing Here'); + + } + +} diff --git a/models/admin/assets/index.php b/models/admin/assets/index.php index 6e7c53f..9cc35f0 100644 --- a/models/admin/assets/index.php +++ b/models/admin/assets/index.php @@ -87,9 +87,20 @@ class GlmMembersAdmin_assets_index extends GlmDataAssetsFacilities $haveFacilities = true; } + // Get cities list + require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php'; + $Cities = new GlmDataCities($this->wpdb, $this->config); + $cities = $Cities->getList(); + + +//echo "
".print_r($this->config,1)."
"; + // Compile template data $templateData = array( - 'haveFacilities' => $haveFacilities + 'haveFacilities' => $haveFacilities, + 'cities' => $cities, + 'states' => $this->config['states'], + 'countries' => $this->config['countries'] ); // Return status, any suggested view, and any data to controller -- 2.17.1