summaryrefslogtreecommitdiffstats
path: root/lib/app.php
diff options
context:
space:
mode:
authorJakob Sack <kde@jakobsack.de>2011-04-16 10:26:18 +0200
committerJakob Sack <kde@jakobsack.de>2011-04-16 10:26:18 +0200
commit683677b4f9c5fcf3f7fed6db1881544898f816cc (patch)
treefdeafe2fbc9d19a5442070e6354fddc50d3a3593 /lib/app.php
parent16e4a1dd1795714426a529f02391d41c41acae71 (diff)
downloadnextcloud-server-683677b4f9c5fcf3f7fed6db1881544898f816cc.tar.gz
nextcloud-server-683677b4f9c5fcf3f7fed6db1881544898f816cc.zip
Support for navigation sub entries
Diffstat (limited to 'lib/app.php')
-rw-r--r--lib/app.php67
1 files changed, 64 insertions, 3 deletions
diff --git a/lib/app.php b/lib/app.php
index 4a7c2b3a963..1ced0469f98 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -29,8 +29,11 @@
class OC_APP{
static private $init = false;
static private $apps = array();
+ static private $activeapp = "";
static private $adminpages = array();
+ static private $settingspages = array();
static private $navigation = array();
+ static private $subnavigation = array();
static private $personalmenu = array();
/**
@@ -88,7 +91,6 @@ class OC_APP{
*
*/
public static function register( $data ){
- // TODO: write function
OC_APP::$apps[] = $data;
}
@@ -147,7 +149,10 @@ class OC_APP{
* the navigation. Lower values come first.
*/
public static function addNavigationSubEntry( $parent, $data ){
- // TODO: write function
+ if( !array_key_exists( self::$subnavigation[$parent] )){
+ self::$subnavigation[$parent] = array();
+ }
+ self::$subnavigation[$parent][] = $data;
return true;
}
@@ -161,7 +166,7 @@ class OC_APP{
* highlighting the current position of the user.
*/
public static function activateNavigationEntry( $id ){
- // TODO: write function
+ self::$activeapp = $id;
return true;
}
@@ -210,6 +215,31 @@ class OC_APP{
}
/**
+ * @brief registers a settings page
+ * @param $data array containing the data
+ * @returns true/false
+ *
+ * This function registers a settings page. $data is an associative array.
+ * The following keys are required:
+ * - app: app the settings belong to ("files")
+ * - id: unique id for this entry ("files_public")
+ * - href: link to the admin page
+ * - name: Human readable name ("Public files")
+ *
+ * The following keys are optional:
+ * - order: integer, that influences the position of your application in
+ * the list. Lower values come first.
+ *
+ * For the main settings page of an app, the keys "app" and "id" have to be
+ * the same.
+ */
+ public static function addSettingsPage( $data = array()){
+ // TODO: write function
+ OC_APP::$settingspages[] = $data;
+ return true;
+ }
+
+ /**
* @brief Returns the navigation
* @returns associative array
*
@@ -250,6 +280,37 @@ class OC_APP{
}
/**
+ * @brief Returns the admin pages
+ * @param $app optional, name of the app we want the settings for
+ * @returns associative array
+ *
+ * This function returns an array with the settings pages. If $app is not
+ * set, it will return the main settings pages for all apps (where
+ * "id" == "app"). Otherwise it will list all settings pages of the app.
+ * The entries are sorted by the key "order" ascending.
+ */
+ public static function getSettingsPages( $app = null ){
+ $return = array();
+
+ if( is_null( $app )){
+ foreach( OC_APP::$settingspages as $i ){
+ if( $i["id"] == $i["app"] ){
+ $return[] = $i;
+ }
+ }
+ }
+ else{
+ foreach( OC_APP::$settingspages as $i ){
+ if( $i["app"] == $app ){
+ $return[] = $i;
+ }
+ }
+ }
+
+ return $return;
+ }
+
+ /**
* @brief Installs an app
* @param $data array with all information
* @returns integer