collections.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php if(!empty($TemplateData['pagination']) && $TemplateData['pagination']['pages'] > 1) { ?>
  2. <?php require Summoner::themefile('collections/collections_pagination.html', UI_THEME); ?>
  3. <?php if(!isset($TemplateData['pagination']['hideSort'])) { ?>
  4. <form method="get" action="index.php">
  5. <?php
  6. foreach($TemplateData['pagination']['currentGetParameters'] as $ck=>$cp) {
  7. echo '<input type="hidden" name="'.$ck.'" value="'.$cp.'" />';
  8. }
  9. ?>
  10. <select name="s">
  11. <?php if(!empty($TemplateData['defaultSortField'])) { ?>
  12. <option value="<?php echo $TemplateData['defaultSortField']; ?>"><?php echo $I18n->t('pagination.select.sort.default'); ?></option>
  13. <?php } else { ?>
  14. <option value=""><?php echo $I18n->t('pagination.select.sort.latest'); ?></option>
  15. <?php } ?>
  16. <?php
  17. if(!empty($TemplateData['simpleSearchFields'])) {
  18. foreach($TemplateData['simpleSearchFields'] as $k=>$v) {
  19. ?>
  20. <option value="<?php echo $k; ?>" <?php if(isset($v['selected'])) echo 'selected' ?> ><?php echo $I18n->t($v['displayname']); ?></option>
  21. <?php
  22. }
  23. }
  24. ?>
  25. </select>
  26. <select name="sd">
  27. <option value="ASC" <?php echo ($TemplateData['pagination']['currentGetParameters']['sd'] ?? '') == 'ASC' ? 'selected' : '' ?>><?php echo $I18n->t('global.ascending'); ?></option>
  28. <option value="DESC" <?php echo ($TemplateData['pagination']['currentGetParameters']['sd'] ?? '') == 'DESC' ? 'selected' : '' ?>><?php echo $I18n->t('global.descending'); ?></option>
  29. </select>
  30. <input type="submit" value="<?php echo $I18n->t('global.sort'); ?>" />
  31. </form>
  32. <?php } ?>
  33. <?php } ?>
  34. <?php if(!empty($TemplateData['search'])) { ?>
  35. <div class="window">
  36. <div class="title-bar">
  37. <div class="title-bar-text"><?php echo $I18n->t('global.search'); ?></div>
  38. <div class="title-bar-controls">
  39. <button aria-label="Close" id="searchNoteWindowCloseButton"></button>
  40. </div>
  41. </div>
  42. <div class="window-body">
  43. <p><?php echo $I18n->t('global.search.resultfor', $TemplateData['search'] ?? ''); ?></p>
  44. </div>
  45. </div>
  46. <script>
  47. const searchNoteWindowCloseButton = document.getElementById('searchNoteWindowCloseButton');
  48. searchNoteWindowCloseButton.addEventListener('click', () => {
  49. window.location.href="index.php?p=collections&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>";
  50. });
  51. </script>
  52. <?php } ?>
  53. <?php if(!empty($TemplateData['entries'])) { ?>
  54. <h3><?php echo $TemplateData['loadedCollection']['name'] ?? ''; ?></h3>
  55. <div class="sunken-panel">
  56. <table width="100%">
  57. <thead>
  58. <tr>
  59. <th width="60px"><?php echo $I18n->t('global.image'); ?></th>
  60. <th width="300px"><?php echo $I18n->t('global.title'); ?></th>
  61. <th><?php echo $I18n->t('global.description'); ?></th>
  62. <th width="60px"><?php echo $I18n->t('global.sort'); ?></th>
  63. </tr>
  64. </thead>
  65. <tbody>
  66. <?php foreach($TemplateData['entries']['results'] as $entryK=>$entry) { ?>
  67. <tr>
  68. <td>
  69. <?php if(isset($entry['fields']['coverimage'])) { ?>
  70. <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>">
  71. <img src="<?php echo $TemplateData['storagePath'].'/'.$entryK.'/'.$entry['fields']['coverimage']['value']; ?>"
  72. alt="<?php echo $I18n->t($entry['fields']['coverimage']['displayname']); ?>"
  73. width="50px">
  74. </a>
  75. <?php } ?>
  76. </td>
  77. <td>
  78. <?php if(isset($entry['fields']['title'])) {
  79. echo $entry['fields']['title']['value'];
  80. } ?>
  81. </td>
  82. <td>
  83. <?php if(isset($entry['fields']['description']['value'])) {
  84. echo $entry['fields']['description']['value'];
  85. } ?>
  86. </td>
  87. <td>
  88. <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>"><?php echo $I18n->t('global.view'); ?></a>
  89. </td>
  90. </tr>
  91. <?php } ?>
  92. </tbody>
  93. </table>
  94. </div>
  95. <?php } elseif(!empty($TemplateData['collections'])) { ?>
  96. <h3><?php echo $I18n->t('global.collection.select.notice'); ?></h3>
  97. <div class="sunken-panel">
  98. <table width="100%">
  99. <thead>
  100. <tr>
  101. <th width="100px"><?php echo $I18n->t('global.name'); ?></th>
  102. <th><?php echo $I18n->t('global.description'); ?></th>
  103. </tr>
  104. </thead>
  105. <tbody>
  106. <?php foreach($TemplateData['collections'] as $k=>$v) { ?>
  107. <tr>
  108. <td><a href="index.php?p=collections&collection=<?php echo $k; ?>"><?php echo $v['name']; ?></a></td>
  109. <td><?php echo $v['description']; ?></td>
  110. <tr>
  111. <?php } ?>
  112. </tbody>
  113. </table>
  114. </div>
  115. <?php } ?>
  116. <?php if(!empty($TemplateData['pagination']) && $TemplateData['pagination']['pages'] > 1) { ?>
  117. <?php require Summoner::themefile('collections/collections_pagination.html', UI_THEME); ?>
  118. <?php } ?>