public function setup()
 {
     parent::setup();
     $this->setWidget('start_date', new aWidgetFormJQueryDate(array('image' => '/apostrophePlugin/images/a-icon-datepicker.png')));
     $this->setValidator('start_date', new sfValidatorDate(array('required' => true)));
     $this->setWidget('start_time', new aWidgetFormJQueryTime(array(), array('twenty-four-hour' => false, 'minutes-increment' => 30)));
     $this->setValidator('start_time', new sfValidatorTime(array('required' => false)));
     $this->setWidget('end_date', new aWidgetFormJQueryDate(array('image' => '/apostrophePlugin/images/a-icon-datepicker.png')));
     $this->setValidator('end_date', new sfValidatorDate(array('required' => true)));
     $this->setWidget('end_time', new aWidgetFormJQueryTime(array(), array('twenty-four-hour' => false, 'minutes-increment' => 30)));
     $this->setValidator('end_time', new sfValidatorTime(array('required' => false)));
     $this->setWidget('location', new sfWidgetFormTextarea());
     $this->setValidator('location', new sfValidatorString(array('required' => false)));
     $this->getWidgetSchema()->setDefault('start_date', date('Y/m/d'));
     $this->getWidgetSchema()->setDefault('end_date', date('Y/m/d'));
     $this->setWidget('all_day', new sfWidgetFormInputCheckbox(array('label' => 'All Day')));
     $this->setValidator('all_day', new sfValidatorBoolean());
     $start = strtotime(aDate::mysql($this->object->start_date));
     $end = strtotime(aDate::mysql($this->object->end_date));
     if (is_null($this->object->start_time) && is_null($this->object->end_time)) {
         $this->getWidgetSchema()->setDefault('all_day', true);
     }
     $this->widgetSchema->setNameFormat('a_blog_item[%s]');
     $this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'validateEndDate'))));
 }
 public function setup()
 {
     parent::setup();
     $this->setWidget('start_date', new sfWidgetFormJQueryDateTime(array('date' => array('image' => '/apostrophePlugin/images/a-icon-datepicker.png'))));
     $this->setValidator('start_date', new sfValidatorDateTime(array('required' => true)));
     $this->setWidget('end_date', new sfWidgetFormJQueryDateTime(array('date' => array('image' => '/apostrophePlugin/images/a-icon-datepicker.png'))));
     $this->setValidator('end_date', new sfValidatorDateTime(array('required' => true)));
     if ($this->getObject()->getStartDate() == $this->getObject()->getEndDate()) {
         $this->getWidget('start_date')->addOption('with_time', false);
         $this->getWidget('end_date')->addOption('with_time', false);
     }
     $this->getWidgetSchema()->setDefault('start_date', date('Y/m/d'));
     $this->getWidgetSchema()->setDefault('end_date', date('Y/m/d'));
     $this->widgetSchema->setNameFormat('a_blog_item[%s]');
 }