/**
* Returns history information about this contact.
*
* @return array A hash with the optional entries 'created' and 'modified'
* and human readable history information as the values.
*/
public function getHistory()
{
if (!$this->getValue('__uid')) {
return array();
}
$history = array();
try {
$log = $GLOBALS['injector']->getInstance('Horde_History')->getHistory($this->getGuid());
foreach ($log as $entry) {
if ($entry['action'] == 'add' || $entry['action'] == 'modify') {
if ($GLOBALS['registry']->getAuth() != $entry['who']) {
$by = sprintf(_("by %s"), Turba::getUserName($entry['who']));
} else {
$by = _("by me");
}
$history[$entry['action'] == 'add' ? 'created' : 'modified'] = strftime($GLOBALS['prefs']->getValue('date_format'), $entry['ts']) . ' ' . date($GLOBALS['prefs']->getValue('twentyFour') ? 'G:i' : 'g:i a', $entry['ts']) . ' ' . htmlspecialchars($by);
}
}
} catch (Exception $e) {
return array();
}
return $history;
}