summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-06-13 14:39:07 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-06-13 14:39:07 -0400
commita03926f90e120ffb8164e92f79b323b55287fdb4 (patch)
treeaf7cf8b05ebc591e11174e8cef54c2dca93f0c14 /lib
parentb8ee15b2203ea7e8d54954d0139930c746dbd112 (diff)
shows feeds in the left column
Diffstat (limited to 'lib')
-rw-r--r--lib/collection.php20
-rw-r--r--lib/feed.php16
-rw-r--r--lib/feedmapper.php16
-rw-r--r--lib/folder.php25
-rw-r--r--lib/foldermapper.php31
-rw-r--r--lib/item.php17
-rw-r--r--lib/itemmapper.php16
-rw-r--r--lib/utils.php17
8 files changed, 51 insertions, 107 deletions
diff --git a/lib/collection.php b/lib/collection.php
index f54df9d0a..2ebbb646f 100644
--- a/lib/collection.php
+++ b/lib/collection.php
@@ -3,20 +3,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
-* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+* This file is licensed under the Affero General Public License version 3 or later.
+* See the COPYING-README file
*
*/
@@ -26,6 +16,10 @@
class OC_News_Collection {
private $id;
+
+ public function __construct($id){
+ $this->id = $id;
+ }
public function getId(){
return $this->id;
diff --git a/lib/feed.php b/lib/feed.php
index 870fd64f6..281a968f0 100644
--- a/lib/feed.php
+++ b/lib/feed.php
@@ -3,20 +3,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
-* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+* This file is licensed under the Affero General Public License version 3 or later.
+* See the COPYING-README file
*
*/
diff --git a/lib/feedmapper.php b/lib/feedmapper.php
index d24d07e4d..e64316d0c 100644
--- a/lib/feedmapper.php
+++ b/lib/feedmapper.php
@@ -3,20 +3,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
-* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+* This file is licensed under the Affero General Public License version 3 or later.
+* See the COPYING-README file
*
*/
diff --git a/lib/folder.php b/lib/folder.php
index 2bdc1fb78..88d3300a5 100644
--- a/lib/folder.php
+++ b/lib/folder.php
@@ -3,20 +3,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
-* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+* This file is licensed under the Affero General Public License version 3 or later.
+* See the COPYING-README file
*
*/
@@ -29,8 +19,11 @@ class OC_News_Folder extends OC_News_Collection {
private $children;
private $parent;
- public function __construct($name, $parent = null){
+ public function __construct($name, $id = null, $parent = null){
$this->name = $name;
+ if ($id !== null){
+ parent::__construct($id);
+ }
$this->children = array();
if ($parent !== null){
$this->parent = $parent;
@@ -55,5 +48,9 @@ class OC_News_Folder extends OC_News_Collection {
public function addChild(OC_News_Collection $child){
$this->children[] = $child;
}
+
+ public function getChildren(){
+ return $children;
+ }
} \ No newline at end of file
diff --git a/lib/foldermapper.php b/lib/foldermapper.php
index f4ff6239b..5aecc2e3b 100644
--- a/lib/foldermapper.php
+++ b/lib/foldermapper.php
@@ -3,20 +3,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
-* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+* This file is licensed under the Affero General Public License version 3 or later.
+* See the COPYING-README file
*
*/
@@ -26,10 +16,25 @@
class OC_News_FolderMapper {
const tableName = '*PREFIX*news_folders';
+
+ private $userid;
+ public function __construct($userid){
+ $this->userid = $userid;
+ }
+
public function root(){
$root = new OC_News_Folder('All feeds');
+ $stmt = OCP\DB::prepare('SELECT *
+ FROM ' . self::tableName .
+ ' WHERE user_id = ? AND parent_id = ?');
+ $result = $stmt->execute(array($this->userid, 0));
+ while( $row = $result->fetchRow()){
+ $child = new OC_News_Folder($row['id'], $row['name']);
+ $root->addChild($child);
+ }
+
return $root;
}
diff --git a/lib/item.php b/lib/item.php
index 2ece7aa82..bd695d8bd 100644
--- a/lib/item.php
+++ b/lib/item.php
@@ -3,24 +3,13 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
-* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+* This file is licensed under the Affero General Public License version 3 or later.
+* See the COPYING-README file
*
*/
-
class StatusFlag{
const Unread = 0x02;
const Important = 0x04;
diff --git a/lib/itemmapper.php b/lib/itemmapper.php
index 4f5bc1a9d..81be77e21 100644
--- a/lib/itemmapper.php
+++ b/lib/itemmapper.php
@@ -3,20 +3,10 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
-* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+* This file is licensed under the Affero General Public License version 3 or later.
+* See the COPYING-README file
*
*/
diff --git a/lib/utils.php b/lib/utils.php
index dd752aea4..e7122bf69 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -3,24 +3,13 @@
* ownCloud - News app
*
* @author Alessandro Cosentino
-* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* Copyright (c) 2012 - Alessandro Cosentino <cosenal@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 Lesser General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+* This file is licensed under the Affero General Public License version 3 or later.
+* See the COPYING-README file
*
*/
-
class OC_News_Utils {
/**