overview.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <?php
  2. /**
  3. * Insipid
  4. * Personal web-bookmark-system
  5. *
  6. * Copyright 2016-2020 Johannes Keßler
  7. *
  8. * Development starting from 2011: Johannes Keßler
  9. * https://www.bananas-playground.net/projekt/insipid/
  10. *
  11. * creator:
  12. * Luke Reeves <luke@neuro-tech.net>
  13. *
  14. * This program is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation, either version 3 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0.
  26. *
  27. */
  28. ?>
  29. <section class="section">
  30. <div class="columns">
  31. <div class="column">
  32. <p class="has-text-right">
  33. <a href="index.php?p=overview&m=tag" title="all tags" class="button">
  34. <span class="icon"><i class="ion-md-pricetags"></i></span>
  35. </a>
  36. <a href="index.php?p=overview&m=category" title="all categories" class="button">
  37. <span class="icon"><i class="ion-md-filing"></i></span>
  38. </a>
  39. <a href="index.php" title="... back to home" class="button">
  40. <span class="icon"><i class="ion-md-home"></i></span>
  41. </a>
  42. </p>
  43. </div>
  44. </div>
  45. <div class="columns">
  46. <div class="column">
  47. <?php if(!empty($subHeadline)) { ?>
  48. <h2 class="is-size-2"><?php echo $subHeadline; ?></h2>
  49. <?php } ?>
  50. </div>
  51. </div>
  52. <div class="columns">
  53. <div class="column is-half">
  54. <?php if($pagination['pages'] > 1) { ?>
  55. <nav class="pagination is-small" role="navigation" aria-label="pagination">
  56. <?php if($pagination['curPage'] > 1) {
  57. echo '<a href="index.php?'.Summoner::createFromParameterLinkQuery($currentGetParameters,array('page'=>($pagination['curPage']-1))).'"
  58. class="pagination-previous">Previous</a>';
  59. }
  60. if($pagination['curPage'] < $pagination['pages']) {
  61. echo '<a href="index.php?'.Summoner::createFromParameterLinkQuery($currentGetParameters,array('page'=>($pagination['curPage']+1))).'"
  62. class="pagination-next">Next</a>';
  63. }
  64. ?>
  65. <ul class="pagination-list">
  66. <?php
  67. $ellipsisShown = 0;
  68. for($i=1;$i<=$pagination['pages'];$i++) {
  69. $active = '';
  70. if($i == $pagination['curPage']) $active = 'is-current';
  71. if(in_array($i,$pagination['visibleRange'])) {
  72. echo '<li><a href="index.php?'.Summoner::createFromParameterLinkQuery($currentGetParameters,array('page'=>$i)).'"
  73. class="pagination-link ' . $active . '"
  74. aria-label="Goto page ' . $i . '">' . $i . '</a></li>';
  75. }
  76. else {
  77. if($i < $pagination['currentRangeStart'] && $ellipsisShown == 0) {
  78. echo '<li><span class="pagination-ellipsis">&hellip;</span></li>';
  79. $ellipsisShown = 1;
  80. }
  81. if($i > $pagination['currentRangeEnd'] && ($ellipsisShown == 0 || $ellipsisShown == 1)) {
  82. echo '<li><span class="pagination-ellipsis">&hellip;</span></li>';
  83. $ellipsisShown = 2;
  84. }
  85. }
  86. }
  87. ?>
  88. </ul>
  89. </nav>
  90. <?php } ?>
  91. </div>
  92. <div class="column is-half">
  93. <?php if(!empty($linkCollection['results'])) { ?>
  94. <div class="is-pulled-right">
  95. <a href="index.php?<?php echo $sortLink['default']; ?>"
  96. class="button is-small <?php if($sortLink['active'] === 'default') { ?>is-link<?php } ?>">default</a>
  97. <a href="index.php?<?php echo $sortLink['name']; ?>"
  98. class="button is-small <?php if($sortLink['active'] === 'title') { ?>is-link<?php } ?>">title</a>
  99. <a href="index.php?<?php echo $sortLink['direction']; ?>"
  100. class="button is-small <?php if($sortLink['activeDirection'] === true) { ?>is-link<?php } ?>"><span class="icon"><i class="ion-md-arrow-dropup"></i></span></a>
  101. </div>
  102. <?php } ?>
  103. </div>
  104. </div>
  105. </section>
  106. <section class="section">
  107. <?php if(!empty($linkCollection['results'])) { ?>
  108. <div class="columns is-multiline">
  109. <?php foreach ($linkCollection['results'] as $link) { ?>
  110. <div class="column is-one-quarter">
  111. <div class="card">
  112. <div class="card-image">
  113. <figure class="image is-4by3">
  114. <a href="<?php echo $link['link']; ?>" target="_blank">
  115. <?php if(!empty($link['image'])) { ?>
  116. <img class="linkthumbnail" src= "<?php echo $link['imageToShow']; ?>">
  117. <?php } else { ?>
  118. <img class="" src= "asset/img/no-link-picture.png">
  119. <?php } ?>
  120. </a>
  121. </figure>
  122. </div>
  123. <div class="card-content">
  124. <div class="content">
  125. <h4><a href="<?php echo $link['link']; ?>" target="_blank"><?php echo $link['title']; ?></a></h4>
  126. <p><?php echo $link['description']; ?></p>
  127. </div>
  128. </div>
  129. <footer class="card-footer">
  130. <a href="<?php echo $link['link']; ?>" target="_blank" class="card-footer-item">Visit link</a>
  131. <?php if($isAwm === true) { ?>
  132. <a href="index.php?p=editlink&id=<?php echo $link['hash']; ?>&awm=1" class="card-footer-item">Edit</a>
  133. <?php } else { ?>
  134. <a href="index.php?p=linkinfo&id=<?php echo $link['hash']; ?>" class="card-footer-item">More details</a>
  135. <?php } ?>
  136. </footer>
  137. </div>
  138. </div>
  139. <?php } ?>
  140. </div>
  141. <?php } if(!empty($tagCollection)) { ?>
  142. <div class="columns">
  143. <div class="column">
  144. <table class="table">
  145. <tr>
  146. <th>Name</th>
  147. <th># of links</th>
  148. </tr>
  149. <?php foreach ($tagCollection as $k=>$v) { ?>
  150. <tr>
  151. <td><a href="index.php?p=overview&m=tag&id=<?php echo urlencode($k); ?>"><?php echo $v['name']; ?></a></td>
  152. <td><?php echo $v['amount']; ?></td>
  153. </tr>
  154. <?php } ?>
  155. </table>
  156. </div>
  157. <?php if($displayEditButton === true) { ?>
  158. <div class="column">
  159. <div class="content">
  160. <a href="index.php?p=edittags" class="button is-small is-danger">
  161. <span class="icon"><i class="ion-md-create"></i></span>
  162. <span>Edit tags</span>
  163. </a>
  164. </div>
  165. </div>
  166. <?php } ?>
  167. </div>
  168. <?php } if(!empty($categoryCollection)) { ?>
  169. <div class="columns">
  170. <div class="column">
  171. <table class="table">
  172. <tr>
  173. <th>Name</th>
  174. <th># of links</th>
  175. </tr>
  176. <?php foreach ($categoryCollection as $k=>$v) { ?>
  177. <tr>
  178. <td><a href="index.php?p=overview&m=category&id=<?php echo urlencode($k); ?>"><?php echo $v['name']; ?></a></td>
  179. <td><?php echo $v['amount']; ?></td>
  180. </tr>
  181. <?php } ?>
  182. </table>
  183. </div>
  184. <?php if($displayEditButton === true) { ?>
  185. <div class="column">
  186. <div class="content">
  187. <a href="index.php?p=editcategories" class="button is-small is-danger">
  188. <span class="icon"><i class="ion-md-create"></i></span>
  189. <span>Edit categories</span>
  190. </a>
  191. </div>
  192. </div>
  193. <?php } ?>
  194. </div>
  195. <?php } ?>
  196. </section>