aboutsummaryrefslogtreecommitdiff
path: root/mod/notifications/views
diff options
context:
space:
mode:
Diffstat (limited to 'mod/notifications/views')
-rw-r--r--mod/notifications/views/default/forms/notificationsettings/groupsave.php111
-rw-r--r--mod/notifications/views/default/forms/notificationsettings/save.php21
-rw-r--r--mod/notifications/views/default/notifications/css.php151
-rw-r--r--mod/notifications/views/default/notifications/settings/usersettings.php3
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/collections.php267
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/form.php41
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/forminternals.php387
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/groupsform.php96
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/jsfuncs.php104
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/personal.php134
10 files changed, 732 insertions, 583 deletions
diff --git a/mod/notifications/views/default/forms/notificationsettings/groupsave.php b/mod/notifications/views/default/forms/notificationsettings/groupsave.php
new file mode 100644
index 000000000..f3e5f693a
--- /dev/null
+++ b/mod/notifications/views/default/forms/notificationsettings/groupsave.php
@@ -0,0 +1,111 @@
+<?php
+/**
+ * Elgg notifications groups subscription form
+ *
+ * @package ElggNotifications
+ *
+ * @uses $vars['user'] ElggUser
+ */
+
+/* @var ElggUser $user */
+$user = $vars['user'];
+
+global $NOTIFICATION_HANDLERS;
+foreach ($NOTIFICATION_HANDLERS as $method => $foo) {
+ $subsbig[$method] = elgg_get_entities_from_relationship(array(
+ 'relationship' => 'notify' . $method,
+ 'relationship_guid' => $user->guid,
+ 'type' => 'group',
+ 'limit' => false,
+ ));
+ $tmparray = array();
+ if ($subsbig[$method]) {
+ foreach($subsbig[$method] as $tmpent) {
+ $tmparray[] = $tmpent->guid;
+ }
+ }
+ $subsbig[$method] = $tmparray;
+}
+
+?>
+
+<div class="elgg-module elgg-module-info">
+ <div class="elgg-body">
+ <?php
+ echo elgg_view('notifications/subscriptions/jsfuncs',$vars);
+ ?>
+ <div>
+ <?php
+ echo elgg_echo('notifications:subscriptions:groups:description');
+ ?>
+ </div>
+<?php
+
+if (isset($vars['groups']) && !empty($vars['groups'])) {
+
+?>
+ <table id="notificationstable" cellspacing="0" cellpadding="4" width="100%">
+ <tr>
+ <td>&nbsp;</td>
+<?php
+
+ $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++;
+ }
+?>
+ <td>&nbsp;</td>
+ </tr>
+<?php
+ foreach($vars['groups'] as $group) {
+
+ $fields = '';
+ $i = 0;
+
+ foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+ if (in_array($group->guid,$subsbig[$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}{$group->guid}" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}{$group->guid}');">
+ <input type="checkbox" name="{$method}subscriptions[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}{$group->guid}');" value="{$group->guid}" {$checked[$method]} /></a></td>
+END;
+ $i++;
+ }
+
+?>
+ <tr>
+ <td class="namefield">
+ <div>
+ <?php echo $group->name; ?>
+ </div>
+ </td>
+ <?php echo $fields; ?>
+ <td>&nbsp;</td>
+ </tr>
+<?php
+ }
+?>
+ </table>
+<?php
+}
+ echo '<div class="elgg-foot mtm">';
+ echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $user->guid));
+ echo elgg_view('input/submit', array('value' => elgg_echo('save')));
+ echo '</div>';
+
+?>
+ </div>
+</div>
diff --git a/mod/notifications/views/default/forms/notificationsettings/save.php b/mod/notifications/views/default/forms/notificationsettings/save.php
new file mode 100644
index 000000000..9470256ca
--- /dev/null
+++ b/mod/notifications/views/default/forms/notificationsettings/save.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Personal notifications form body
+ *
+ * @uses $vars['user'] ElggUser
+ */
+
+/* @var ElggUser $user */
+$user = $vars['user'];
+
+echo elgg_view('notifications/subscriptions/personal', $vars);
+echo elgg_view('notifications/subscriptions/collections', $vars);
+echo elgg_view('notifications/subscriptions/forminternals', $vars);
+
+?>
+<div class="elgg-foot">
+<?php
+echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $user->guid));
+echo elgg_view('input/submit', array('value' => elgg_echo('save')));
+?>
+</div>
diff --git a/mod/notifications/views/default/notifications/css.php b/mod/notifications/views/default/notifications/css.php
index a46bd978d..385c55b0b 100644
--- a/mod/notifications/views/default/notifications/css.php
+++ b/mod/notifications/views/default/notifications/css.php
@@ -1,64 +1,87 @@
-#notificationstable td.namefield {
- width:250px;
- text-align: left;
- vertical-align: middle;
-}
-#notificationstable td.namefield p {
- margin:0;
- vertical-align: middle;
- line-height: 1.1em;
- padding:5px 0 5px 0;
-}
-#notificationstable td.namefield img {
- padding:6px 10px 6px 3px;
- float:left;
-}
-#notificationstable td.namefield p.namefieldlink {
- margin:9px 0 0 0;
-}
-#notificationstable td.emailtogglefield,
-#notificationstable td.smstogglefield {
- width:50px;
- text-align: center;
- vertical-align: middle;
-}
-#notificationstable td.spacercolumn {
- width:30px;
-}
-#notificationstable td {
- border-bottom: 1px solid silver;
-}
-#notificationstable td.emailtogglefield input {
- margin-right:36px;
- margin-top:5px;
-}
-#notificationstable td.emailtogglefield a {
- width:46px;
- height:24px;
- cursor: pointer;
- display: block;
- outline: none;
-}
-#notificationstable td.emailtogglefield a.emailtoggleOff {
- background: url(<?php echo $vars['url']; ?>mod/notifications/graphics/icon_notifications_email.gif) no-repeat right 2px;
-}
-#notificationstable td.emailtogglefield a.emailtoggleOn {
- background: url(<?php echo $vars['url']; ?>mod/notifications/graphics/icon_notifications_email.gif) no-repeat right -36px;
-}
-
-.notification_collections,
-.notification_personal {
- margin-bottom: 25px;
-}
-
-.settings_form .friendsPicker_container h3 {
- color:#999999;
- font-size:3em;
- margin:0 0 20px;
- text-align:left;
- background: none;
- border-bottom: none;
-}
-
-
-
+<?php
+/**
+ * Elgg notifications CSS
+ *
+ * @package notifications
+ */
+?>
+
+#notificationstable td.namefield {
+ width:250px;
+ text-align: left;
+ vertical-align: middle;
+}
+#notificationstable td.namefield p {
+ margin:0;
+ vertical-align: middle;
+ line-height: 1.1em;
+ padding:5px 0 5px 0;
+}
+#notificationstable td.namefield p.namefieldlink {
+ margin:5px 0 0 0;
+}
+#notificationstable td.namefield a img {
+ float:left;
+ width:25px;
+ height:25px;
+ margin:5px 10px 5px 5px;
+}
+#notificationstable td.emailtogglefield,
+#notificationstable td.smstogglefield {
+ width:50px;
+ text-align: center;
+ vertical-align: middle;
+}
+#notificationstable td.spacercolumn {
+ width:30px;
+}
+#notificationstable td {
+ border-bottom: 1px solid silver;
+}
+#notificationstable td.emailtogglefield input {
+ margin-right:36px;
+ margin-top:5px;
+}
+#notificationstable td.emailtogglefield a {
+ width:46px;
+ height:24px;
+ cursor: pointer;
+ display: block;
+ outline: none;
+}
+#notificationstable td.sitetogglefield {
+ width:50px;
+ text-align: center;
+ vertical-align: middle;
+}
+#notificationstable td.sitetogglefield input {
+ margin-right:36px;
+ margin-top:5px;
+}
+#notificationstable td.sitetogglefield a {
+ width:46px;
+ height:24px;
+ cursor: pointer;
+ display: block;
+ outline: none;
+}
+#notificationstable td.emailtogglefield a.emailtoggleOff {
+ background: url(<?php echo elgg_get_site_url(); ?>mod/notifications/graphics/icon_notifications_email.gif) no-repeat right 2px;
+}
+#notificationstable td.emailtogglefield a.emailtoggleOn {
+ background: url(<?php echo elgg_get_site_url(); ?>mod/notifications/graphics/icon_notifications_email.gif) no-repeat right -36px;
+}
+#notificationstable td.sitetogglefield a.sitetoggleOff {
+ background: url(<?php echo elgg_get_site_url(); ?>mod/notifications/graphics/icon_notifications_site.gif) no-repeat right 2px;
+}
+#notificationstable td.sitetogglefield a.sitetoggleOn {
+ background: url(<?php echo elgg_get_site_url(); ?>mod/notifications/graphics/icon_notifications_site.gif) no-repeat right -37px;
+}
+.notification_friends,
+.notification_personal,
+.notifications_per_user {
+ margin-bottom: 25px;
+}
+
+
+
diff --git a/mod/notifications/views/default/notifications/settings/usersettings.php b/mod/notifications/views/default/notifications/settings/usersettings.php
deleted file mode 100644
index 0165eb215..000000000
--- a/mod/notifications/views/default/notifications/settings/usersettings.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-
-?> \ No newline at end of file
diff --git a/mod/notifications/views/default/notifications/subscriptions/collections.php b/mod/notifications/views/default/notifications/subscriptions/collections.php
index 8582069a8..207b2e3b9 100644
--- a/mod/notifications/views/default/notifications/subscriptions/collections.php
+++ b/mod/notifications/views/default/notifications/subscriptions/collections.php
@@ -1,103 +1,164 @@
-<?php
-
- if ($collections = get_user_access_collections($vars['user']->guid)) {
- global $NOTIFICATION_HANDLERS;
-?>
-
-<script type="text/javascript">
-
- function setCollection(members, method, id) {
- for ( var i in members ) {
- var checked = $('#' + method + 'collections' + id).children("INPUT[type='checkbox']").attr('checked');
- if ($("#"+method+members[i]).children("INPUT[type='checkbox']").attr('checked') != checked) {
- $("#"+method+members[i]).children("INPUT[type='checkbox']").attr('checked', checked);
- functioncall = 'adjust' + method + '_alt("'+method+members[i]+'");';
- eval(functioncall);
- }
- }
- }
-
-</script>
-
-<h3>
- <?php echo elgg_echo('notifications:subscriptions:collections:title'); ?>
-</h3>
-<div class="notification_personal">
-<p>
- <?php echo elgg_echo('notifications:subscriptions:collections:description'); ?>
- <a href="<?php echo $vars['url']; ?>pg/collections/<?php echo $vars['user']->username; ?>"><?php echo elgg_echo('notifications:subscriptions:collections:edit') ?></a>
-</p>
-<table id="notificationstable" cellspacing="0" cellpadding="4" border="1" width="100%">
- <tr>
- <td>&nbsp;</td>
-<?php
- $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++;
- }
-?>
- <td>&nbsp;</td>
- </tr>
-<?php
-
- foreach($collections as $collection) {
- $members = get_members_of_access_collection($collection->id, true);
- $memberno = sizeof($members);
- $members = implode(',',$members);
-
-?>
- <tr>
- <td class="namefield">
- <p>
- <?php echo $collection->name; ?> (<?php echo $memberno; ?>)
- </p>
-
- </td>
-
-<?php
-
- $fields = '';
- $i = 0;
- foreach($NOTIFICATION_HANDLERS as $method => $foo) {
- $metaname = 'collections_notifications_preferences_' . $method;
- if ($collections_preferences = $vars['user']->$metaname) {
- if (!empty($collections_preferences) && !is_array($collections_preferences))
- $collections_preferences = array($collections_preferences);
- if (is_array($collections_preferences))
- if (in_array($collection->id,$collections_preferences)) {
- $collectionschecked[$method] = 'checked="checked"';
- } else {
- $collectionschecked[$method] = '';
- }
- }
- if ($i > 0) $fields .= "<td class=\"spacercolumn\">&nbsp;</td>";
- $fields .= <<< END
- <td class="{$method}togglefield">
- <a href="#" border="0" id="{$method}collections{$collection->id}" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}collections{$collection->id}'); setCollection([{$members}],'{$method}',{$collection->id});">
- <input type="checkbox" name="{$method}collections[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}collections{$collection->id}');" value="{$collection->id}" {$collectionschecked[$method]} /></a></td>
-END;
- $i++;
- }
- echo $fields;
-
-?>
-
- <td>&nbsp;</td>
- </tr>
-<?php
-
- }
-
-?>
-</table>
-</div>
-<?php
-
- }
-
-?> \ No newline at end of file
+<?php
+/**
+ * @uses $vars['user'] ElggUser
+ */
+
+/* @var ElggUser $user */
+$user = $vars['user'];
+
+//@todo JS 1.8: no ?>
+<script type="text/javascript">
+
+ function setCollection(members, method, id) {
+ for ( var i in members ) {
+ var checked = $('#' + method + 'collections' + id).children("INPUT[type='checkbox']").attr('checked');
+ if ($("#"+method+members[i]).children("INPUT[type='checkbox']").attr('checked') != checked) {
+ $("#"+method+members[i]).children("INPUT[type='checkbox']").attr('checked', checked);
+ functioncall = 'adjust' + method + '_alt("'+method+members[i]+'");';
+ eval(functioncall);
+ }
+ }
+ }
+
+</script>
+<div class="elgg-module elgg-module-info">
+ <div class="elgg-head">
+ <h3>
+ <?php echo elgg_echo('notifications:subscriptions:friends:title'); ?>
+ </h3>
+ </div>
+<p class="margin-none">
+ <?php echo elgg_echo('notifications:subscriptions:friends:description'); ?>
+</p>
+<table id="notificationstable" cellspacing="0" cellpadding="4" width="100%">
+ <tr>
+ <td>&nbsp;</td>
+<?php
+ $i = 0;
+ global $NOTIFICATION_HANDLERS;
+ 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++;
+ }
+?>
+ <td>&nbsp;</td>
+ </tr>
+<?php
+ $members = array();
+ if ($friends = get_user_friends($user->guid, '', 9999, 0)) {
+ foreach($friends as $friend) {
+ $members[] = $friend->guid;
+ }
+ }
+ $memberno = sizeof($members);
+ $members = implode(',',$members);
+
+?>
+ <tr>
+ <td class="namefield">
+ <p>
+ <?php echo elgg_echo('friends:all'); ?> (<?php echo $memberno; ?>)
+ </p>
+ </td>
+<?php
+
+ $fields = '';
+ $i = 0;
+ foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+ $metaname = 'collections_notifications_preferences_' . $method;
+ if ($collections_preferences = $user->$metaname) {
+ if (!empty($collections_preferences) && !is_array($collections_preferences)) {
+ $collections_preferences = array($collections_preferences);
+ }
+ if (is_array($collections_preferences)) {
+ if (in_array(-1,$collections_preferences)) {
+ $collectionschecked[$method] = 'checked="checked"';
+ } else {
+ $collectionschecked[$method] = '';
+ }
+ }
+ }
+ if ($i > 0) {
+ $fields .= "<td class='spacercolumn'>&nbsp;</td>";
+ }
+ $fields .= <<< END
+ <td class="{$method}togglefield">
+ <a border="0" id="{$method}collections-1" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}collections-1'); setCollection([{$members}],'{$method}',-1);">
+ <input type="checkbox" name="{$method}collections[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}collections-1');" value="-1" {$collectionschecked[$method]} /></a></td>
+END;
+ $i++;
+ }
+ echo $fields;
+
+?>
+ <td>&nbsp;</td>
+ </tr>
+<?php
+
+ if ($collections = get_user_access_collections($user->guid)) {
+ foreach ($collections as $collection) {
+ $members = get_members_of_access_collection($collection->id, true);
+ $memberno = 0;
+ if ($members) {
+ $memberno = sizeof($members);
+ $members = implode(',', $members);
+ } else {
+ $members = '';
+ }
+
+
+?>
+ <tr>
+ <td class="namefield">
+ <p>
+ <?php echo $collection->name; ?> (<?php echo $memberno; ?>)
+ </p>
+ </td>
+
+<?php
+
+ $fields = '';
+ $i = 0;
+ foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+ $metaname = 'collections_notifications_preferences_' . $method;
+ if ($collections_preferences = $user->$metaname) {
+ if (!empty($collections_preferences) && !is_array($collections_preferences)) {
+ $collections_preferences = array($collections_preferences);
+ }
+ if (is_array($collections_preferences)) {
+ if (in_array($collection->id,$collections_preferences)) {
+ $collectionschecked[$method] = 'checked="checked"';
+ } else {
+ $collectionschecked[$method] = '';
+ }
+ }
+ }
+ if ($i > 0) {
+ $fields .= "<td class='spacercolumn'>&nbsp;</td>";
+ }
+ $fields .= <<< END
+ <td class="{$method}togglefield">
+ <a border="0" id="{$method}collections{$collection->id}" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}collections{$collection->id}'); setCollection([{$members}],'{$method}',{$collection->id});">
+ <input type="checkbox" name="{$method}collections[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}collections{$collection->id}');" value="{$collection->id}" {$collectionschecked[$method]} /></a></td>
+END;
+ $i++;
+ }
+ echo $fields;
+
+?>
+
+ <td>&nbsp;</td>
+ </tr>
+<?php
+
+ }
+ }
+
+?>
+</table>
+</div>
diff --git a/mod/notifications/views/default/notifications/subscriptions/form.php b/mod/notifications/views/default/notifications/subscriptions/form.php
index ccae930fc..559354eff 100644
--- a/mod/notifications/views/default/notifications/subscriptions/form.php
+++ b/mod/notifications/views/default/notifications/subscriptions/form.php
@@ -1,35 +1,12 @@
<?php
+/**
+ * Elgg personal notifications
+ *
+ * @uses $vars['user'] ElggUser that owns the notification settings
+ */
- /**
- * Elgg SMS Client
- *
- * @package ElggSMS
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2009
- * @link http://elgg.com/
- */
+// @todo is this a view for extensions?
+echo elgg_view('subscriptions/form/additions', $vars);
-
- // Echo title
- echo elgg_view_title(elgg_echo('notifications:subscriptions:changesettings'));
-
- echo elgg_view('subscriptions/form/additions',$vars);
-
- // Display a description
-?>
-<div class="settings_form">
-<div class="notification_methods">
-<?php
-
- echo elgg_view('input/form',array(
- 'body' => elgg_view('notifications/subscriptions/personal') .
- elgg_view('notifications/subscriptions/collections') .
- elgg_view('notifications/subscriptions/forminternals'),
- 'method' => 'post',
- 'action' => $vars['url'] . 'action/notificationsettings/save',
- ));
-
-?>
-</div>
-</div> \ No newline at end of file
+$form_vars = array('class' => 'elgg-form-alt');
+echo elgg_view_form('notificationsettings/save', $form_vars, $vars);
diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php
index ca28fc72a..79a7959ac 100644
--- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php
+++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php
@@ -1,113 +1,142 @@
- <h3>
- <?php echo elgg_echo('notifications:subscriptions:title'); ?>
- </h3>
- <p class="notification_methods_intro">
- <?php echo elgg_echo('notifications:subscriptions:description'); ?>
- </p>
<?php
+/**
+ * Hacked up friends picker that needs to be replaced
+ *
+ * @uses $vars['user'] ElggUser
+ */
- // Get friends and subscriptions
- $friends = get_user_friends($vars['user']->guid,'',9999,0);
-
- global $NOTIFICATION_HANDLERS;
- foreach($NOTIFICATION_HANDLERS as $method => $foo) {
- $subsbig[$method] = get_entities_from_relationship('notify' . $method,$vars['user']->guid,false,'user','',0,'',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; }
- }
- }
+/* @var ElggUser $user */
+$user = $vars['user'];
- // Let the system know that the friends picker is in use
- global $pickerinuse;
- $pickerinuse = true;
+elgg_load_js('elgg.friendspicker');
+elgg_load_js('jquery.easing');
- // 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']);
- }
- }
+?>
+<div class="elgg-module elgg-module-info">
+ <div class="elgg-head">
+ <h3>
+ <?php echo elgg_echo('notifications:subscriptions:title'); ?>
+ </h3>
+ </div>
+ <p>
+ <?php echo elgg_echo('notifications:subscriptions:description'); ?>
+ </p>
+<?php
- // Initialise whether we're calling back or not
- if (isset($vars['callback'])) {
- $callback = $vars['callback'];
- } else {
- $callback = false;
- }
+// Get friends and subscriptions
+$friends = get_user_friends($user->guid, '', 9999, 0);
- // 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'];
+global $NOTIFICATION_HANDLERS;
+foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+ $subsbig[$method] = elgg_get_entities_from_relationship(array(
+ 'relationship' => 'notify' . $method,
+ 'relationship_guid' => $user->guid,
+ 'type' => 'user',
+ 'limit' => false,
+ ));
+}
+
+$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 name
+if (!isset($vars['name'])) {
+ $name = "friend";
+} else {
+ $name = $vars['name'];
+}
+
+// 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'];
+}
- $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) {
-
- $letter = strtoupper(substr($user->name,0,1));
- if ($letter >= "0" && $letter <= "9") {
- $letter = "0";
- }
- if (!isset($users[$letter])) {
- $users[$letter] = array();
- }
- $users[$letter][$user->name] = $user;
+// Sort users by letter
+if (is_array($friends) && sizeof($friends)) {
+ foreach($friends as $friend) {
- }
-
- if (!$callback) {
+ $letter = elgg_substr($friend->name,0,1);
+ $letter = elgg_strtoupper($letter);
+ if (!elgg_substr_count($chararray,$letter)) {
+ $letter = "*";
+ }
+ if (!isset($users[$letter])) {
+ $users[$letter] = array();
+ }
+ $users[$letter][$friend->guid] = $friend;
+ }
+}
+
+if (!$callback) {
?>
-<div class="friends_picker">
+<div class="friends-picker-main-wrapper">
<?php
- if (isset($vars['content'])) echo $vars['content'];
-
+ if (isset($vars['content'])) {
+ echo $vars['content'];
+ }
?>
- <div id="friends_picker_placeholder<?php echo $friendspicker; ?>">
+ <div id="friends-picker_placeholder<?php echo $friendspicker; ?>">
<?php
- }
+}
- if (!isset($vars['replacement'])) {
+if (!isset($vars['replacement'])) {
- if ($formtarget) {
+ if ($formtarget) {
?>
-
+<?php //@todo JS 1.8: no ?>
<script language="text/javascript">
$(function() { // onload...do
$('#collectionMembersForm<?php echo $friendspicker; ?>').submit(function() {
@@ -122,33 +151,34 @@
data: inputs.join('&'),
url: this.action,
success: function(){
- $('a.collectionmembers<?php echo $friendspicker; ?>').click();
- }
+ $('a.collectionmembers<?php echo $friendspicker; ?>').click();
+ }
});
return false;
- })
- })
+ })
+ })
</script>
<?php
- }
-
- echo elgg_view('notifications/subscriptions/jsfuncs',$vars);
+ }
+
+ echo elgg_view('notifications/subscriptions/jsfuncs',$vars);
?>
-
- <div class="friendsPicker_wrapper">
- <div id="friendsPicker<?php echo $friendspicker; ?>">
- <div class="friendsPicker_container">
+ <div class="friends-picker-wrapper">
+ <div id="friends-picker<?php echo $friendspicker; ?>">
+ <div class="friends-picker-container">
<?php
// Initialise letters
- $letter = 'A';
- 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">
@@ -156,87 +186,100 @@
<?php
- if (isset($users[$letter])) {
- ksort($users[$letter]);
+ if (isset($users[$letter])) {
+ ksort($users[$letter]);
?>
-<table id="notificationstable" cellspacing="0" cellpadding="4" border="1" width="100%">
- <tr>
- <td>&nbsp;</td>
-<?php
- $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++;
- }
+<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>";
+ }
+?>
+ <td class="<?php echo $method; ?>togglefield"><?php echo elgg_echo('notification:method:'.$method); ?></td>
+<?php
+ $i++;
+ }
?>
- <td>&nbsp;</td>
- </tr>
+ <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;
-
- $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 href="#" 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++;
- }
+ if (!in_array($letter,$activeletters)) {
+ $activeletters[] = $letter;
+ }
+
+ $method = array();
+ $fields = '';
+ $i = 0;
+
+ 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++;
+ }
?>
- <tr>
- <td class="namefield"><a href="<?php echo $friend->getURL(); ?>">
+<tr>
+ <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_entity_icon($friend, 'tiny', array('use_hover' => false));
?>
- </a><p class="namefieldlink"><a href="<?php echo $friend->getURL(); ?>"><?php echo $friend->name ?></p></td>
-
-<?php echo $fields; ?>
-
- <td>&nbsp;</td>
- </tr>
+ </a>
+ <p class="namefieldlink">
+ <a href="<?php echo $friend->getURL(); ?>"><?php echo $friend->name ?></a>
+ </p>
+ </td>
+
+<?php echo $fields; ?>
+
+<td>&nbsp;</td>
+</tr>
<?php
+ }
+ }
}
- }
?>
</table>
<?php
- }
+ }
?>
</div>
</div>
<?php
- if ($letter == 'Z') break;
- $letter++;
+ $letpos++;
+ if ($letpos == elgg_strlen($chararray)) {
+ break;
}
+ $letter = elgg_substr($chararray,$letpos,1);
+ }
?>
</div>
@@ -244,10 +287,10 @@ END;
</div>
<?php
- } else {
- echo $vars['replacement'];
- }
- if (!$callback) {
+} else {
+ echo $vars['replacement'];
+}
+if (!$callback) {
?>
@@ -257,29 +300,30 @@ END;
<?php
- }
+}
?>
<?php
- if (!isset($vars['replacement'])) {
+if (!isset($vars['replacement'])) {
?>
-
+<?php //@todo JS 1.8: no ?>
<script type="text/javascript">
// initialise picker
- $("div#friendsPicker<?php echo $friendspicker; ?>").friendsPicker(<?php echo $friendspicker; ?>);
+ $("div#friends-picker<?php echo $friendspicker; ?>").friendsPicker(<?php echo $friendspicker; ?>);
</script>
-<script>
- $(document).ready(function () {
+<script type="text/javascript">
+ $(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#friendsPickerNavigation<?php echo $friendspicker; ?> li.tab<?php echo $tab; ?> a").addClass("tabHasContent");
+ $("div#friends-picker-navigation<?php echo $friendspicker; ?> li.tab<?php echo $tab; ?> a").addClass("tabHasContent");
<?php
}
+ }
?>
});
@@ -287,16 +331,7 @@ END;
<?php
- }
+}
?>
-
-
-
-<div class="clearfloat"></div>
-<div class="friendspicker_savebuttons">
- <input type="submit" value="<?php echo elgg_echo('save'); ?>" />
-<br /></div>
-
-
- \ No newline at end of file
+</div>
diff --git a/mod/notifications/views/default/notifications/subscriptions/groupsform.php b/mod/notifications/views/default/notifications/subscriptions/groupsform.php
index 5c0ee1057..f1dbdcff8 100644
--- a/mod/notifications/views/default/notifications/subscriptions/groupsform.php
+++ b/mod/notifications/views/default/notifications/subscriptions/groupsform.php
@@ -1,92 +1,4 @@
-<?php
-
- global $NOTIFICATION_HANDLERS;
- foreach($NOTIFICATION_HANDLERS as $method => $foo) {
- $subsbig[$method] = get_entities_from_relationship('notify' . $method,$vars['user']->guid,false,'group','',0,'',99999);
- }
-
-?>
-
-<div class="settings_form">
- <div class="notification_methods">
-
- <?php
- echo elgg_view('notifications/subscriptions/jsfuncs',$vars);
- ?>
- <?php echo elgg_view_title(elgg_echo('notifications:subscriptions:groups')); ?>
- <p>
- <?php
-
- echo elgg_echo('notifications:subscriptions:groups:description');
-
- ?>
- </p>
-<?php
-
- if (isset($vars['groups']) && !empty($vars['groups'])) {
-
-?>
-<table id="notificationstable" cellspacing="0" cellpadding="4" border="1" width="100%">
- <tr>
- <td>&nbsp;</td>
-<?php
- global $NOTIFICATION_HANDLERS;
- $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++;
- }
-?>
- <td>&nbsp;</td>
- </tr>
-<?php
- foreach($vars['groups'] as $group) {
-
- $fields = '';
- $i = 0;
-
- foreach($NOTIFICATION_HANDLERS as $method => $foo) {
- if (in_array($group->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 href="#" border="0" id="{$method}{$group->guid}" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}{$group->guid}');">
- <input type="checkbox" name="{$method}subscriptions[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}{$group->guid}');" value="{$group->guid}" {$checked[$method]} /></a></td>
-END;
- $i++;
- }
-
-?>
- <tr>
- <td class="namefield">
- <p>
- <?php echo $group->name; ?>
- </p>
- </td>
-<?php
- echo $fields;
-?>
- <td>&nbsp;</td>
- </tr>
-<?php
-
-
- }
-?>
-</table>
-<?php
- }
-
-?>
-
- <input type="submit" value="<?php echo elgg_echo('save'); ?>" />
- </div>
-</div> \ No newline at end of file
+<?php
+
+elgg_deprecated_notice("notifications/subscriptions/groupsform was moved to forms/notificationsettings/groupsave", 1.8);
+echo elgg_view('forms/notificationsettings/groupsave'); \ No newline at end of file
diff --git a/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php b/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php
index 5d8e6c101..ace622581 100644
--- a/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php
+++ b/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php
@@ -1,52 +1,54 @@
-<?php
-
- global $NOTIFICATION_HANDLERS;
-
-?>
-
-<script type="text/javascript">
-
-$(document).ready(function () {
-<?php
- foreach($NOTIFICATION_HANDLERS as $method => $foo) {
-?>
- $('input[@type=checkbox]:checked').parent("a.<?php echo $method; ?>toggleOff").each(function(){
- $(this).removeClass('<?php echo $method; ?>toggleOff').addClass('<?php echo $method; ?>toggleOn');
- });
-
-<?php
- }
-?>
-
-});
-
-<?php
- foreach($NOTIFICATION_HANDLERS as $method => $foo) {
-?>
-function adjust<?php echo $method; ?>(linkId) {
- var obj = $(this).prev("a");
-
- if (obj.className == "<?php echo $method; ?>toggleOff") {
- obj.className = "<?php echo $method; ?>toggleOn";
- } else {
- obj.className = "<?php echo $method; ?>toggleOff";
- }
- return false;
-}
-function adjust<?php echo $method; ?>_alt(linkId) {
- var obj = document.getElementById(linkId);
-
- if (obj.className == "<?php echo $method; ?>toggleOff") {
- obj.className = "<?php echo $method; ?>toggleOn";
- $('#' + linkId).children("INPUT[type='checkbox']").attr('checked', true);
- } else {
- obj.className = "<?php echo $method; ?>toggleOff";
- $('#' + linkId).children("INPUT[type='checkbox']").attr('checked', false);
- }
- return false;
-}
-<?php
- }
-?>
-
+<?php
+
+global $NOTIFICATION_HANDLERS;
+
+?>
+<?php //@todo JS 1.8: no ?>
+<script type="text/javascript">
+
+$(document).ready(function () {
+<?php
+foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+?>
+ $('input[type=checkbox]:checked').parent("a.<?php echo $method; ?>toggleOff").each(function(){
+ $(this).removeClass('<?php echo $method; ?>toggleOff').addClass('<?php echo $method; ?>toggleOn');
+ });
+
+<?php
+}
+?>
+
+});
+
+ clickflag = 0;
+
+<?php
+foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+?>
+function adjust<?php echo $method; ?>(linkId) {
+ var obj = $(this).prev("a");
+
+ if (obj.className == "<?php echo $method; ?>toggleOff") {
+ obj.className = "<?php echo $method; ?>toggleOn";
+ } else {
+ obj.className = "<?php echo $method; ?>toggleOff";
+ }
+ return false;
+}
+function adjust<?php echo $method; ?>_alt(linkId) {
+ var obj = document.getElementById(linkId);
+
+ if (obj.className == "<?php echo $method; ?>toggleOff") {
+ obj.className = "<?php echo $method; ?>toggleOn";
+ $('#' + linkId).children("input[type='checkbox']").attr('checked', true);
+ } else {
+ obj.className = "<?php echo $method; ?>toggleOff";
+ $('#' + linkId).children("input[type='checkbox']").attr('checked', false);
+ }
+ return false;
+}
+<?php
+}
+?>
+
</script> \ No newline at end of file
diff --git a/mod/notifications/views/default/notifications/subscriptions/personal.php b/mod/notifications/views/default/notifications/subscriptions/personal.php
index 56984929e..cf05426e2 100644
--- a/mod/notifications/views/default/notifications/subscriptions/personal.php
+++ b/mod/notifications/views/default/notifications/subscriptions/personal.php
@@ -1,63 +1,73 @@
-<?php
-
- global $NOTIFICATION_HANDLERS;
-
-?>
-<div class="notification_personal">
-<div class="notification_methods">
- <h3>
- <?php echo elgg_echo('notifications:subscriptions:personal:title'); ?>
- </h3>
-</div>
-<table id="notificationstable" cellspacing="0" cellpadding="4" border="1" width="100%">
- <tr>
- <td>&nbsp;</td>
-<?php
- $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++;
- }
-?>
- <td>&nbsp;</td>
- </tr>
- <tr>
- <td class="namefield">
- <p>
- <?php echo elgg_echo('notifications:subscriptions:personal:description') ?>
- </p>
-
- </td>
-
-<?php
-
- $fields = '';
- $i = 0;
- foreach($NOTIFICATION_HANDLERS as $method => $foo) {
- if ($notification_settings = get_user_notification_settings($vars['user']->guid)) {
- if ($notification_settings->$method) {
- $personalchecked[$method] = 'checked="checked"';
- } else {
- $personalchecked[$method] = '';
- }
- }
- if ($i > 0) $fields .= "<td class=\"spacercolumn\">&nbsp;</td>";
- $fields .= <<< END
- <td class="{$method}togglefield">
- <a href="#" border="0" id="{$method}personal" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}personal');">
- <input type="checkbox" name="{$method}personal" id="{$method}checkbox" onclick="adjust{$method}('{$method}personal');" value="1" {$personalchecked[$method]} /></a></td>
-END;
- $i++;
- }
- echo $fields;
-
-?>
-
- <td>&nbsp;</td>
- </tr>
-</table>
+<?php
+/**
+ * @uses $vars['user'] ElggUser
+ */
+
+/* @var ElggUser $user */
+$user = $vars['user'];
+
+global $NOTIFICATION_HANDLERS;
+
+?>
+<div class="notification_personal">
+<div class="elgg-module elgg-module-info">
+ <div class="elgg-head">
+ <h3>
+ <?php echo elgg_echo('notifications:subscriptions:personal:title'); ?>
+ </h3>
+ </div>
+</div>
+<table id="notificationstable" cellspacing="0" cellpadding="4" width="100%">
+ <tr>
+ <td>&nbsp;</td>
+<?php
+$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++;
+}
+?>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td class="namefield">
+ <p>
+ <?php echo elgg_echo('notifications:subscriptions:personal:description') ?>
+ </p>
+ </td>
+
+<?php
+
+$fields = '';
+$i = 0;
+foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+ if ($notification_settings = get_user_notification_settings($user->guid)) {
+ if ($notification_settings->$method) {
+ $personalchecked[$method] = 'checked="checked"';
+ } else {
+ $personalchecked[$method] = '';
+ }
+ }
+ if ($i > 0) {
+ $fields .= "<td class='spacercolumn'>&nbsp;</td>";
+ }
+ $fields .= <<< END
+ <td class="{$method}togglefield">
+ <a border="0" id="{$method}personal" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}personal');">
+ <input type="checkbox" name="{$method}personal" id="{$method}checkbox" onclick="adjust{$method}('{$method}personal');" value="1" {$personalchecked[$method]} /></a></td>
+END;
+ $i++;
+}
+echo $fields;
+
+?>
+
+ <td>&nbsp;</td>
+ </tr>
+</table>
</div> \ No newline at end of file