aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/forminternals.php16
-rw-r--r--views/default/friends/forms/edit.php8
-rw-r--r--views/default/friends/picker.php20
3 files changed, 32 insertions, 12 deletions
diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php
index ca28fc72a..eb35b5ba0 100644
--- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php
+++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php
@@ -23,7 +23,8 @@
// Let the system know that the friends picker is in use
global $pickerinuse;
- $pickerinuse = true;
+ $pickerinuse = true;
+ $chararray = elgg_echo('friendspicker:chararray');
// Initialise internalname
if (!isset($vars['internalname'])) {
@@ -74,8 +75,8 @@
foreach($friends as $user) {
$letter = strtoupper(substr($user->name,0,1));
- if ($letter >= "0" && $letter <= "9") {
- $letter = "0";
+ if (!substr_count($chararray,$letter)) {
+ $letter = "*";
}
if (!isset($users[$letter])) {
$users[$letter] = array();
@@ -147,7 +148,9 @@
<?php
// Initialise letters
- $letter = 'A';
+ $letter = substr($chararray,0,1);
+ $letpos = 0;
+ $chararray .= '*';
while (1 == 1) {
?>
<div class="panel" title="<?php echo $letter; ?>">
@@ -234,8 +237,9 @@ END;
</div>
</div>
<?php
- if ($letter == 'Z') break;
- $letter++;
+ $letpos++;
+ if ($letpos == strlen($chararray)) break;
+ $letter = substr($chararray,$letpos,1);
}
?>
diff --git a/views/default/friends/forms/edit.php b/views/default/friends/forms/edit.php
index 683e0503c..924c479e0 100644
--- a/views/default/friends/forms/edit.php
+++ b/views/default/friends/forms/edit.php
@@ -18,10 +18,12 @@
// Set title, form destination
if (isset($vars['collection'])) {
$action = "friends/editcollection";
- $title = $vars['collection'][0]->name;
+ $title = $vars['collection'][0]->name;
+ $highlight = 'default';
} else {
$action = "friends/addcollection";
- $title = "";
+ $title = "";
+ $highlight = 'all';
}
@@ -46,7 +48,7 @@
$form_body .= "</p>";
$form_body .= "<p><label>" . elgg_echo("friends:addfriends") . "</label>".
- elgg_view('friends/picker',array('entities' => $vars['friends'], 'internalname' => 'friends_collection')) . "</p>";
+ elgg_view('friends/picker',array('entities' => $vars['friends'], 'internalname' => 'friends_collection', 'highlight' => $highlight)) . "</p>";
$form_body .= "<p>";
if (isset($vars['collection'])) {
diff --git a/views/default/friends/picker.php b/views/default/friends/picker.php
index 877a07782..5b7227c99 100644
--- a/views/default/friends/picker.php
+++ b/views/default/friends/picker.php
@@ -24,7 +24,11 @@
$internalname = "friend";
} else {
$internalname = $vars['internalname'];
- }
+ }
+
+ // Are we highlighting default or all?
+ if (empty($vars['highlight'])) $vars['highlight'] = 'default';
+ if ($vars['highlight'] != 'all') $vars['highlight'] = 'default';
// Initialise values
if (!isset($vars['value'])) {
@@ -165,10 +169,20 @@
//echo "<p>" . $user->name . "</p>";
$label = elgg_view("profile/icon",array('entity' => $friend, 'size' => 'tiny', 'override' => true));
- $options[$label] = $friend->getGUID();
+ $options[$label] = $friend->getGUID();
+
+ if ($vars['highlight'] == 'all'
+ && !in_array($letter,$activeletters)) {
+ $activeletters[] = $letter;
+ }
+
+
if (in_array($friend->getGUID(),$vars['value'])) {
$checked = "checked = \"checked\"";
- if (!in_array($letter,$activeletters))
+ if (
+ !in_array($letter,$activeletters)
+ && $vars['highlight'] == 'default'
+ )
$activeletters[] = $letter;
} else {
$checked = "";