From: Steve Sutton
Date: Mon, 8 Jan 2018 20:46:42 +0000 (-0500)
Subject: Adding ability to update the attendee from admin attendee list.
X-Git-Tag: v1.0.0^2~74
X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=4c4e79b3d273d0a4c8d6d5fb612b8a51e8c112a3;p=WP-Plugins%2Fglm-member-db-registrations.git
Adding ability to update the attendee from admin attendee list.
Edit attendee shows the custom fields now and it will save out the
attendee (fname,lname) and the custom fields.
---
diff --git a/models/admin/ajax/regAdmin.php b/models/admin/ajax/regAdmin.php
index 7fbc9e7..acb8e45 100644
--- a/models/admin/ajax/regAdmin.php
+++ b/models/admin/ajax/regAdmin.php
@@ -75,7 +75,7 @@ class GlmMembersAdmin_ajax_regAdmin
$collection = filter_var( $_REQUEST['collection'], FILTER_SANITIZE_STRING );
// If not a valid collection, die quietly
- if (!in_array($collection, array('regClasses', 'regRates'))) {
+ if (!in_array($collection, array('regClasses', 'regRates', 'attendee'))) {
$this->failureResponse('Not a valid desitination (collection?).');
}
diff --git a/models/admin/ajax/regAdmin/attendee.php b/models/admin/ajax/regAdmin/attendee.php
new file mode 100644
index 0000000..289532c
--- /dev/null
+++ b/models/admin/ajax/regAdmin/attendee.php
@@ -0,0 +1,140 @@
+
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release regRates.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+// Load Registrations data abstract
+require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRate.php';
+
+class GlmMembersAdmin_registrations_ajax_attendee // extends GlmDataRegistrationsRequestRegistrant
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /**
+ * Constructor
+ *
+ * This contructor performs the work for this model. This model returns
+ * an array containing the following.
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ * @wpdb object WordPress database object
+ *
+ * @return array Array containing status, suggested view, and any data
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ /*
+ * Run constructor for the Registrations data class
+ *
+ * Note, the third parameter is a flag that indicates to the Contacts
+ * data class that it should flag a group of fields as 'view_only'.
+ */
+ // parent::__construct(false, false, true);
+
+ }
+
+ public function modelAction($modelData)
+ {
+
+ trigger_error( print_r( $modelData, true ) );
+
+
+ // Perform specified action
+ switch ($modelData['option']) {
+
+ case 'update':
+
+ $this->wpdb->update(
+ GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request_registrant',
+ array(
+ 'fname' => $modelData['fname'],
+ 'lname' => $modelData['lname'],
+ ),
+ array( 'id' => $modelData['reg_id'] ),
+ '%s',
+ array( '%d' )
+ );
+
+ $registrant = array(
+ 'id' => $modelData['reg_id'],
+ 'fname' => $modelData['fname'],
+ 'lname' => $modelData['lname'],
+ );
+
+ parse_str( $modelData['formData'], $queryParams );
+ // Store the custom field data
+ $_REQUEST = $queryParams;
+
+ // Save the custom field data if custom fields plugin is on
+ apply_filters(
+ 'glm-members-customfields-form-submit',
+ '',
+ 'glm_reg_customfields_reg_event_attendee_' . $modelData['reg_event_id'],
+ $modelData['reg_id'],
+ true
+ );
+
+ echo json_encode( $registrant, JSON_NUMERIC_CHECK );
+ wp_die();
+
+ break;
+
+ default:
+ die(); // should never get here
+ break;
+
+ }
+
+ wp_die();
+
+
+
+ }
+
+
+}
diff --git a/views/admin/registrations/eventRegistrants.html b/views/admin/registrations/eventRegistrants.html
index 58abe0f..6f9562c 100644
--- a/views/admin/registrations/eventRegistrants.html
+++ b/views/admin/registrations/eventRegistrants.html
@@ -45,95 +45,113 @@
- {$terms.reg_term_attendee_cap} ID
+ {$terms.reg_term_attendee_cap} ID
{$terms.reg_term_attendee_cap} Name
Address Line #1
Address Line #2
@@ -173,7 +191,6 @@
{if apply_filters('glm-members-customfields-plugin-active', false)}
Custom Fields
{/if}
-