From c589616df8bdfd702048de1c9f64526037ca7c43 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 7 Jun 2019 10:14:50 -0400 Subject: [PATCH] Setup event detail page to show only the date a recurring event is on. If the event on detail page is a recurring event and the user just click on the list or calendar from a certain date, then only show that date for the event not the entire range of dates. --- models/front/events/baseAction.php | 26 +++++++++--- views/front/events/agenda.html | 2 +- views/front/events/agenda_new.html | 60 ++++++++++++++++---------- views/front/events/detail.html | 68 ++++++++++++++++++------------ 4 files changed, 100 insertions(+), 56 deletions(-) diff --git a/models/front/events/baseAction.php b/models/front/events/baseAction.php index 6974afc..802e4b6 100644 --- a/models/front/events/baseAction.php +++ b/models/front/events/baseAction.php @@ -556,6 +556,7 @@ abstract class GlmMembersFront_events_baseAction extends GlmDataEvents { $this->postAddTimes = true; $this->postAddLocations = true; + $fromDate = false; $event = $this->getEntry( $eventId ); if ( $event['url'] ) { if ( !preg_match( '/^http:|https:/', $event['url'] ) ) { @@ -570,18 +571,29 @@ abstract class GlmMembersFront_events_baseAction extends GlmDataEvents $event['ticket_url'] = 'http://' . $event['ticket_url']; } } - //if ( $event['recurrences'][0]['recurring']['value'] ) { - // $nextDate = $this->getNextDate( $event['id'], $fromDate ); - // $event['dates'] = ( $nextDate ) - // ? strftime( '%b %e, %Y', strtotime( $nextDate ) ) - // : strftime( '%b %e, %Y', strtotime( $event['ending_date'] ) ); - //} else { + if ( isset( $_REQUEST['glm_event_from'] ) ) { + $fromDate = filter_var( + $_REQUEST['glm_event_from'], + FILTER_VALIDATE_REGEXP, + array( + 'options' => array( + 'regexp' => '%[0-9]{4}-[0-9]{2}-[0-9]{2}%' + ) + ) + ); + } + if ( $fromDate && $event['recurrences'][0]['recurring']['value'] ) { + $nextDate = $this->getNextDate( $event['id'], $fromDate ); + $event['dates'] = ( $nextDate ) + ? strftime( '%b %e, %Y', strtotime( $nextDate ) ) + : strftime( '%b %e, %Y', strtotime( $event['ending_date'] ) ); + } else { $event['dates'] = $this->getEventDate( strtotime( $event['starting_date'] ), strtotime( $event['ending_date'] ), 'timestamp' ); - //} + } $event['recurDays'] = $this->getEventRecurDays( $event ).' '; $this->postAddTimes = false; $this->postAddLocations = false; diff --git a/views/front/events/agenda.html b/views/front/events/agenda.html index 75a1310..751652d 100644 --- a/views/front/events/agenda.html +++ b/views/front/events/agenda.html @@ -88,7 +88,7 @@ {if $event.image}{/if} {$event.intro}
- Read More + Read More
diff --git a/views/front/events/agenda_new.html b/views/front/events/agenda_new.html index 3c05997..979604d 100644 --- a/views/front/events/agenda_new.html +++ b/views/front/events/agenda_new.html @@ -58,7 +58,7 @@ {/if} +<<<<<<< HEAD +======= + + {if $settings.agenda_view_more_enabled} +
+ + {if $settings.agenda_view_more_text}{$settings.agenda_view_more_text}{else}Read More{/if} + +
+ {/if} + +>>>>>>> dc38bda... Setup event detail page to show only the date a recurring event is on. {/foreach} {/foreach} diff --git a/views/front/events/detail.html b/views/front/events/detail.html index be2f4e8..38219bb 100755 --- a/views/front/events/detail.html +++ b/views/front/events/detail.html @@ -81,27 +81,43 @@
- {if $rec.recurring.value == 1} Occurring {/if} - - {$eDate} - {if $rec.from_date.date != $rec.to_date.date} - - {$rec.to_date.timestamp|date_format:"%B %e, %Y"} - {else if $rec.specific_dates} - - {$rec.specific_dates|@end|date_format:"%B %e, %Y"} - {/if} + {* + Check if event is recurring and $_REQUEST['glm_event_from'] exists. + If it is then output just the $event.dates. + *} + {if isset( $smarty.request.glm_event_from ) && $rec.recurring.value == 1} + {$event.dates} + {else} + {if $rec.recurring.value == 1} Occurring {/if} + {$eDate} + {if $rec.from_date.date != $rec.to_date.date} + - {$rec.to_date.timestamp|date_format:"%B %e, %Y"} + {else if $rec.specific_dates} + - {$rec.specific_dates|@end|date_format:"%B %e, %Y"} + {/if} + {/if} - {if $rec.day_of_week.names|@count < 7 && $rec.day_of_week.names|@count > 0 } + {* + Check if $_REQUEST['glm_event_from'] exists. + Then don't output anything else for dates. + *} + {if !isset($smarty.request.glm_event_from) && $rec.day_of_week.names|@count < 7 && $rec.day_of_week.names|@count > 0 } - on - {foreach $rec.day_of_week.names as $day} - {if $day == "Thursday"} - {$day|substr:0:4} - {else} - {$day|substr:0:3} - {/if} - {/foreach} + on + {if $rec.week_of_month.names|@count < 5 && $rec.week_of_month.names|@count > 0 } + {foreach $rec.week_of_month.names as $wom} + {$wom} + {/foreach} + {/if} + {foreach $rec.day_of_week.names as $day} + {if $day == "Thursday"} + {$day|substr:0:4} + {else} + {$day|substr:0:3} + {/if} + {/foreach} {/if} @@ -135,18 +151,18 @@ {if $event.hide_address.name == 'No'} {if !$event.use_member_location.value && ($event.locations.name || $event.locations.address)}
- {if $event.locations.name}{$event.locations.name}
{/if} - {if $event.locations.address} {$event.locations.address}
{/if} - {if $event.locations.city.name}{$event.locations.city.name}{/if}{if $event.locations.state.value}, {$event.locations.state.value} {/if} - {if $event.locations.zip} {$event.locations.zip} {/if} - {if $event.locations.phone} {apply_filters('glm_associate_phone_filter', $event.locations.phone)} {/if} + {if $event.locations.name}{$event.locations.name}
{/if} + {if $event.locations.address} {$event.locations.address}
{/if} + {if $event.locations.city.name}{$event.locations.city.name}{/if}{if $event.locations.state.value}, {$event.locations.state.value} {/if} + {if $event.locations.zip} {$event.locations.zip} {/if} + {if $event.locations.phone} {apply_filters('glm_associate_phone_filter', $event.locations.phone)} {/if}
{elseif $event.use_member_location.value || $event.other_ref_dest}
- {if $event.member.member} {$event.member.member}
{/if} - {if $event.member.addr1} {$event.member.addr1}
{/if} - {if $event.member.city}{$event.member.city}{/if}{if $event.member.state.value}, {$event.member.state.value}{/if} - {if $event.member.zip} {$event.member.zip} {/if} + {if $event.member.member} {$event.member.member}
{/if} + {if $event.member.addr1} {$event.member.addr1}
{/if} + {if $event.member.city}{$event.member.city}{/if}{if $event.member.state.value}, {$event.member.state.value}{/if} + {if $event.member.zip} {$event.member.zip} {/if}
{/if} {/if} -- 2.17.1