summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appinfo/app.php1
-rw-r--r--controllers/news.controller.php4
-rw-r--r--lib/item.php9
-rw-r--r--lib/itemmapper.php4
-rw-r--r--templates/part.items.php6
5 files changed, 18 insertions, 6 deletions
diff --git a/appinfo/app.php b/appinfo/app.php
index ed51748da..6c2aca9ef 100644
--- a/appinfo/app.php
+++ b/appinfo/app.php
@@ -15,6 +15,7 @@ OC::$CLASSPATH['OCA\News\Item'] = 'apps/news/lib/item.php';
OC::$CLASSPATH['OCA\News\Collection'] = 'apps/news/lib/collection.php';
OC::$CLASSPATH['OCA\News\Feed'] = 'apps/news/lib/feed.php';
OC::$CLASSPATH['OCA\News\Folder'] = 'apps/news/lib/folder.php';
+OC::$CLASSPATH['OCA\News\FeedType'] = 'apps/news/lib/feedtypes.php';
OC::$CLASSPATH['OCA\News\FeedMapper'] = 'apps/news/lib/feedmapper.php';
OC::$CLASSPATH['OCA\News\ItemMapper'] = 'apps/news/lib/itemmapper.php';
diff --git a/controllers/news.controller.php b/controllers/news.controller.php
index 4f498b944..814f90d10 100644
--- a/controllers/news.controller.php
+++ b/controllers/news.controller.php
@@ -12,12 +12,8 @@
namespace OCA\News;
-require_once(\OC_App::getAppPath('news') . '/lib/feedtypes.php');
-
-
class NewsController extends Controller {
-
/**
* Decides wether to show the feedpage or the firstrun page
*/
diff --git a/lib/item.php b/lib/item.php
index f2d4fbd63..95a64859c 100644
--- a/lib/item.php
+++ b/lib/item.php
@@ -34,6 +34,7 @@ class Item {
private $id; //id of the item in the database table
private $author;
private $date; //date is stored in the Unix format
+ private $feedTitle;
public function __construct($url, $title, $guid, $body, $id = null) {
$this->title = $title;
@@ -119,6 +120,14 @@ class Item {
public function setTitle($title) {
$this->title = $title;
}
+
+ public function getFeedTitle() {
+ return $this->feedTitle;
+ }
+
+ public function setFeedTitle($feedtitle) {
+ $this->feedTitle = $feedtitle;
+ }
public function getUrl() {
return $this->url;
diff --git a/lib/itemmapper.php b/lib/itemmapper.php
index 58894cce8..92a3928d7 100644
--- a/lib/itemmapper.php
+++ b/lib/itemmapper.php
@@ -57,10 +57,12 @@ class ItemMapper {
public function findByFeedId($feedid) {
$stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE feed_id = ? ORDER BY pub_date DESC');
$result = $stmt->execute(array($feedid));
-
+ $feedmapper = new FeedMapper($this->userid);
+ $feed = $feedmapper->findById($feedid);
$items = array();
while ($row = $result->fetchRow()) {
$item = $this->fromRow($row);
+ $item->setFeedTitle($feed->getTitle());
$items[] = $item;
}
diff --git a/templates/part.items.php b/templates/part.items.php
index 174a96e5e..d331f5172 100644
--- a/templates/part.items.php
+++ b/templates/part.items.php
@@ -31,7 +31,11 @@ foreach($items as $item) {
echo '</div>';
echo '<h1 class="item_title"><a target="_blank" href="' . $item->getUrl() . '">' . htmlspecialchars($item->getTitle(), ENT_QUOTES, 'UTF-8') . '</a></h1>';
-
+
+// if ($lastViewedFeedType !== OCA\News\FeedType::FEED) {
+ echo '<div class="item_feed">' . $l->t('from') . ' ' . $item->getFeedTitle() . '</div>';
+// }
+
if(($item->getAuthor() !== null) && (trim($item->getAuthor()) != '')) {
echo '<h2 class="item_author">'. $l->t('by') . ' ' . htmlspecialchars($item->getAuthor(), ENT_QUOTES, 'UTF-8') . '</h2>';
}