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. #1940

Closed
jgerman-bot opened this issue Jul 2, 2021 · 0 comments · Fixed by #1944
Closed

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

jgerman-bot opened this issue Jul 2, 2021 · 0 comments · Fixed by #1944

Comments

@jgerman-bot
Copy link

New language relevant PR in upstream repo: joomla/joomla-cms#31675 Here are the upstream changes:

Click to expand the diff!
diff --git a/administrator/components/com_actionlogs/config.xml b/administrator/components/com_actionlogs/config.xml
index 8ccd6e176e251..f84146d31ccf0 100644
--- a/administrator/components/com_actionlogs/config.xml
+++ b/administrator/components/com_actionlogs/config.xml
@@ -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>
diff --git a/administrator/components/com_actionlogs/src/View/Actionlogs/HtmlView.php b/administrator/components/com_actionlogs/src/View/Actionlogs/HtmlView.php
index 77a559496e7b7..1eb52ab681fa0 100644
--- a/administrator/components/com_actionlogs/src/View/Actionlogs/HtmlView.php
+++ b/administrator/components/com_actionlogs/src/View/Actionlogs/HtmlView.php
@@ -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.
 	 *
@@ -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()))
 		{
diff --git a/administrator/components/com_actionlogs/tmpl/actionlogs/default.php b/administrator/components/com_actionlogs/tmpl/actionlogs/default.php
index a9b88b5782c7f..41d6d976838e1 100644
--- a/administrator/components/com_actionlogs/tmpl/actionlogs/default.php
+++ b/administrator/components/com_actionlogs/tmpl/actionlogs/default.php
@@ -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); ?>
diff --git a/administrator/language/en-GB/com_actionlogs.ini b/administrator/language/en-GB/com_actionlogs.ini
index a29e34ac7785c..058f2a3af51b9 100644
--- a/administrator/language/en-GB/com_actionlogs.ini
+++ b/administrator/language/en-GB/com_actionlogs.ini
@@ -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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants