diff --git a/advanced-custom-fields/veranstaltungen.php b/advanced-custom-fields/veranstaltungen.php index 45609b0..09b435f 100644 --- a/advanced-custom-fields/veranstaltungen.php +++ b/advanced-custom-fields/veranstaltungen.php @@ -107,7 +107,11 @@ function cptui_register_my_cpts_veranstaltungen() { 'key' => 'field_5fc8d0b28edb0', 'label' => __('Beschreibung','quartiersplattform'), 'name' => 'text', - 'type' => 'textarea', + 'type' => 'textarea', // 'wysiwyg' + // 'tabs' => 'visual', // 'visual' || 'text' || 'all' + // 'toolbar' => 'basic', // 'full' || 'basic' + // 'media_upload' => 1, + // 'delay' => 1, 'instructions' => __('Worum geht es bei deiner Veranstaltung?','quartiersplattform'), 'required' => 0, 'conditional_logic' => 0, @@ -127,7 +131,7 @@ function cptui_register_my_cpts_veranstaltungen() { 'label' => __('Datum','quartiersplattform'), 'name' => 'event_date', 'type' => 'date_picker', - 'instructions' => __('Wann wird deine Veranstaltung stattfinden?','quartiersplattform'), + 'instructions' => __('Wann wird deine Veranstaltung stattfinden bzw. beginnen?','quartiersplattform'), 'required' => 1, 'conditional_logic' => 0, 'wrapper' => array( @@ -135,7 +139,7 @@ function cptui_register_my_cpts_veranstaltungen() { 'class' => '', 'id' => '', ), - 'display_format' => 'F j, Y', + 'display_format' => 'j. F Y', 'return_format' => 'Y-m-d', 'first_day' => 1, ), @@ -172,6 +176,23 @@ 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' => 'j. F Y', + 'return_format' => 'Y-m-d', + 'first_day' => 1, + ), array( 'key' => 'field_5fc8d1c4d15c8', 'label' => __('Website','quartiersplattform'), @@ -296,5 +317,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..ea715b3 100644 --- a/components/calendar/calendar_download.php +++ b/components/calendar/calendar_download.php @@ -1,19 +1,26 @@ strtotime($ende) ) { +if (empty($date_end)) { + // Enddatum not given - single day event + $date_end = $date_start; +} + +if (empty($time_end) || strtotime($start) > strtotime("$date_end $time_end")) { // one hour after start - $ende = date('Ymd', strtotime($start) + (60*60)) . "T" . date('His', strtotime($start) + (60*60)); + $time_end = date('H:i:s', strtotime("$time_start +1 hour")); } +$ende = date('Ymd', strtotime("$date_end $time_end")) . "T" . date('His', strtotime("$date_end $time_end")); + // directory $links = get_template_directory_uri(); $destination_folder = $_SERVER['DOCUMENT_ROOT']; @@ -28,18 +35,19 @@ } // acf fields - ticket if (get_field('ticket')) { - $website = get_field('ticket');''; + $website = get_field('ticket'); } else { $website = ''; } -$description = get_field( "text" ); +$description = get_field("text"); $file_name = $post->post_name; $dir = "/assets/generated/calendar-files/"; $kb_start = $start; $kb_end = $ende; + $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 +79,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 +92,4 @@ ?> - \ No newline at end of file + diff --git a/components/project/events.php b/components/project/events.php index 6785f42..72e34f5 100644 --- a/components/project/events.php +++ b/components/project/events.php @@ -1,41 +1,59 @@ 'veranstaltungen', - 'post_status'=>'publish', - 'posts_per_page'=> 10, - 'offset' => '0', + 'post_type' => 'veranstaltungen', + 'post_status' => 'publish', + 'posts_per_page' => 10, + 'tax_query' => array( + array( + 'taxonomy' => 'projekt', + 'field' => 'slug', + 'terms' => $post->post_name, + ), + ), 'meta_query' => array( - 'relation' => 'AND', - 'date_clause' => array( - 'key' => 'event_date', - 'value' => date("Y-m-d"), - 'compare' => '>=', - 'type' => 'DATE' + 'relation' => 'OR', + array( + 'relation' => 'AND', + 'date_clause' => array( + 'key' => 'event_date', + 'value' => date('Y-m-d'), + 'compare' => '>=', + 'type' => 'DATE' + ), + 'time_clause' => array( + 'key' => 'event_time', + 'compare' => '=', + ), ), - 'time_clause' => array( - 'key' => 'event_time', - 'compare' => '=', + array( + 'relation' => 'AND', + 'end_date_clause' => array( + 'key' => 'event_end_date', + 'value' => date('Y-m-d'), + 'compare' => '>=', + 'type' => 'DATE' + ), + 'end_time_clause' => array( + 'key' => 'event_end_time', + 'compare' => '=', + ), + 'date_clause' => array( + 'key' => 'event_date', + 'value' => date('Y-m-d'), + 'compare' => '<', + 'type' => 'DATE' + ), ), ), 'orderby' => array( 'date_clause' => 'ASC', 'time_clause' => 'ASC', ), - 'tax_query' => array( - array( - 'taxonomy' => 'projekt', - 'field' => 'slug', - 'terms' => ".$post->post_name." - ) - ) - ); if (count_query($args_chronik)) { - echo "