From 86dff5e76578a1dec15bc406a9eca48f5a06e9db Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Thu, 25 Feb 2016 15:50:51 -0500 Subject: [PATCH] added css style or add fields, added event tabs for member, created event menu under Members with tabs --- activate.php | 9 ++ classes/data/dataCategories.php | 2 +- css/admin.css | 31 +++++ js/admin.js | 42 ++++++ models/admin/events/add.php | 127 ++++++++++++++++++ models/admin/events/categories.php | 125 +++++++++++++++++ models/admin/events/index.php | 32 +++++ .../{info/index.php => member/events.php} | 8 +- models/admin/members/events.php | 1 - setup/adminMenus.php | 33 +++-- setup/adminTabs.php | 49 ++++++- setup/validActions.php | 9 +- views/admin/events/add.html | 57 ++++++++ views/admin/events/categories.html | 16 +++ views/admin/events/header.html | 11 ++ views/admin/events/index.html | 1 + views/admin/events/more.html | 6 - views/admin/info/index.html | 6 - views/admin/member/events.html | 21 +++ views/admin/members/events.html | 22 ++- 20 files changed, 563 insertions(+), 45 deletions(-) create mode 100644 css/admin.css create mode 100644 js/admin.js create mode 100644 models/admin/events/add.php create mode 100644 models/admin/events/categories.php rename models/admin/{info/index.php => member/events.php} (92%) create mode 100644 views/admin/events/add.html create mode 100644 views/admin/events/categories.html create mode 100644 views/admin/events/header.html delete mode 100644 views/admin/events/more.html delete mode 100644 views/admin/info/index.html create mode 100644 views/admin/member/events.html diff --git a/activate.php b/activate.php index 00cd105..97ac9a9 100644 --- a/activate.php +++ b/activate.php @@ -84,6 +84,15 @@ class glmMembersEventsPluginActivate // Set Roles and Capabilities for this plugin require_once(GLM_MEMBERS_EVENTS_PLUGIN_SETUP_PATH.'/rolesAndCapabilities.php'); + wp_enqueue_script('jquery'); + wp_enqueue_script('jquery-style'); + wp_enqueue_script('jquery-ui-core'); + wp_enqueue_script('jquery-ui-dialog'); + wp_enqueue_script('jquery-ui-autocomplete'); + + // Jquery DatePicker + wp_enqueue_script('jquery-ui-datepicker'); + wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css'); } /* diff --git a/classes/data/dataCategories.php b/classes/data/dataCategories.php index d81cdf7..c39ce72 100644 --- a/classes/data/dataCategories.php +++ b/classes/data/dataCategories.php @@ -176,7 +176,7 @@ class GlmDataEventsCategories extends GlmDataAbstract { return $r; } - + } ?> diff --git a/css/admin.css b/css/admin.css new file mode 100644 index 0000000..bb6ebce --- /dev/null +++ b/css/admin.css @@ -0,0 +1,31 @@ +/* +To change this license header, choose License Headers in Project Properties. +To change this template file, choose Tools | Templates +and open the template in the editor. +*/ +/* + Created on : 15-Feb-2016, 1:53:23 PM + Author : anthony +*/ + + +#dateTimeLink, #location, #cost, #admin{ + background: grey; + color: lawngreen; + display: block; +} + #locationDetails, #costDetails, #adminDetails{ + display: none; +} +#startTime, #startDate,#endDate, #endTime{ + width: 15%; +} +//#endDate, #endTime{ +// width: 15%; +//} +#timeZone{ + width: 25%; +} +.titles{ + +} \ No newline at end of file diff --git a/js/admin.js b/js/admin.js new file mode 100644 index 0000000..f9e21ed --- /dev/null +++ b/js/admin.js @@ -0,0 +1,42 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +jQuery(document).ready( function () { + jQuery("#startDate, #endDate").datepicker(); + jQuery('#dateTimeLink, #location, #cost, #admin').click(function(e) { + e.preventDefault(); + return false; + }); + + jQuery("#dateTimeLink").click( function (){ + if(jQuery("#dateTime").css("display") == "none"){ + jQuery("#dateTime").slideDown(600) ; + } else { + jQuery("#dateTime").slideUp(600) ; + } + }); + jQuery("#location").click( function (){ + if(jQuery("#locationDetails").css("display") == "none"){ + jQuery("#locationDetails").slideDown(600) ; + } else { + jQuery("#locationDetails").slideUp(600) ; + } + }); + jQuery("#cost").click( function (){ + if(jQuery("#costDetails").css("display") == "none"){ + jQuery("#costDetails").slideDown(600) ; + } else { + jQuery("#costDetails").slideUp(600) ; + } + }); + jQuery("#admin").click( function (){ + if(jQuery("#adminDetails").css("display") == "none"){ + jQuery("#adminDetails").slideDown(600) ; + } else { + jQuery("#adminDetails").slideUp(600) ; + } + }); +}); + diff --git a/models/admin/events/add.php b/models/admin/events/add.php new file mode 100644 index 0000000..08a96c8 --- /dev/null +++ b/models/admin/events/add.php @@ -0,0 +1,127 @@ + + * @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_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php'); + +class GlmMembersAdmin_events_add // extends GlmDataContacts +{ + + /** + * 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 = 'Welcome to more information!
This is the Events Add-On "events" model with action "more" talking to you from inside WordPress.'; + + // Compile template data + $templateData = array( + 'displayData' => $displayData + ); + + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'admin/events/add.html', + 'data' => $templateData + ); + + } + + +} + + diff --git a/models/admin/events/categories.php b/models/admin/events/categories.php new file mode 100644 index 0000000..b099cbf --- /dev/null +++ b/models/admin/events/categories.php @@ -0,0 +1,125 @@ + + * @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_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php'); + +class GlmMembersAdmin_events_categories // extends GlmDataContacts +{ + + /** + * 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 = 'Welcome to more information!
This is the Events Add-On "events" model with action "more" talking to you from inside WordPress.'; + + // Compile template data + $templateData = array( + 'displayData' => $displayData + ); + + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'admin/events/categories.html', + 'data' => $templateData + ); + + } + + +} diff --git a/models/admin/events/index.php b/models/admin/events/index.php index 5c43a53..e33a297 100644 --- a/models/admin/events/index.php +++ b/models/admin/events/index.php @@ -118,6 +118,38 @@ class GlmMembersAdmin_events_index // extends GlmDataContacts 'view' => 'admin/events/index.html', 'data' => $templateData ); + + // Check for required Categories + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php'); + $Categories = new GlmDataCategories($this->wpdb, $this->config); + $categoriesStats = $Categories->getStats(); + $haveCategories = ($categoriesStats > 0); + + // Check for required Event Categories + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataEventCategories.php'); + $eventCategories = new GlmDataEventsEventCategories($this->wpdb, $this->config); + $eventCategoriesStats = $eventCategories->getStats(); + $eventHaveCategories = ($eventCategoriesStats > 0); + + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataEvents.php'); + $Events = new GlmDataEvents($this->wpdb, $this->config); + $eventsStats = $Events->getStats(); + $haveEvents = ($eventsStats > 0); + + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataLocations.php'); + $Locations = new GlmDataEventsLocations($this->wpdb, $this->config); + $locationsStats = $Locations->getStats(); + $haveLocations = ($locationsStats > 0); + + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/Recurrences.php'); + $Recurrences = new GlmDataEventsRecurrences($this->wpdb, $this->config); + $recurrencesStats = $Recurrences->getStats(); + $haveRecurrences = ($recurrencesStats > 0); + + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/Times.php'); + $Times = new GlmDataEventsTimes($this->wpdb, $this->config); + $timesStats = $Times->getStats(); + $haveTimes = ($timesStats > 0); } diff --git a/models/admin/info/index.php b/models/admin/member/events.php similarity index 92% rename from models/admin/info/index.php rename to models/admin/member/events.php index 4c61edb..f27ef43 100644 --- a/models/admin/info/index.php +++ b/models/admin/member/events.php @@ -16,9 +16,8 @@ // Load Contacts data abstract //require_once(GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php'); -class GlmMembersAdmin_info_index // extends GlmDataContacts +class GlmMembersAdmin_member_events // extends GlmDataContacts { - /** * WordPress Database Object * @@ -104,7 +103,7 @@ class GlmMembersAdmin_info_index // extends GlmDataContacts public function modelAction($actionData = false) { - $displayData = 'This is the Sample Add-On "Info" model talking to you from inside WordPress.'; + $displayData = 'This is the Events "Members" "Events" model talking to you from inside WordPress.'; // Compile template data $templateData = array( @@ -115,10 +114,9 @@ class GlmMembersAdmin_info_index // extends GlmDataContacts return array( 'status' => true, 'modelRedirect' => false, - 'view' => 'admin/info/index.html', + 'view' => 'admin/member/events.html', 'data' => $templateData ); - } diff --git a/models/admin/members/events.php b/models/admin/members/events.php index 9f69514..b57b1bf 100644 --- a/models/admin/members/events.php +++ b/models/admin/members/events.php @@ -18,7 +18,6 @@ class GlmMembersAdmin_members_events // extends GlmDataContacts { - /** * WordPress Database Object * diff --git a/setup/adminMenus.php b/setup/adminMenus.php index 94e95e1..4749178 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -72,29 +72,36 @@ // Add a main menu item add_menu_page( - 'GLM events', // Page Title - 'GLM events', // Menu Title + 'GLM Events', // Page Title + 'GLM Events', // Menu Title 'glm-members-members', // Capability 'glm-members-admin-menu-events', // Menu Slug function() {$this->controller('events');}, // Called function false, // Icon URL '92' // Menu Position ); - -add_submenu_page( + add_submenu_page( 'glm-members-admin-menu-events', // Parent slug - 'events', // Page title - 'events', // Menu Title + 'Add Event', // Page title + 'Add Event', // Menu Title 'glm_members_members', // Capability required - 'glm-members-admin-menu-events-events', // Menu slug - function() {$this->controller('events');} + 'glm-members-admin-menu-events-add', // Menu slug + function() {$this->controller('add');} +); + add_submenu_page( + 'glm-members-admin-menu-events', // Parent slug + 'Event Categories', // Page title + 'Event Categories', // Menu Title + 'glm_members_members', // Capability required + 'glm-members-admin-menu-events-categories', // Menu slug + function() {$this->controller('categories');} ); add_submenu_page( - 'glm-members-admin-menu-events', // Parent slug - 'Info', // Page title - 'Info', // Menu Title + 'glm-members-admin-menu-members', // Parent slug + 'Events', // Page title + 'Events', // Menu Title 'glm_members_members', // Capability required - 'glm-members-admin-menu-events-info', // Menu slug - function() {$this->controller('info');} + 'glm-members-admin-menu-members-events', // Menu slug + function() {$this->controller('events');} ); diff --git a/setup/adminTabs.php b/setup/adminTabs.php index e3cb1a7..e90461d 100644 --- a/setup/adminTabs.php +++ b/setup/adminTabs.php @@ -33,17 +33,60 @@ * */ -add_filter('glm-member-db-add-tab-for-members', +//add_filter('glm-member-db-add-tab-for-members', +// function($addOnTabs) { +// $newTabs = array( +// array( +// 'text' => 'Events', +// 'menu' => 'members', +// 'action' => 'events' +// ), +// ); +// $addOnTabs = array_merge($addOnTabs, $newTabs); +// return $addOnTabs; +// } +//); +add_filter('glm-member-db-add-tab-for-member', function($addOnTabs) { $newTabs = array( array( 'text' => 'Events', - 'menu' => 'members', + 'menu' => 'member', 'action' => 'events' - ) + ), + ); $addOnTabs = array_merge($addOnTabs, $newTabs); return $addOnTabs; } ); +add_filter('glm-member-db-add-tab-for-events', + function($addOnTabs) { + $newTabs = array( + array( + 'text' => 'Add Event', + 'menu' => 'events', + 'action' => 'add' + ), + + ); + $addOnTabs = array_merge($addOnTabs, $newTabs); + return $addOnTabs; + } +); + +add_filter('glm-member-db-add-tab-for-events', + function($addOnTabs) { + $newTabs = array( + array( + 'text' => 'Event Categories', + 'menu' => 'events', + 'action' => 'categories' + ), + + ); + $addOnTabs = array_merge($addOnTabs, $newTabs); + return $addOnTabs; + } +); \ No newline at end of file diff --git a/setup/validActions.php b/setup/validActions.php index c3c218d..50b75f0 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -32,16 +32,17 @@ $glmMembersEventsAddOnValidActions = array( 'adminActions' => array( - 'members' => array( + 'members' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, + 'event'=> GLM_MEMBERS_EVENTS_PLUGIN_SLUG, + 'member' => array( 'events' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, ), 'events' => array( 'index' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, 'more' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, + 'add' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, + 'categories' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG ), - 'info' => array( - 'index' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG - ) ), 'frontActions' => array( /* diff --git a/views/admin/events/add.html b/views/admin/events/add.html new file mode 100644 index 0000000..2a39099 --- /dev/null +++ b/views/admin/events/add.html @@ -0,0 +1,57 @@ +{include file='admin/events/header.html'} + + Date and Time +
+
+ All Day
+ No End Time
+ Start Date + + Start Time + + End Date + + End Time + + Repeating
+ Exclude
+ Time Zone + +
+
+ Location Details +
+
+ Venue Name + + Address + + +
+
+ Cost and tickets +
+
+ Cost + + Free event
+ Url + +
+
+ Admin Contact Info +
+
+ Contact Name + + Contact Phone + + Contact Email + + Contact Website + +
+
+ + + diff --git a/views/admin/events/categories.html b/views/admin/events/categories.html new file mode 100644 index 0000000..c627c24 --- /dev/null +++ b/views/admin/events/categories.html @@ -0,0 +1,16 @@ + + + + + TODO supply a title + + + + +
TODO write content
+ + diff --git a/views/admin/events/header.html b/views/admin/events/header.html new file mode 100644 index 0000000..27b3a1c --- /dev/null +++ b/views/admin/events/header.html @@ -0,0 +1,11 @@ +
+

