[cvs] [Wiki] changed: CustomizingPreferences
Ben Chavet
ben at horde.org
Fri May 20 15:26:05 PDT 2005
ben Fri, 20 May 2005 15:26:05 -0700
Modified page: http://wiki.horde.org/display.php?page=CustomizingPreferences
New Revision: 1.15
@@ -139,29 +139,61 @@
have a "New Event" link in their menu. (don't forget to add the {{'hook' => 'true'}} to {{$prefs['display_cals']}}).
<code type="php">
if (!function_exists('_prefs_hook_display_cals')) {
- function _prefs_hook_display_cals($user = null)
+ function _prefs_hook_display_cals($uid = null)
{
require_once 'Horde/Share.php';
+
+ if (is_null($uid)) {
+ $uid = Auth::getAuth();
+ }
+
$kronolith_shares = &Horde_Share::singleton('kronolith');
- if (!$kronolith_shares->exists(Auth::getAuth())) {
+ if (!$kronolith_shares->exists($uid)) {
require_once 'Horde/Identity.php';
$identity = &Identity::singleton();
$name = $identity->getValue('fullname');
if (trim($name) == '') {
- $name = Auth::removeHook(Auth::getAuth());
+ $name = Auth::removeHook($uid);
}
- $share = $kronolith_shares->newShare(Auth::getAuth());
+ $share = $kronolith_shares->newShare($uid);
$share->set('name', sprintf(_("%s's Calendar"), $name));
$kronolith_shares->addShare($share);
}
- return 'a:2:{i:0;s:' . strlen(Auth::getAuth()) . ':"' . Auth::getAuth() . '";i:1;s:32:"ac2bc478568fa773d9a7530b1a71398b";}';
+ return 'a:2:{i:0;s:' . strlen($uid) . ':"' . $uid . '";i:1;s:32:"ac2bc478568fa773d9a7530b1a71398b";}';
}
}
</code>
+The following compliments the previous function by providing a default {{fb_cals}} pref.
+
+<code type="php">
+if (!function_exists('_prefs_hook_fb_cals')) {
+ function _prefs_hook_fb_cals($uid = null)
+ {
+ if (is_null($uid)) {
+ $uid = Auth::getAuth();
+ }
+
+ $kronolith_shares = &Horde_Share::singleton('kronolith');
+ if (!$kronolith_shares->exists($uid)) {
+ require_once 'Horde/Identity.php';
+ $identity = &Identity::singleton();
+ $name = $identity->getValue('fullname');
+ if (trim($name) == '') {
+ $name = Auth::removeHook($uid);
+ }
+ $share = $kronolith_shares->newShare($uid);
+ $share->set('name', sprintf(_("%s's Calendar"), $name));
+ $kronolith_shares->addShare($share);
+ }
+
+ return 'a:1:{i:0;s:' . strlen($uid) . ':"' . $uid . '";}';
+ }
+}
+</code>
--Ben Chavet
----
More information about the cvs
mailing list