Skip to content

Commit a72fb5d

Browse files
HarmageddonQuy
andauthored
[4.1] Actionlogs: Added parameter to disable relative timestamps. (#31675)
* Actionlogs: Added parameter to disable relative timestamps. * Update administrator/components/com_actionlogs/config.xml Co-authored-by: Quy <[email protected]> * Apply suggestions from code review Co-authored-by: Quy <[email protected]> Co-authored-by: Quy <[email protected]>
1 parent 7152030 commit a72fb5d

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

administrator/components/com_actionlogs/config.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,16 @@
5656
<option value="PUT">COM_ACTIONLOGS_FIELD_VALUE_PUT</option>
5757
<option value="PATCH">COM_ACTIONLOGS_FIELD_VALUE_PATCH</option>
5858
</field>
59+
<field
60+
name="date_relative"
61+
type="radio"
62+
label="COM_ACTIONLOGS_DATE_RELATIVE_LABEL"
63+
layout="joomla.form.field.radio.switcher"
64+
default="1"
65+
filter="integer"
66+
>
67+
<option value="0">JHIDE</option>
68+
<option value="1">JSHOW</option>
69+
</field>
5970
</fieldset>
6071
</config>

administrator/components/com_actionlogs/src/View/Actionlogs/HtmlView.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ class HtmlView extends BaseHtmlView
7878
*/
7979
protected $showIpColumn = false;
8080

81+
/**
82+
* Setting if the date should be displayed relative to the current date.
83+
*
84+
* @var boolean
85+
* @since __DEPLOY_VERSION__
86+
*/
87+
protected $dateRelative = false;
88+
8189
/**
8290
* Method to display the view.
8391
*
@@ -100,6 +108,7 @@ public function display($tpl = null)
100108
$this->activeFilters = $model->getActiveFilters();
101109
$params = ComponentHelper::getParams('com_actionlogs');
102110
$this->showIpColumn = (bool) $params->get('ip_logging', 0);
111+
$this->dateRelative = (bool) $params->get('date_relative', 1);
103112

104113
if (count($errors = $model->getErrors()))
105114
{

administrator/components/com_actionlogs/tmpl/actionlogs/default.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,14 @@
8888
<?php echo $this->escape(Text::_($extension)); ?>
8989
</td>
9090
<td class="d-none d-md-table-cell">
91-
<?php echo HTMLHelper::_('date.relative', $item->log_date); ?>
92-
<div class="small">
91+
<?php if ($this->dateRelative) : ?>
92+
<?php echo HTMLHelper::_('date.relative', $item->log_date); ?>
93+
<div class="small">
94+
<?php endif; ?>
9395
<?php echo HTMLHelper::_('date', $item->log_date, Text::_('DATE_FORMAT_LC6')); ?>
94-
</div>
96+
<?php if ($this->dateRelative) : ?>
97+
</div>
98+
<?php endif; ?>
9599
</td>
96100
<td class="d-md-table-cell">
97101
<?php echo $this->escape($item->name); ?>

administrator/language/en-GB/com_actionlogs.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ COM_ACTIONLOGS_COMMA="Comma"
1414
COM_ACTIONLOGS_CONFIGURATION="User Actions Log: Options"
1515
COM_ACTIONLOGS_CSV_DELIMITER_LABEL="CSV Delimiter"
1616
COM_ACTIONLOGS_DATE="Date"
17+
COM_ACTIONLOGS_DATE_RELATIVE_LABEL="Relative Date/Time"
1718
COM_ACTIONLOGS_DISABLED="Disabled"
1819
COM_ACTIONLOGS_EMAIL_BODY="Latest User Actions\n------\nThis is the latest action performed by a user on your website.\n\nAction | Date | Extension | Name\n{MESSAGES} {MESSAGE} | {DATE} | {EXTENSION} | {USERNAME} \n{/MESSAGES}"
1920
COM_ACTIONLOGS_EMAIL_DESC="This is the latest action performed by a user on your website."

0 commit comments

Comments
 (0)