diff options
Diffstat (limited to 'mod')
9 files changed, 95 insertions, 7 deletions
diff --git a/mod/notifications/actions/save.php b/mod/notifications/actions/save.php index 3e50ffc11..44b341e9b 100644 --- a/mod/notifications/actions/save.php +++ b/mod/notifications/actions/save.php @@ -18,6 +18,9 @@ global $NOTIFICATION_HANDLERS;
foreach($NOTIFICATION_HANDLERS as $method => $foo) {
$subscriptions[$method] = get_input($method.'subscriptions');
+ $personal[$method] = get_input($method.'personal');
+
+ set_user_notification_setting($_SESSION['user']->guid, $method, ($personal[$method] == '1') ? true : false);
remove_entity_relationships($SESSION['user']->guid,'notify' , $method, false);
}
@@ -25,7 +28,6 @@ foreach($subscriptions as $key => $subscription)
if (is_array($subscription) && !empty($subscription)) {
foreach($subscription as $subscriptionperson) {
- // register_notification_interest($SESSION['user']->guid, $subscription);
add_entity_relationship($_SESSION['user']->guid, 'notify' . $key, $subscriptionperson);
}
}
diff --git a/mod/notifications/languages/en.php b/mod/notifications/languages/en.php index db2d143b7..71db65744 100644 --- a/mod/notifications/languages/en.php +++ b/mod/notifications/languages/en.php @@ -2,12 +2,15 @@ $english = array(
+ 'notifications:subscriptions:personal:description' => 'Receive notifications when actions are performed on your content',
+ 'notifications:subscriptions:personal:title' => 'Personal notifications',
+
'notifications:subscriptions:changesettings' => 'Notifications',
'notification:method:email' => 'Email',
'notifications:subscriptions:description' => 'To receive notifications from your friends when they create new content, find them below and select the notification method you would like to use.',
- 'notifications:subscriptions:success' => 'Your subscriptions have been saved.',
+ 'notifications:subscriptions:success' => 'Your subscription settings have been saved.',
);
diff --git a/mod/notifications/start.php b/mod/notifications/start.php index 22d4a0be0..1691872a6 100644 --- a/mod/notifications/start.php +++ b/mod/notifications/start.php @@ -23,10 +23,18 @@ function notifications_plugin_init() {
extend_view('css','notifications/css');
+ global $CONFIG;
+
+ // Unset the default user settings hook
+ if (isset($CONFIG->hooks['usersettings:save']['user']))
+ foreach($CONFIG->hooks['usersettings:save']['user'] as $key => $function) {
+ if ($function == 'notification_user_settings_save')
+ unset($CONFIG->hooks['usersettings:save']['user'][$key]);
+ }
}
register_elgg_event_handler('pagesetup','system','notifications_plugin_pagesetup',1000);
- register_elgg_event_handler('init','system','notifications_plugin_init');
+ register_elgg_event_handler('init','system','notifications_plugin_init',1000);
// Register action
global $CONFIG;
diff --git a/mod/notifications/views/default/notifications/css.php b/mod/notifications/views/default/notifications/css.php index 1c20a7b96..db766a2c9 100644 --- a/mod/notifications/views/default/notifications/css.php +++ b/mod/notifications/views/default/notifications/css.php @@ -38,4 +38,8 @@ }
#notificationstable td.emailtogglefield a.emailtoggleOn {
background: url(<?php echo $vars['url']; ?>mod/notifications/graphics/icon_notifications_email.gif) no-repeat right -36px;
+}
+
+.notification_personal {
+ margin-bottom: 25px;
}
\ No newline at end of file diff --git a/mod/notifications/views/default/notifications/settings/usersettings.php b/mod/notifications/views/default/notifications/settings/usersettings.php new file mode 100644 index 000000000..0165eb215 --- /dev/null +++ b/mod/notifications/views/default/notifications/settings/usersettings.php @@ -0,0 +1,3 @@ +<?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 new file mode 100644 index 000000000..0165eb215 --- /dev/null +++ b/mod/notifications/views/default/notifications/subscriptions/collections.php @@ -0,0 +1,3 @@ +<?php
+
+?>
\ No newline at end of file diff --git a/mod/notifications/views/default/notifications/subscriptions/form.php b/mod/notifications/views/default/notifications/subscriptions/form.php index 08e539e17..a81f4290b 100644 --- a/mod/notifications/views/default/notifications/subscriptions/form.php +++ b/mod/notifications/views/default/notifications/subscriptions/form.php @@ -19,13 +19,12 @@ // Display a description ?> <div class="notification_methods"> - <p class="notification_methods_intro"> - <?php echo elgg_echo('notifications:subscriptions:description'); ?> - </p> <?php echo elgg_view('input/form',array( - 'body' => elgg_view('notifications/subscriptions/forminternals'), + 'body' => elgg_view('notifications/subscriptions/personal') .
+ elgg_view('notifications/subscriptions/collections') .
+ elgg_view('notifications/subscriptions/forminternals'), 'method' => 'post', 'action' => $vars['url'] . 'action/notificationsettings/save', )); diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php index 122a00fb5..e73dc5f3e 100644 --- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php +++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php @@ -1,3 +1,6 @@ + <p class="notification_methods_intro">
+ <?php echo elgg_echo('notifications:subscriptions:description'); ?>
+ </p>
<?php // Get friends and subscriptions diff --git a/mod/notifications/views/default/notifications/subscriptions/personal.php b/mod/notifications/views/default/notifications/subscriptions/personal.php new file mode 100644 index 000000000..6c8069bd3 --- /dev/null +++ b/mod/notifications/views/default/notifications/subscriptions/personal.php @@ -0,0 +1,63 @@ +<?php
+
+ global $NOTIFICATION_HANDLERS;
+
+?>
+<div class="notification_personal">
+<div class="notification_methods">
+ <p class="notification_methods_intro">
+ <?php echo elgg_echo('notifications:subscriptions:personal:title'); ?>
+ </p>
+</div>
+<table id="notificationstable" cellspacing="0" cellpadding="4" border="1" width="100%">
+ <tr>
+ <td> </td>
+<?php
+ $i = 0;
+ foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+ if ($i > 0)
+ echo "<td class=\"spacercolumn\"> </td>";
+?>
+ <td class="<?php echo $method; ?>togglefield"><?php echo elgg_echo('notification:method:'.$method); ?></td>
+<?php
+ $i++;
+ }
+?>
+ <td> </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\"> </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> </td>
+ </tr>
+</table>
+</div>
\ No newline at end of file |