From 9035020b30c58c120a4a4d0943fe5dd2328af785 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Tue, 29 Mar 2016 07:44:14 -0400 Subject: [PATCH] added shareThis to detail page, testing ical, add page from client, calender view --- css/front.css | 3 + js/front.js | 9 ++ models/front/events/detail.php | 7 +- models/front/events/export.php | 151 ++++++++++++++++++++++ setup/shortcodes.php | 7 +- setup/validActions.php | 3 +- views/front/events/add.html | 200 ++++++++++++++++++++++++++++++ views/front/events/agenda.html | 1 + views/front/events/export.html | 17 +++ views/front/events/shortCuts.html | 1 + 10 files changed, 396 insertions(+), 3 deletions(-) create mode 100644 models/front/events/export.php create mode 100644 views/front/events/add.html create mode 100644 views/front/events/export.html diff --git a/css/front.css b/css/front.css index 65e590d..f3d73c9 100644 --- a/css/front.css +++ b/css/front.css @@ -112,3 +112,6 @@ height: 22px; background-position: 0px 0px !important; } +#addEventFields{ + display:none; +} \ No newline at end of file diff --git a/js/front.js b/js/front.js index 4a5dfbf..ef814a8 100644 --- a/js/front.js +++ b/js/front.js @@ -18,6 +18,15 @@ var EventFront = { jQuery(".glm-read-more").click(function(){ this.preventDefault(); return false; + }); + jQuery("#addEvent").on("click", function (e){ + e.preventDefault(); + jQuery("#addEventFields").slideToggle('slow'); + jQuery(this).toggleClass('open'); + return false; + + + }); } }; diff --git a/models/front/events/detail.php b/models/front/events/detail.php index 3ecb45d..ce516aa 100644 --- a/models/front/events/detail.php +++ b/models/front/events/detail.php @@ -56,7 +56,6 @@ class GLmMembersFront_events_detail extends GlmMembersFront_events_baseAction WHERE name_slug = '$eventslug'"; $eventId = $this->wpdb->get_var($sql); } - $categories = $this->getCategories(); wp_register_script( 'googlemaps-js', @@ -98,7 +97,10 @@ class GLmMembersFront_events_detail extends GlmMembersFront_events_baseAction $categoryEvents = array(); break; } + + // for shareThis url and title variables in its span tag $permalink = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; + $icsFile = get_permalink(2934); $title = get_the_title(); // Compile template data @@ -110,6 +112,7 @@ class GLmMembersFront_events_detail extends GlmMembersFront_events_baseAction 'event' => $event, 'permalink' => $permalink, 'title' => $title, + 'icsFile' => $icsFile, 'mainImgUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/large/' ); @@ -123,4 +126,6 @@ class GLmMembersFront_events_detail extends GlmMembersFront_events_baseAction 'settings' => $settings ); } + } + diff --git a/models/front/events/export.php b/models/front/events/export.php new file mode 100644 index 0000000..2ae4f01 --- /dev/null +++ b/models/front/events/export.php @@ -0,0 +1,151 @@ + + * @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt} + */ +class GLmMembersFront_events_export extends GlmMembersFront_events_baseAction +{ + /** + * modelAction + * + * @param bool $actionData Action Data passed to the modelAction + * + * @access public + * @return void + */ + + + + public function modelAction($actionData = false) + { + header("Content-Type: text/Calendar"); +header("Content-Disposition: inline; filename=calendar.ics"); + +echo "BEGIN:VCALENDARn"; +echo "PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//ENn"; +echo "VERSION:2.0n"; +echo "METHOD:PUBLISHn"; +echo "X-MS-OLK-FORCEINSPECTOROPEN:TRUEn"; + +echo "BEGIN:VEVENTn"; +echo "CLASS:PUBLICn"; +echo "CREATED:$createdn"; +echo "DESCRIPTION:Description of the Event Goes Heren"; +echo "DTSTAMP:20120715T190000n"; +echo "DTSTART:20120715T190000n"; +echo "DTEND:20120715T210000n"; +echo "LAST-MODIFIED:0101T000000n"; +echo "LOCATION:Location_of_Eventn"; +echo "PRIORITY:5n"; +echo "SEQUENCE:0n"; +echo "SUMMARY;LANGUAGE=en-us:Summary Messagen"; +echo "TRANSP:OPAQUEn"; +echo "UID:$random_numbern"; // UID just needs to be some random number. I used rand() in PHP. +echo "X-MICROSOFT-CDO-BUSYSTATUS:BUSYn"; +echo "X-MICROSOFT-CDO-IMPORTANCE:1n"; +echo "X-MICROSOFT-DISALLOW-COUNTER:FALSEn"; +echo "X-MS-OLK-ALLOWEXTERNCHECK:TRUEn"; +echo "X-MS-OLK-AUTOFILLLOCATION:FALSEn"; +echo "X-MS-OLK-CONFTYPE:0n"; + +//Here is where you set the reminder for the event. +echo "BEGIN:VALARMn"; +echo "TRIGGER:-PT1440Mn"; +echo "ACTION:DISPLAYn"; +echo "DESCRIPTION:Reminder - Reminder Text Goes Heren"; + +echo "END:VALARMn"; +echo "END:VEVENTn"; +echo "END:VCALENDARn"; +// $status = null; +// $action = ''; +// $settings = $event = array(); +// +// if ( isset($_REQUEST['glm_event_from']) ) { +// $fromDate = filter_var($_REQUEST['glm_event_from'], FILTER_SANITIZE_STRING); +// } else { +// $fromDate = date('m/d/Y'); +// } +// $this->dateRange = "start_time >= '{$fromDate}'"; +// +// if ( isset($_REQUEST['eventId']) && $eventId = filter_var($_REQUEST['eventId'], FILTER_VALIDATE_INT)) { +// $search = true; +// $action = 'event-detail'; +// } else { +// $search = true; +// $action = 'event-detail'; +// $eventslug = get_query_var( 'eventslug' ); +// //echo '
$eventslug: ' . print_r($eventslug, true) . '
'; +// $sql = " +// SELECT id +// FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX. "events +// WHERE name_slug = '$eventslug'"; +// $eventId = $this->wpdb->get_var($sql); +// } +// +// $fileName = $eventslug . "ics"; +// +// $categories = $this->getCategories(); +// $eventIcs = $this->getModelEventData($eventId); +// $times = $eventIcs['times']; +// foreach($times as $time){ +// $start = $time['start_time']['timestamp']; +// } +//// echo '
', print_r($eventIcs = $this->getModelEventData($eventId)), '
'; +//// echo '
', print_r($eventIcs['times']), '
'; +// +// // note that we are using "H" instead of "g" because iCalendar's Time format +// // requires 24-hour time (see RFC 5545 section 3.3.12 for info). +// function dateToCal($timestamp) { +// return date('Ymd\THis\Z', $timestamp); +// } +// echo dateToCal($start); +// // Escapes a string of characters +// function escapeString($string) { +// return preg_replace('/([\,;])/','\\\$1', $string); +// } +// +// // for shareThis url and title variables in its span tag +// $permalink = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; +// $title = get_the_title(); +// $templateData = array( +// 'siteBaseUrl' => GLM_MEMBERS_EVENTS_SITE_BASE_URL, +// 'currentUrl' => $_SERVER['HTTP_REFERER'], +// 'categories' => $categories, +// 'fromDate' => $fromDate, +// 'event' => $event, +// 'permalink' => $permalink, +// 'title' => $title, +// 'icsFile' => $icsFile, +// 'mainImgUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/large/' +// ); +// +// error_reporting(E_ALL ^ E_NOTICE); +// return array( +// 'status' => $status, +// 'menuItemRedirect' => false, +// 'modelRedirect' => false, +// 'view' => 'front/events/export.html', +// 'data' => $templateData, +// 'settings' => $settings +// ); + + } +} + + diff --git a/setup/shortcodes.php b/setup/shortcodes.php index 3043323..8faf519 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -113,7 +113,12 @@ $glmMembersEventsShortcodes = array( 'attributes' => array( 'id' => false ) - ) + ), + 'glm-members-event-export' => array( + 'plugin' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, + 'menu' => 'events', + 'action' => 'export' + ) ); $glmMembersEventsShortcodesDescription = ' diff --git a/setup/validActions.php b/setup/validActions.php index f0c382e..620a182 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -49,7 +49,8 @@ $glmMembersEventsAddOnValidActions = array( 'frontActions' => array( 'events' => array( 'list' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, - 'detail' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG + 'detail' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG, + 'export' =>GLM_MEMBERS_EVENTS_PLUGIN_SLUG ) ) ); diff --git a/views/front/events/add.html b/views/front/events/add.html new file mode 100644 index 0000000..998a759 --- /dev/null +++ b/views/front/events/add.html @@ -0,0 +1,200 @@ + +
+
+ + + + + + + + + +{if $haveEvent} + + + + + + + + + + + + + + + + +{/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event Name: + + {if $event.fieldFail.name}

{$event.fieldFail.name}

{/if}
+
Member: + {if $haveMember} + {$memberData.member_name} + {else} + + {/if} +
Name for URLs:{$event.fieldData.name_slug}
Created:{$event.fieldData.created.datetime}
Last Updated:{$event.fieldData.updated.datetime}
Last Approved:{$event.fieldData.approved.datetime}
Status: + + {if $event.fieldFail.status}

{$event.fieldFail.status}

{/if} +
Categories + + + +
Add a new Category
+
+ + + + + + + + + +
Category Name: + +
+
Parent Category: + +
OR
+ +
+

* Required

+ Cancel + +
+ + + +    Select a category to add to box below.
+
+ + {if isset($event.fieldData.categories) && $event.fieldData.categories} + {foreach $event.fieldData.categories as $c} +
+ {if $c.parent_name != ''}{$c.parent_name}: {/if}{$c.name} + X + +
+ {/foreach} + {/if} +
+
Intro Text: + + {if $event.fieldFail.intro}

{$event.fieldFail.intro}

{/if} +
Description: + {php} + wp_editor('{$event.fieldData.descr|escape:quotes}', 'glm_descr', array( + // 'media_buttons' => true, + // 'quicktags' => false, + // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text. + 'textarea_name' => 'descr', + 'editor_height' => 200, // Height in px, overrides editor_rows + // 'textarea_rows' => 8 + )); + {/php} + {if $event.fieldFail.descr}

{$event.fieldFail.descr}

{/if} +
Image: + + {if $event.fieldData.image} + + + + + {/if} + +
+
+ +
+
+ Delete Image
+ {$event.fieldData.image}
+
New image:
+
+ {if $event.fieldFail.image}

{$event.fieldFail.image}

{/if} +
Web Address (URL): + + {if $event.fieldFail.url}

{$event.fieldFail.url}

{/if}
+
Ticketing Address (URL): + + {if $event.fieldFail.ticket_url}

{$event.fieldFail.ticket_url}

{/if}
+
Description of Cost: + + {if $event.fieldFail.cost}

{$event.fieldFail.cost}

{/if}
+
Notes: + + {if $event.fieldFail.notes}

{$event.fieldFail.notes}

{/if} +
+ +
+
diff --git a/views/front/events/agenda.html b/views/front/events/agenda.html index 48f7223..736c33d 100644 --- a/views/front/events/agenda.html +++ b/views/front/events/agenda.html @@ -3,6 +3,7 @@ {include file='front/events/searchForm.html'} {include file='front/events/shortCuts.html'} + {include file='front/events/add.html'}
diff --git a/views/front/events/export.html b/views/front/events/export.html new file mode 100644 index 0000000..2b12d60 --- /dev/null +++ b/views/front/events/export.html @@ -0,0 +1,17 @@ + + + + + TODO supply a title + + + + + Read More +
TODO write content
+ + diff --git a/views/front/events/shortCuts.html b/views/front/events/shortCuts.html index a37abb9..ad3a027 100644 --- a/views/front/events/shortCuts.html +++ b/views/front/events/shortCuts.html @@ -3,6 +3,7 @@
  • Today's Events
  • Tomorrow's Events
  • Next 7 Days
  • +
  • Add an Event
  • -- 2.17.1