diff --git a/core/attributedef/AttributeDuration.php b/core/attributedef/AttributeDuration.php new file mode 100644 index 000000000..f875f22b7 --- /dev/null +++ b/core/attributedef/AttributeDuration.php @@ -0,0 +1,130 @@ + $days, 'hours' => $hours, 'minutes' => $minutes, 'seconds' => $seconds); + } + + public static function GetFormFieldClass() + { + return '\\Combodo\\iTop\\Form\\Field\\DurationField'; + } + + public function MakeFormField(DBObject $oObject, $oFormField = null) + { + if ($oFormField === null) { + $sFormFieldClass = static::GetFormFieldClass(); + $oFormField = new $sFormFieldClass($this->GetCode()); + } + parent::MakeFormField($oObject, $oFormField); + + // Note : As of today, this attribute is -by nature- only supported in readonly mode, not edition + $sAttCode = $this->GetCode(); + $oFormField->SetCurrentValue($oObject->Get($sAttCode)); + $oFormField->SetReadOnly(true); + + return $oFormField; + } + +} \ No newline at end of file