1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-30 19:52:17 +01:00

port oc_preferences

This commit is contained in:
Frank Karlitschek 2012-05-02 15:54:34 +02:00
parent f508ad3d9d
commit 299cabaf87
2 changed files with 4 additions and 4 deletions

View File

@ -168,7 +168,7 @@ class OC_Contacts_Addressbook{
if(is_null($uid)){ if(is_null($uid)){
$uid = OCP\USER::getUser(); $uid = OCP\USER::getUser();
} }
$prefbooks = OC_Preferences::getValue($uid,'contacts','openaddressbooks',null); $prefbooks = OCP\Config::getUserValue($uid,'contacts','openaddressbooks',null);
if(!$prefbooks){ if(!$prefbooks){
$addressbooks = OC_Contacts_Addressbook::all($uid); $addressbooks = OC_Contacts_Addressbook::all($uid);
if(count($addressbooks) == 0){ if(count($addressbooks) == 0){
@ -176,7 +176,7 @@ class OC_Contacts_Addressbook{
$addressbooks = OC_Contacts_Addressbook::all($uid); $addressbooks = OC_Contacts_Addressbook::all($uid);
} }
$prefbooks = $addressbooks[0]['id']; $prefbooks = $addressbooks[0]['id'];
OC_Preferences::setValue($uid,'contacts','openaddressbooks',$prefbooks); OCP\Config::setUserValue($uid,'contacts','openaddressbooks',$prefbooks);
} }
return explode(';',$prefbooks); return explode(';',$prefbooks);
} }
@ -235,7 +235,7 @@ class OC_Contacts_Addressbook{
$openaddressbooks = self::cleanArray($openaddressbooks, false); $openaddressbooks = self::cleanArray($openaddressbooks, false);
sort($openaddressbooks, SORT_NUMERIC); sort($openaddressbooks, SORT_NUMERIC);
// FIXME: I alway end up with a ';' prepending when imploding the array..? // FIXME: I alway end up with a ';' prepending when imploding the array..?
OC_Preferences::setValue(OCP\USER::getUser(),'contacts','openaddressbooks',implode(';', $openaddressbooks)); OCP\Config::setUserValue(OCP\USER::getUser(),'contacts','openaddressbooks',implode(';', $openaddressbooks));
return true; return true;
} }

View File

@ -1,7 +1,7 @@
<script type='text/javascript'> <script type='text/javascript'>
var totalurl = '<?php echo OCP\Util::linkToAbsolute('contacts', 'carddav.php'); ?>/addressbooks'; var totalurl = '<?php echo OCP\Util::linkToAbsolute('contacts', 'carddav.php'); ?>/addressbooks';
var categories = <?php echo json_encode($_['categories']); ?>; var categories = <?php echo json_encode($_['categories']); ?>;
var lang = '<?php echo OC_Preferences::getValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>'; var lang = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>';
</script> </script>
<div id="leftcontent" class="leftcontent"> <div id="leftcontent" class="leftcontent">
<ul id="contacts"> <ul id="contacts">