Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.1] Actionlogs: Added parameter to disable relative timestamps. #31675

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions administrator/components/com_actionlogs/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,16 @@
<option value="PUT">COM_ACTIONLOGS_FIELD_VALUE_PUT</option>
<option value="PATCH">COM_ACTIONLOGS_FIELD_VALUE_PATCH</option>
</field>
<field
name="date_relative"
type="radio"
label="COM_ACTIONLOGS_DATE_RELATIVE_LABEL"
layout="joomla.form.field.radio.switcher"
default="1"
filter="integer"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ class HtmlView extends BaseHtmlView
*/
protected $showIpColumn = false;

/**
* Setting if the date should be displayed relative to the current date.
*
* @var boolean
* @since __DEPLOY_VERSION__
*/
protected $dateRelative = false;

/**
* Method to display the view.
*
Expand All @@ -100,6 +108,7 @@ public function display($tpl = null)
$this->activeFilters = $model->getActiveFilters();
$params = ComponentHelper::getParams('com_actionlogs');
$this->showIpColumn = (bool) $params->get('ip_logging', 0);
$this->dateRelative = (bool) $params->get('date_relative', 1);

if (count($errors = $model->getErrors()))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,14 @@
<?php echo $this->escape(Text::_($extension)); ?>
</td>
<td class="d-none d-md-table-cell">
<?php echo HTMLHelper::_('date.relative', $item->log_date); ?>
<div class="small">
<?php if ($this->dateRelative) : ?>
<?php echo HTMLHelper::_('date.relative', $item->log_date); ?>
<div class="small">
<?php endif; ?>
<?php echo HTMLHelper::_('date', $item->log_date, Text::_('DATE_FORMAT_LC6')); ?>
</div>
<?php if ($this->dateRelative) : ?>
</div>
<?php endif; ?>
</td>
<td class="d-md-table-cell">
<?php echo $this->escape($item->name); ?>
Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/com_actionlogs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ COM_ACTIONLOGS_COMMA="Comma"
COM_ACTIONLOGS_CONFIGURATION="User Actions Log: Options"
COM_ACTIONLOGS_CSV_DELIMITER_LABEL="CSV Delimiter"
COM_ACTIONLOGS_DATE="Date"
COM_ACTIONLOGS_DATE_RELATIVE_LABEL="Relative Date/Time"
COM_ACTIONLOGS_DISABLED="Disabled"
COM_ACTIONLOGS_EMAIL_DESC="This is the latest action performed by a user on your website."
COM_ACTIONLOGS_EMAIL_SUBJECT="Latest User Actions"
Expand Down