users-statistics.phtml 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * @version 7.1
  4. */
  5. ?>
  6. <div class="table-responsive">
  7. <table class="table table-striped table-hover">
  8. <caption>
  9. <strong><?php echo $this->paginator->getPages()->totalItemCount; ?></strong> <?php echo $this->_('online users found.'); ?>
  10. <?php if ($this->paginator->getPages()->totalItemCount) { ?>
  11. <?php echo $this->_('Showing results'); ?>
  12. <strong><?php echo $this->paginator->getPages()->firstItemNumber; ?></strong>
  13. <?php echo $this->_('to'); ?>
  14. <strong><?php echo $this->paginator->getPages()->lastItemNumber; ?></strong>
  15. <?php } ?>
  16. </caption>
  17. <?php if ($this->paginator->getPages()->totalItemCount) { ?>
  18. <thead>
  19. <tr>
  20. <th class="size-small"><?php echo $this->_('User / IP'); ?></th>
  21. <th><?php echo $this->_('Active Page'); ?></th>
  22. <th class="size-medium"><?php echo $this->_('Browser'); ?></th>
  23. <th class="size-mini"><?php echo $this->_('Language'); ?></th>
  24. <th class="size-mini"><?php echo $this->_('Session Duration'); ?></th>
  25. </tr>
  26. </thead>
  27. <?php } ?>
  28. <tbody>
  29. <?php
  30. /** @var \Cube\Db\Table\Row $stat */
  31. foreach ($this->paginator as $stat) {
  32. $link = $this->url($stat['request_uri'], null, false, null, false);
  33. $user = $stat->findParentRow('\Ppb\Db\Table\Users');
  34. ?>
  35. <tr>
  36. <td>
  37. <div><?php echo $this->fieldDisplay($user, $user['username'], '<em>' . $this->_('Guest') . '</em>'); ?></div>
  38. <div>
  39. <small>
  40. <abbr
  41. title="<?php echo @gethostbyaddr($stat['remote_addr']); ?>"><?php echo $stat['remote_addr']; ?></abbr>
  42. </small>
  43. </div>
  44. </td>
  45. <td>
  46. <div>
  47. <a href="<?php echo $link; ?>" target="_blank">
  48. <?php echo $stat['request_uri']; ?>
  49. </a>
  50. </div>
  51. <div>
  52. <small><?php echo $stat['page_title']; ?></small>
  53. </div>
  54. <?php if (!empty($stat['http_referrer'])) { ?>
  55. <div>
  56. <small><em><?php echo $stat['http_referrer']; ?></em></small>
  57. </div>
  58. <?php } ?>
  59. </td>
  60. <td>
  61. <small>
  62. <abbr
  63. title="<?php echo $stat['http_user_agent']; ?>"><?php echo substr($stat['http_user_agent'], 0, 60) . ' ... '; ?></abbr>
  64. </small>
  65. </td>
  66. <td>
  67. <small>
  68. <?php echo $stat['http_accept_language']; ?>
  69. </small>
  70. </td>
  71. <td>
  72. <?php
  73. $start = new \DateTime($stat['created_at']);
  74. $updatedAt = ($stat['updated_at'] == $stat['created_at']) ? date('Y-m-d H:i:s', time()) : $stat['updated_at'];
  75. $interval = $start->diff(new \DateTime($updatedAt));
  76. echo $interval->format('%i:%S');
  77. ?>
  78. </td>
  79. </tr>
  80. <?php } ?>
  81. </tbody>
  82. </table>
  83. </div>
  84. <?php echo $this->pagination($this->paginator, 'sliding', 'partials/pagination.phtml'); ?>