From: Chuck Scott Date: Wed, 30 Mar 2016 16:37:31 +0000 (-0400) Subject: Added ajax pdfOutput.pdf model for testing. X-Git-Tag: v2.0.0^2~46 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=e987ee0d25241a8c8503f7d06d464cbe495029bf;p=WP-Plugins%2Fglm-member-db.git Added ajax pdfOutput.pdf model for testing. --- diff --git a/models/admin/ajax/pdfOutput.php b/models/admin/ajax/pdfOutput.php new file mode 100644 index 00000000..95ac50c2 --- /dev/null +++ b/models/admin/ajax/pdfOutput.php @@ -0,0 +1,100 @@ + + * @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']."
"; + die(); + } + + +} diff --git a/setup/validActions.php b/setup/validActions.php index f3b9208c..8a3d3544 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -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'