Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/*
4
 * This file is part of the symfony package.
5
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
 
11
/**
12
 * sfWidgetFormI18nDateTime represents a date and time widget.
13
 *
14
 * @package    symfony
15
 * @subpackage widget
16
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17
 * @version    SVN: $Id: sfWidgetFormI18nDateTime.class.php 15086 2009-01-30 00:23:45Z FabianLange $
18
 */
19
class sfWidgetFormI18nDateTime extends sfWidgetFormDateTime
20
{
21
  /**
22
   * Constructor.
23
   *
24
   * Available options:
25
   *
26
   *  * culture: The culture to use for internationalized strings (required)
27
   *
28
   * @param array $options     An array of options
29
   * @param array $attributes  An array of default HTML attributes
30
   *
31
   * @see sfWidgetFormDateTime
32
   */
33
  protected function configure($options = array(), $attributes = array())
34
  {
35
    parent::configure($options, $attributes);
36
 
37
    $this->addRequiredOption('culture');
38
 
39
    $culture = isset($options['culture']) ? $options['culture'] : 'en';
40
 
41
    // format
42
    $this->setOption('format', str_replace(array('{0}', '{1}'), array('%time%', '%date%'), sfDateTimeFormatInfo::getInstance($culture)->getDateTimeOrderPattern()));
43
  }
44
 
45
  /**
46
   * @see sfWidgetFormDateTime
47
   */
48
  protected function getDateWidget($attributes = array())
49
  {
50
    return new sfWidgetFormI18nDate(array_merge(array('culture' => $this->getOption('culture')), $this->getOptionsFor('date')), $this->getAttributesFor('date', $attributes));
51
  }
52
 
53
  /**
54
   * @see sfWidgetFormDateTime
55
   */
56
  protected function getTimeWidget($attributes = array())
57
  {
58
    return new sfWidgetFormI18nTime(array_merge(array('culture' => $this->getOption('culture')), $this->getOptionsFor('time')), $this->getAttributesFor('time', $attributes));
59
  }
60
}