From: Anthony Talarico Date: Mon, 29 Feb 2016 18:24:50 +0000 (-0500) Subject: added categories tab, adjusting actions, added table structure to main events page X-Git-Tag: v1.0.0^2~170^2~4^2~2^2~5 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=c1f059034e2d320cffd9c29f508f6d4d4bb9603c;p=WP-Plugins%2Fglm-member-db-events.git added categories tab, adjusting actions, added table structure to main events page --- diff --git a/css/admin.css b/css/admin.css index bb6ebce..6c69553 100644 --- a/css/admin.css +++ b/css/admin.css @@ -9,12 +9,12 @@ and open the template in the editor. */ -#dateTimeLink, #location, #cost, #admin{ +#dateTimeLink, #location, #cost, #admin, #eventAdmin{ background: grey; color: lawngreen; display: block; } - #locationDetails, #costDetails, #adminDetails{ + #locationDetails, #costDetails, #adminDetails, #eventAdminDetails{ display: none; } #startTime, #startDate,#endDate, #endTime{ diff --git a/js/admin.js b/js/admin.js index f9e21ed..4ae8d41 100644 --- a/js/admin.js +++ b/js/admin.js @@ -5,7 +5,7 @@ */ jQuery(document).ready( function () { jQuery("#startDate, #endDate").datepicker(); - jQuery('#dateTimeLink, #location, #cost, #admin').click(function(e) { + jQuery('#dateTimeLink, #location, #cost, #admin, #eventAdmin').click(function(e) { e.preventDefault(); return false; }); @@ -38,5 +38,12 @@ jQuery(document).ready( function () { jQuery("#adminDetails").slideUp(600) ; } }); + jQuery("#eventAdmin").click( function (){ + if(jQuery("#eventAdminDetails").css("display") == "none"){ + jQuery("#eventAdminDetails").slideDown(600) ; + } else { + jQuery("#eventAdminDetails").slideUp(600) ; + } + }); }); diff --git a/models/admin/member/add.php b/models/admin/member/add.php new file mode 100644 index 0000000..ec7a5c8 --- /dev/null +++ b/models/admin/member/add.php @@ -0,0 +1,180 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +// Load Contacts data abstract +require_once(GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEvents.php'); + +class GlmMembersAdmin_member_add extends GlmDataEvents +{ + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Contact Info + * + * @var $contactInfo + * @access public + */ + public $contactInfo = false; + /** + * Member ID + * + * @var $memberID + * @access public + */ + public $memberID = false; + /** + * Contact ID + * + * @var $contactID + * @access public + */ + public $contactID = false; + + + /* + * 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 Contacts 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($actionData = false) + { + + $displayData = 'This is the Events "Members" "Events" model talking to you from inside WordPress.'; + + // Get the Member ID + $memberID = 0; + if (isset($_REQUEST['member']) && ($_REQUEST['member']-0) > 0) { + $memberID = $_REQUEST['member'] - 0; + } + if ($memberID == 0) { + // There should have been a member ID - So failure + return array( + 'status' => false, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => false + ); + + } + $option = $_REQUEST['option']; + + $eventFields = array_filter($_REQUEST, function($k) { + return preg_match('/^events_/',$k); + }, ARRAY_FILTER_USE_KEY); + +// echo "
EventsArray:"; + foreach($eventFields as $key=>$value) { +// echo(""); + $formFields[] = $value; + } +// echo "
$key$value

