aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/notifications/actions/save.php3
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/collections.php28
2 files changed, 22 insertions, 9 deletions
diff --git a/mod/notifications/actions/save.php b/mod/notifications/actions/save.php
index 44b341e9b..782237b34 100644
--- a/mod/notifications/actions/save.php
+++ b/mod/notifications/actions/save.php
@@ -19,7 +19,10 @@
foreach($NOTIFICATION_HANDLERS as $method => $foo) {
$subscriptions[$method] = get_input($method.'subscriptions');
$personal[$method] = get_input($method.'personal');
+ $collections[$method] = get_input($method.'collections');
+ $metaname = 'collections_notifications_preferences_' . $method;
+ $_SESSION['user']->$metaname = $collections[$method];
set_user_notification_setting($_SESSION['user']->guid, $method, ($personal[$method] == '1') ? true : false);
remove_entity_relationships($SESSION['user']->guid,'notify' , $method, false);
}
diff --git a/mod/notifications/views/default/notifications/subscriptions/collections.php b/mod/notifications/views/default/notifications/subscriptions/collections.php
index 41ce4118f..8cac8cf12 100644
--- a/mod/notifications/views/default/notifications/subscriptions/collections.php
+++ b/mod/notifications/views/default/notifications/subscriptions/collections.php
@@ -43,16 +43,26 @@
$fields = '';
$i = 0;
- foreach($NOTIFICATION_HANDLERS as $method => $foo) {
- if ($i > 0) $fields .= "<td class=\"spacercolumn\">&nbsp;</td>";
- $toggle = elgg_echo('toggle');
- $fields .= <<< END
- <td class="{$method}togglefield">
- <a href="#" class="{$method}toggleOn"></a>
- </td>
-END;
- $i++;
+ 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" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}collections');">
+ <input type="checkbox" name="{$method}collections[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}collections');" value="{$collection->id}" {$collectionschecked[$method]} /></a></td>
+END;
+ $i++;
+ }
echo $fields;
?>