entry_bottom.phtml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. /** @var FreshRSS_View $this */
  3. $sharing = array();
  4. if (FreshRSS_Auth::hasAccess()) {
  5. $sharing = FreshRSS_Context::$user_conf->sharing;
  6. }
  7. $bottomline_read = FreshRSS_Context::$user_conf->bottomline_read;
  8. $bottomline_favorite = FreshRSS_Context::$user_conf->bottomline_favorite;
  9. $bottomline_sharing = FreshRSS_Context::$user_conf->bottomline_sharing && (count($sharing) > 0);
  10. $bottomline_labels = true; //TODO
  11. $bottomline_tags = FreshRSS_Context::$user_conf->bottomline_tags;
  12. $bottomline_date = FreshRSS_Context::$user_conf->bottomline_date;
  13. $bottomline_link = FreshRSS_Context::$user_conf->bottomline_link;
  14. ?><ul class="horizontal-list bottom"><?php
  15. if (FreshRSS_Auth::hasAccess()) {
  16. if ($bottomline_read) {
  17. ?><li class="item manage"><?php
  18. $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $this->entry->id()));
  19. if ($this->entry->isRead()) {
  20. $arUrl['params']['is_read'] = 0;
  21. }
  22. ?><a class="read" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?php
  23. echo _i($this->entry->isRead() ? 'read' : 'unread'); ?></a><?php
  24. ?></li><?php
  25. }
  26. if ($bottomline_favorite) {
  27. ?><li class="item manage"><?php
  28. $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $this->entry->id()));
  29. if ($this->entry->isFavorite()) {
  30. $arUrl['params']['is_favorite'] = 0;
  31. }
  32. ?><a class="bookmark" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?php
  33. echo _i($this->entry->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php
  34. ?></li><?php
  35. }
  36. }
  37. if ($bottomline_labels) {
  38. ?><li class="item">
  39. <div class="dropdown dynamictags">
  40. <div id="dropdown-labels-<?= $this->entry->id() ?>" class="dropdown-target"></div>
  41. <?= FreshRSS_Themes::alt('label') ?>
  42. <a class="dropdown-toggle" href="#dropdown-labels-<?= $this->entry->id() ?>"><?php
  43. echo _t('index.menu.tags');
  44. ?></a>
  45. <ul class="dropdown-menu dropdown-menu-scrollable">
  46. <li class="dropdown-close"><a href="#close">❌</a></li>
  47. <!-- Ajax -->
  48. </ul>
  49. <div class="dropdown-close"><a href="#close">❌</a></div>
  50. </div>
  51. </li><?php
  52. }
  53. $tags = $bottomline_tags ? $this->entry->tags() : null;
  54. if (!empty($tags)) {
  55. ?><li class="item">
  56. <div class="dropdown">
  57. <div id="dropdown-tags-<?= $this->entry->id() ?>" class="dropdown-target"></div>
  58. <?= _i('tag') ?>
  59. <a class="dropdown-toggle" href="#dropdown-tags-<?= $this->entry->id() ?>"><?php
  60. echo _t('index.tag.related');
  61. ?></a>
  62. <ul class="dropdown-menu">
  63. <li class="dropdown-close"><a href="#close">❌</a></li><?php
  64. foreach ($tags as $tag) {
  65. ?><li class="item"><a href="<?= _url('index', 'index', 'search', '#' . str_replace(' ', '+', htmlspecialchars_decode($tag, ENT_QUOTES))) ?>"><?= $tag ?></a></li><?php
  66. } ?>
  67. </ul>
  68. </div>
  69. </li><?php
  70. }
  71. ?><li class="item"><?php
  72. if ($bottomline_sharing) {
  73. ?><div class="dropdown">
  74. <div id="dropdown-share-<?= $this->entry->id() ?>" class="dropdown-target"></div>
  75. <a class="dropdown-toggle" href="#dropdown-share-<?= $this->entry->id() ?>">
  76. <?= _i('share') ?>
  77. <?= _t('index.share') ?>
  78. </a>
  79. <ul class="dropdown-menu">
  80. <li class="dropdown-close"><a href="#close">❌</a></li><?php
  81. $id = $this->entry->id();
  82. $link = $this->entry->link();
  83. $title = $this->entry->title() . ' · ' . $this->feed->name();
  84. foreach (FreshRSS_Context::$user_conf->sharing as $share_options) {
  85. $share = FreshRSS_Share::get($share_options['type']);
  86. if ($share === null) {
  87. continue;
  88. }
  89. $share_options['id'] = $id;
  90. $share_options['link'] = $link;
  91. $share_options['title'] = $title;
  92. $share->update($share_options);
  93. ?><li class="item share">
  94. <?php if ('GET' === $share->method()) {?>
  95. <a target="_blank" rel="noreferrer" href="<?= $share->url() ?>" data-type="<?= $share->type() ?>"><?= $share->name() ?></a>
  96. <?php } else {?>
  97. <a href="POST"><?= $share->name() ?></a>
  98. <form method="POST" action="<?= $share->url() ?>" disabled="disabled">
  99. <input type="hidden" value="<?= $link ?>" name="<?= $share->field() ?>"/>
  100. </form>
  101. <?php } ?>
  102. </li><?php
  103. }
  104. ?></ul>
  105. </div>
  106. <?php } ?>
  107. </li><?php
  108. if ($bottomline_date) {
  109. ?><li class="item date"><time datetime="<?= $this->entry->machineReadableDate() ?>"><?= $this->entry->date() ?></time>&nbsp;</li><?php
  110. }
  111. if ($bottomline_link) {
  112. ?><li class="item link"><a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>" title="<?= _t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a></li><?php
  113. } ?>
  114. </ul>