function showDates($options = array())
{
$isNewID = isset($options['withtemplate']) && $options['withtemplate'] == 2 || $this->isNewID($this->getID());
if ($isNewID) {
return true;
}
$date_creation_exists = $this->getField('date_creation') != NOT_AVAILABLE;
$date_mod_exists = $this->getField('date_mod') != NOT_AVAILABLE;
$colspan = $options['colspan'];
if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
$colspan = 1;
}
echo "<tr class='tab_bg_1 footerRow'>";
//Display when it's not a new asset being created
if ($date_creation_exists && $this->getID() > 0 && (!isset($options['withtemplate']) || $options['withtemplate'] == 0)) {
echo "<th colspan='{$colspan}'>";
printf(__('Created on %s'), Html::convDateTime($this->fields["date_creation"]));
echo "</th>";
} else {
if (!isset($options['withtemplate']) || $options['withtemplate'] == 0) {
echo "<th colspan='{$colspan}'>";
echo "</th>";
}
}
if (isset($options['withtemplate']) && $options['withtemplate']) {
echo "<th colspan='{$colspan}'>";
//TRANS: %s is the datetime of insertion
printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
echo "</th>";
}
if ($date_mod_exists) {
echo "<th colspan='{$colspan}'>";
//TRANS: %s is the datetime of update
printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
echo "</th>";
} else {
echo "<th colspan='{$colspan}'>";
echo "</th>";
}
if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) {
echo "<th colspan='" . $colspan * 2 . "'>";
printf(__('Created from the template %s'), $this->fields['template_name']);
echo "</th>";
}
echo "</tr>";
}