summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-08-19 15:13:39 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-08-19 15:13:39 -0400
commit32bd7c839c8538b9f892c11893c140bb70677636 (patch)
tree466504d558d42353663354cf66960a5abee081e5 /templates
parent608b3c7f8aefbb8c7f11d3c0dd548e5a04b4b0b0 (diff)
now saves item's author in db
Diffstat (limited to 'templates')
-rw-r--r--templates/part.items.php39
-rw-r--r--templates/part.listfeed.php2
2 files changed, 19 insertions, 22 deletions
diff --git a/templates/part.items.php b/templates/part.items.php
index 1023ab452..d40730e27 100644
--- a/templates/part.items.php
+++ b/templates/part.items.php
@@ -4,26 +4,21 @@ $feedId = isset($_['feedid']) ? $_['feedid'] : '';
$itemMapper = new OCA\News\ItemMapper();
-$showAll = OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'showAll');
+$showAll = OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'showAll');
-// select items by feed id and by preference
-switch ($feedId) {
- case -1:
- $feedMapper = new OCA\News\FeedMapper();
- $items = $itemMapper->findEveryItemByStatus(OCA\News\StatusFlag::IMPORTANT);
- break;
+$specialfeed = false;
- case -2:
- $items = $itemMapper->findEveryItemByStatus(OCA\News\StatusFlag::UNREAD);
- break;
-
- default:
- if($showAll){
- $items = $itemMapper->findAll($feedId);
+if ($feedId == -1 || $feedId == -2) { //TODO: change this values, too obscure
+ $specialfeed = true;
+ $status = ($feedId == -1) ? OCA\News\StatusFlag::IMPORTANT : OCA\News\StatusFlag::UNREAD;
+ $items = $itemMapper->findEveryItemByStatus($status);
+}
+else {
+ if($showAll){
+ $items = $itemMapper->findAll($feedId);
} else {
$items = $itemMapper->findAllStatus($feedId, OCA\News\StatusFlag::UNREAD);
}
- break;
}
echo '<ul>';
@@ -55,14 +50,16 @@ foreach($items as $item) {
echo '</div>';
echo '<h1 class="item_title"><a target="_blank" href="' . $item->getUrl() . '">' . $item->getTitle() . '</a></h1>';
-
- if(trim($item->getAuthor()) == ''){
+
+ if ($specialfeed) {
$from = $l->t('from') . ' ' . parse_url($item->getUrl(), PHP_URL_HOST);
- } else {
- $from = $l->t('from') . ' ' . $item->getAuthor();
+ echo '<h2 class="item_feed_title">' . $from .'</h2>';
}
- echo '<h2 class="item_author">' . $from . '</h2>';
-
+
+ if(($item->getAuthor() !== null) && (trim($item->getAuthor()) != '')){
+ echo '<h2 class="item_author">'. $l->t('by') . ' ' . $item->getAuthor() . '</h2>';
+ }
+
echo '<div class="body">' . $item->getBody() . '</div>';
echo '<div class="bottom_utils">';
diff --git a/templates/part.listfeed.php b/templates/part.listfeed.php
index f0205776b..0d343d3a9 100644
--- a/templates/part.listfeed.php
+++ b/templates/part.listfeed.php
@@ -7,7 +7,7 @@ $unreadItemsCount = isset($_['unreadItemsCount']) ? $_['unreadItemsCount'] : nul
$favicon = $feed->getFavicon();
if ($favicon == null) {
- $favicon = OCP\Util::imagePath('news', 'rss.svg');
+ $favicon = OCP\Util::imagePath('core', 'actions/public.svg');
}
if($unreadItemsCount == 0){