Most of Asset Mgt admin dashboard coming up.
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 8 Mar 2018 13:59:49 +0000 (08:59 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 8 Mar 2018 13:59:49 +0000 (08:59 -0500)
models/admin/ajax/assetManagement.php [new file with mode: 0644]
models/admin/assets/index.php

diff --git a/models/admin/ajax/assetManagement.php b/models/admin/ajax/assetManagement.php
new file mode 100644 (file)
index 0000000..3fa6dec
--- /dev/null
@@ -0,0 +1,108 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Asset Management - Asset Admin
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @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');
+
+    }
+
+}
index 6e7c53f..9cc35f0 100644 (file)
@@ -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 "<pre>".print_r($this->config,1)."</pre>";
+
         // 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