From: Steve Sutton Date: Thu, 25 Feb 2016 14:16:42 +0000 (-0500) Subject: Setting up shortcode for the front end X-Git-Tag: v1.0.0^2~191 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=d12060a55a147dab280a7ef5b0a7bf8bff156a7c;p=WP-Plugins%2Fglm-member-db-events.git Setting up shortcode for the front end Setting up the shortcode for front end with action for detail and list views. current shortcode used is only the list one. --- diff --git a/models/front/events/list.php b/models/front/events/list.php new file mode 100644 index 0000000..75ac343 --- /dev/null +++ b/models/front/events/list.php @@ -0,0 +1,107 @@ +wpdb = $wpdb; + $this->config = $config; + + parent::__construct(false, false); + } + + public function modelAction($actionData = false) + { + $action = ''; + $settings = $events = $event = array(); + if ($eventId = filter_var($_REQUEST['eventId'], FILTER_VALIDATE_INT)) { + $search = true; + $action = 'event-detail'; + } + if ($search = filter_var($_REQUEST['search'], FILTER_VALIDATE_INT)) { + $search = true; + $action = 'event-list'; + } + + switch ($action) { + case 'event-detail': + $eventData = array( + 'title' => 'Owr Prowl: Barred Owls', + 'starting' => '02/25/2016', + 'ending' => '02/25/2016', + 'description' => '

Test event description text here!

', + 'category' => 'Outdoor/Nature' + ); + break; + case 'event-list': + $events = array( + array( + 'title' => 'Owr Prowl: Barred Owls', + 'starting' => '02/25/2016', + 'ending' => '02/25/2016', + 'description' => '

Test event description text here!

', + 'category' => 'Outdoor/Nature' + ), + array( + 'title' => 'Owls of Michigan', + 'starting' => '02/28/2016', + 'ending' => '02/28/2016', + 'description' => '

Test event description text here!

', + 'category' => 'Outdoor/Nature' + ), + array( + 'title' => 'Bird Sanctuary Resource Center Re-Opening', + 'starting' => '02/29/2016', + 'ending' => '02/29/2016', + 'description' => '

Test event description text here!

', + 'category' => 'Outdoor/Nature' + ), + array( + 'title' => 'Lead Day Hike', + 'starting' => '02/29/2016', + 'ending' => '02/29/2016', + 'description' => '

Test event description text here!

', + 'category' => 'Outdoor/Nature' + ), + array( + 'title' => 'Project Snowstorm: Snowy Owls in Michigan', + 'starting' => '03/01/2016', + 'ending' => '03/01/2016', + 'description' => '

Test event description text here!

', + 'category' => 'Outdoor/Nature' + ), + ); + $view = 'list.html'; + break; + default: + + $view = 'dashboard.html'; + break; + } + + + + // Compile template data + $templateData = array( + 'siteBaseUrl' => GLM_MEMBERS_SITE_BASE_URL, + 'events' => $events, + 'event' => $event + ); + + return array( + 'status' => $status, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => 'front/events/' . $view, + 'data' => $templateData, + 'settings' => $settings + ); + } +} diff --git a/setup/shortcodes.php b/setup/shortcodes.php index c4c5d79..9c23395 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -93,7 +93,36 @@ */ $glmMembersEventsShortcodes = array( + 'glm-members-event-list' => array( + 'plugin' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, + 'menu' => 'events', + 'action' => 'list', + 'table' => false, + 'attributes' => array( + 'type' => 'all', + 'order' => 'title', + 'member' => false, + 'template' => false + ) + ), + 'glm-members-event-detail' => array( + 'plugin' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, + 'menu' => 'events', + 'action' => 'detail', + 'table' => false, + 'attributes' => array( + 'id' => false + ) + ) ); -$glmMembersEventsShortcodesDescription = ''; +$glmMembersEventsShortcodesDescription = ' + + [glm-members-event-list] +   + + Displays a list of events. + + + '; diff --git a/setup/validActions.php b/setup/validActions.php index c3c218d..e5ab238 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -44,12 +44,10 @@ $glmMembersEventsAddOnValidActions = array( ) ), 'frontActions' => array( -/* 'events' => array( 'list' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, 'detail' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG ) -*/ ) ); diff --git a/views/front/events/dashboard.html b/views/front/events/dashboard.html new file mode 100644 index 0000000..0dcead7 --- /dev/null +++ b/views/front/events/dashboard.html @@ -0,0 +1,41 @@ +

Dashboard

+
+
+ {include file='front/events/searchForm.html'} +
+
+ {include file='front/events/shortCuts.html'} +
+
+
+
+
    +
  • Arts & Crafts
  • +
  • Event title and date
  • +
+
+
+
    +
  • Arts/Cultural Events
  • +
  • Event title and date
  • +
+
+
+
    +
  • Beer/Wine Focus
  • +
  • Event title and date
  • +
+
+
+
    +
  • Concert/Live Music
  • +
  • Event title and date
  • +
+
+
+
    +
  • Educational
  • +
  • Event title and date
  • +
+
+
diff --git a/views/front/events/list.html b/views/front/events/list.html new file mode 100644 index 0000000..2e6a83f --- /dev/null +++ b/views/front/events/list.html @@ -0,0 +1,23 @@ +

Event List

+
+
+ {include file='front/events/searchForm.html'} +
+
+ {include file='front/events/shortCuts.html'} +
+
+
+ {foreach $events as $event} +
+
+
{$event.starting}
+
+ {$event.category}
+ {$event.title} +
+
+
+
+ {/foreach} +
diff --git a/views/front/events/searchForm.html b/views/front/events/searchForm.html new file mode 100644 index 0000000..09526b0 --- /dev/null +++ b/views/front/events/searchForm.html @@ -0,0 +1,43 @@ +

Find An Event

+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
diff --git a/views/front/events/shortCuts.html b/views/front/events/shortCuts.html new file mode 100644 index 0000000..08d4ab9 --- /dev/null +++ b/views/front/events/shortCuts.html @@ -0,0 +1,7 @@ +

Shortcuts

+ +