advancedsearch.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?php if(!empty($TemplateData['loadedCollection'])) { ?>
  2. <?php if(!empty($TemplateData['search'])) { ?>
  3. <div uk-alert id="searchNotice">
  4. <button class="uk-alert-close" type="button" uk-close></button>
  5. <p><?php echo $I18n->t('advsearch.result', $TemplateData['search'] ?? ''); ?></p>
  6. </div>
  7. <div class="uk-padding-small uk-padding-remove-left">
  8. <script type="text/javascript">
  9. UIkit.util.on('#searchNotice', 'hide', function () {
  10. window.location.href="index.php?p=advancedsearch&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>";
  11. });
  12. </script>
  13. <button class="uk-button uk-button-default uk-button-small"
  14. type="button" uk-toggle="target: #searchFrame; animation: uk-animation-scale-down; cls: uk-hidden"><?php echo $I18n->t('advsearch.togglesearch'); ?></button>
  15. <?php if(!empty($TemplateData['entries']) && $Doomguy->isSignedIn() === true) { ?>
  16. <form method="post" action="index.php?p=bulkedit&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>" class="uk-display-inline-block">
  17. <?php foreach($TemplateData['entries']['ids'] as $f) { ?>
  18. <input type="hidden" name="bulkedit[]" value="<?php echo $f; ?>" />
  19. <?php } ?>
  20. <button type="submit" class="uk-button uk-button-default uk-button-small"><?php echo $I18n->t('advsearch.submit.bulkedit'); ?></button>
  21. </form>
  22. <?php } ?>
  23. </div>
  24. <?php } ?>
  25. <div class="uk-grid-small uk-grid-row-small uk-grid-row-small <?php if(!empty($TemplateData['search'])) { ?>uk-hidden<?php } ?>"
  26. uk-grid id="searchFrame">
  27. <div class="uk-width-1-2@l">
  28. <form class="uk-form-horizontal uk-margin-small" method="post">
  29. <div class="uk-margin">
  30. <label class="uk-form-label" for="search"><?php echo $I18n->t('advsearch.input.search.label'); ?></label>
  31. <div class="uk-form-controls">
  32. <input class="uk-input" id="search" type="text" autocomplete="off" name="fdata[search]"
  33. placeholder="<?php echo $I18n->t('advsearch.input.search.placeholder'); ?>">
  34. </div>
  35. </div>
  36. <div class="uk-margin">
  37. <div class="uk-form-label"><?php echo $I18n->t('advsearch.input.tableview.label'); ?></div>
  38. <div class="uk-form-controls uk-form-controls-text">
  39. <label>
  40. <input class="uk-checkbox" type="checkbox" name="fdata[tableView]" value="1"><br>
  41. <small><?php echo $I18n->t('advsearch.tableview.description'); ?></small>
  42. </label>
  43. </div>
  44. </div>
  45. <div class="uk-margin">
  46. <button class="uk-button uk-button-primary" type="submit" name="submitForm">
  47. <?php echo $I18n->t('global.search'); ?>
  48. </button>
  49. </div>
  50. </form>
  51. </div>
  52. <div class="uk-width-1-2@l">
  53. <h4><?php echo $I18n->t('advsearch.headline.syntax'); ?></h4>
  54. <p><?php echo $I18n->t('advsearch.help.1'); ?></p>
  55. <p><?php echo $I18n->t('advsearch.help.2'); ?></p>
  56. eg.: <code>title: bourne</code>
  57. <p><?php echo $I18n->t('advsearch.explain.fields', $TemplateData['loadedCollection']['name'] ?? ''); ?></p>
  58. <pre style="white-space: normal">
  59. <?php
  60. foreach($TemplateData['collectionFields'] as $k=>$v) {
  61. echo $v['identifier']." ";
  62. }
  63. ?>
  64. </pre>
  65. <p><?php echo $I18n->t('advsearch.operators'); ?></p>
  66. <p>* = <?php echo $I18n->t('advsearch.operators.asterisk'); ?></p>
  67. <p>+ = <?php echo $I18n->t('advsearch.operators.plus'); ?></p>
  68. <p>- = <?php echo $I18n->t('advsearch.operators.plus'); ?></p>
  69. <p>" = <?php echo $I18n->t('advsearch.operators.quote'); ?></p>
  70. <p>&gt; = <?php echo $I18n->t('advsearch.operators.quote'); ?></p>
  71. <p>&lt; = <?php echo $I18n->t('advsearch.operators.quote'); ?></p>
  72. </div>
  73. </div>
  74. <?php if(!empty($TemplateData['entries'])) { ?>
  75. <div>
  76. <?php if($TemplateData['searchResultStyle'] == "table") { ?>
  77. <table class="uk-table uk-table-small uk-table-divider uk-table-justify">
  78. <thead>
  79. <tr>
  80. <th class="">#</th>
  81. <?php
  82. foreach($TemplateData['collectionFields'] as $f) {
  83. if(in_array($f['id'],$TemplateData['loadedCollection']['advancedSearchTableFields'])) {
  84. echo '<th>'.$f['displayname'].'</th>';
  85. }
  86. }
  87. ?>
  88. </tr>
  89. </thead>
  90. <tbody>
  91. <?php foreach($TemplateData['entries']['results'] as $entryK=>$entry) { ?>
  92. <tr>
  93. <td class="">
  94. <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>" target=_blank><span class="" uk-icon="icon: link"></span></a>
  95. </td>
  96. <?php
  97. foreach($entry['fields'] as $f) {
  98. if(in_array($f['id'],$TemplateData['loadedCollection']['advancedSearchTableFields'])) {
  99. ?>
  100. <td>
  101. <?php
  102. if(isset($f['value'])) {
  103. if(is_array($f['value'])) {
  104. echo Summoner::limitWithDots(implode(', ',$f['value']),100,'...');
  105. }
  106. else {
  107. echo Summoner::limitWithDots($f['value'],100,'...');
  108. }
  109. }
  110. ?>
  111. </td>
  112. <?php
  113. }
  114. }
  115. ?>
  116. </tr>
  117. <?php } ?>
  118. </tbody>
  119. </table>
  120. </div>
  121. <?php
  122. } else {
  123. ?>
  124. <?php foreach($TemplateData['entries']['results'] as $entryK=>$entry) { ?>
  125. <div class="uk-card uk-card-default uk-grid-collapse uk-margin uk-grid">
  126. <div class="uk-card-media-left uk-cover-container uk-width-1-2@s uk-width-1-3@m uk-width-1-6@l uk-visible@s">
  127. <?php if(isset($entry['fields']['coverimage'])) { ?>
  128. <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>" target=_blank>
  129. <img src="<?php echo $TemplateData['storagePath'].'/'.$entryK.'/'.$entry['fields']['coverimage']['value']; ?>"
  130. alt="<?php echo $entry['fields']['coverimage']['displayname']; ?>" uk-cover>
  131. <canvas width="400" height="200"></canvas>
  132. </a>
  133. <?php } ?>
  134. </div>
  135. <div class="uk-width-1-2@s uk-width-2-3@m uk-width-5-6@l">
  136. <div class="uk-card-body">
  137. <?php if(isset($entry['fields']['title'])) { ?>
  138. <h3 class="uk-card-title"><?php echo $entry['fields']['title']['value']; ?></h3>
  139. <?php } ?>
  140. <?php if(isset($entry['fields']['description'])) { ?>
  141. <p><?php echo $entry['fields']['description']['value']; ?></p>
  142. <?php } ?>
  143. </div>
  144. <div class="uk-card-footer">
  145. <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>" class="uk-button uk-button-text" target=_blank><?php echo $I18n->t('global.view'); ?></a>
  146. </div>
  147. </div>
  148. </div>
  149. <?php
  150. }
  151. }
  152. ?>
  153. <?php } ?>
  154. <?php } else { ?>
  155. <div class="uk-grid-small uk-grid-row-small uk-grid-row-small" uk-grid>
  156. <div class="uk-width-2-3@m uk-width-1-2@xl">
  157. <h3 class="uk-heading-divider"><?php echo $I18n->t('global.collection.select.notice'); ?></h3>
  158. <dl class="uk-description-list">
  159. <?php foreach($TemplateData['collections'] as $k=>$v) { ?>
  160. <dt><a href="index.php?p=advancedsearch&collection=<?php echo $k; ?>"><?php echo $v['name']; ?></a></dt>
  161. <dd><?php echo $v['description']; ?></dd>
  162. <?php } ?>
  163. </dl>
  164. </div>
  165. </div>
  166. <?php } ?>