From 5bfe6334b67c110636716c4b6225cea8e4fe2b80 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Fri, 2 Jul 2010 22:02:25 +0200 Subject: [PATCH] Simplify --- turba/lib/Object.php | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/turba/lib/Object.php b/turba/lib/Object.php index f0968270c..c3a0663ca 100644 --- a/turba/lib/Object.php +++ b/turba/lib/Object.php @@ -205,34 +205,18 @@ class Turba_Object { ->getInstance('Horde_History') ->getHistory($this->getGuid()); foreach ($log as $entry) { - switch ($entry['action']) { - case 'add': + if ($entry['action'] == 'add' || $entry['action'] == 'modify') { if ($GLOBALS['registry']->getAuth() != $entry['who']) { - $createdby = sprintf(_("by %s"), Turba::getUserName($entry['who'])); + $by = sprintf(_("by %s"), Turba::getUserName($entry['who'])); } else { - $createdby = _("by me"); + $by = _("by me"); } - $history['created'] + $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($createdby, ENT_COMPAT, Horde_Nls::getCharset()); - break; - - case 'modify': - if ($GLOBALS['registry']->getAuth() != $entry['who']) { - $modifiedby = sprintf(_("by %s"), Turba::getUserName($entry['who'])); - } else { - $modifiedby = _("by me"); - } - $history['modified'] - = strftime($GLOBALS['prefs']->getValue('date_format'), $entry['ts']) - . ' ' - . date($GLOBALS['prefs']->getValue('twentyFour') ? 'G:i' : 'g:i a', $entry['ts']) - . ' ' - . @htmlspecialchars($modifiedby, ENT_COMPAT, Horde_Nls::getCharset()); - break; + . @htmlspecialchars($by, ENT_COMPAT, Horde_Nls::getCharset()); } } } catch (Exception $e) { -- 2.11.0