Development

Changeset 30086

You must first sign up to be able to contribute.

Changeset 30086

Show
Ignore:
Timestamp:
07/01/10 11:40:34 (3 years ago)
Author:
uncleringo
Message:

Bug fix for date format of date widgets in forms
Added support to set all filter date formats to a default (which can be specified in app.yml)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfTrafficCMSPlugin/trunk/lib/filter/TrafficCMSBaseFilter.class.php

    r27008 r30086  
    2323  private function autoConfigure() 
    2424  { 
     25    $config = sfConfig::get('app_sf_traffic_cms_plugin_auto_configure', array()); 
     26 
     27    if (!isset($config['date_format'])) 
     28    { 
     29      $config['date_format'] = '%day%/%month%/%year%'; 
     30    } 
     31     
    2532    foreach ($this->getWidgetSchema()->getFields() as $name => $widget) 
    2633    { 
    27 //      if ($widget instanceof sfWidgetFormFilterDate) 
    28 //      { 
    29 //        $this->setWidget($name, new sfWidgetFormJQueryDate(array( 
    30 //            'format' => sfConfig::get('app_sf_traffic_cms_plugin_date_format', $config['date_format']), 
    31 //            'can_be_empty' => $widget->getOption('can_be_empty'), 
    32 //        ))); 
    33 //      } 
     34      if ($widget instanceof sfWidgetFormFilterDate) 
     35      { 
     36        $this->getWidget($name)->getOption('from_date')->setOption('format', $config['date_format']); 
     37        $this->getWidget($name)->getOption('to_date')->setOption('format', $config['date_format']); 
     38      } 
    3439    } 
    3540  } 
  • plugins/sfTrafficCMSPlugin/trunk/lib/form/TrafficCMSBaseForm.class.php

    r29817 r30086  
    230230        sfJSLibManager::addLib('jquery_ui'); 
    231231 
    232         $appConfig = sfConfig::get('app_sf_traffic_cms_plugin_auto_configure'); 
    233         $dateYear = array_combine($appConfig['date_picker']['years'], $appConfig['date_picker']['years']); 
     232        $dateYear = array_combine($config['date_picker']['years'], $config['date_picker']['years']); 
    234233 
    235234        $dateWidget = $this->getWidget($name); 
    236235        $dateWidget->setOptions(array( 
    237             'format' => sfConfig::get($appConfig['date_format'], $config['date_format']), 
     236            'format' => sfConfig::get($config['date_format'], '%day%/%month%/%year%'), 
    238237            'can_be_empty' => $widget->getOption('can_be_empty'), 
    239238            'years' => $dateYear,