Support of date and time custom formats... for custom fields !!

SVN:trunk[4023]
This commit is contained in:
Denis Flaven
2016-05-03 15:17:46 +00:00
parent 668e822fc6
commit 3579f557d1
8 changed files with 189 additions and 9 deletions

View File

@@ -29,9 +29,22 @@ class DateTimeField extends StringField
{
protected $sJSDateTimeFormat;
protected $sPHPDateTimeFormat;
protected $bDateOnly;
/**
* Overloaded constructor
*
* @param string $sId
* @param Closure $onFinalizeCallback (Used in the $oForm->AddField($sId, ..., function() use ($oManager, $oForm, '...') { ... } ); )
*/
public function __construct($sId, Closure $onFinalizeCallback = null)
{
parent::__construct($sId, $onFinalizeCallback);
$this->bDateOnly = false;
}
/**
* Get the PHP format string
* @return string
*/
public function GetPHPDateTimeFormat()
@@ -51,7 +64,6 @@ class DateTimeField extends StringField
}
/**
*
* @return string
*/
public function GetJSDateTimeFormat()
@@ -74,4 +86,21 @@ class DateTimeField extends StringField
{
return AttributeDatetime::GetFormat()->Format($this->currentValue);
}
/**
* Set the DateOnly flag
* @return \Combodo\iTop\Form\Field\DateTimeField
*/
public function SetDateOnly($bDateOnly)
{
return $this->bDateOnly = $bDateOnly;
return $this;
}
/**
* @return bool
*/
public function IsDateOnly()
{
return $this->bDateOnly;
}
}