diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-06-06 13:34:19 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-06-06 13:34:19 -0400 |
commit | 6f1204c3b9e145436fad1ee64e53ff0b58c89e66 (patch) | |
tree | d46e7624263aeb94df259b16c10ac2ec1b15f0b1 /lib | |
parent | 200aebe1f4220d9d0b8f1b3807704300ced28f16 (diff) |
starts the GUI
Diffstat (limited to 'lib')
-rw-r--r-- | lib/feedmapper.php | 17 | ||||
-rw-r--r-- | lib/folder.php | 1 | ||||
-rw-r--r-- | lib/foldermapper.php | 19 | ||||
-rw-r--r-- | lib/item.php | 4 | ||||
-rw-r--r-- | lib/itemmapper.php | 4 |
5 files changed, 40 insertions, 5 deletions
diff --git a/lib/feedmapper.php b/lib/feedmapper.php index 4d885579e..d24d07e4d 100644 --- a/lib/feedmapper.php +++ b/lib/feedmapper.php @@ -136,7 +136,6 @@ class OC_News_FeedMapper { } public function delete(OC_News_Feed $feed){ - $id = $feed->getId(); $stmt = OCP\DB::prepare(" @@ -151,6 +150,22 @@ class OC_News_FeedMapper { $itemMapper->deleteAll($id); return true; + } + + public function deleteAll($folderdid){ + $id = $feed->getId(); + + $stmt = OCP\DB::prepare(" + DELETE FROM " . self::tableName . + "WHERE id = $id + "); + + $result = $stmt->execute(); + + $itemMapper = new OC_News_ItemMapper(); + //TODO: handle the value that the execute returns + $itemMapper->deleteAll($id); + return true; } }
\ No newline at end of file diff --git a/lib/folder.php b/lib/folder.php index f97960c7b..6c7c4c2f5 100644 --- a/lib/folder.php +++ b/lib/folder.php @@ -35,7 +35,6 @@ class OC_News_Folder { $this->name = $name; $this->parent = $parent; $this->feeds = array(); - $this->id = 0; } public function getName(){ diff --git a/lib/foldermapper.php b/lib/foldermapper.php index b751e6bcc..e9de89341 100644 --- a/lib/foldermapper.php +++ b/lib/foldermapper.php @@ -94,4 +94,23 @@ class OC_News_FolderMapper { $folder->setId($folderid); } + + //TODO: replace it with a DELETE INNER JOIN operation + public function delete(OC_News_Folder $folder){ + $id = $folder->getId(); + + $stmt = OCP\DB::prepare(" + DELETE FROM " . self::tableName . + "WHERE id = $id + "); + + $result = $stmt->execute(); + + $feedMapper = new OC_News_FeedMapper(); + //TODO: handle the value that the execute returns + $feedMapper->deleteAll($id); + + return true; + } + }
\ No newline at end of file diff --git a/lib/item.php b/lib/item.php index 73fd472e1..2ece7aa82 100644 --- a/lib/item.php +++ b/lib/item.php @@ -81,6 +81,10 @@ class OC_News_Item { $this->status |= StatusFlag::Important; } + public function setUnimportant(){ + $this->status &= ~StatusFlag::Important; + } + public function isImportant(){ return ($this->status & StatusFlag::Important); } diff --git a/lib/itemmapper.php b/lib/itemmapper.php index 6f7acb939..4f5bc1a9d 100644 --- a/lib/itemmapper.php +++ b/lib/itemmapper.php @@ -72,7 +72,6 @@ class OC_News_ItemMapper { public function save(OC_News_Item $item, $feedid){ $guid = $item->getGuid(); $status = $item->getStatus(); - echo $status; $itemid = $this->findIdFromGuid($guid, $feedid); @@ -120,7 +119,7 @@ class OC_News_ItemMapper { $item->setId($itemid); return $itemid; } - + /** * @brief Retrieve an item from the database * @param id The id of the feed in the database table. @@ -142,7 +141,6 @@ class OC_News_ItemMapper { * @return */ public function deleteAll($feedid){ - $stmt = OCP\DB::prepare(" DELETE FROM " . self::tableName . "WHERE feedid = $id |