From 7ebcea562b1d08fe62d6205cfd976c81c0477c25 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 3 Apr 2010 18:44:30 +0000 Subject: merged [5526] - [5530] into trunk from 1.7 branch - there are more changes before and after these revisions to be merged git-svn-id: http://code.elgg.org/elgg/trunk@5605 36083f99-b078-4883-b0ff-0f9b5a30f544 --- .../notifications/subscriptions/forminternals.php | 293 +++++++++++---------- 1 file changed, 151 insertions(+), 142 deletions(-) (limited to 'mod/notifications/views/default') diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php index 97fe77cac..254f849bd 100644 --- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php +++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php @@ -8,89 +8,92 @@

guid,'',9999,0); +// Get friends and subscriptions +$friends = get_user_friends($vars['user']->guid,'',9999,0); - global $NOTIFICATION_HANDLERS; - foreach($NOTIFICATION_HANDLERS as $method => $foo) { - $subsbig[$method] = elgg_get_entities_from_relationship(array('relationship' => 'notify' . $method, 'relationship_guid' => $vars['user']->guid, 'types' => 'user', 'limit' => 99999)); - } +global $NOTIFICATION_HANDLERS; +foreach($NOTIFICATION_HANDLERS as $method => $foo) { + $subsbig[$method] = elgg_get_entities_from_relationship(array('relationship' => 'notify' . $method, 'relationship_guid' => $vars['user']->guid, 'types' => 'user', 'limit' => 99999)); +} - $subs = array(); - foreach($subsbig as $method => $big) { - if (is_array($subsbig[$method]) && sizeof($subsbig[$method])) { - foreach($subsbig[$method] as $u) { $subs[$method][] = $u->guid; } - } - } - - // Let the system know that the friends picker is in use - global $pickerinuse; - $pickerinuse = true; - $chararray = elgg_echo('friendspicker:chararray'); - - // Initialise internalname - if (!isset($vars['internalname'])) { - $internalname = "friend"; - } else { - $internalname = $vars['internalname']; +$subs = array(); +foreach($subsbig as $method => $big) { + if (is_array($subsbig[$method]) && sizeof($subsbig[$method])) { + foreach($subsbig[$method] as $u) { + $subs[$method][] = $u->guid; } + } +} + +// Let the system know that the friends picker is in use +global $pickerinuse; +$pickerinuse = true; +$chararray = elgg_echo('friendspicker:chararray'); + +// Initialise internalname +if (!isset($vars['internalname'])) { + $internalname = "friend"; +} else { + $internalname = $vars['internalname']; +} - // Initialise values - if (!isset($vars['value'])) { - $vars['value'] = array(); - } else { - if (!is_array($vars['value'])) { - $vars['value'] = (int) $vars['value']; - $vars['value'] = array($vars['value']); - } - } - - // Initialise whether we're calling back or not - if (isset($vars['callback'])) { - $callback = $vars['callback']; - } else { - $callback = false; - } +// Initialise values +if (!isset($vars['value'])) { + $vars['value'] = array(); +} else { + if (!is_array($vars['value'])) { + $vars['value'] = (int) $vars['value']; + $vars['value'] = array($vars['value']); + } +} + +// Initialise whether we're calling back or not +if (isset($vars['callback'])) { + $callback = $vars['callback']; +} else { + $callback = false; +} - // We need to count the number of friends pickers on the page. - if (!isset($vars['friendspicker'])) { - global $friendspicker; - if (!isset($friendspicker)) $friendspicker = 0; - $friendspicker++; - } else { - $friendspicker = $vars['friendspicker']; - } +// We need to count the number of friends pickers on the page. +if (!isset($vars['friendspicker'])) { + global $friendspicker; + if (!isset($friendspicker)) { + $friendspicker = 0; + } + $friendspicker++; +} else { + $friendspicker = $vars['friendspicker']; +} - $users = array(); - $activeletters = array(); +$users = array(); +$activeletters = array(); - // Are we displaying form tags and submit buttons? - // (If we've been given a target, then yes! Otherwise, no.) - if (isset($vars['formtarget'])) { - $formtarget = $vars['formtarget']; - } else { - $formtarget = false; - } +// Are we displaying form tags and submit buttons? +// (If we've been given a target, then yes! Otherwise, no.) +if (isset($vars['formtarget'])) { + $formtarget = $vars['formtarget']; +} else { + $formtarget = false; +} - // Sort users by letter - if (is_array($friends) && sizeof($friends)) - foreach($friends as $user) { +// Sort users by letter +if (is_array($friends) && sizeof($friends)) { + foreach($friends as $user) { - if (is_callable('mb_substr')) - $letter = strtoupper(mb_substr($user->name,0,1)); - else - $letter = strtoupper(substr($user->name,0,1)); - if (!substr_count($chararray,$letter)) { - $letter = "*"; - } - if (!isset($users[$letter])) { - $users[$letter] = array(); - } - $users[$letter][$user->name] = $user; + $letter = elgg_substr($user->name,0,1); + $letter = elgg_strtoupper($letter); + if (!elgg_substr_count($chararray,$letter)) { + $letter = "*"; + } + if (!isset($users[$letter])) { + $users[$letter] = array(); + } + $users[$letter][$user->name] = $user; - } - - if (!$callback) { + } +} + +if (!$callback) { ?> @@ -98,8 +101,9 @@ @@ -107,11 +111,11 @@ -