normal_view.phtml 7.8 KB

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