normal_view.phtml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?php
  2. $this->partial ('aside_flux');
  3. $this->partial ('nav_menu');
  4. if (!empty($this->entries)) {
  5. $display_today = true;
  6. $display_yesterday = true;
  7. $display_others = true;
  8. if ($this->loginOk) {
  9. $sharing = $this->conf->sharing;
  10. } else {
  11. $sharing = array();
  12. }
  13. $hidePosts = !$this->conf->display_posts;
  14. $lazyload = $this->conf->lazyload;
  15. $topline_read = $this->conf->topline_read;
  16. $topline_favorite = $this->conf->topline_favorite;
  17. $topline_date = $this->conf->topline_date;
  18. $topline_link = $this->conf->topline_link;
  19. $bottomline_read = $this->conf->bottomline_read;
  20. $bottomline_favorite = $this->conf->bottomline_favorite;
  21. $bottomline_sharing = $this->conf->bottomline_sharing && (count($sharing));
  22. $bottomline_tags = $this->conf->bottomline_tags;
  23. $bottomline_date = $this->conf->bottomline_date;
  24. $bottomline_link = $this->conf->bottomline_link;
  25. ?>
  26. <div id="stream" class="normal<?php echo $hidePosts ? ' hide_posts' : ''; ?>"><?php
  27. ?><div id="new-article">
  28. <a href="<?php echo Minz_Url::display ($this->url); ?>"><?php echo Minz_Translate::t ('new_article'); ?></a>
  29. </div><?php
  30. foreach ($this->entries as $item) {
  31. if ($display_today && $item->isDay (FreshRSS_Days::TODAY, $this->today)) {
  32. ?><div class="day" id="day_today"><?php
  33. echo Minz_Translate::t ('today');
  34. ?><span class="date"> — <?php echo timestamptodate (time (), false); ?></span><?php
  35. ?><span class="name"><?php echo $this->currentName; ?></span><?php
  36. ?></div><?php
  37. $display_today = false;
  38. }
  39. if ($display_yesterday && $item->isDay (FreshRSS_Days::YESTERDAY, $this->today)) {
  40. ?><div class="day" id="day_yesterday"><?php
  41. echo Minz_Translate::t ('yesterday');
  42. ?><span class="date"> — <?php echo timestamptodate (time () - 86400, false); ?></span><?php
  43. ?><span class="name"><?php echo $this->currentName; ?></span><?php
  44. ?></div><?php
  45. $display_yesterday = false;
  46. }
  47. if ($display_others && $item->isDay (FreshRSS_Days::BEFORE_YESTERDAY, $this->today)) {
  48. ?><div class="day" id="day_before_yesterday"><?php
  49. echo Minz_Translate::t ('before_yesterday');
  50. ?><span class="name"><?php echo $this->currentName; ?></span><?php
  51. ?></div><?php
  52. $display_others = false;
  53. }
  54. ?><div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>">
  55. <ul class="horizontal-list flux_header"><?php
  56. if ($this->loginOk) {
  57. if ($topline_read) {
  58. ?><li class="item manage"><?php
  59. $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id ()));
  60. if ($item->isRead()) {
  61. $arUrl['params']['is_read'] = 0;
  62. }
  63. ?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
  64. echo FreshRSS_Themes::icon($item->isRead () ? 'read' : 'unread'); ?></a><?php
  65. ?></li><?php
  66. }
  67. if ($topline_favorite) {
  68. ?><li class="item manage"><?php
  69. $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id ()));
  70. if ($item->isFavorite()) {
  71. $arUrl['params']['is_favorite'] = 0;
  72. }
  73. ?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
  74. echo FreshRSS_Themes::icon($item->isFavorite () ? 'starred' : 'non-starred'); ?></a><?php
  75. ?></li><?php
  76. }
  77. }
  78. $feed = FreshRSS_CategoryDAO::findFeed($this->cat_aside, $item->feed ()); //We most likely already have the feed object in cache
  79. if (empty($feed)) $feed = $item->feed (true);
  80. ?><li class="item website"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> <span><?php echo $feed->name(); ?></span></a></li>
  81. <li class="item title"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo $item->title (); ?></a></li>
  82. <?php if ($topline_date) { ?><li class="item date"><?php echo $item->date (); ?> </li><?php } ?>
  83. <?php if ($topline_link) { ?><li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a></li><?php } ?>
  84. </ul>
  85. <div class="flux_content">
  86. <div class="content">
  87. <h1 class="title"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo $item->title (); ?></a></h1>
  88. <?php
  89. $author = $item->author ();
  90. echo $author != '' ? '<div class="author">' . Minz_Translate::t ('by_author', $author) . '</div>' : '';
  91. if ($lazyload) {
  92. echo $hidePosts ? lazyIframe(lazyimg($item->content())) : lazyimg($item->content());
  93. } else {
  94. echo $item->content();
  95. }
  96. ?>
  97. </div>
  98. <ul class="horizontal-list bottom"><?php
  99. if ($this->loginOk) {
  100. if ($bottomline_read) {
  101. ?><li class="item manage"><?php
  102. $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id ()));
  103. if ($item->isRead()) {
  104. $arUrl['params']['is_read'] = 0;
  105. }
  106. ?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
  107. echo FreshRSS_Themes::icon($item->isRead () ? 'read' : 'unread'); ?></a><?php
  108. ?></li><?php
  109. }
  110. if ($bottomline_favorite) {
  111. ?><li class="item manage"><?php
  112. $arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id ()));
  113. if ($item->isFavorite()) {
  114. $arUrl['params']['is_favorite'] = 0;
  115. }
  116. ?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
  117. echo FreshRSS_Themes::icon($item->isFavorite () ? 'starred' : 'non-starred'); ?></a><?php
  118. ?></li><?php
  119. }
  120. } ?>
  121. <li class="item"><?php
  122. if ($bottomline_sharing) {
  123. $link = urlencode ($item->link ());
  124. $title = urlencode ($item->title () . ' · ' . $feed->name ());
  125. ?><div class="dropdown">
  126. <div id="dropdown-share-<?php echo $item->id ();?>" class="dropdown-target"></div>
  127. <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>">
  128. <?php echo FreshRSS_Themes::icon('share'); ?>
  129. <?php echo Minz_Translate::t ('share'); ?>
  130. </a>
  131. <ul class="dropdown-menu">
  132. <li class="dropdown-close"><a href="#close">❌</a></li>
  133. <?php foreach ($sharing as $share) :?>
  134. <li class="item share">
  135. <a target="_blank" href="<?php echo FreshRSS_Share::generateUrl($this->conf->shares, $share, $item->link(), $item->title() . ' . ' . $feed->name())?>">
  136. <?php echo Minz_Translate::t ($share['name']);?>
  137. </a>
  138. </li>
  139. <?php endforeach;?>
  140. </ul>
  141. </div>
  142. <?php } ?>
  143. </li><?php
  144. $tags = $bottomline_tags ? $item->tags() : null;
  145. if (!empty($tags)) {
  146. ?><li class="item">
  147. <div class="dropdown">
  148. <div id="dropdown-tags-<?php echo $item->id ();?>" class="dropdown-target"></div>
  149. <a class="dropdown-toggle" href="#dropdown-tags-<?php echo $item->id ();?>"><?php
  150. echo FreshRSS_Themes::icon('tag'), Minz_Translate::t ('related_tags');
  151. ?></a>
  152. <ul class="dropdown-menu">
  153. <li class="dropdown-close"><a href="#close">❌</a></li><?php
  154. foreach($tags as $tag) {
  155. ?><li class="item"><a href="<?php echo _url ('index', 'index', 'search', urlencode ('#' . $tag)); ?>"><?php echo $tag; ?></a></li><?php
  156. } ?>
  157. </ul>
  158. </div>
  159. </li><?php
  160. }
  161. if ($bottomline_date) {
  162. ?><li class="item date"><?php echo $item->date (); ?></li><?php
  163. }
  164. if ($bottomline_link) {
  165. ?><li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a></li><?php
  166. } ?>
  167. </ul>
  168. </div>
  169. </div>
  170. <?php } ?>
  171. <?php $this->renderHelper('pagination'); ?>
  172. </div>
  173. <?php $this->partial ('nav_entries'); ?>
  174. <?php } else { ?>
  175. <div id="stream" class="alert alert-warn normal">
  176. <span class="alert-head"><?php echo Minz_Translate::t ('no_feed_to_display'); ?></span>
  177. <?php echo Minz_Translate::t ('think_to_add'); ?>
  178. </div>
  179. <?php } ?>