- 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:
Denis Flaven
2011-08-05 13:08:56 +00:00
parent 506702c50b
commit 8cfebdf723
2 changed files with 16 additions and 4 deletions

View File

@@ -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;
}

View File

@@ -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)