advancedsearch.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php if(!empty($TemplateData['loadedCollection'])) { ?>
  2. <form method="post">
  3. <div class="field-row">
  4. <label for="search"><?php echo $I18n->t('advsearch.input.search.label'); ?></label>
  5. <input id="search" type="text" autocomplete="off" name="fdata[search]"
  6. placeholder="<?php echo $I18n->t('advsearch.input.search.placeholder'); ?>" size="50" />
  7. </div>
  8. <div class="field-row">
  9. <p><?php echo $I18n->t('advsearch.input.description'); ?></p>
  10. </div>
  11. <div class="field-row">
  12. <input type="submit" name="submitForm" value="<?php echo $I18n->t('global.search'); ?>" />
  13. </div>
  14. </form>
  15. <h4><?php echo $I18n->t('advsearch.headline.syntax'); ?></h4>
  16. <p><?php echo $I18n->t('advsearch.help.1'); ?></p>
  17. <p><?php echo $I18n->t('advsearch.help.2'); ?></p>
  18. <pre>title: bourne</pre>
  19. <p><?php echo $I18n->t('advsearch.explain.fields', $TemplateData['loadedCollection']['name'] ?? ''); ?></p>
  20. <pre style="white-space: normal">
  21. <?php foreach($TemplateData['collectionFields'] as $k=>$v) {
  22. echo $v['identifier']." ";
  23. } ?>
  24. </pre>
  25. <p><?php echo $I18n->t('advsearch.operators'); ?></p>
  26. <dl>
  27. <dt>&ast;</dt>
  28. <dd><?php echo $I18n->t('advsearch.operators.asterisk'); ?></dd>
  29. <dt>&plus;</dt>
  30. <dd><?php echo $I18n->t('advsearch.operators.plus'); ?></dd>
  31. <dt>&minus;</dt>
  32. <dd><?php echo $I18n->t('advsearch.operators.minus'); ?></dd>
  33. <dt>&quot;</dt>
  34. <dd><?php echo $I18n->t('advsearch.operators.quote'); ?></dd>
  35. <dt>&gt;</dt>
  36. <dd><?php echo $I18n->t('advsearch.operators.greater'); ?></dd>
  37. <dt>&lt;</dt>
  38. <dd><?php echo $I18n->t('advsearch.operators.less'); ?></dd>
  39. </dl>
  40. <?php if(!empty($TemplateData['search'])) { ?>
  41. <div class="window">
  42. <div class="title-bar">
  43. <div class="title-bar-text"><?php echo $I18n->t('global.search'); ?></div>
  44. <div class="title-bar-controls">
  45. <button aria-label="Close" id="searchNoteWindowCloseButton"></button>
  46. </div>
  47. </div>
  48. <div class="window-body">
  49. <p><?php echo $I18n->t('advsearch.result', $TemplateData['search'] ?? ''); ?></p>
  50. </div>
  51. </div>
  52. <script>
  53. const searchNoteWindowCloseButton = document.getElementById('searchNoteWindowCloseButton');
  54. searchNoteWindowCloseButton.addEventListener('click', () => {
  55. window.location.href="index.php?p=advancedsearch&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>";
  56. });
  57. </script>
  58. <?php } ?>
  59. <?php if(!empty($TemplateData['entries'])) { ?>
  60. <form method="post" action="index.php?p=bulkedit&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>">
  61. <?php foreach($TemplateData['entries']['ids'] as $f) { ?>
  62. <input type="hidden" name="bulkedit[]" value="<?php echo $f; ?>" />
  63. <?php } ?>
  64. <div class="field-row">
  65. <input type="submit" value="<?php echo $I18n->t('advsearch.submit.bulkedit'); ?>">
  66. </div>
  67. </form>
  68. <div class="sunken-panel">
  69. <table width="100%">
  70. <thead>
  71. <tr>
  72. <th width="60px"><?php echo $I18n->t('global.view'); ?></th>
  73. <?php
  74. foreach($TemplateData['collectionFields'] as $f) {
  75. if(in_array($f['id'],$TemplateData['loadedCollection']['advancedSearchTableFields'])) {
  76. echo '<th>'.$f['displayname'].'</th>';
  77. }
  78. }
  79. ?>
  80. </tr>
  81. </thead>
  82. <tbody>
  83. <?php foreach($TemplateData['entries']['results'] as $entryK=>$entry) { ?>
  84. <tr>
  85. <td>
  86. <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>"><?php echo $I18n->t('global.view'); ?></a>
  87. </td>
  88. <?php
  89. foreach($entry['fields'] as $f) {
  90. if(in_array($f['id'],$TemplateData['loadedCollection']['advancedSearchTableFields'])) {
  91. ?>
  92. <td>
  93. <?php
  94. if(isset($f['value'])) {
  95. if(is_array($f['value'])) {
  96. echo Summoner::limitWithDots(implode(', ',$f['value']),100,'...');
  97. }
  98. else {
  99. echo Summoner::limitWithDots($f['value'],100,'...');
  100. }
  101. }
  102. ?>
  103. </td>
  104. <?php
  105. }
  106. }
  107. ?>
  108. </tr>
  109. <?php } ?>
  110. </tbody>
  111. </table>
  112. </div>
  113. <?php }
  114. } else { ?>
  115. <h3><?php echo $I18n->t('global.collection.select.notice'); ?></h3>
  116. <div class="sunken-panel">
  117. <table width="100%">
  118. <thead>
  119. <tr>
  120. <th width="100px"><?php echo $I18n->t('global.name'); ?></th>
  121. <th><?php echo $I18n->t('global.description'); ?></th>
  122. </tr>
  123. </thead>
  124. <tbody>
  125. <?php foreach($TemplateData['collections'] as $k=>$v) { ?>
  126. <tr>
  127. <td><a href="index.php?p=advancedsearch&collection=<?php echo $k; ?>"><?php echo $v['name']; ?></a></td>
  128. <td><?php echo $v['description']; ?></td>
  129. <tr>
  130. <?php } ?>
  131. </tbody>
  132. </table>
  133. </div>
  134. <?php } ?>