Added ajax pdfOutput.pdf model for testing.
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 30 Mar 2016 16:37:31 +0000 (12:37 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 30 Mar 2016 16:37:31 +0000 (12:37 -0400)
models/admin/ajax/pdfOutput.php [new file with mode: 0644]
setup/validActions.php

diff --git a/models/admin/ajax/pdfOutput.php b/models/admin/ajax/pdfOutput.php
new file mode 100644 (file)
index 0000000..95ac50c
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * PDF Output by admin-ajax
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+/*
+ * Steve Note...
+ *
+ * You can get to this using the following URL.
+ *
+ *  {host}/wp-admin/admin-ajax.php?action=glm_members_admin_ajax&glm_action=pdfOutput&mystuff=THIS
+ *
+ * You should be able to do this as POST or GET and should be able to add and read additional parameters.
+ * I added a "mystuff" parameter to the URL above and it does output from the code in the
+ * modelAction() function below.
+ *
+ * To add another model under models/admin/ajax all you need to do is create it and add it to the
+ * setup/validActions.php file.
+ *
+ */
+
+// Load Members data abstract
+// require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataImages.php');
+
+/*
+ * 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_pdfOutput // extends GlmDataImages
+{
+
+    /**
+     * 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;
+
+        // Run constructor for members data class
+//        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)
+    {
+        echo "Stuff = ".$_REQUEST['mystuff']."<br>";
+        die();
+    }
+
+
+}
index f3b9208..8a3d354 100644 (file)
@@ -33,7 +33,8 @@
 $glmMembersValidActions = array(
     'adminActions' => array(
         'ajax' => array(
-                'imageUpload' => 'glm-member-db'
+                'imageUpload' => 'glm-member-db',
+                'pdfOutput' => 'glm-member-db'
         ),
         'dashboardWidget' => array(
                 'index' => 'glm-member-db'