settings-settings-logs.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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-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. <div class="white-box bg-org 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. <tfoot>
  29. <tr>
  30. <th lang="en">Date</th>
  31. <th lang="en">Username</th>
  32. <th lang="en">IP Address</th>
  33. <th lang="en">Type</th>
  34. </tr>
  35. </tfoot>
  36. <tbody></tbody>
  37. </table>
  38. </div>
  39. </div>
  40. <div class="white-box bg-org logTable orgLogDiv hidden">
  41. <h3 class="box-title m-b-0" lang="en">Organizr Logs</h3>
  42. <div class="table-responsive">
  43. <table id="organizrLogTable" class="table table-striped">
  44. <thead>
  45. <tr>
  46. <th lang="en">Date</th>
  47. <th lang="en">Username</th>
  48. <th lang="en">IP Address</th>
  49. <th lang="en">Message</th>
  50. <th lang="en">Type</th>
  51. </tr>
  52. </thead>
  53. <tfoot>
  54. <tr>
  55. <th lang="en">Date</th>
  56. <th lang="en">Username</th>
  57. <th lang="en">IP Address</th>
  58. <th lang="en">Message</th>
  59. <th lang="en">Type</th>
  60. </tr>
  61. </tfoot>
  62. <tbody></tbody>
  63. </table>
  64. </div>
  65. </div>
  66. <!-- /.container-fluid -->
  67. <script>
  68. //$.fn.dataTable.moment(\'DD-MMM-Y HH:mm:ss\');
  69. $("#loginLogTable").DataTable( {
  70. "ajax": "api/?v1/login_log",
  71. "columns": [
  72. { data: \'utc_date\',
  73. render: function ( data, type, row ) {
  74. if ( type === \'display\' || type === \'filter\' ) {
  75. var m = moment.tz(data, activeInfo.timezone);
  76. return moment(m).format(\'LLL\');
  77. }
  78. return data;
  79. }
  80. },
  81. { "data": "username" },
  82. { "data": "ip" },
  83. { data: \'auth_type\',
  84. render: function ( data, type, row ) {
  85. if ( type === \'display\' || type === \'filter\' ) {
  86. return logIcon(data);
  87. }
  88. return logIcon(data);
  89. }
  90. }
  91. ],
  92. "order": [[ 0, \'desc\' ]],
  93. } );
  94. $("#organizrLogTable").DataTable( {
  95. "ajax": "api/?v1/organizr_log",
  96. "columns": [
  97. { data: \'utc_date\',
  98. render: function ( data, type, row ) {
  99. // If display or filter data is requested, format the date
  100. if ( type === \'display\' || type === \'filter\' ) {
  101. var m = moment.tz(data, activeInfo.timezone);
  102. return moment(m).format(\'LLL\');
  103. }
  104. // Otherwise the data type requested (`type`) is type detection or
  105. // sorting data, for which we want to use the integer, so just return
  106. // that, unaltered
  107. return data;}
  108. },
  109. { "data": "username" },
  110. { "data": "ip" },
  111. { "data": "message" },
  112. { data: \'type\',
  113. render: function ( data, type, row ) {
  114. if ( type === \'display\' || type === \'filter\' ) {
  115. return logIcon(data);
  116. }
  117. return logIcon(data);
  118. }
  119. }
  120. ],
  121. "order": [[ 0, \'desc\' ]],
  122. } );
  123. </script>
  124. ';