1. sfWidgetFormI18nDateTime.class.php
  2. /** * sfWidgetFormI18nDateTime represents a date and time widget. * * @package symfony * @subpackage widget * @author Fabien Potencier * @version SVN: $Id: sfWidgetFormI18nDateTime.class.php 15086 2009-01-30 00:23:45Z FabianLange $ */
  3. class sfWidgetFormI18nDateTime extends sfWidgetFormDateTime
  4. {
  5. /**
  6. * Constructor.
  7. *
  8. * Available options:
  9. *
  10. * * culture: The culture to use for internationalized strings (required)
  11. *
  12. * @param array $options An array of options
  13. * @param array $attributes An array of default HTML attributes
  14. *
  15. * @see sfWidgetFormDateTime
  16. */
  17. protected function configure($options = array(), $attributes = array())
  18. {
  19. parent::configure($options, $attributes);
  20. $this->addRequiredOption('culture');
  21. $culture = isset($options['culture']) ? $options['culture'] : 'en';
  22. // format
  23. $this->setOption('format', str_replace(array('{0}', '{1}'), array('%time%', '%date%'), sfDateTimeFormatInfo::getInstance($culture)->getDateTimeOrderPattern()));
  24. }
  25. /**
  26. * @see sfWidgetFormDateTime
  27. */
  28. protected function getDateWidget($attributes = array())
  29. {
  30. return new sfWidgetFormI18nDate(array_merge(array('culture' => $this->getOption('culture')), $this->getOptionsFor('date')), $this->getAttributesFor('date', $attributes));
  31. }
  32. /**
  33. * @see sfWidgetFormDateTime
  34. */
  35. protected function getTimeWidget($attributes = array())
  36. {
  37. return new sfWidgetFormI18nTime(array_merge(array('culture' => $this->getOption('culture')), $this->getOptionsFor('time')), $this->getAttributesFor('time', $attributes));
  38. }
  39. }

Debug toolbar