dashboard.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <html>
  2. <?php include("header.php") ?>
  3. <style type="text/css">
  4. </style>
  5. <div id="message-center"></div>
  6. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js"></script>
  7. <div style="width: 70%; margin-left: auto; margin-right: auto;">
  8. <canvas id="canvas"></canvas>
  9. </div>
  10. <div style="clear: both;">
  11. <table style="margin: auto; width: 70%;">
  12. <?php foreach($activity_log as $record) : ?>
  13. <tr>
  14. <td>
  15. <?=$record['message']?> on <?=$record['recordtime']?>
  16. </td>
  17. </tr>
  18. <?php endforeach; ?>
  19. </table>
  20. </div>
  21. <script>
  22. window.chartColors = {
  23. red: 'rgb(255, 99, 132)',
  24. orange: 'rgb(255, 159, 64)',
  25. yellow: 'rgb(255, 205, 86)',
  26. green: 'rgb(75, 192, 192)',
  27. blue: 'rgb(54, 162, 235)',
  28. purple: 'rgb(153, 102, 255)',
  29. grey: 'rgb(201, 203, 207)'
  30. };
  31. var config = {
  32. type: 'line',
  33. data: {
  34. labels: ["<?=implode("\", \"", $last_seven_days)?>"],
  35. datasets: [
  36. /*{
  37. label: "Admin Logins",
  38. backgroundColor: window.chartColors.blue,
  39. borderColor: window.chartColors.blue,
  40. data: [<?=implode(", ", $admin_logins)?>],
  41. fill: false,
  42. }, {
  43. label: "Client Logins",
  44. fill: false,
  45. backgroundColor: window.chartColors.green,
  46. borderColor: window.chartColors.green,
  47. data: [<?=implode(", ", $client_logins)?>],
  48. },*/
  49. {
  50. label: "User Logins",
  51. fill: false,
  52. backgroundColor: window.chartColors.blue,
  53. borderColor: window.chartColors.blue,
  54. data: [<?=implode(", ", $user_logins)?>],
  55. },
  56. {
  57. label: "Failed Logins",
  58. fill: false,
  59. backgroundColor: window.chartColors.red,
  60. borderColor: window.chartColors.red,
  61. data: [<?=implode(", ", $failed_logins)?>],
  62. }]
  63. },
  64. options: {
  65. responsive: true,
  66. title:{
  67. display:true,
  68. text:'User Activity'
  69. },
  70. tooltips: {
  71. mode: 'index',
  72. intersect: false,
  73. },
  74. hover: {
  75. mode: 'nearest',
  76. intersect: true
  77. },
  78. scales: {
  79. xAxes: [{
  80. display: true,
  81. scaleLabel: {
  82. display: true,
  83. labelString: 'Last Week'
  84. }
  85. }],
  86. yAxes: [{
  87. display: true,
  88. scaleLabel: {
  89. display: true,
  90. labelString: 'Logins'
  91. },
  92. ticks: {
  93. beginAtZero: true
  94. }
  95. }]
  96. }
  97. }
  98. };
  99. window.onload = function() {
  100. var ctx = document.getElementById("canvas").getContext("2d");
  101. window.myLine = new Chart(ctx, config);
  102. };
  103. var colorNames = Object.keys(window.chartColors);
  104. </script>
  105. <script type="text/javascript">
  106. document.addEventListener("DOMContentLoaded", function() {
  107. <?php foreach($abandoned_uploads as $upload): ?>
  108. showUnfinishedUploadDialog(<?=$upload['project_id']?>, "<?=$upload['project_name']?>", "<?=$upload['upload_timestamp']?>", <?=$upload['count']?>);
  109. <?php endforeach; ?>
  110. <?php if($superadmin): ?>
  111. superadminNotice();
  112. <?php endif; ?>
  113. });
  114. </script>
  115. </body>
  116. </html>