diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-02-05 18:45:02 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-02-05 18:45:02 +0000 |
commit | b2128acbdccfa8289cb6b8978870a8a2a6886896 (patch) | |
tree | f81919b13269fbec8ca17859214d5994574d8037 | |
parent | 6d6591d8097661c5e64623972d18664913378ab4 (diff) | |
download | elgg-b2128acbdccfa8289cb6b8978870a8a2a6886896.tar.gz elgg-b2128acbdccfa8289cb6b8978870a8a2a6886896.tar.bz2 |
Friends collections preferences are saved
git-svn-id: https://code.elgg.org/elgg/trunk@2661 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/notifications/actions/save.php | 3 | ||||
-rw-r--r-- | mod/notifications/views/default/notifications/subscriptions/collections.php | 28 |
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\"> </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\"> </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;
?>
|