*
* Check that an event has enough data to support a registration for dates in the future.
*
- * getEventConfig() must have been run first to get the event configuration
- *
- *
*/
public function getEventForRegistration($regEventId = false)
{
$this->regEventData['reg_class'][$regClassKey]['non_time_specific_time'] = array();
$this->regEventData['reg_class'][$regClassKey]['hasTimes'] = false;
- // For each event time except non-time-specific entry
- foreach ($this->regEventData['reg_time'] as $regTimeKey=>$regTime) {
-
- // If event time is for non-time-specific event - Calculate from the earlies and latest event times
- if ($regTime['non_time_specific']['value']) {
+ // If event time is time-specific event
+ if ($this->regEventData['time_specific']['value']) {
+ // Scan times
+ foreach ($this->regEventData['reg_time'] as $regTimeKey=>$regTime) {
// Try to find a current rate for this time - within the start and end days before this time
foreach ($regClass['reg_rate'] as $regRateKey=>$regRate) {
+ if (!$regTime['non_time_specific']['value']) {
+
+ // Calculate earliest and latest days for this rate calculated from the start of this event time
+ $earliestTime = strtotime(date('m/d/Y', $regTime['start_datetime']['timestamp']).' -'.$regRate['start_days'].' days');
+ $latestTime = strtotime(date('m/d/Y', $regTime['start_datetime']['timestamp']).' -'.($regRate['end_days']-1).' days');
- // Calculate earliest and latest days for this rate calculated from the start of the first date/time for this event
- $earliestTime = strtotime(date('m/d/Y', $this->regEventData['first_datetime']['timestamp']).' -'.$regRate['start_days'].' days');
- $latestTime = strtotime(date('m/d/Y', $this->regEventData['first_datetime']['timestamp']).' -'.($regRate['end_days']).' days');
+ // If it's time to register with this time/rate - Add it to the class data
+ if (time() >= $earliestTime && time() <= $latestTime) {
- // If it's time to register with this time/rate - Add it to the class data
- if (time() >= $earliestTime && time() <= $latestTime && false) {
+ // Preserve rate ID and don't let it trash the time ID
+ $regRate['rate_id'] = $regRate['id'];
+ unset($regRate['id'], $regRate['reg_event']);
- // Preserve rate ID and don't let it trash the time ID
- $regRate['rate_id'] = $regRate['id'];
- unset($regRate['id'], $regRate['reg_event']);
+ $this->regEventData['reg_class'][$regClassKey]['times'][$regTime['id']] = array_merge($regTime, $regRate);
+ $this->regEventData['reg_class'][$regClassKey]['hasTimes'] = true;
+ }
- $this->regEventData['reg_class'][$regClassKey]['times'][$regTime['event_time']] = array_merge($regTime, $regRate);
- $this->regEventData['reg_class'][$regClassKey]['hasTimes'] = true;
}
}
-
unset($this->regEventData['reg_time'][$regTimeKey]);
- // If time specific event - calculate based on the time entries
- } else {
+ }
- // Try to find a current rate for this time - within the start and end days before this time
- foreach ($regClass['reg_rate'] as $regRateKey=>$regRate) {
+ } else {
- // Calculate earliest and latest days for this rate calculated from the start of this event time
- $earliestTime = strtotime(date('m/d/Y', $regTime['start_datetime']['timestamp']).' -'.$regRate['start_days'].' days');
- $latestTime = strtotime(date('m/d/Y', $regTime['start_datetime']['timestamp']).' -'.($regRate['end_days']-1).' days');
- // If it's time to register with this time/rate - Add it to the class data
- if (time() > $earliestTime && time() < $latestTime) {
+ // For each event time except non-time-specific entry
+ foreach ($this->regEventData['reg_time'] as $regTimeKey=>$regTime) {
- // Preserve rate ID and don't let it trash the time ID
- $regRate['rate_id'] = $regRate['id'];
- unset($regRate['id']);
+ if ($regTime['non_time_specific']['value']) {
- $this->regEventData['reg_class'][$regClassKey]['times'][$regTime['event_time']] = array_merge($regTime, $regRate);
- $this->regEventData['reg_class'][$regClassKey]['hasTimes'] = true;
- }
+ // Try to find a current rate for this time - within the start and end days before this time
+ foreach ($regClass['reg_rate'] as $regRateKey=>$regRate) {
- }
+ // Calculate earliest and latest days for this rate calculated from the start of the first date/time for this event
+ $earliestTime = strtotime(date('m/d/Y', $this->regEventData['last_datetime']['timestamp']).' -'.$regRate['start_days'].' days');
+ $latestTime = strtotime(date('m/d/Y', $this->regEventData['last_datetime']['timestamp']).' -'.($regRate['end_days']).' days');
- }
+ // If it's time to register with this time/rate - Add it to the class data
+ if (time() > $earliestTime && time() < $latestTime) {
+ // Preserve rate ID and don't let it trash the time ID
+ $regRate['rate_id'] = $regRate['id'];
+ unset($regRate['id']);
+ $this->regEventData['reg_class'][$regClassKey]['times'][$regTime['id']] = array_merge($regTime, $regRate);
+ $this->regEventData['reg_class'][$regClassKey]['hasTimes'] = true;
+ }
+ }
+ }
+ }
}
} // Have rates for this class