summaryrefslogtreecommitdiffstats
path: root/bl/folderbl.php
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-20 21:48:22 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-21 00:31:18 +0100
commit6dab27a668b33f91efe5905d0bcb83d4b212ee86 (patch)
tree129ee8329c90eed20aa02c7bcfef5bd39c6425da /bl/folderbl.php
parentb9d98e336c29d15cbf669d7d735eff7c80b02414 (diff)
be nice
Diffstat (limited to 'bl/folderbl.php')
-rw-r--r--bl/folderbl.php55
1 files changed, 45 insertions, 10 deletions
diff --git a/bl/folderbl.php b/bl/folderbl.php
index 85c386d90..9f9c09d15 100644
--- a/bl/folderbl.php
+++ b/bl/folderbl.php
@@ -1,27 +1,61 @@
<?php
-namespace OCA\News;
+/**
+* ownCloud - News
+*
+* @author Alessandro Cosentino
+* @author Bernhard Posselt
+* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
-class FolderBl {
+namespace OCA\News\Bl;
+
+use \OCA\News\Db\Folder;
+
+
+class FolderBl extends Bl {
public function __construct($folderMapper){
- $this->folderMapper = $folderMapper;
+ parent::__construct($folderMapper);
}
- public function getAll() {
- return $this->folderMapper->getAll();
+
+ public function getAll($userId) {
+ return $this->mapper->findAllFromUser($userId);
}
+
public function create($name, $parentId) {
- //TODO: change the setparentid in the model class Folder
- $folder = new Folder($name, null, null);
- return $this->folderMapper->save($folder);
+ $folder = new Folder();
+ $folder->setName($name);
+ $folder->setParentId($parentId);
+ return $this->mapper->insert($folder);
}
- public function delete($folderid) {
- return $this->folderMapper->deleteById($folderid);
+
+ public function setOpened($folderId, $opened, $userId){
+ $folder = $this->find($folderId, $userId);
+ $folder->setOpened($opened);
+ $this->mapper->update($folder);
}
+
+/*
public function modify($folderid, $name = null, $parent = null, $opened = null) {
$folder = $this->folderMapper->find($folderid);
if(!$folder)
@@ -35,4 +69,5 @@ class FolderBl {
$folder->setOpened($opened);
return $this->folderMapper->update($folder);
}
+*/
}