MINOR Removed unnecessary $timeformat parameter from TimeField::__construct, and getting the default from Zend_Locale_Format in the same way that DateField behaves (unreleased API, so no api change).

MINOR Automatically choosing $locale in TimeField::__construct, to be consistent with DateField (from r103975)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112328 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-10-14 23:53:13 +00:00
parent 683cf79fe6
commit c969e04731

View File

@ -30,7 +30,7 @@ class TimeField extends TextField {
protected $config = array(
'showdropdown' => false,
'timeformat' => null,
'timeformat' => 'HH:mm:ss',
'use_strtotime' => true,
'datavalueformat' => 'HH:mm:ss'
);
@ -47,20 +47,13 @@ class TimeField extends TextField {
*/
protected $valueObj = null;
/**
* Constructor saves the format difference. Timefields shouldn't
* have a problem with length as times can only be represented in on way.
*
* @param $name string The name of the field
* @param $title string The Title of the field
* @param $value string the value for the field
* @param $timeformat string The Time format in ISO format (see Zend_Date)
*/
function __construct($name, $title = null, $value = "",$timeformat = 'HH:mm:ss'){
if($timeformat) {
$this->setConfig('timeformat', $timeformat);
} else {
$this->setConfig('timeformat', Zend_Locale_Format::getTimeFormat($this->locale));
function __construct($name, $title = null, $value = ""){
if(!$this->locale) {
$this->locale = i18n::get_locale();
}
if(!$this->getConfig('timeformat')) {
$this->setConfig('timeformat', Zend_Locale_Format::getDateFormat($this->locale));
}
parent::__construct($name,$title,$value);