Development

Changeset 3014

You must first sign up to be able to contribute.

Changeset 3014

Show
Ignore:
Timestamp:
12/11/06 13:44:04 (2 years ago)
Author:
chtito
Message:

allowing editing of timestamps in the admin generator

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/helper/FormHelper.php

    r3012 r3014  
    745745  } 
    746746   
    747   if (_get_option($options, 'withtime', false)) 
     747  if ($withTime = _get_option($options, 'withtime', false)) 
    748748  { 
    749749    $pattern = 'g'; 
     
    779779 
    780780  // date format 
    781   $dateFormatInfo = sfDateTimeFormatInfo::getInstance($culture); 
    782   $date_format = strtolower($dateFormatInfo->getShortDatePattern()); 
     781  $dateFormatInfo = new sfDateFormat($culture); 
     782  $date_format = $dateFormatInfo->getPattern($pattern); 
    783783 
    784784  // calendar date format 
    785   $calendar_date_format = $date_format; 
    786   $calendar_date_format = strtr($calendar_date_format, array('M' => 'm', 'y' => 'Y')); 
    787   $calendar_date_format = preg_replace('/([mdy])+/i', '%\\1', $calendar_date_format); 
     785  $calendar_date_format = $date_format;error_log($date_format); 
     786  $calendar_date_format = strtr($date_format, array('MM' => 'm', 'M'=>'m', 'dd'=>'d', 'yyyy' => 'Y', 'HH'=>'H', 'h'=>'l', 'mm'=>'M', 'ss'=>'S', 'a'=>'p')); 
     787 
     788  $calendar_date_format = preg_replace('/([mdyhlsp])+/i', '%\\1', $calendar_date_format); 
     789error_log($calendar_date_format); 
    788790 
    789791  $id_inputField = (isset($options['id']))? $options['id'] : get_id_from_name($name); 
     
    794796      inputField : "'.$id_inputField.'", 
    795797      ifFormat : "'.$calendar_date_format.'", 
     798      daFormat : "'.$calendar_date_format.'", 
    796799      button : "'.$id_calendarButton.'"'; 
     800   
     801  if ($withTime) 
     802  { 
     803    $js .= ",\n showsTime : true"; 
     804  } 
    797805 
    798806  // calendar options 
     
    823831  if (!isset($options['size'])) 
    824832  { 
    825     $options['size'] = 11; 
     833    // educated guess about the size 
     834    $options['size'] = strlen($date_format)+2; 
    826835  } 
    827836  $html = input_tag($name, $value, $options); 
  • trunk/lib/i18n/sfDateFormat.class.php

    r2834 r3014  
    190190   * @see DateTimeFormatInfo::formatDateTime() 
    191191   */ 
    192   protected function getPattern($pattern) 
     192  public function getPattern($pattern) 
    193193  { 
    194194    if (is_array($pattern) && count($pattern) == 2)