list_access_keys.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <!-- Begin toolbar -->
  2. <div class="toolbar">
  3. <div class="toolbar-inner">
  4. <div class="toolbar-buttons">
  5. <?php if ($_SESSION["userContext"] === "admin" && $_SESSION['look'] !== '' && $_GET["user"] !== "admin") { ?>
  6. <a href="/edit/user/?<?= tohtml(http_build_query(["user" => $_SESSION["look"], "token" => $_SESSION["token"]])) ?>" class="button button-secondary button-back js-button-back">
  7. <i class="fas fa-arrow-left icon-blue"></i><?= tohtml( _("Back")) ?>
  8. </a>
  9. <?php } else { ?>
  10. <a href="/edit/user/?<?= tohtml(http_build_query(["user" => $_SESSION["user"], "token" => $_SESSION["token"]])) ?>" class="button button-secondary button-back js-button-back">
  11. <i class="fas fa-arrow-left icon-blue"></i><?= tohtml( _("Back")) ?>
  12. </a>
  13. <?php } ?>
  14. <a href="/add/access-key/" class="button button-secondary js-button-create">
  15. <i class="fas fa-circle-plus icon-green"></i><?= tohtml( _("Add Access Key")) ?>
  16. </a>
  17. </div>
  18. <div class="toolbar-right">
  19. <div class="toolbar-sorting">
  20. <button class="toolbar-sorting-toggle js-toggle-sorting-menu" type="button" title="<?= tohtml( _("Sort items")) ?>">
  21. <?= tohtml( _("Sort by")) ?>:
  22. <span class="u-text-bold">
  23. <?= tohtml( _("Date")) ?> <i class="fas fa-arrow-down-a-z"></i>
  24. </span>
  25. </button>
  26. <ul class="toolbar-sorting-menu js-sorting-menu u-hidden">
  27. <li data-entity="sort-date" data-sort-as-int="1">
  28. <span class="name <?php if ($_SESSION['userSortOrder'] === 'date') { echo 'active'; } ?>"><?= tohtml( _("Date")) ?> <i class="fas fa-arrow-down-a-z"></i></span><span class="up"><i class="fas fa-arrow-up-a-z"></i></span>
  29. </li>
  30. <li data-entity="sort-key">
  31. <span class="name"><?= tohtml( _("Access Key")) ?> <i class="fas fa-arrow-down-a-z"></i></span><span class="up"><i class="fas fa-arrow-up-a-z"></i></span>
  32. </li>
  33. <li data-entity="sort-comment">
  34. <span class="name"><?= tohtml( _("Comment")) ?> <i class="fas fa-arrow-down-a-z"></i></span><span class="up"><i class="fas fa-arrow-up-a-z"></i></span>
  35. </li>
  36. </ul>
  37. <form x-data x-bind="BulkEdit" action="/bulk/access-key/" method="post">
  38. <input type="hidden" name="token" value="<?= tohtml($_SESSION["token"]) ?>">
  39. <select class="form-select" name="action">
  40. <option value=""><?= tohtml( _("Apply to selected")) ?></option>
  41. <option value="delete"><?= tohtml( _("Delete")) ?></option>
  42. </select>
  43. <button type="submit" class="toolbar-input-submit" title="<?= tohtml( _("Apply to selected")) ?>">
  44. <i class="fas fa-arrow-right"></i>
  45. </button>
  46. </form>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <!-- End toolbar -->
  52. <div class="container">
  53. <h1 class="u-text-center u-hide-desktop u-mt20 u-pr30 u-mb20 u-pl30"><?= tohtml( _("Access Keys")) ?></h1>
  54. <div class="units-table js-units-container">
  55. <div class="units-table-header">
  56. <div class="units-table-cell">
  57. <input type="checkbox" class="js-toggle-all-checkbox" title="<?= tohtml( _("Select all")) ?>">
  58. </div>
  59. <div class="units-table-cell"><?= tohtml( _("Access Key")) ?></div>
  60. <div class="units-table-cell"></div>
  61. <div class="units-table-cell u-text-center"><?= tohtml( _("Comment")) ?></div>
  62. <div class="units-table-cell u-text-center"><?= tohtml( _("Date")) ?></div>
  63. <div class="units-table-cell u-text-center"><?= tohtml( _("Time")) ?></div>
  64. </div>
  65. <?php
  66. foreach ($data as $key => $value) {
  67. ++$i;
  68. $key_user = !empty($value['USER']) ? $value['USER'] : 'admin';
  69. $key_comment = !empty($value['COMMENT']) ? $value['COMMENT'] : '-';
  70. //$key_permissions = !empty($value['PERMISSIONS']) ? $value['PERMISSIONS'] : '-';
  71. //$key_permissions = implode(' ', $key_permissions);
  72. $key_date = !empty($value['DATE']) ? $value['DATE'] : '-';
  73. $key_time = !empty($value['TIME']) ? $value['TIME'] : '-';
  74. ?>
  75. <div class="units-table-row js-unit"
  76. data-sort-key="<?= tohtml(strtolower($key)) ?>"
  77. data-sort-comment="<?= tohtml(strtolower($key_comment)) ?>"
  78. data-sort-date="<?= tohtml(strtotime($data[$key]["DATE"] . " " . $data[$key]["TIME"])) ?>">
  79. <div class="units-table-cell">
  80. <div>
  81. <input id="check<?= tohtml($i) ?>" class="js-unit-checkbox" type="checkbox" title="<?= tohtml( _("Select")) ?>" name="key[]" value="<?= tohtml($key) ?>">
  82. <label for="check<?= tohtml($i) ?>" class="u-hide-desktop"><?= tohtml( _("Select")) ?></label>
  83. </div>
  84. </div>
  85. <div class="units-table-cell units-table-heading-cell u-text-bold">
  86. <span class="u-hide-desktop"><?= tohtml( _("Access Key")) ?>:</span>
  87. <a href="/list/access-key/?<?= tohtml(http_build_query(["key" => $key, "token" => $_SESSION["token"]])) ?>" title="<?= tohtml( _("Access Key")) ?>: <?= tohtml($key) ?>">
  88. <?= tohtml($key) ?>
  89. </a>
  90. </div>
  91. <div class="units-table-cell">
  92. <ul class="units-table-row-actions">
  93. <li class="units-table-row-action shortcut-delete" data-key-action="js">
  94. <a
  95. class="units-table-row-action-link data-controls js-confirm-action"
  96. href="/delete/access-key/?<?= tohtml(http_build_query(["key" => $key, "token" => $_SESSION["token"]])) ?>"
  97. title="<?= tohtml( _("Delete")) ?>"
  98. data-confirm-title="<?= tohtml( _("Delete")) ?>"
  99. data-confirm-message="<?= tohtml(sprintf(_("Are you sure you want to delete access key %s?"), $key)) ?>"
  100. >
  101. <i class="fas fa-trash icon-red"></i>
  102. <span class="u-hide-desktop"><?= tohtml( _("Delete")) ?></span>
  103. </a>
  104. </li>
  105. </ul>
  106. </div>
  107. <div class="units-table-cell u-text-bold u-text-center-desktop">
  108. <span class="u-hide-desktop"><?= tohtml( _("Comment")) ?>:</span>
  109. <?= tohtml( _($key_comment)) ?>
  110. </div>
  111. <div class="units-table-cell u-text-bold u-text-center-desktop">
  112. <span class="u-hide-desktop"><?= tohtml( _("Date")) ?>:</span>
  113. <time datetime="<?= tohtml($key_date) ?>"><?= tohtml($key_date) ?></time>
  114. </div>
  115. <div class="units-table-cell u-text-bold u-text-center-desktop">
  116. <span class="u-hide-desktop"><?= tohtml( _("Time")) ?>:</span>
  117. <?= tohtml($key_time) ?>
  118. </div>
  119. </div>
  120. <?php } ?>
  121. </div>
  122. <div class="units-table-footer">
  123. <p>
  124. <?php printf(ngettext("%d access key", "%d access keys", $i), $i); ?>
  125. </p>
  126. </div>
  127. </div>