--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ *
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Staff Data
+require_once GLM_MEMBERS_STAFF_PLUGIN_CLASS_PATH.'/data/dataStaff.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_staffEmail
+{
+
+ /**
+ * 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);
+
+ }
+
+ /*
+ * AJAX Debugging
+ *
+ */
+ function write_log ( $log ) {
+ if ( true === WP_DEBUG ) {
+ if ( is_array( $log ) || is_object( $log ) ) {
+ error_log( print_r( $log, true ) );
+ } else {
+ error_log( $log );
+ }
+ }
+ }
+ /*
+ * 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)
+ {
+ global $wpdb;
+ $this->write_log("test");
+
+ if( isset($_REQUEST['staff_id'] ) ){
+ $staff_id = filter_var($_REQUEST['staff_id'], FILTER_SANITIZE_STRING);
+
+ $sql = "SELECT email FROM ". GLM_MEMBERS_STAFF_PLUGIN_DB_PREFIX . "staff WHERE id = $staff_id";
+ $staff_email_address = $wpdb->get_results($sql);
+ if( $staff_email_address){
+ $staff_email_address = $staff_email_address[0]->email;
+ }else{
+ $staff_email_address = null;
+ }
+
+ }
+ $return = array(
+ 'email' => $staff_email_address, // Where our events list will go
+ );
+ echo json_encode($return);
+ wp_die();
+ }
+}
</div>
<span class="glm-staff-email">
- <a href="mailto:{$staffVal.email}">{$staffVal.email}</a>
+ <a data-id="{$staffVal.id}" href="#" data-reveal-id="emailModal">Email</a>
</span>
-
</div>
</div>
{/foreach}
Sorry, no staff members found.
{/if}
-</div>
\ No newline at end of file
+</div>
+<div id="emailModal" class="reveal-modal" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
+ <div class="row">
+ <input class="modal-email-field" type="text" id="sender-name">
+ <input class="modal-email-field" type="text" id="sender-email">
+ <input class="modal-email-field" type="text" id="sender-phone">
+ <input class="modal-email-field" type="text" id="email-subject">
+ <textarea rows="5" class="modal-email-field" type="text" id="email-message"></textarea>
+ </div>
+ <a class="close-reveal-modal" aria-label="Close">×</a>
+</div>
+<script>
+ jQuery(function($){
+ $('.glm-staff-email > a').on("click", function(e){
+ let id = $(this).data('id');
+ let data = {
+
+ action: 'glm_members_admin_ajax',
+ glm_action: 'staffEmail',
+ staff_id: id
+ };
+ // $.ajax({
+ // type: 'POST',
+ // url: '{$ajaxUrl}',
+ // data: data,
+ // beforeSend: function(){
+
+ // },
+ // complete: function(){
+
+ // },
+ // cache: false,
+ // success: function (response){
+ // console.log(response)
+ // $("#email-form-root"),
+ // }
+ // })
+ })
+ });
+
+</script>
\ No newline at end of file