summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-06-27 02:12:14 +0200
committerThomas Tanghus <thomas@tanghus.net>2012-06-27 02:12:53 +0200
commit3edc40a68a7cf576d7197328e57c001d1667ae39 (patch)
tree6f5d87f8d8118b01679391d96f4f7b09a07500b8
parent823bef3a090fdcfc0ac6ad6662e5535d7a5aae72 (diff)
downloadnextcloud-server-3edc40a68a7cf576d7197328e57c001d1667ae39.tar.gz
nextcloud-server-3edc40a68a7cf576d7197328e57c001d1667ae39.zip
Load default categories if there are none,
-rw-r--r--apps/contacts/lib/app.php35
1 files changed, 29 insertions, 6 deletions
diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php
index 29428763d60..b3a7abd28bc 100644
--- a/apps/contacts/lib/app.php
+++ b/apps/contacts/lib/app.php
@@ -10,7 +10,6 @@
* This class manages our app actions
*/
OC_Contacts_App::$l10n = OC_L10N::get('contacts');
-OC_Contacts_App::$categories = new OC_VCategories('contacts');
class OC_Contacts_App {
/*
* @brief language object for calendar app
@@ -137,31 +136,55 @@ class OC_Contacts_App {
}
}
- /*
+ /**
* @brief returns the vcategories object of the user
* @return (object) $vcategories
*/
protected static function getVCategories() {
if (is_null(self::$categories)) {
- self::$categories = new OC_VCategories('contacts');
+ self::$categories = new OC_VCategories('contacts', null, self::getDefaultCategories());
}
return self::$categories;
}
- /*
+ /**
* @brief returns the categories for the user
* @return (Array) $categories
*/
public static function getCategories() {
- $categories = self::$categories->categories();
+ $categories = self::getVCategories()->categories();
if(count($categories) == 0) {
self::scanCategories();
$categories = self::$categories->categories();
}
- return $categories;
+ return ($categories ? $categories : self::getDefaultCategories());
}
/**
+ * @brief returns the default categories of ownCloud
+ * @return (array) $categories
+ */
+ protected static function getDefaultCategories(){
+ return array(
+ (string)self::$l10n->t('Birthday'),
+ (string)self::$l10n->t('Business'),
+ (string)self::$l10n->t('Call'),
+ (string)self::$l10n->t('Clients'),
+ (string)self::$l10n->t('Deliverer'),
+ (string)self::$l10n->t('Holidays'),
+ (string)self::$l10n->t('Ideas'),
+ (string)self::$l10n->t('Journey'),
+ (string)self::$l10n->t('Jubilee'),
+ (string)self::$l10n->t('Meeting'),
+ (string)self::$l10n->t('Other'),
+ (string)self::$l10n->t('Personal'),
+ (string)self::$l10n->t('Projects'),
+ (string)self::$l10n->t('Questions'),
+ (string)self::$l10n->t('Work'),
+ );
+ }
+
+ /**
* scan vcards for categories.
* @param $vccontacts VCards to scan. null to check all vcards for the current user.
*/