aboutsummaryrefslogtreecommitdiff
path: root/mod/notifications
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-03 18:44:30 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-03 18:44:30 +0000
commit7ebcea562b1d08fe62d6205cfd976c81c0477c25 (patch)
tree7b70ad881c881b49cbd90b4530ee8e16d6c481fe /mod/notifications
parentecbbea3fb7d3401b5a7ed9aa4466fafae3218934 (diff)
downloadelgg-7ebcea562b1d08fe62d6205cfd976c81c0477c25.tar.gz
elgg-7ebcea562b1d08fe62d6205cfd976c81c0477c25.tar.bz2
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
Diffstat (limited to 'mod/notifications')
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/forminternals.php293
1 files changed, 151 insertions, 142 deletions
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 @@
</p>
<?php
- // Get friends and subscriptions
- $friends = get_user_friends($vars['user']->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 @@
<?php
- if (isset($vars['content'])) echo $vars['content'];
-
+ if (isset($vars['content'])) {
+ echo $vars['content'];
+ }
?>
@@ -107,11 +111,11 @@
<?php
- }
+}
- if (!isset($vars['replacement'])) {
+if (!isset($vars['replacement'])) {
- if ($formtarget) {
+ if ($formtarget) {
?>
<script language="text/javascript">
@@ -140,26 +144,22 @@
<?php
- }
+ }
- echo elgg_view('notifications/subscriptions/jsfuncs',$vars);
+ echo elgg_view('notifications/subscriptions/jsfuncs',$vars);
?>
-
<div class="friends_picker_wrapper">
<div id="friends_picker<?php echo $friendspicker; ?>">
<div class="friends_picker_container">
<?php
// Initialise letters
- if (is_callable('mb_substr'))
- $letter = mb_substr($chararray,0,1);
- else
- $letter = substr($chararray,0,1);
- $letpos = 0;
- $chararray .= '*';
- while (1 == 1) {
+ $letter = elgg_substr($chararray,0,1);
+ $letpos = 0;
+ $chararray .= '*';
+ while (1 == 1) {
?>
<div class="panel" title="<?php echo $letter; ?>">
<div class="wrapper">
@@ -167,62 +167,71 @@
<?php
- if (isset($users[$letter])) {
- ksort($users[$letter]);
+ if (isset($users[$letter])) {
+ ksort($users[$letter]);
?>
<table id="notificationstable" cellspacing="0" cellpadding="4" border="0" width="100%">
<tr>
<td>&nbsp;</td>
<?php
- $i = 0;
- foreach($NOTIFICATION_HANDLERS as $method => $foo) {
- if ($i > 0)
- echo "<td class='spacercolumn'>&nbsp;</td>";
+ $i = 0;
+ foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+ if ($i > 0) {
+ echo "<td class='spacercolumn'>&nbsp;</td>";
+ }
?>
<td class="<?php echo $method; ?>togglefield"><?php echo elgg_echo('notification:method:'.$method); ?></td>
<?php
- $i++;
- }
+ $i++;
+ }
?>
<td>&nbsp;</td>
</tr>
<?php
- if (is_array($users[$letter]) && sizeof($users[$letter]) > 0)
- foreach($users[$letter] as $friend) {
- if ($friend instanceof ElggUser ) {
+ if (is_array($users[$letter]) && sizeof($users[$letter]) > 0) {
+ foreach($users[$letter] as $friend) {
+ if ($friend instanceof ElggUser ) {
- if (!in_array($letter,$activeletters))
- $activeletters[] = $letter;
+ if (!in_array($letter,$activeletters)) {
+ $activeletters[] = $letter;
+ }
- $method = array();
- $fields = '';
- $i = 0;
+ $method = array();
+ $fields = '';
+ $i = 0;
- foreach($NOTIFICATION_HANDLERS as $method => $foo) {
- if (in_array($friend->guid,$subs[$method])) {
- $checked[$method] = 'checked="checked"';
- } else {
- $checked[$method] = '';
- }
- if ($i > 0) $fields .= "<td class='spacercolumn'>&nbsp;</td>";
- $fields .= <<< END
- <td class="{$method}togglefield">
- <a border="0" id="{$method}{$friend->guid}" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}{$friend->guid}');">
- <input type="checkbox" name="{$method}subscriptions[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}{$friend->guid}');" value="{$friend->guid}" {$checked[$method]} /></a></td>
+ foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+ if (isset($subs[$method]) && in_array($friend->guid,$subs[$method])) {
+ $checked[$method] = 'checked="checked"';
+ } else {
+ $checked[$method] = '';
+ }
+ if ($i > 0) {
+ $fields .= "<td class='spacercolumn'>&nbsp;</td>";
+ }
+ $fields .= <<< END
+<td class="{$method}togglefield">
+<a border="0" id="{$method}{$friend->guid}" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}{$friend->guid}');">
+<input type="checkbox" name="{$method}subscriptions[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}{$friend->guid}');" value="{$friend->guid}" {$checked[$method]} /></a></td>
END;
- $i++;
- }
+ $i++;
+ }
?>
<tr>
- <td class="namefield"><a href="<?php echo $friend->getURL(); ?>">
+ <td class="namefield">
+ <a href="<?php echo $friend->getURL(); ?>">
<?php
- echo elgg_view("profile/icon",array('entity' => $friend, 'size' => 'tiny', 'override' => true));
+ echo elgg_view("profile/icon",array('entity' => $friend, 'size' => 'tiny', 'override' => true));
?>
- </a><p class="namefieldlink"><a href="<?php echo $friend->getURL(); ?>"><?php echo $friend->name ?></p></td>
+ </a>
+ <p class="namefieldlink">
+ <a href="<?php echo $friend->getURL(); ?>"><?php echo $friend->name ?></a>
+ </p>
+ </td>
<?php echo $fields; ?>
@@ -231,27 +240,27 @@ END;
<?php
+ }
+ }
}
- }
?>
</table>
<?php
- }
+ }
?>
</div>
</div>
<?php
- $letpos++;
- if ($letpos == strlen($chararray)) break;
- if (is_callable('mb_substr'))
- $letter = mb_substr($chararray,$letpos,1);
- else
- $letter = substr($chararray,$letpos,1);
+ $letpos++;
+ if ($letpos == elgg_strlen($chararray)) {
+ break;
}
+ $letter = elgg_substr($chararray,$letpos,1);
+ }
?>
</div>
@@ -259,10 +268,10 @@ END;
</div>
<?php
- } else {
- echo $vars['replacement'];
- }
- if (!$callback) {
+} else {
+ echo $vars['replacement'];
+}
+if (!$callback) {
?>
@@ -272,29 +281,30 @@ END;
<?php
- }
+}
?>
<?php
- if (!isset($vars['replacement'])) {
+if (!isset($vars['replacement'])) {
?>
<script type="text/javascript">
// initialise picker
$("div#friends_picker<?php echo $friendspicker; ?>").friendsPicker(<?php echo $friendspicker; ?>);
</script>
-<script>
+<script type="text/javascript">
$(document).ready(function () {
// manually add class to corresponding tab for panels that have content
<?php
- if (sizeof($activeletters) > 0)
- $chararray = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ if (sizeof($activeletters) > 0) {
+ $chararray .= "*";
foreach($activeletters as $letter) {
- $tab = strpos($chararray, $letter) + 1;
+ $tab = elgg_strpos($chararray, $letter) + 1;
?>
$("div#friends_picker_navigation<?php echo $friendspicker; ?> li.tab<?php echo $tab; ?> a").addClass("tabHasContent");
<?php
}
+ }
?>
});
@@ -302,12 +312,11 @@ END;
<?php
- }
+}
?>
+
<div class="divider">
<input type="submit" value="<?php echo elgg_echo('save'); ?>" />
-</div>
</div>
-
- \ No newline at end of file
+</div>