<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
?>
<?php include APPLICATION_PATH . '/application/modules/Gdpr/views/scripts/_adminHeader.tpl'; ?>

<p><?php echo $this->translate('This page lists audit log for the user selected by you. Use the search box to find the user for which you want to see the audit log for various consents on your website.'); ?></p>
<div class='admin_search '>
  <?php echo $this->formFilter->render($this) ?>
</div>
<?php if ($this->paginator->getTotalItemCount()) { ?>
  <div>
  <textarea class="w-100" style="min-height:200px;"><?php
    $table = Engine_Api::_()->getDbTable('users', 'user');
    $counter = 0;
    foreach ($this->paginator as $item) {
      if ($item->email && !$counter) {
        $date = $table->select()->from($table->info('name'), 'creation_date')->where('email =?', $item->email)->limit(1)->query()
          ->fetchColumn();
        echo date("Y-m-d H:i:s", strtotime($date)) . ' User registered on site.&#013;&#010;';
      }
      echo date('Y-m-d H:i:s', strtotime($item->creation_date)) . ' ' . $item->description . '&#013;&#010;';

      $counter++;
    } ?>
    </textarea>
  </div>
<?php } else { ?>
  <ul class="form-notices d-inline-flex">
    <li><?php echo $this->translate('Please enter the users email address to view the audit log.'); ?> </li>
  </ul>
<?php } ?>
