diff --git a/advanced-custom-fields/veranstaltungen.php b/advanced-custom-fields/veranstaltungen.php index 45609b0..01162a2 100644 --- a/advanced-custom-fields/veranstaltungen.php +++ b/advanced-custom-fields/veranstaltungen.php @@ -1,3 +1,4 @@ + __('Datum','quartiersplattform'), 'name' => 'event_date', 'type' => 'date_picker', - 'instructions' => __('Wann wird deine Veranstaltung stattfinden?','quartiersplattform'), + 'instructions' => __('Wann wird deine Veranstaltung stattfinden/beginnen?','quartiersplattform'), 'required' => 1, 'conditional_logic' => 0, 'wrapper' => array( @@ -172,6 +173,50 @@ function cptui_register_my_cpts_veranstaltungen() { 'display_format' => 'H:i', 'return_format' => 'H:i:s', ), + array( + 'key' => 'field_5fc8d1ae96113', + 'label' => __('Enddatum (bei mehrtägigen Veranstaltungen)','quartiersplattform'), + 'name' => 'event_end_date', + 'type' => 'date_picker', + 'instructions' => __('Wann findet die mehrtägige Veranstaltung zuletzt statt?','quartiersplattform'), + 'required' => 0, + 'conditional_logic' => 0, + 'wrapper' => array( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'display_format' => 'F j, Y', + 'return_format' => 'Y-m-d', + 'first_day' => 1, + ), + array( + 'key' => 'field_63137dc0b7174', + 'label' => 'Wiederholung', + 'name' => 'event_frequency', + 'type' => 'select', + 'instructions' => __('In welchem Rhytmus findet die Veranstaltung statt?','quartiersplattform'), + 'required' => 0, + 'conditional_logic' => 0, + 'wrapper' => array( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'choices' => array( + 'täglich' => 'täglich', + 'wöchentlich' => 'wöchentlich', + 'monatlich' => 'monatlich', + 'jährlich' => 'jährlich', + ), + 'default_value' => 'daily', + 'allow_null' => 0, + 'multiple' => 0, + 'ui' => 0, + 'return_format' => 'value', + 'ajax' => 0, + 'placeholder' => '', + ), array( 'key' => 'field_5fc8d1c4d15c8', 'label' => __('Website','quartiersplattform'), @@ -296,5 +341,5 @@ function cptui_register_my_cpts_veranstaltungen() { 'active' => true, 'description' => '', )); - - endif; \ No newline at end of file + + endif; diff --git a/components/calendar/calendar_download.php b/components/calendar/calendar_download.php index 185aaf5..3af9027 100644 --- a/components/calendar/calendar_download.php +++ b/components/calendar/calendar_download.php @@ -4,16 +4,26 @@ $date = get_field('event_date', $post); $time = get_field('event_time', $post); $time_end = get_field('event_end_time', $post); +$date_end = get_field('event_end_date', $post); +$frequenz = get_field('event_frequency',$post); $title = get_the_title(); $start = date('Ymd', strtotime("$date $time")) . "T" . date('His', strtotime("$date $time")); $ende = date('Ymd', strtotime("$date $time")) . "T" . date('His', strtotime("$date $time_end")); -if (empty($ende) || strtotime($start) > strtotime($ende) ) { +if (empty($time_end) || strtotime($start) > strtotime($ende) ) { // one hour after start $ende = date('Ymd', strtotime($start) + (60*60)) . "T" . date('His', strtotime($start) + (60*60)); } +if (!empty($date_end)) { + // Enddatum given + $letzter = date('Ymd', strtotime("$date_end")) . "T" . date('His', strtotime("$ende")); +} +else { + $letzter = $ende; +} + // directory $links = get_template_directory_uri(); $destination_folder = $_SERVER['DOCUMENT_ROOT']; @@ -40,6 +50,21 @@ $kb_start = $start; $kb_end = $ende; + +if($frequenz == 'täglich' ) { + $kb_freq = 'daily'; +} +else if($frequenz == 'wöchentlich' ) { + $kb_freq = 'weekly'; +} +else if($frequenz == 'monatlich' ) { + $kb_freq = 'monthly'; +} +else { + $kb_freq = 'yearly'; +} + +$kb_until = $letzter; $kb_current_time = date("Ymd")."T".date("His"); $kb_title = html_entity_decode($title, ENT_COMPAT, 'UTF-8'); $kb_location = preg_replace('/([\,;])/','\\\$1',$location); @@ -71,7 +96,7 @@ 'DTEND:'.$kb_end.$eol. 'LOCATION:'.$kb_location.$eol. 'DTSTAMP:'.$kb_current_time.$eol. - // 'RRULE:FREQ='.$kb_freq.';UNTIL='.ende_der_widerholung. + 'RRULE:FREQ='.$kb_freq.';UNTIL='.$kb_until.$eol. 'SUMMARY:'.$kb_title.$eol. 'URL;VALUE=URI:'.$kb_url.$eol. 'DESCRIPTION:'.$kb_description.$eol. @@ -84,4 +109,4 @@ ?> - \ No newline at end of file + diff --git a/pages/form-veranstaltungen.php b/pages/form-veranstaltungen.php index ab80d0c..08d1e82 100644 --- a/pages/form-veranstaltungen.php +++ b/pages/form-veranstaltungen.php @@ -66,7 +66,9 @@ 'field_5fc8d0b28edb0', //Text 'field_5fc8d15b8765b', //Date 'field_5fc8d16e8765c', //Start AP1 - 'field_5fc8d18b8765d', //End AP1 + 'field_5fc8d18b8765d', //End AP1 + 'field_5fc8d1ae96113', //EndDate + 'field_63137dc0b7174', //Frequenz 'field_5fc8d1e0d15c9', //Livestream 'field_5fc8d1f4d15ca', //Ticket 'field_5fc8d1c4d15c8', //Website @@ -86,4 +88,4 @@ - \ No newline at end of file + diff --git a/pages/single-veranstaltungen.php b/pages/single-veranstaltungen.php index 5706026..2a33727 100644 --- a/pages/single-veranstaltungen.php +++ b/pages/single-veranstaltungen.php @@ -56,7 +56,7 @@ // get project by Term ?>

-
+

@@ -197,7 +197,9 @@ 'field_5fc8d0b28edb0', //Text 'field_5fc8d15b8765b', //Date 'field_5fc8d16e8765c', //Start - 'field_5fc8d18b8765d', //End + 'field_5fc8d18b8765d', //End + 'field_5fc8d1ae96113', //EndDate + 'field_63137dc0b7174', //Frequenz 'field_5fc8d1e0d15c9', //Livestream 'field_5fc8d1f4d15ca', //Ticket 'field_5fc8d1c4d15c8', //Website @@ -271,4 +273,4 @@ - \ No newline at end of file +