Merge pull request #4928 from owncloud/interfaces
Add a couple of interface definitionsremotes/origin/stable6
commit
200e9691de
@ -0,0 +1,77 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
* |
||||
*/ |
||||
|
||||
namespace OC; |
||||
|
||||
/** |
||||
* Class to combine all the configuration options ownCloud offers |
||||
*/ |
||||
class AllConfig implements \OCP\IConfig { |
||||
/** |
||||
* Sets a new system wide value |
||||
* @param string $key the key of the value, under which will be saved |
||||
* @param string $value the value that should be stored |
||||
* @todo need a use case for this |
||||
*/ |
||||
// public function setSystemValue($key, $value) { |
||||
// \OCP\Config::setSystemValue($key, $value); |
||||
// } |
||||
|
||||
/** |
||||
* Looks up a system wide defined value |
||||
* @param string $key the key of the value, under which it was saved |
||||
* @return string the saved value |
||||
*/ |
||||
public function getSystemValue($key) { |
||||
return \OCP\Config::getSystemValue($key, ''); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 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($appName, $key, $value) { |
||||
\OCP\Config::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($appName, $key) { |
||||
return \OCP\Config::getAppValue($appName, $key, ''); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 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 |
||||
*/ |
||||
public function setUserValue($userId, $appName, $key, $value) { |
||||
\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 |
||||
* @param string $appName the appName that we stored the value under |
||||
* @param string $key the key under which the value is being stored |
||||
*/ |
||||
public function getUserValue($userId, $appName, $key){ |
||||
return \OCP\Config::getUserValue($userId, $appName, $key); |
||||
} |
||||
} |
@ -0,0 +1,64 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> |
||||
* 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 implements \OCP\INavigationManager { |
||||
protected $entries = array(); |
||||
protected $activeEntry; |
||||
|
||||
/** |
||||
* 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; |
||||
} |
||||
} |
@ -0,0 +1,65 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
* |
||||
*/ |
||||
|
||||
namespace OCP; |
||||
|
||||
/** |
||||
* Access to all the configuration options ownCloud offers |
||||
*/ |
||||
interface IConfig { |
||||
/** |
||||
* Sets a new system wide value |
||||
* @param string $key the key of the value, under which will be saved |
||||
* @param string $value the value that should be stored |
||||
* @todo need a use case for this |
||||
*/ |
||||
// public function setSystemValue($key, $value); |
||||
|
||||
/** |
||||
* Looks up a system wide defined value |
||||
* @param string $key the key of the value, under which it was saved |
||||
* @return string the saved value |
||||
*/ |
||||
public function getSystemValue($key); |
||||
|
||||
|
||||
/** |
||||
* 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($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($appName, $key); |
||||
|
||||
|
||||
/** |
||||
* 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 |
||||
*/ |
||||
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 |
||||
*/ |
||||
public function getUserValue($userId, $appName, $key); |
||||
} |
@ -0,0 +1,74 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
* |
||||
*/ |
||||
|
||||
namespace OCP; |
||||
|
||||
/** |
||||
* TODO: Description |
||||
*/ |
||||
interface IDBConnection { |
||||
/** |
||||
* Used to abstract the owncloud database access away |
||||
* @param string $sql the sql query with ? placeholder for params |
||||
* @param int $limit the maximum number of rows |
||||
* @param int $offset from which row we want to start |
||||
* @return \Doctrine\DBAL\Driver\Statement The prepared statement. |
||||
*/ |
||||
public function prepare($sql, $limit=null, $offset=null); |
||||
|
||||
/** |
||||
* Used to get the id of the just inserted element |
||||
* @param string $tableName the name of the table where we inserted the item |
||||
* @return int the id of the inserted element |
||||
*/ |
||||
public function lastInsertId($table = null); |
||||
|
||||
/** |
||||
* @brief Insert a row if a matching row doesn't exists. |
||||
* @param $table string The table name (will replace *PREFIX*) to perform the replace on. |
||||
* @param $input array |
||||
* |
||||
* The input array if in the form: |
||||
* |
||||
* array ( 'id' => array ( 'value' => 6, |
||||
* 'key' => true |
||||
* ), |
||||
* 'name' => array ('value' => 'Stoyan'), |
||||
* 'family' => array ('value' => 'Stefanov'), |
||||
* 'birth_date' => array ('value' => '1975-06-20') |
||||
* ); |
||||
* @return bool |
||||
* |
||||
*/ |
||||
public function insertIfNotExist($table, $input); |
||||
|
||||
/** |
||||
* @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(); |
||||
|
||||
/** |
||||
* returns the error code and message as a string for logging |
||||
* @return string |
||||
*/ |
||||
public function getError(); |
||||
} |
@ -0,0 +1,27 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
* |
||||
*/ |
||||
|
||||
namespace OCP; |
||||
|
||||
/** |
||||
* Manages the ownCloud navigation |
||||
*/ |
||||
interface INavigationManager { |
||||
/** |
||||
* Creates a new navigation entry |
||||
* @param array $entry containing: id, name, order, icon and href key |
||||
*/ |
||||
public function add(array $entry); |
||||
|
||||
/** |
||||
* Sets the current navigation entry of the currently running app |
||||
* @param string $appId id of the app entry to activate (from added $entry) |
||||
*/ |
||||
public function setActiveEntry($appId); |
||||
} |
@ -0,0 +1,30 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
* |
||||
*/ |
||||
|
||||
namespace OCP; |
||||
|
||||
/** |
||||
* User session |
||||
*/ |
||||
interface IUserSession { |
||||
/** |
||||
* Do a user login |
||||
* @param string $user the username |
||||
* @param string $password the password |
||||
* @return bool true if successful |
||||
*/ |
||||
public function login($user, $password); |
||||
|
||||
/** |
||||
* @brief Logs the user out including all the session data |
||||
* Logout, destroys session |
||||
*/ |
||||
public function logout(); |
||||
|
||||
} |
Loading…
Reference in new issue