mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-05 17:14:20 +01:00
- New configuration parameter deadline_format to specify how to display Deadlines (date or time difference or a mix of the two)
SVN:trunk[1424]
This commit is contained in:
@@ -2280,17 +2280,20 @@ class AttributeDeadline extends AttributeDateTime
|
||||
$sResult = '';
|
||||
if ($value !== null)
|
||||
{
|
||||
$value = AttributeDateTime::GetAsUnixSeconds($value);
|
||||
$difference = $value - time();
|
||||
$iValue = AttributeDateTime::GetAsUnixSeconds($value);
|
||||
$sDate = parent::GetAsHTML($value, $oHostObject);
|
||||
$difference = $iValue - time();
|
||||
|
||||
if ($difference >= 0)
|
||||
{
|
||||
$sResult = self::FormatDuration($difference);
|
||||
$sDifference = self::FormatDuration($difference);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sResult = Dict::Format('UI:DeadlineMissedBy_duration', self::FormatDuration(-$difference));
|
||||
$sDifference = Dict::Format('UI:DeadlineMissedBy_duration', self::FormatDuration(-$difference));
|
||||
}
|
||||
$sFormat = MetaModel::GetConfig()->Get('deadline_format', '$difference$');
|
||||
$sResult = str_replace(array('$date$', '$difference$'), array($sDate, $sDifference), $sFormat);
|
||||
}
|
||||
return $sResult;
|
||||
}
|
||||
|
||||
@@ -392,6 +392,15 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => true,
|
||||
),
|
||||
'deadline_format' => array(
|
||||
'type' => 'string',
|
||||
'description' => 'The format used for displaying "deadline" attributes: any string with the following placeholders: $date$, $difference$',
|
||||
// examples... $date$ ($deadline$)
|
||||
'default' => '$difference$',
|
||||
'value' => '$difference$',
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => true,
|
||||
),
|
||||
);
|
||||
|
||||
public function IsProperty($sPropCode)
|
||||
|
||||
Reference in New Issue
Block a user