From 1c57c2b7bdf360728abd61b19ead39e390cfb250 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 17 Mar 2013 21:47:25 +0100 Subject: Changement API : export (Uniflux) du flux public à la place du flux des favoris avec content = notes et gestion des tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/Entry.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/models/Entry.php') diff --git a/app/models/Entry.php b/app/models/Entry.php index d97cad408..3e90db289 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -442,6 +442,23 @@ class EntryDAO extends Model_pdo { return HelperEntry::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC)); } + public function listPublic ($order = 'high_to_low') { + $where = ' WHERE is_public=1'; + + if ($order == 'low_to_high') { + $order = ' DESC'; + } else { + $order = ''; + } + + $sql = 'SELECT * FROM entry' . $where . ' ORDER BY date' . $order; + + $stm = $this->bd->prepare ($sql); + $stm->execute (); + + return HelperEntry::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC)); + } + public function listByCategory ($cat, $mode, $search = false, $order = 'high_to_low') { $where = ' WHERE category=?'; if ($mode == 'not_read') { -- cgit v1.2.3