From e3013c580108e6b0cc332ba14976f3ffb4b7b274 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 20 Sep 2013 17:34:33 +0200 Subject: Add Navigation class to server container --- lib/navigationmanager.php | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 lib/navigationmanager.php (limited to 'lib/navigationmanager.php') diff --git a/lib/navigationmanager.php b/lib/navigationmanager.php new file mode 100644 index 00000000000..f032afd1fc4 --- /dev/null +++ b/lib/navigationmanager.php @@ -0,0 +1,63 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + * + */ + +namespace OC; + +/** + * Manages the owncloud navigation + */ +class NavigationManager { + protected $entries = array(); + + /** + * Creates a new navigation entry + * @param array $entry containing: id, name, order, icon and href key + */ + public function add(array $entry) { + $entry['active'] = false; + if(!isset($entry['icon'])) { + $entry['icon'] = ''; + } + $this->entries[] = $entry; + } + + /** + * @brief returns all the added Menu entries + * @return array of the added entries + */ + public function getAll() { + return $this->entries; + } + + /** + * @brief removes all the entries + */ + public function clear() { + $this->entries = array(); + } + + /** + * Sets the current navigation entry of the currently running app + * @param string $id of the app entry to activate (from added $entry) + */ + public function setActiveEntry($id) { + $this->activeEntry = $id; + } + + /** + * @brief gets the active Menu entry + * @return string id or empty string + * + * This function returns the id of the active navigation entry (set by + * setActiveEntry + */ + public function getActiveEntry() { + return $this->activeEntry; + } +} -- cgit v1.2.3 From f83f32326949d6bc16c2b0d7aefcdbb48f9119d7 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Fri, 20 Sep 2013 21:45:27 +0200 Subject: fixing typos + adding missing filed $activeEntry --- lib/navigationmanager.php | 3 ++- lib/public/inavigationmanager.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/navigationmanager.php') diff --git a/lib/navigationmanager.php b/lib/navigationmanager.php index f032afd1fc4..cf3bf84d998 100644 --- a/lib/navigationmanager.php +++ b/lib/navigationmanager.php @@ -10,10 +10,11 @@ namespace OC; /** - * Manages the owncloud navigation + * Manages the ownCloud navigation */ class NavigationManager { protected $entries = array(); + protected $activeEntry; /** * Creates a new navigation entry diff --git a/lib/public/inavigationmanager.php b/lib/public/inavigationmanager.php index 21744dd1c21..f89e790c1d0 100644 --- a/lib/public/inavigationmanager.php +++ b/lib/public/inavigationmanager.php @@ -10,7 +10,7 @@ namespace OCP; /** - * Manages the owncloud navigation + * Manages the ownCloud navigation */ interface INavigationManager { /** @@ -24,4 +24,4 @@ interface INavigationManager { * @param string $appId id of the app entry to activate (from added $entry) */ public function setActiveEntry($appId); -} \ No newline at end of file +} -- cgit v1.2.3 From 0c6dcdba6b890dc170f59a461ab80961a85a53db Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 20 Sep 2013 22:45:22 +0200 Subject: Add missing implements and fix parameters in IConfig --- lib/allconfig.php | 1 - lib/navigationmanager.php | 2 +- lib/public/iconfig.php | 22 ++++++++++++++-------- lib/public/idbconnection.php | 3 +++ lib/user/session.php | 2 +- 5 files changed, 19 insertions(+), 11 deletions(-) (limited to 'lib/navigationmanager.php') diff --git a/lib/allconfig.php b/lib/allconfig.php index 353608e5d21..72aabf60793 100644 --- a/lib/allconfig.php +++ b/lib/allconfig.php @@ -65,7 +65,6 @@ class AllConfig implements \OCP\IConfig { \OCP\Config::setUserValue($userId, $appName, $key, $value); } - /** * Shortcut for getting a user defined value * @param string $userId the userId of the user that we want to store the value under diff --git a/lib/navigationmanager.php b/lib/navigationmanager.php index cf3bf84d998..1f657b9ad80 100644 --- a/lib/navigationmanager.php +++ b/lib/navigationmanager.php @@ -12,7 +12,7 @@ namespace OC; /** * Manages the ownCloud navigation */ -class NavigationManager { +class NavigationManager implements \OCP\INavigationManager { protected $entries = array(); protected $activeEntry; diff --git a/lib/public/iconfig.php b/lib/public/iconfig.php index dab4590969b..850bddf6935 100644 --- a/lib/public/iconfig.php +++ b/lib/public/iconfig.php @@ -1,10 +1,12 @@ +/** + * Copyright (c) 2013 Bart Visscher * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. * */ + namespace OCP; /** @@ -29,31 +31,35 @@ interface IConfig { /** * Writes a new app wide value + * @param string $appName the appName that we want to store the value under * @param string $key the key of the value, under which will be saved * @param string $value the value that should be stored */ - public function setAppValue($key, $value, $appName=null); + public function setAppValue($appName, $key, $value); /** * Looks up an app wide defined value + * @param string $appName the appName that we stored the value under * @param string $key the key of the value, under which it was saved * @return string the saved value */ - public function getAppValue($key, $appName=null); + public function getAppValue($appName, $key); /** - * Shortcut for setting a user defined value + * Set a user defined value + * @param string $userId the userId of the user that we want to store the value under + * @param string $appName the appName that we want to store the value under * @param string $key the key under which the value is being stored * @param string $value the value that you want to store - * @param string $userId the userId of the user that we want to store the value under, defaults to the current one */ - public function setUserValue($key, $value, $userId=null); + public function setUserValue($userId, $appName, $key, $value); /** * Shortcut for getting a user defined value + * @param string $userId the userId of the user that we want to store the value under + * @param string $appName the appName that we stored the value under * @param string $key the key under which the value is being stored - * @param string $userId the userId of the user that we want to store the value under, defaults to the current one */ - public function getUserValue($key, $userId=null); + public function getUserValue($userId, $appName, $key); } diff --git a/lib/public/idbconnection.php b/lib/public/idbconnection.php index 67dd7ccfc37..c741a0f061a 100644 --- a/lib/public/idbconnection.php +++ b/lib/public/idbconnection.php @@ -50,16 +50,19 @@ interface IDBConnection { /** * @brief Start a transaction + * @return bool TRUE on success or FALSE on failure */ public function beginTransaction(); /** * @brief Commit the database changes done during a transaction that is in progress + * @return bool TRUE on success or FALSE on failure */ public function commit(); /** * @brief Rollback the database changes done during a transaction that is in progress + * @return bool TRUE on success or FALSE on failure */ public function rollBack(); diff --git a/lib/user/session.php b/lib/user/session.php index 9a6c669e935..98a24d5bb00 100644 --- a/lib/user/session.php +++ b/lib/user/session.php @@ -27,7 +27,7 @@ use OC\Hooks\Emitter; * * @package OC\User */ -class Session implements Emitter { +class Session implements Emitter, \OCP\IUserSession { /** * @var \OC\User\Manager $manager */ -- cgit v1.2.3