Skip to content

Commit 0f476d6

Browse files
author
Magnus Berntsson
committed
Show status/action name instead of id in detailed view.
1 parent a4501fa commit 0f476d6

2 files changed

Lines changed: 38 additions & 2 deletions

File tree

  • src/app
    • code/community/FireGento/AdminMonitoring/Helper
    • design/adminhtml/default/default/template/firegento/adminmonitoring

src/app/code/community/FireGento/AdminMonitoring/Helper/Data.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,42 @@ class FireGento_AdminMonitoring_Helper_Data extends Mage_Core_Helper_Abstract
5050
const STATUS_SUCCESS = 1;
5151
const STATUS_FAILURE = 2;
5252

53+
/**
54+
* Retrieve status name from status id
55+
*
56+
* @param int $id Status id
57+
* @return string Status name
58+
*/
59+
public function statusIdToName($id)
60+
{
61+
switch ($id) {
62+
case self::STATUS_SUCCESS:
63+
return "Success";
64+
case self::STATUS_FAILURE:
65+
return "Fail";
66+
}
67+
}
68+
69+
/**
70+
* Retrieve action name from action id
71+
*
72+
* @param int $id Action id
73+
* @return string Action name
74+
*/
75+
public function actionIdToName($id)
76+
{
77+
switch ($id) {
78+
case self::ACTION_INSERT:
79+
return "Insert";
80+
case self::ACTION_UPDATE:
81+
return "Update";
82+
case self::ACTION_DELETE:
83+
return "Delete";
84+
case self::ACTION_LOGIN:
85+
return "Login";
86+
}
87+
}
88+
5389
/**
5490
* Checks if the given admin user id is excluded
5591
*

src/app/design/adminhtml/default/default/template/firegento/adminmonitoring/view.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@
7373
<tbody>
7474
<tr>
7575
<td class="label"><label><?php echo $this->__('Status') ?></label></td>
76-
<td class="value"><strong><?php echo $this->getHistory()->getData('status') ?></strong></td>
76+
<td class="value"><strong><?php echo Mage::helper('firegento_adminmonitoring')->statusIdToName($this->getHistory()->getData('status')) ?></strong></td>
7777
</tr>
7878
<tr>
7979
<td class="label"><label><?php echo $this->__('Action') ?></label></td>
80-
<td class="value"><strong><?php echo $this->getHistory()->getData('action') ?></strong></td>
80+
<td class="value"><strong><?php echo Mage::helper('firegento_adminmonitoring')->actionIdToName($this->getHistory()->getData('action')) ?></strong></td>
8181
</tr>
8282
<tr>
8383
<td class="label"><label><?php echo $this->__('Object Type') ?></label></td>

0 commit comments

Comments
 (0)