settings-settings-logs.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. $pageSettingsSettingsLogs = '
  3. <script>
  4. $(document).on("click", ".swapLog", function(e) {
  5. var log = $(this).attr(\'data-name\')+\'Div\';
  6. $(\'.logTable\').addClass(\'hidden\');
  7. $(\'.\'+log).addClass(\'show\').removeClass(\'hidden\');
  8. $(\'.swapLog\').removeClass(\'active\');
  9. $(this).addClass(\'active\');
  10. });
  11. </script>
  12. <div class="btn-group m-b-20 pull-left">
  13. <button type="button" class="btn btn-default btn-outline waves-effect bg-org swapLog active" data-name="loginLog" lang="en">Login Log</button>
  14. <button type="button" class="btn btn-default btn-outline waves-effect bg-org swapLog" data-name="orgLog" lang="en">Organizr Log</button>
  15. </div>
  16. <button class="btn btn-danger btn-sm waves-effect waves-light pull-right purgeLog" type="button"><span class="btn-label"><i class="fa fa-trash"></i></span>Purge Log</button>
  17. <div class="clearfix"></div>
  18. <div class="white-box bg-org logTable loginLogDiv">
  19. <h3 class="box-title m-b-0" lang="en">Login Logs</h3>
  20. <div class="table-responsive">
  21. <table id="loginLogTable" class="table table-striped">
  22. <thead>
  23. <tr>
  24. <th lang="en">Date</th>
  25. <th lang="en">Username</th>
  26. <th lang="en">IP Address</th>
  27. <th lang="en">Type</th>
  28. </tr>
  29. </thead>
  30. <tfoot>
  31. <tr>
  32. <th lang="en">Date</th>
  33. <th lang="en">Username</th>
  34. <th lang="en">IP Address</th>
  35. <th lang="en">Type</th>
  36. </tr>
  37. </tfoot>
  38. <tbody></tbody>
  39. </table>
  40. </div>
  41. </div>
  42. <div class="white-box bg-org logTable orgLogDiv hidden">
  43. <h3 class="box-title m-b-0" lang="en">Organizr Logs</h3>
  44. <div class="table-responsive">
  45. <table id="organizrLogTable" class="table table-striped">
  46. <thead>
  47. <tr>
  48. <th lang="en">Date</th>
  49. <th lang="en">Username</th>
  50. <th lang="en">IP Address</th>
  51. <th lang="en">Message</th>
  52. <th lang="en">Type</th>
  53. </tr>
  54. </thead>
  55. <tfoot>
  56. <tr>
  57. <th lang="en">Date</th>
  58. <th lang="en">Username</th>
  59. <th lang="en">IP Address</th>
  60. <th lang="en">Message</th>
  61. <th lang="en">Type</th>
  62. </tr>
  63. </tfoot>
  64. <tbody></tbody>
  65. </table>
  66. </div>
  67. </div>
  68. <!-- /.container-fluid -->
  69. <script>
  70. //$.fn.dataTable.moment(\'DD-MMM-Y HH:mm:ss\');
  71. $("#loginLogTable").DataTable( {
  72. "ajax": "api/?v1/login_log",
  73. "columns": [
  74. { data: \'utc_date\',
  75. render: function ( data, type, row ) {
  76. if ( type === \'display\' || type === \'filter\' ) {
  77. var m = moment.tz(data, activeInfo.timezone);
  78. return moment(m).format(\'LLL\');
  79. }
  80. return data;
  81. }
  82. },
  83. { "data": "username" },
  84. { "data": "ip" },
  85. { data: \'auth_type\',
  86. render: function ( data, type, row ) {
  87. if ( type === \'display\' || type === \'filter\' ) {
  88. return logIcon(data);
  89. }
  90. return logIcon(data);
  91. }
  92. }
  93. ],
  94. "order": [[ 0, \'desc\' ]],
  95. } );
  96. $("#organizrLogTable").DataTable( {
  97. "ajax": "api/?v1/organizr_log",
  98. "columns": [
  99. { data: \'utc_date\',
  100. render: function ( data, type, row ) {
  101. // If display or filter data is requested, format the date
  102. if ( type === \'display\' || type === \'filter\' ) {
  103. var m = moment.tz(data, activeInfo.timezone);
  104. return moment(m).format(\'LLL\');
  105. }
  106. // Otherwise the data type requested (`type`) is type detection or
  107. // sorting data, for which we want to use the integer, so just return
  108. // that, unaltered
  109. return data;}
  110. },
  111. { "data": "username" },
  112. { "data": "ip" },
  113. { "data": "message" },
  114. { data: \'type\',
  115. render: function ( data, type, row ) {
  116. if ( type === \'display\' || type === \'filter\' ) {
  117. return logIcon(data);
  118. }
  119. return logIcon(data);
  120. }
  121. }
  122. ],
  123. "order": [[ 0, \'desc\' ]],
  124. } );
  125. </script>
  126. ';