From: Steve Sutton Date: Tue, 21 Mar 2017 13:46:17 +0000 (-0400) Subject: Adding ajax return for dropdown and offcanvas X-Git-Tag: v1.0.0^2~21 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=dd6c5b0745a13a38a773eecb57b9a41fd394d3c3;p=WP-Plugins%2Fglm-member-db-apis.git Adding ajax return for dropdown and offcanvas They don't run the do shortcode in time to be used. --- diff --git a/models/admin/ajax/dropdown.php b/models/admin/ajax/dropdown.php new file mode 100644 index 0000000..f63e82b --- /dev/null +++ b/models/admin/ajax/dropdown.php @@ -0,0 +1,90 @@ + + * @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_dropdown +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + + /** + * __construct + * + * @param mixed $wpdb The main Word Press DB Object + * @param mixed $config The main Config + * + * @access public + * @return void + */ + public function __construct($wpdb, $config) + { + $this->wpdb = $wpdb; + $this->config = $config; + + //parent::__construct(false, false); + + } + + /** + * modelAction + * + * @param bool $actionData Action Data passed to the modelAction + * + * @access public + * @return void + */ + public function modelAction($actionData = false) + { + get_template_part( 'parts/top-bar' ); + exit; + } + +} diff --git a/models/admin/ajax/offcanvas.php b/models/admin/ajax/offcanvas.php new file mode 100644 index 0000000..277f8cd --- /dev/null +++ b/models/admin/ajax/offcanvas.php @@ -0,0 +1,90 @@ + + * @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_offcanvas +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + + /** + * __construct + * + * @param mixed $wpdb The main Word Press DB Object + * @param mixed $config The main Config + * + * @access public + * @return void + */ + public function __construct($wpdb, $config) + { + $this->wpdb = $wpdb; + $this->config = $config; + + //parent::__construct(false, false); + + } + + /** + * modelAction + * + * @param bool $actionData Action Data passed to the modelAction + * + * @access public + * @return void + */ + public function modelAction($actionData = false) + { + get_template_part( 'parts/off-canvas-menu' ); + exit; + } + +} diff --git a/models/admin/ajax/schedule.php b/models/admin/ajax/schedule.php index b91f625..659148d 100644 --- a/models/admin/ajax/schedule.php +++ b/models/admin/ajax/schedule.php @@ -92,7 +92,7 @@ class GlmMembersAdmin_ajax_schedule $url = $starlineUrl . 'schedule-' . $_REQUEST['schedule_id'] . '.js'; $curl = curl_init( $url ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); - curl_setopt( $curl, CURLOPT_USERPWD, 'dev55:Glm15Keep!' ); + curl_setopt( $curl, CURLOPT_USERPWD, 'dev55:Glm15Keep!' ); $content = curl_exec( $curl ); curl_close( $curl ); echo $content; diff --git a/setup/validActions.php b/setup/validActions.php index 972d477..dd7ba87 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -60,10 +60,12 @@ $glmMembersApisAddOnValidActions = array( 'adminActions' => array( 'ajax' => array( - 'schedule' => GLM_MEMBERS_APIS_PLUGIN_SLUG, + 'schedule' => GLM_MEMBERS_APIS_PLUGIN_SLUG, + 'dropdown' => GLM_MEMBERS_APIS_PLUGIN_SLUG, + 'offcanvas' => GLM_MEMBERS_APIS_PLUGIN_SLUG, ), 'management' => array( - 'apis' => GLM_MEMBERS_APIS_PLUGIN_SLUG + 'apis' => GLM_MEMBERS_APIS_PLUGIN_SLUG, ), ), 'frontActions' => array(