aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-17 17:22:19 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-17 17:22:19 +0100
commitdbb0de4e368b814f8cab9e7e1a1462a2839471dc (patch)
tree9e51f1773bb47a6934b9eed22089c8771e0365ba /app
parentd4c0fc28ec8b6fcc2afa0e9a187dfb910aed9d17 (diff)
Les catégories d'un article sont désormais ajoutées à ses tags
Diffstat (limited to 'app')
-rwxr-xr-xapp/models/Entry.php4
-rw-r--r--app/models/Feed.php14
2 files changed, 17 insertions, 1 deletions
diff --git a/app/models/Entry.php b/app/models/Entry.php
index a57a5b2d1..d97cad408 100755
--- a/app/models/Entry.php
+++ b/app/models/Entry.php
@@ -212,7 +212,7 @@ class Entry extends Model {
class EntryDAO extends Model_pdo {
public function addEntry ($valuesTmp) {
- $sql = 'INSERT INTO entry(id, guid, title, author, content, link, date, is_read, is_favorite, is_public, id_feed, lastUpdate) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
+ $sql = 'INSERT INTO entry(id, guid, title, author, content, link, date, is_read, is_favorite, is_public, id_feed, annotation, tags, lastUpdate) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
$stm = $this->bd->prepare ($sql);
$values = array (
@@ -227,6 +227,8 @@ class EntryDAO extends Model_pdo {
$valuesTmp['is_favorite'],
$valuesTmp['is_public'],
$valuesTmp['id_feed'],
+ $valuesTmp['annotation'],
+ $valuesTmp['tags'],
$valuesTmp['lastUpdate'],
);
diff --git a/app/models/Feed.php b/app/models/Feed.php
index 2f471f0a4..8e3168e3b 100644
--- a/app/models/Feed.php
+++ b/app/models/Feed.php
@@ -117,6 +117,10 @@ class Feed extends Model {
$feed->set_cache_location (CACHE_PATH);
$feed->init ();
+ $subscribe_url = $feed->subscribe_url ();
+ if (!is_null ($subscribe_url) && $subscribe_url != $this->url) {
+ $this->_url ($subscribe_url);
+ }
$title = $feed->get_title ();
$this->_name (!is_null ($title) ? $title : $this->url);
$this->_website ($feed->get_link ());
@@ -134,6 +138,15 @@ class Feed extends Model {
$link = $item->get_permalink ();
$date = strtotime ($item->get_date ());
+ // gestion des tags (catégorie == tag)
+ $tags_tmp = $item->get_categories ();
+ $tags = array ();
+ if (!is_null ($tags_tmp)) {
+ foreach ($tags_tmp as $tag) {
+ $tags[] = $tag->get_label ();
+ }
+ }
+
// Gestion du contenu
// On cherche à récupérer les articles en entier... même si le flux ne le propose pas
$path = $this->pathEntries ();
@@ -156,6 +169,7 @@ class Feed extends Model {
!is_null ($link) ? $link : '',
$date ? $date : time ()
);
+ $entry->_tags ($tags);
$entries[$entry->id ()] = $entry;
}