Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
datetime.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset_attribute.inc';
19 require_once SQ_FUDGE_PATH.'/datetime_field/datetime_field.inc';
20 require_once SQ_FUDGE_PATH.'/general/datetime.inc';
21 
73 {
74 
75 
83  function Asset_Attribute_DateTime($attributeid=0, $value=NULL)
84  {
85  $this->Asset_Attribute($attributeid, $value);
86 
87  // default values
88  $this->_edit_params['allow_null'] = TRUE;
89  $this->_edit_params['max'] = '2030-12-31 23:59:59';
90  $this->_edit_params['min'] = '1970-01-01 00:00:00';
91  $this->_edit_params['allow_circa'] = '0';
92  $this->_edit_params['print_format'] = 'l, F jS, Y H:i:s';
93  $this->_edit_params['allow_period'] = FALSE;
94  $this->_edit_params['allow_period_today'] = FALSE;
95  $this->_edit_params['use_picker'] = FALSE;
96 
97  // default date format and display style.
98  $this->_edit_params['show'] = Array('y', 'm', 'd', 'h', 'i', 's');
99  $this->_edit_params['style'] = Array(
100  'y' => 's',
101  'm' => 's',
102  'd' => 's',
103  'h' => 's',
104  'i' => 's',
105  's' => 's',
106  );
107  $this->_edit_params['extras'] = Array(
108  'y' => '',
109  'm' => '',
110  'd' => '',
111  'h' => '',
112  'i' => '',
113  's' => '',
114  );
115  $this->_edit_params['null'] = Array();
116 
117  }//end constructor
118 
119 
129  function setEditParams(&$node)
130  {
131  if (!parent::setEditParams($node)) return FALSE;
132 
133  if (!empty($node->attributes()->min)) {
134  $this->_edit_params['min'] = (string)$node->attributes()->min;
135  }
136  if (!empty($node->attributes()->max)) {
137  $this->_edit_params['max'] = (string)$node->attributes()->max;
138  }
139  if (!empty($node->attributes()->allow_circa)) {
140  $this->_edit_params['allow_circa'] = (string)$node->attributes()->allow_circa;
141  }
142  if (!empty($node->attributes()->print_format)) {
143  $this->_edit_params['print_format'] = (string)$node->attributes()->print_format;
144  }
145 
146  // what to print and how to show it (textbox or select box)
147  // need to do some more intense looking around for these options :)
148  $this->_edit_params['show'] = Array();
149  $this->_edit_params['style'] = Array();
150  foreach ($node->children() as $c => $child) {
151  if ($child->getName() == 'show') {
152  foreach ($child->children() as $i => $format) {
153  $this->_edit_params['show'][] = $format->getName();
154  $this->_edit_params['style'][(string) $format->getName()] = (string)$format->attributes()->style;
155  if (isset($format->attributes()->allow_null) && (string)$format->attributes()->allow_null) {
156  $this->_edit_params['null'][] = $format->getName();
157  }
158  }
159  break;
160  }
161  }
162 
163  if (isset($node->attributes()->allow_period) && (string)$node->attributes()->allow_period) {
164  $this->_edit_params['allow_period'] = TRUE;
165  }
166 
167  if (isset($node->attributes()->use_picker) && (string)$node->attributes()->use_picker) {
168  $this->_edit_params['use_picker'] = TRUE;
169  }
170 
171  if (isset($node->attributes()->allow_period_today) && (string)$node->attributes()->allow_period_today) {
172  $this->_edit_params['allow_period_today'] = TRUE;
173  }
174 
175  // if nothing was found, define some defaults of our own
176  if (empty($this->_edit_params['show'])) {
177  $this->_edit_params['show'] = Array('y','m','d','h','i','s');
178  foreach ($this->_edit_params['show'] as $u) {
179  $this->_edit_params['style'][$u] = 's';
180  }
181  }
182 
183  return TRUE;
184 
185  }//end setEditParams()
186 
187 
197  function paint($prefix, $read_only=FALSE)
198  {
199  $date_option = NULL;
200 
201  $period_options = $this->_getPeriodOptions();
202  $age_options = $this->_getAgeOptions();
203 
204  $period_num = '1';
205  $period_type = 'd';
206  $period_age = '-';
207  $base_time = '00:00:00';
208 
209  $matches = Array();
210 
211  $circa = NULL;
212  if (substr($this->value, 0, 2) === 'c.') {
213  $circa = TRUE;
214  $date_value = substr($this->value, 2);
215  } else {
216  $circa = FALSE;
217  $date_value = $this->value;
218  }
219 
220  if ((empty($date_value) === TRUE) || (is_iso8601($date_value) === TRUE)) {
221  // Single date
222  // To be stored in pseudo-ISO 8601 format (yyyy-mm-dd hh:ii:ss)
223  $date_option = 'single_date';
224 
225  } else {
226  // Test for time period, from current date/time
227  // eg. "+1m", "-8w", etc
228  $found = preg_match('/^([\-\+])([0-9]+)(['.implode('', array_keys($period_options)).'])$/', $date_value, $matches);
229 
230  if ($found === 1) {
231  // All good
232  $date_option = 'date_period';
233  list(, $period_age, $period_num, $period_type) = $matches;
234 
235  } else {
236  // What about a time period from "today"?
237  // eg. "12:30:00 -10d"
238  $found = preg_match('/^([0-9]{2}):([0-9]{2}):([0-9]{2}) ([\-\+])([0-9]+)(['.implode('', array_keys($period_options)).'])$/', $date_value, $matches);
239 
240  if ($found === 1) {
241  // All good
242  list($period_age, $period_num, $period_type) = array_slice($matches, 4, 3);
243  $date_option = 'date_period_today';
244 
245  } else {
246  // Not an option!
247  $date_value = '0000-00-00 00:00:00';
248  $date_value = str_replace('0', '-', $date_value);
249  $date_option = 'single_date';
250 
251  }//end if date period (from "today")
252 
253 
254  }//end if date period (from "now")
255 
256  }//end if single date
257 
258  // Calculate the default values to shown in the other date types
259  switch ($date_option) {
260  case 'single_date':
261  $date_field_value = $date_value;
262 
263  if (empty($date_field_value) === TRUE) {
264  // Empty
265  $date_field_value = ts_iso8601(time());
266  $date_period_value = '';
267 
268  } else if ($date_field_value !== '---------- --:--:--') {
269  // Not null date
270  // Calculate a default time period to put into the "date period"
271  $timestamp = strtotime(str_replace('--', '0', $date_field_value));
272 
273  if ($timestamp < time()) {
274  $format = easy_time_total(time() - $timestamp, FALSE, TRUE);
275  $period_age = '-';
276 
277  } else {
278  $format = easy_time_total($timestamp - time(), FALSE, TRUE);
279  $period_age = '+';
280 
281  }
282 
283  if (empty($format) === FALSE) {
284  if ($format['d'] > 0) {
285  $period_num = $format['d'];
286  $period_type = 'd';
287 
288  } else if ($format['h'] > 0) {
289  $period_num = $format['h'];
290  $period_type = 'h';
291 
292  } else if ($format['m'] > 0) {
293  $period_num = $format['m'];
294  $period_type = 'i';
295 
296  } else if ($format['s'] > 0) {
297  $period_num = $format['s'];
298  $period_type = 's';
299 
300  }
301 
302  }
303 
304  $date_period_value = $period_age.$period_num.$period_type;
305  } else {
306  $date_period_value = '';
307  }
308 
309  break;
310 
311  case 'date_period':
312  $date_period_value = $period_age.$period_num.$period_type;
313  $date_period = $period_age.$period_num.' '.$period_options[$period_type];
314  $date_field_value = ts_iso8601(strtotime($date_period));
315  $base_time = '00:00:00';
316  break;
317 
318  case 'date_period_today':
319  $date_period_value = $period_age.$period_num.$period_type;
320  $date_period = $period_age.$period_num.' '.$period_options[$period_type];
321  $base_time = $matches[1].':'.$matches[2].':'.$matches[3];
322  $date_field_value = ts_iso8601(strtotime($base_time.' '.$date_period));
323  break;
324 
325  }//end switch on date type
326 
327  if (!empty($this->_params['print_format'])) {
328  $this->_edit_params['print_format'] = $this->_params['print_format'];
329  }
330 
331  if ($read_only === TRUE) {
332  switch ($date_option) {
333  case 'single_date':
334  if ($this->_edit_params['allow_circa'] === '1') {
335  if ($circa === TRUE) {
336  $date_field_value .= ' 1';
337  } else {
338  $date_field_value .= ' 0';
339  }
340  }
341  $field = new Datetime_Field($prefix, $date_field_value, $this->_edit_params);
342  echo $field->format();
343  break;
344 
345  case 'date_period':
346  if ((int)$period_num === 0) {
347  echo translate('attribute_datetime_period_age_0', $period_num, $period_options[$period_type]);
348  } else {
349  echo translate('attribute_datetime_period_age_'.$period_age, $period_num, $period_options[$period_type]);
350  }
351  break;
352 
353  case 'date_period_today':
354  if ((int)$period_num === 0) {
355  echo translate('attribute_datetime_today_age_0', $period_num, $period_options[$period_type], $base_time);
356  } else {
357  echo translate('attribute_datetime_today_age_'.$period_age, $period_num, $period_options[$period_type], $base_time);
358  }
359  break;
360 
361  }//end switch on date option
362 
363  } else {
364  $options = Array(
365  'single_date' => translate('attribute_datetime_option_single_date'),
366  'date_period' => translate('attribute_datetime_option_date_period'),
367  'date_period_today' => translate('attribute_datetime_option_date_period_today'),
368  );
369 
370  if ((boolean)$this->_edit_params['allow_period'] === FALSE) {
371  unset($options['date_period']);
372  }
373  if ((boolean)$this->_edit_params['allow_period_today'] === FALSE) {
374  unset($options['date_period_today']);
375  }
376 
377  $edit_fields = Array();
378  foreach ($options as $option_key => $option_name) {
379  $edit_fields[$option_key] = $this->_getDateOptionEditInterface($prefix, $option_key, $date_field_value, $date_period_value, $circa);
380  }
381 
382  if (count($edit_fields) > 1) {
383  ?>
384  <fieldset>
385  <legend>
386  <select name="<?php echo $prefix ?>_period_select" id="<?php echo $prefix ?>_period_select" onchange="items = document.getElementsByClassName('sq-datetime-field-date-option-<?php echo $prefix; ?>'); for (var x = 0; x < items.length; x++) {items[x].style.display = (items[x].id == ('<?php echo $prefix; ?>_field_' + this.value)) ? 'block' : 'none' };">
387  <?php foreach ($options as $option_key => $option_name) {
388  ?><option value="<?php echo $option_key ?>"<?php echo ($option_key === $date_option) ? ' selected="selected"' : ''; ?>><?php echo $option_name ?></option>
389  <?php } ?>
390  </select>
391  </legend>
392  <?php
393  }
394 
395  foreach ($options as $option_key => $option_name) {
396  ?><div id="<?php echo $prefix; ?>_field_<?php echo $option_key ?>" class="sq-datetime-field-date-option-<?php echo $prefix; ?>" style="display: <?php echo ($option_key === $date_option) ? 'block' : 'none'; ?>;">
397  <p><?php echo $edit_fields[$option_key]; ?></p>
398  <p><em><?php echo translate('attribute_datetime_select_'.$option_key); ?></em></p></div><?php
399  }//end foreach
400 
401  if (count($edit_fields) > 1) {
402  ?>
403  </fieldset>
404  <?php
405  }
406 
407  }//end if read-only
408 
409  }//end paint()
410 
411 
420  function process($prefix)
421  {
422  $date_option = array_get_index($_REQUEST, $prefix.'_period_select', 'single_date');
423  $field_value = $this->value;
424 
425  switch ($date_option) {
426  case 'single_date':
427  $this->processed = FALSE;
428 
429  // If the current value cannot be used as a single date and we
430  // can't process what we have, reset to a null date
431  if (is_iso8601($field_value) === FALSE) {
432  $field_value = '---------- --:--:--';
433  }
434 
435  $field = new Datetime_Field($prefix, $field_value, $this->_edit_params);
436  if ($field->processField() === TRUE) {
437  if ($this->_edit_params['allow_circa'] === '1') {
438  $value_bits = explode(' ', $field_value);
439  if ($value_bits[2] === '0') {
440  $field_value = $value_bits[0].' '.$value_bits[1];
441  } else {
442  $field_value = 'c.'.$value_bits[0].' '.$value_bits[1];
443  }
444  }
445 
446  // Attribute has changed
447  if ($this->value !== $field_value) {
448  $ok = $this->setValue($field_value);
449  if ($ok === TRUE) {
450  // Processed OK
451  $this->processed = TRUE;
452  }
453  }
454  }
455  break;
456 
457  case 'date_period':
458  $this->processed = FALSE;
459 
460  // If not set, default to "1 day in the past"
461  $period_num = (int) array_get_index($_REQUEST, $prefix.'period_num', 1);
462  $period_type = (string) array_get_index($_REQUEST, $prefix.'_period_type', 'd');
463  $period_age = (string) array_get_index($_REQUEST, $prefix.'_period_age', '-');
464 
465  // Are the periods/ages passed to us valid?
466  $period_options = $this->_getPeriodOptions();
467  $age_options = $this->_getAgeOptions();
468 
469  if (isset($period_options[$period_type]) === FALSE) {
470  $period_type = 'd';
471  }
472  if (isset($age_options[$period_age]) === FALSE) {
473  $period_age = '-';
474  }
475 
476  $field_value = $period_age.$period_num.$period_type;
477 
478  if ($this->value !== $field_value) {
479  $ok = $this->setValue($field_value);
480  if ($ok === TRUE) {
481  // Processed OK
482  $this->processed = TRUE;
483  }
484  }
485 
486  break;
487 
488  case 'date_period_today':
489  $this->processed = FALSE;
490 
491  // If not set, default to "Today at midnight"
492  $period_num = (int) array_get_index($_REQUEST, $prefix.'_today_period_num', 0);
493  $period_type = (string) array_get_index($_REQUEST, $prefix.'_today_period_type', 'd');
494  $period_age = (string) array_get_index($_REQUEST, $prefix.'_today_period_age', '-');
495  $base_time = '00:00:00';
496 
497  // Are the periods/ages passed to us valid? (Certain periods
498  // can't be used.)
499  $period_options = $this->_getPeriodOptions();
500  $age_options = $this->_getAgeOptions();
501  unset($period_options['h']);
502  unset($period_options['i']);
503 
504  if (isset($period_options[$period_type]) === FALSE) {
505  $period_type = 'd';
506  }
507  if (isset($age_options[$period_age]) === FALSE) {
508  $period_age = '-';
509  }
510 
511  // Now grab the base time from the datetime field, and if that
512  // is good, add the time component of it to the period
513  $edit_params = $this->_edit_params;
514  $edit_params['show'] = Array('h', 'i', 's');
515  $field = new Datetime_Field($prefix.'_today_time', $base_time, $edit_params);
516 
517  if ($field->processField() === TRUE) {
518  $base_time = iso8601_time_component($base_time);
519  $field_value = $base_time.' '.$period_age.$period_num.$period_type;
520 
521  if ($this->value !== $field_value) {
522  $ok = $this->setValue($field_value);
523  if ($ok === TRUE) {
524  // Processed OK
525  $this->processed = TRUE;
526  }
527  }
528  }
529 
530  break;
531 
532  }//end switch
533 
534  return;
535 
536  }//end process()
537 
538 
545  function getTimestamp()
546  {
547  $date_field_value = NULL;
548 
549  if (is_iso8601($this->value) === TRUE) {
550  // Single date
551  $date_field_value = $this->value;
552 
553  } else if (substr($this->value, 0, 2) === 'c.') {
554  // Single date with circa
555  if (is_iso8601(substr($this->value, 2)) === TRUE) {
556  $date_field_value = substr($this->value, 2);
557  }
558 
559  } else {
560  // Are the periods/ages passed to us valid?
561  $period_options = $this->_getPeriodOptions();
562  $age_options = $this->_getAgeOptions();
563 
564  $found = preg_match('/^([\-\+])([0-9]+)(['.implode('', array_keys($period_options)).'])$/', $this->value, $matches);
565  if ($found === 1) {
566  // Date period from "now"
567  list(, $period_age, $period_num, $period_type) = $matches;
568  $date_field_value = date('Y-m-d H:i:s', strtotime($period_age.$period_num.' '.$period_options[$period_type]));
569 
570  } else {
571  $found = preg_match('/^([0-9]{2}:[0-9]{2}:[0-9]{2}) ([\-\+])([0-9]+)(['.implode('', array_keys($period_options)).'])$/', $this->value, $matches);
572  if ($found === 1) {
573  // Date period from "today" at certain time
574  list(, $base_time, $period_age, $period_num, $period_type) = $matches;
575  $date_field_value = date('Y-m-d H:i:s', strtotime($base_time.' '.$period_age.$period_num.' '.$period_options[$period_type]));
576  } else {
577  $date_field_value = NULL;
578  }
579  }
580 
581  }
582 
583  $timestamp = NULL;
584 
585  if ($date_field_value === NULL) {
586  $timestamp = -1;
587  } else {
588  $field = new Datetime_Field('blah', $date_field_value, $this->_edit_params);
589  $units = $field->strToUnitsArray($date_field_value);
590  foreach (Array('y', 'm', 'd') as $u) {
591  if ($units[$u] == -1) {
592  $timestamp = -1;
593  }
594  }
595 
596  if ($timestamp !== -1) {
597  // now we know that we can formulate a date
598  $strtotime = $units['m'].'/'.$units['d'].'/'.$units['y'];
599 
600  $dotime = TRUE;
601  foreach (Array('h', 'i', 's') as $u) {
602  if ($units[$u] == -1) $dotime = FALSE;
603  }
604  if ($dotime) {
605  $strtotime .= ' '.$units['h'].':'.$units['i'].':'.$units['s'];
606  }
607 
608  $timestamp = strtotime($strtotime);
609  }
610  }
611 
612  return $timestamp;
613 
614  }//end getTimestamp()
615 
616 
623  function getISO8601()
624  {
625  if (is_iso8601($this->value) === TRUE) {
626  return $this->value;
627  } else {
628  $time_zone_designater = date('O');
629  $tzd_iso8601 = substr($time_zone_designater, 0, 3).':'.substr($time_zone_designater, -2);
630 
631  return date('Y-m-d\TH:i:s', $this->getTimestamp()).$tzd_iso8601;
632  }
633 
634  }//end getISO8601()
635 
636 
645  function validateValue(&$value)
646  {
647  // specific check for null
648  if (!empty($this->_params['allow_null']) && ($value == '---------- --:--:--' || $value == '')) {
649  return TRUE;
650  }
651 
652  // See if we have a 'circa' notation (for single date only)
653  // We support 'c.', 'circ.', 'circa.' - with and without dot,
654  // with and without trailing space before date itself.
655  $found = preg_match('/^(c(irc(a)?)?[\.]?[ ]?)?(.*)$/', $value, $matches);
656  if ($found) {
657  $date_value = $matches[4];
658  $circa = FALSE;
659  if (empty($matches[1]) === FALSE) {
660  $circa = TRUE;
661  }
662  } else {
663  $date_value = $value;
664  }
665 
666  if (is_iso8601($date_value) === TRUE) {
667  $ref = '';
668  $field = new Datetime_Field('blah', $ref, $this->_edit_params);
669  $value = $field->validateValue($value);
670  if ($this->_edit_params['allow_circa'] === '1') {
671  $value_bits = explode(' ', $value);
672  if ($value_bits[2] === '0') {
673  $value = $value_bits[0].' '.$value_bits[1];
674  } else {
675  $value = 'c.'.$value_bits[0].' '.$value_bits[1];
676  }
677  }
678 
679  } else {
680  if (!empty($date_value) && !preg_match('|([0-9]{2}:[0-9]{2}:[0-9]{2} )?[\-\+][0-9]+['.implode('', array_keys($this->_getPeriodOptions())).']|', $date_value)) {
681  return FALSE;
682  }
683  }
684 
685  return TRUE;
686 
687  }//end validateValue()
688 
689 
696  function _getPeriodOptions()
697  {
698  return Array(
699  'i' => translate('minutes'),
700  'h' => translate('hours'),
701  'd' => translate('days'),
702  'w' => translate('weeks'),
703  'm' => translate('months'),
704  'y' => translate('years'),
705  );
706 
707  }//end _getPeriodOptions()
708 
709 
716  function _getAgeOptions()
717  {
718  return Array(
719  '-' => 'in the past',
720  '+' => 'in the future',
721  );
722 
723  }//end _getAgeOptions()
724 
725 
733  {
734  return Array(
735  '-' => 'before today',
736  '+' => 'after today',
737  );
738 
739  }//end _getTodayAgeOptions()
740 
741 
750  function getKeywordValue($format='')
751  {
752  if ($format !== '') {
753  // Get the current date/time, whether fixed or calculated from period
754  $ts = $this->getTimestamp();
755 
756  if ($ts !== -1) {
757  $format_value = format_date($ts, $format);
758  if ($format_value) {
759  return $format_value;
760  }
761  }
762  }
763  return parent::getKeywordValue($format);
764 
765  }//end getKeywordValue()
766 
767 
780  protected function _getDateOptionEditInterface($prefix, $option_name, $default_date=NULL, $default_period=NULL, $circa=NULL)
781  {
782  ob_start();
783 
784  switch ($option_name) {
785  case 'single_date':
786  if ($this->_edit_params['allow_circa'] === '1') {
787  if ($circa === TRUE) {
788  $default_date .= ' 1';
789  } else {
790  $default_date .= ' 0';
791  }
792  }
793 
794  $field = new Datetime_Field($prefix, $default_date, $this->_edit_params);
795  $field->printField();
796 
797  if ($this->_edit_params['use_picker']) {
798  // print the JS calendar popup date selecta
799  require_once SQ_LIB_PATH.'/js_calendar/js_calendar.inc';
800 
801  $calendar = new JS_Calendar();
802  $calendar->changeSetting('onDayClick', 'datetime_set_date');
803  $calendar->paint($prefix, $prefix.'_cal_picker', TRUE);
804  }
805  break;
806 
807  case 'date_period':
808  $period_options = $this->_getPeriodOptions();
809  $age_options = $this->_getAgeOptions();
810 
811  $found = preg_match('/^([\-\+])([0-9]+)(['.implode('', array_keys($period_options)).'])$/', $default_period, $matches);
812  if ($found === 1) {
813  list(, $period_age, $period_num, $period_type) = $matches;
814  } else {
815  list($period_age, $period_num, $period_type) = Array('-', '', 'd');
816  }
817 
818  ob_start();
819  int_text_box($prefix.'period_num', $period_num, FALSE, 3);
820  $cb_period_num = ob_get_clean();
821 
822  ob_start();
823  combo_box($prefix.'_period_type', $period_options, FALSE, $period_type);
824  $cb_period_type = ob_get_clean();
825 
826  ob_start();
827  combo_box($prefix.'_period_age', $age_options, FALSE, $period_age);
828  $cb_period_age = ob_get_clean();
829 
830  echo translate('attribute_datetime_date_period_edit_format', $cb_period_num, $cb_period_type, $cb_period_age);
831 
832  break;
833 
834  case 'date_period_today':
835  $period_options = $this->_getPeriodOptions();
836  $age_options = $this->_getTodayAgeOptions();
837 
838  $found = preg_match('/^[0-9]{2}:[0-9]{2}:[0-9]{2} ([\-\+])([0-9]+)(['.implode('', array_keys($period_options)).'])$/', date('H:i:s', strtotime($default_date)).' '.$default_period, $matches);
839  if ($found === 1) {
840  list(, $period_age, $period_num, $period_type) = $matches;
841  } else {
842  list($period_age, $period_num, $period_type) = Array('-', '', 'd');
843  }
844 
845  // If we have inherited an unsupported period type (ie. switching
846  // from date period using hours or minutes), convert it into days
847  // and round down.
848  if ($period_type === 'i') {
849  $period_num = floor($period_num / 1440);
850  $period_type = 'd';
851  } else if ($period_type === 'h') {
852  $period_num = floor($period_num / 24);
853  $period_type = 'd';
854  }
855 
856  ob_start();
857  int_text_box($prefix.'_today_period_num', $period_num, FALSE, 3);
858  $cb_period_num = ob_get_clean();
859 
860  ob_start();
861  // No point having options smaller than "days" here
862  unset($period_options['i']);
863  unset($period_options['h']);
864  combo_box($prefix.'_today_period_type', $period_options, FALSE, $period_type);
865  $cb_period_type = ob_get_clean();
866 
867  ob_start();
868  combo_box($prefix.'_today_period_age', $age_options, FALSE, $period_age);
869  $cb_period_age = ob_get_clean();
870 
871  ob_start();
872  $edit_params = $this->_edit_params;
873  $edit_params['show'] = Array('h', 'i', 's');
874 
875  $field = new Datetime_Field($prefix.'_today_time', $default_date, $edit_params);
876  $field->printField();
877  $datetime_field_output = ob_get_clean();
878 
879  echo translate('attribute_datetime_today_period_edit_format', $cb_period_num, $cb_period_type, $cb_period_age, $datetime_field_output);
880 
881  break;
882 
883  }//end switch
884 
885  $output = ob_get_clean();
886 
887  // If empty, it must have been an invalid option, so return FALSE
888  if (empty($output) === TRUE) {
889  $output = FALSE;
890  }
891 
892  return $output;
893 
894  }//end _getDateOptionEditInterface()
895 
896 
897 }//end class
898 
899 ?>