4
0

settings-settings-logs.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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">
  13. <button type="button" class="btn btn-default btn-outline waves-effect bg-theme-dark swapLog active" data-name="loginLog" lang="en">Login Log</button>
  14. <button type="button" class="btn btn-default btn-outline waves-effect bg-theme-dark swapLog" data-name="orgLog" lang="en">Organizr Log</button>
  15. </div>
  16. <div class="white-box bg-theme-dark logTable loginLogDiv">
  17. <h3 class="box-title m-b-0" lang="en">Login Logs</h3>
  18. <div class="table-responsive">
  19. <table id="loginLogTable" class="table table-striped">
  20. <thead>
  21. <tr>
  22. <th lang="en">Date</th>
  23. <th lang="en">Username</th>
  24. <th lang="en">IP Address</th>
  25. <th lang="en">Type</th>
  26. </tr>
  27. </thead>
  28. <tbody></tbody>
  29. </table>
  30. </div>
  31. </div>
  32. <div class="white-box bg-theme-dark logTable orgLogDiv hidden">
  33. <h3 class="box-title m-b-0" lang="en">Organizr Logs</h3>
  34. <div class="table-responsive">
  35. <table id="organizrLogTable" class="table table-striped">
  36. <thead>
  37. <tr>
  38. <th lang="en">Date</th>
  39. <th lang="en">Username</th>
  40. <th lang="en">IP Address</th>
  41. <th lang="en">Message</th>
  42. <th lang="en">Type</th>
  43. </tr>
  44. </thead>
  45. <tbody></tbody>
  46. </table>
  47. </div>
  48. </div>
  49. <!-- /.container-fluid -->
  50. <script>
  51. //$.fn.dataTable.moment(\'DD-MMM-Y HH:mm:ss\');
  52. $("#loginLogTable").DataTable( {
  53. "ajax": "api/?v1/login_log",
  54. "columns": [
  55. { data: \'utc_date\',
  56. render: function ( data, type, row ) {
  57. if ( type === \'display\' || type === \'filter\' ) {
  58. var m = moment.tz(data, activeInfo.timezone);
  59. return moment(m).format(\'LLL\');
  60. }
  61. return data;
  62. }
  63. },
  64. { "data": "username" },
  65. { "data": "ip" },
  66. { data: \'auth_type\',
  67. render: function ( data, type, row ) {
  68. if ( type === \'display\' || type === \'filter\' ) {
  69. return logIcon(data);
  70. }
  71. return logIcon(data);
  72. }
  73. }
  74. ],
  75. "order": [[ 0, \'desc\' ]],
  76. } );
  77. $("#organizrLogTable").DataTable( {
  78. "ajax": "api/?v1/organizr_log",
  79. "columns": [
  80. { data: \'utc_date\',
  81. render: function ( data, type, row ) {
  82. // If display or filter data is requested, format the date
  83. if ( type === \'display\' || type === \'filter\' ) {
  84. var m = moment.tz(data, activeInfo.timezone);
  85. return moment(m).format(\'LLL\');
  86. }
  87. // Otherwise the data type requested (`type`) is type detection or
  88. // sorting data, for which we want to use the integer, so just return
  89. // that, unaltered
  90. return data;}
  91. },
  92. { "data": "username" },
  93. { "data": "ip" },
  94. { "data": "message" },
  95. { data: \'type\',
  96. render: function ( data, type, row ) {
  97. if ( type === \'display\' || type === \'filter\' ) {
  98. return logIcon(data);
  99. }
  100. return logIcon(data);
  101. }
  102. }
  103. ],
  104. "order": [[ 0, \'desc\' ]],
  105. } );
  106. </script>
  107. ';