All Members

+ +
+ \ No newline at end of file diff --git a/views/admin/events/index.html b/views/admin/events/index.html index 8523cba..e18433a 100644 --- a/views/admin/events/index.html +++ b/views/admin/events/index.html @@ -1,3 +1,4 @@ +{include file='admin/events/header.html'}

Events Model

diff --git a/views/admin/events/more.html b/views/admin/events/more.html deleted file mode 100644 index 2276047..0000000 --- a/views/admin/events/more.html +++ /dev/null @@ -1,6 +0,0 @@ -
-
-

Events Model - More Information

-

{$displayData}

-
-
diff --git a/views/admin/info/index.html b/views/admin/info/index.html deleted file mode 100644 index eab9b97..0000000 --- a/views/admin/info/index.html +++ /dev/null @@ -1,6 +0,0 @@ -
-
-

Info Sub-menu Model

-

{$displayData}

-
-
\ No newline at end of file diff --git a/views/admin/member/events.html b/views/admin/member/events.html new file mode 100644 index 0000000..53fcb2d --- /dev/null +++ b/views/admin/member/events.html @@ -0,0 +1,21 @@ + + + + + TODO supply a title + + + + +
TODO write content
+
+ + + +
Update
+ + diff --git a/views/admin/members/events.html b/views/admin/members/events.html index c28034c..c627c24 100644 --- a/views/admin/members/events.html +++ b/views/admin/members/events.html @@ -1,6 +1,16 @@ -{include file='admin/members/header.html'} - -

Members Events Tab

-

{$displayData}

- -{include file='admin/footer.html'} + + + + + TODO supply a title + + + + +
TODO write content
+ + -- 2.17.1