summaryrefslogtreecommitdiffstats
path: root/lib/itemmapper.php
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-05-20 19:14:34 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-05-20 19:14:34 -0400
commit2a15c85cd9c08af627798c61eced0511b05a1ac3 (patch)
tree96824baa8d9748669851fd95714448d2bcd880fd /lib/itemmapper.php
parent4cb80788b059506fa30c8aeae3da87dec931332b (diff)
fetching items from remote feed working now
Diffstat (limited to 'lib/itemmapper.php')
-rw-r--r--lib/itemmapper.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/itemmapper.php b/lib/itemmapper.php
index 177a95fd6..fa6705f69 100644
--- a/lib/itemmapper.php
+++ b/lib/itemmapper.php
@@ -26,7 +26,7 @@
*/
class OC_News_ItemMapper {
- private $tableName = '*PREFIX*news_items';
+ const tableName = '*PREFIX*news_items';
private $feed;
public function __construct(OC_News_Feed $feed){
@@ -34,11 +34,11 @@ class OC_News_ItemMapper {
}
/**
- * @brief Retrieve a feed from the database
+ * @brief Retrieve an item from the database
* @param id The id of the feed in the database table.
*/
public function find($id){
- $stmt = OCP\DB::prepare('SELECT * FROM ' . $this->feedTableName . ' WHERE id = ?');
+ $stmt = OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE id = ?');
$result = $stmt->execute(array($id));
$row = $result->fetchRow();
@@ -56,25 +56,25 @@ class OC_News_ItemMapper {
$feedid = $this->feed->getId();
$query = OCP\DB::prepare('
- INSERT INTO ' . $this->tableName .
+ INSERT INTO ' . self::tableName .
'(url, title, feedid)
VALUES (?, ?, $feedid)
');
$title = $item->getTitle();
-echo $title;
+echo $title . '<br>';
if(empty($title)) {
$l = OC_L10N::get('news');
$title = $l->t('no title');
}
$params=array(
- htmlspecialchars_decode($feed->getUrl()),
+ htmlspecialchars_decode($item->getUrl()),
htmlspecialchars_decode($title)
);
$query->execute($params);
- $itemid = OCP\DB::insertid($this->tableName);
+ $itemid = OCP\DB::insertid(self::tableName);
$item->setId($itemid);
return $itemid;
}