Skip to content
Open
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
51 changes: 26 additions & 25 deletions MarkupActivityLog.inc
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
<dl class="MarkupActivityLog">
<?php foreach ($entries as $entry):?>
<?php if ($entry->date):?>
<dt class="date-stamp"><i class="fa fa-calendar"></i> <?php echo $entry->date;?></dt>
<dd class="date-stamp">&nbsp;</dd>
<? endif; ?>
<dt><i class="fa fa-clock-o"></i> <?php echo $entry->time;?></dt>
<dd>
<ul>
<li><?php echo $entry->user_fields;?></li>

<?php foreach ($entry->changes as $change):?>
<li>
<?php echo __("Changed ");?> <b><?php echo $change->field ;?></b>
<?php if ($change->type == 'FieldtypeTextarea'):?>
<a href="<?php echo $config->urls->admin;?>activity-log-service/<?php echo $change->attrs; ?>" class="view-diff"><?php echo __('View Changes');?></a>
<? else: ?>
<?php echo __("from ");?> <del class='diffmod'><?php echo $change->old;?></del>
<?php echo __("to ");?> <ins class='diffmod'><?php echo $change->new;?></ins>
<? endif; ?>
</li>
<? endforeach; ?>

</ul>
</dd>
<? endforeach; ?>
<?php foreach ($entries as $entry) { ?>
<?php if ($entry->date) { ?>
<dt class="date-stamp"><i class="fa fa-calendar"></i> <?php echo $entry->date; ?></dt>
<dd class="date-stamp">&nbsp;</dd>
<?php } ?>
<dt><i class="fa fa-clock-o"></i> <?php echo $entry->time; ?></dt>
<dd>
<ul>
<li><i class="fa fa-user"></i> <?php echo $entry->user_fields; ?></li>

<?php foreach ($entry->changes as $change) { ?>
<li>
<b><?php echo $change->field; ?></b> <?php echo __("Changed "); ?>
<?php if ($change->type == 'FieldtypeTextarea') { ?>
<a href="<?php echo $config->urls->admin; ?>activity-log-service/<?php echo $change->attrs; ?>" class="view-diff"><?php echo __('View Changes'); ?></a>
<?php } else { ?>
<?php echo __("from "); ?>
<del class='diffmod'><?php echo $change->old; ?></del>
<?php echo __("to "); ?>
<span class='diffmod'><?php echo $change->new; ?></span>
<?php } ?>
</li>
<?php } ?>
</ul>
</dd>
<?php } ?>
</dl>
12 changes: 9 additions & 3 deletions MarkupActivityLog.module
Original file line number Diff line number Diff line change
Expand Up @@ -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.'),
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion ProcessActivityLogService.module
Original file line number Diff line number Diff line change
Expand Up @@ -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']));
Expand Down