From 141dc24d7184e3588708bcd76eddcdf2be608687 Mon Sep 17 00:00:00 2001 From: Jens Martsch Date: Wed, 15 Feb 2017 14:40:55 +0100 Subject: [PATCH 1/2] using getLabel function instead of $field->get('label|name') for compatibility with multilanguage setups added icon for the user --- MarkupActivityLog.module | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/MarkupActivityLog.module b/MarkupActivityLog.module index 309f4b6..d41f44a 100644 --- a/MarkupActivityLog.module +++ b/MarkupActivityLog.module @@ -4,7 +4,7 @@ class MarkupActivityLog extends WireData implements Module, ConfigurableModule { public static function getModuleInfo() { return array( - 'title' => __('Activity Log'), + 'title' => __('Activity Log'), 'version' => '1.0.1', 'author' => 'Tom Reno (Renobird)', 'summary' => __('Adds an Activity Log tab to pages. Configurable to specific templates.'), @@ -223,10 +223,12 @@ class MarkupActivityLog extends WireData implements Module, ConfigurableModule { if (array_key_exists($entry->field, $this->builtInPageFields)){ $type = $entry->field; $fieldLabel = $this->builtInPageFields["$entry->field"]; + $fieldLabel = wire("fields")->get($fieldLabel)->getLabel(); } else { $field = wire()->fields->get($entry->field); - $fieldLabel = $field->get('label|name'); + $fieldLabel = $field->get('name'); + $fieldLabel = wire("fields")->get($fieldLabel)->getLabel(); $type = $field->type->name; } @@ -238,7 +240,11 @@ class MarkupActivityLog extends WireData implements Module, ConfigurableModule { case 'status': $out[] = $this->formatStatusChange($fieldLabel, $type, $old, $new); break; - + + case 'FieldtypeDatetime': + $out[] = array("field" => $fieldLabel, "type" => $type, "old" => strftime('%d.%m.%Y %H:%M:%S', $old), "new" => strftime('%d.%m.%Y %H:%M:%S', $new)); + break; + default: $out[] = array("field" => $fieldLabel, "type" => $type, "old" => $old, "new" => $new); break; From 02b99b2f2075c8e5d17b350bc9ee3d1b73d463ae Mon Sep 17 00:00:00 2001 From: Jens Martsch Date: Wed, 15 Feb 2017 14:59:27 +0100 Subject: [PATCH 2/2] For people who don't have short_open_tag enabled in their php.ini Use getLabel function instead of $field->get('label|name') for compatibility with multilanguage setups added icon for the user --- MarkupActivityLog.inc | 51 ++++++++++++++++---------------- ProcessActivityLogService.module | 4 ++- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/MarkupActivityLog.inc b/MarkupActivityLog.inc index 2eb9436..f46e29b 100644 --- a/MarkupActivityLog.inc +++ b/MarkupActivityLog.inc @@ -1,27 +1,28 @@
- - date):?> -
date;?>
-
 
- -
time;?>
-
-
    -
  • user_fields;?>
  • - - changes as $change):?> -
  • - field ;?> - type == 'FieldtypeTextarea'):?> - - - old;?> - new;?> - -
  • - - -
-
- + + date) { ?> +
date; ?>
+
 
+ +
time; ?>
+
+
    +
  • user_fields; ?>
  • + + changes as $change) { ?> +
  • + field; ?> + type == 'FieldtypeTextarea') { ?> + + + + old; ?> + + new; ?> + +
  • + +
+
+
\ No newline at end of file diff --git a/ProcessActivityLogService.module b/ProcessActivityLogService.module index 35ba820..142a294 100644 --- a/ProcessActivityLogService.module +++ b/ProcessActivityLogService.module @@ -121,7 +121,9 @@ class ProcessActivityLogService extends Process { if ($entry->field != $fieldID) continue; // split if this is not the requested field. $field = wire()->fields->get($entry->field); - $fieldLabel = $field->get('label|name'); + $fieldLabel = $field->get('name'); + $fieldLabel = wire("fields")->get($fieldLabel)->getLabel(); + $log = $this->modules->get('MarkupActivityLog'); $date = date($log->getDateFormat(), strtotime($row['date'])); $time = date($log->getTimeFormat(), strtotime($row['date']));