"; + + // Get field names for each column + $dbFields = " + SELECT column_name + FROM information_schema.columns + WHERE table_name = '" .GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events' + AND table_schema = 'worddb' + ;"; + $alldbFields = $this->wpdb->get_results($dbFields, ARRAY_A); + + // Store field names in an array for later use + foreach($alldbFields as $key=>$value){ + $field[] = $value['column_name']; + } + if($option == 'submit'){ + if (isset($_REQUEST['events_name'])) { + $title = trim(filter_var($_REQUEST['events_name'],FILTER_SANITIZE_STRING)); + } + + // sql query + $sql = " + INSERT INTO ". GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events + (id,name) + VALUES (" . "'$memberID '". "," . "'$title '". ") + ;"; + $this->wpdb->query($sql); + } + $templateData = array( + 'displayData' => $displayData, + 'haveMember' => $haveMember, + 'memberID' => $memberID, + 'option' => $option + ); + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'admin/member/add.html', + 'data' => $templateData + ); + + } + + +} diff --git a/models/admin/member/categories.php b/models/admin/member/categories.php new file mode 100644 index 0000000..8f83837 --- /dev/null +++ b/models/admin/member/categories.php @@ -0,0 +1,169 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +// Load Contacts data abstract +require_once(GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEvents.php'); + +class GlmMembersAdmin_member_categories extends GlmDataEvents +{ + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Contact Info + * + * @var $contactInfo + * @access public + */ + public $contactInfo = false; + /** + * Member ID + * + * @var $memberID + * @access public + */ + public $memberID = false; + /** + * Contact ID + * + * @var $contactID + * @access public + */ + public $contactID = false; + + + /* + * 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 Contacts 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($actionData = false) + { + + $displayData = 'This is the Events "Members" "Events" model talking to you from inside WordPress.'; + + // Get the Member ID + $memberID = 0; + if (isset($_REQUEST['member']) && ($_REQUEST['member']-0) > 0) { + $memberID = $_REQUEST['member'] - 0; + } + if ($memberID == 0) { + // There should have been a member ID - So failure + return array( + 'status' => false, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => false + ); + + } + $option = $_REQUEST['option']; + echo $memberID; + echo "
Request:"; + foreach($_REQUEST as $key=>$value) { + echo(""); + } + echo "
$key$value
"; + $socialarray = array_filter($_REQUEST, function($k) { + return preg_match('/^events_/',$k); + }, ARRAY_FILTER_USE_KEY); + echo "
EventsArray:"; + echo "
";print_r($socialarray,true);echo "
"; + foreach($socialarray as $key=>$value) { + echo(""); + } + echo "
$key$value

"; + if($option == 'submit'){ + if (isset($_REQUEST['title'])) { + $title = trim(filter_var($_REQUEST['title'],FILTER_SANITIZE_STRING)); + } +// $sql = " +// INSERT INTO ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events +// (id,name) +// VALUES ('3', '" . $title . "') +// ;";query($sql); +// +// $this->wpdb->query($sql); + } + $templateData = array( + 'displayData' => $displayData, + 'haveMember' => $haveMember, + 'memberID' => $memberID, + 'option' => $option + ); + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'admin/member/categories.html', + 'data' => $templateData + ); + + } + + +} diff --git a/models/admin/member/events.php b/models/admin/member/events.php index f27ef43..9f82e35 100644 --- a/models/admin/member/events.php +++ b/models/admin/member/events.php @@ -14,9 +14,9 @@ */ // Load Contacts data abstract -//require_once(GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php'); +require_once(GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEvents.php'); -class GlmMembersAdmin_member_events // extends GlmDataContacts +class GlmMembersAdmin_member_events extends GlmDataEvents { /** * WordPress Database Object @@ -105,11 +105,57 @@ class GlmMembersAdmin_member_events // extends GlmDataContacts $displayData = 'This is the Events "Members" "Events" model talking to you from inside WordPress.'; - // Compile template data + // Get the Member ID + $memberID = 0; + if (isset($_REQUEST['member']) && ($_REQUEST['member']-0) > 0) { + $memberID = $_REQUEST['member'] - 0; + } + if ($memberID == 0) { + // There should have been a member ID - So failure + return array( + 'status' => false, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => false + ); + + } + + $option = $_REQUEST['option']; + echo $memberID; + echo "
Request:"; + foreach($_REQUEST as $key=>$value) { + echo(""); + } + echo "
$key$value
"; + $socialarray = array_filter($_REQUEST, function($k) { + return preg_match('/^events_/',$k); + }, ARRAY_FILTER_USE_KEY); + echo "
EventsArray:"; + echo "
";print_r($socialarray,true);echo "
"; + foreach($socialarray as $key=>$value) { + echo(""); + } + echo "
$key$value

"; + if($option == 'submit'){ + if (isset($_REQUEST['title'])) { + $title = trim(filter_var($_REQUEST['title'],FILTER_SANITIZE_STRING)); + } +// $sql = " +// INSERT INTO ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events +// (id,name) +// VALUES ('3', '" . $title . "') +// ;"; + + $this->wpdb->query($sql); + } $templateData = array( - 'displayData' => $displayData + 'displayData' => $displayData, + 'haveMember' => $haveMember, + 'memberID' => $memberID, + 'option' => $option ); - // Return status, any suggested view, and any data to controller return array( 'status' => true, @@ -117,6 +163,7 @@ class GlmMembersAdmin_member_events // extends GlmDataContacts 'view' => 'admin/member/events.html', 'data' => $templateData ); + } diff --git a/setup/validActions.php b/setup/validActions.php index 50b75f0..2419db7 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -36,6 +36,8 @@ $glmMembersEventsAddOnValidActions = array( 'event'=> GLM_MEMBERS_EVENTS_PLUGIN_SLUG, 'member' => array( 'events' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, + 'add' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, + 'categories' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, ), 'events' => array( 'index' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, diff --git a/views/admin/error/index.html b/views/admin/error/index.html new file mode 100644 index 0000000..c627c24 --- /dev/null +++ b/views/admin/error/index.html @@ -0,0 +1,16 @@ + + + + + TODO supply a title + + + + +
TODO write content
+ + diff --git a/views/admin/events/add.html b/views/admin/events/add.html index 2a39099..f8ac4d3 100644 --- a/views/admin/events/add.html +++ b/views/admin/events/add.html @@ -1,57 +1,89 @@ {include file='admin/events/header.html'} - - Date and Time +
{$memberID}
+ Event Details
-
- All Day
- No End Time
- Start Date - - Start Time - - End Date - - End Time - - Repeating
- Exclude
- Time Zone - -
+
+

Event Name

+ + +

All Day

+ +

Active?

+ + +

Start Date

+ +

End Date

+ +

Start Time

+ +

End Time

+ +

Recurring

+ +
Location Details
- - Venue Name - - Address - + +

Hide Event Address

+ +

Place

+ +

Address

+ +

City

+ +

State

+ +

ZIP Code

+ - +
Cost and tickets
-
- Cost - - Free event
- Url - -
+ +

Cost

+ +

Free Event

+ +

Website

+ +
- Admin Contact Info + Event Contact Information
-
- Contact Name + +

Contact Name

+ +

Contact Phone

+ +

Contact Email

+ + +
+ Event Admin Information +
+ +

Contact Name Submitting Event

- Contact Phone - - Contact Email - - Contact Website - - +

Organization Name Submitting Event

+ +

Contact Phone

+ +

Contact Email

+ +

Notes

+ + +
+ + + diff --git a/views/admin/events/header.html b/views/admin/events/header.html index 27b3a1c..b400e92 100644 --- a/views/admin/events/header.html +++ b/views/admin/events/header.html @@ -1,11 +1,8 @@ -
-

All Members

+
+ \ No newline at end of file diff --git a/views/admin/member/add.html b/views/admin/member/add.html new file mode 100644 index 0000000..a7167b8 --- /dev/null +++ b/views/admin/member/add.html @@ -0,0 +1,91 @@ + + +{include file='admin/events/header.html'} + + Event Details +
+
+

Event Name

+ + +

All Day

+ +

Active?

+ + +

Start Date

+ +

End Date

+ +

Start Time

+ +

End Time

+ +

Recurring

+ + +
+ Location Details +
+ +

Hide Event Address

+ +

Place

+ +

Address

+ +

City

+ +

State

+ +

ZIP Code

+ + + +
+ Cost and tickets +
+ +

Cost

+ +

Free Event

+ +

Website

+ + +
+ Event Contact Information +
+ +

Contact Name

+ +

Contact Phone

+ +

Contact Email

+ + +
+ Event Admin Information +
+ +

Contact Name Submitting Event

+ +

Organization Name Submitting Event

+ +

Contact Phone

+ +

Contact Email

+ +

Notes

+ + + +
+ + + + + + diff --git a/views/admin/member/categories.html b/views/admin/member/categories.html new file mode 100644 index 0000000..3a404ff --- /dev/null +++ b/views/admin/member/categories.html @@ -0,0 +1,8 @@ +{include file='admin/events/header.html'} + + + + + +
TODO write content
+ diff --git a/views/admin/member/events.html b/views/admin/member/events.html index 53fcb2d..9939a4e 100644 --- a/views/admin/member/events.html +++ b/views/admin/member/events.html @@ -1,21 +1,24 @@ - - - - - TODO supply a title - - - - -
TODO write content
-
- - - -
Update
- - +{include file='admin/members/header.html'} + + +

Events

+ + + + + + + + + + + + + + + +
Event TitleCategoryTimesDaysStart DateEnd Date