From 123c5491ab8ec6550fa74bbdc1c1281719d4a9a8 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 15 Feb 2018 16:58:33 -0500 Subject: [PATCH] Working on getting the data entered into the date fields to stay. When you have a required field not filled out it is loosing the date data that was entered. I have the time and date now saving. Need to work on getting the checkboxes and recurring data to save. --- classes/data/dataRecurrences.php | 2 +- models/admin/events/list.php | 65 +++++++++++++++++++++++----- views/admin/events/editSchedule.html | 4 +- 3 files changed, 57 insertions(+), 14 deletions(-) diff --git a/classes/data/dataRecurrences.php b/classes/data/dataRecurrences.php index 89e20c9..a4694a8 100644 --- a/classes/data/dataRecurrences.php +++ b/classes/data/dataRecurrences.php @@ -159,7 +159,7 @@ class GlmDataEventsRecurrences extends GlmDataAbstract 'start_time_only' => array ( 'field' => 'start_time_only', 'type' => 'checkbox', - 'default' => true, + 'default' => false, 'use' => 'a' ), diff --git a/models/admin/events/list.php b/models/admin/events/list.php index 01f0ae8..4092a10 100644 --- a/models/admin/events/list.php +++ b/models/admin/events/list.php @@ -255,23 +255,25 @@ class GlmMembersAdmin_events_list extends GlmDataEvents $view = 'edit'; + // echo '
$newRecurrence: ' . print_r( $newRecurrence, true ) . '
'; break; case 'insert': $event = $this->insertEntry(); + if ($event['status']) { + // echo '
$event: ' . print_r( $event, true ) . '
'; - $this->eventID = $event['fieldData']['id']; + $this->eventID = $event['fieldData']['id']; - $this->updateCategories(); - $categories = $Categories->getListSortedParentChild(false); + $this->updateCategories(); + $categories = $Categories->getListSortedParentChild(false); - if ( $this->config['settings']['use_event_amenities'] ) { - $this->updateAmenities(); - $amenities = $Amenities->getList(false); - } + if ( $this->config['settings']['use_event_amenities'] ) { + $this->updateAmenities(); + $amenities = $Amenities->getList(false); + } - if ($event['status']) { $haveEvent = true; $eventAdded = true; @@ -369,15 +371,56 @@ class GlmMembersAdmin_events_list extends GlmDataEvents glmClearShortcodeCache(); } else { + // echo '
$_REQUEST: ' . print_r( $_REQUEST, true ) . '
'; + // echo '
$event: ' . print_r( $event, true ) . '
'; + // echo '
$newRecurrence: ' . print_r( $newRecurrence, true ) . '
'; $option = 'add'; $eventAddError = true; // Add any recurrence data that may have been submitted - // if (isset($_REQUEST[''])) { - // NOT COMPLETED - // } + $newRecurSetup = array( + 'name', + 'start_time', + 'end_time', + 'from_date', + 'to_date', + 'month_of_year', + 'week_of_month', + 'day_of_week', + 'all_day', + 'start_time_only', + ); + + if ( isset( $_REQUEST['recurID'] ) ) { + foreach ( $_REQUEST['recurID'] as $recur ) { + foreach ( $newRecurSetup as $rec ) { + $rec_name = $recur . '_' . $rec; + if ( $_REQUEST[$rec_name] ) { + switch ( $rec ) { + case 'start_time': + case 'end_time': + $newRecurrence['fieldData'][$rec]['time'] = $_REQUEST[$rec_name]; + break; + case 'from_date': + case 'to_date': + $newRecurrence['fieldData'][$rec]['date'] = $_REQUEST[$rec_name]; + break; + case 'name': + case 'month_of_year': + case 'week_of_month': + case 'day_of_week': + case 'all_day': + case 'start_time_only': + $newRecurrence['fieldData'][$rec]['value'] = $_REQUEST[$rec_name]; + break; + } + } + } + } + } } + // echo '
$newRecurrence: ' . print_r( $newRecurrence, true ) . '
'; $view = 'edit'; diff --git a/views/admin/events/editSchedule.html b/views/admin/events/editSchedule.html index 2bcda6a..5a7a2f5 100644 --- a/views/admin/events/editSchedule.html +++ b/views/admin/events/editSchedule.html @@ -236,14 +236,14 @@ All Day Event: - + Start Time: - Start time only + Start time only -- 2.17.1