public function configure() { // these values are defined in the comment to the 'date_format' field of the user table $formats = PcCommonData::getDateFormats(); $this->setWidgets(array('format' => new sfWidgetFormSelect(array('choices' => $formats)))); $this->setValidators(array('format' => new sfValidatorInteger(array('min' => 0, 'max' => 4)))); $this->widgetSchema->setLabels(array('format' => __('ACCOUNT_SETTINGS_SELECT_DATE_FORMAT'))); $this->widgetSchema->setNameFormat('dateFormat[%s]'); }
/** * Maps the ids on the database to a string: * 0 -> Y-m-d * 3 -> d-m-Y * 4 -> m-d-Y * * @param boolean $returnIndex (=false) - whether to return the actual format or the index * @return string */ public function getDateFormat($returnIndex = false) { if ($returnIndex) { return parent::getDateFormat(); } $dt = PcCommonData::getDateFormats(); return $dt[parent::getDateFormat()]; }