mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
Support of date and time custom formats... for custom fields !!
SVN:trunk[4023]
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user