public function render($name, $value = null, $attributes = array(), $errors = array()) { return parent::render($name, $value, $attributes, $errors) . <<<EOF <script type="text/javascript"> jQuery(document).ready(function(){ var eleYear = ".ui-datepicker-year"; jQuery(".ui-datepicker-trigger, div#ui-datepicker-div").click(function() { jQuery("span.jpYearSuffix").remove(); jQuery(eleYear).after("<span class='jpYearSuffix'>年</span>"); }); }); </script> EOF . ($this->getOption('with_time') ? $this->getTimeWidget($attributes)->render($name, $value) : ""); }
protected function configure($options = array(), $attributes = array()) { parent::configure(); $this->addOption('date_range', array()); $this->addOption('date_widget_options', array()); $this->setOption('image', '/images/calendar.png'); if (isset($options['date_range'])) { $years = range($options['date_range']['min'], $options['date_range']['max']); unset($options['date_range']); } else { $years = range(2009, date('Y') + 2); } $date_widget_options = array('culture' => 'fr', 'years' => array_combine($years, $years), 'can_be_empty' => true); if (isset($options['date_widget_options'])) { $date_widget_options = array_merge($date_widget_options, $options['date_widget_options']); } $this->date_widget = new sfWidgetFormI18nDate($date_widget_options); // $this->setOption( // 'date_widget', // $date_widget // ); $this->setOption('culture', 'fr'); $this->setOption('config', '{showMonthAfterYear: false, firstDay: 1}'); }