diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2012-10-13 23:52:49 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2012-10-13 23:52:49 -0500 |
commit | c5f280351a96aaebd90c27da095c9b1ff28624a5 (patch) | |
tree | 2a1ff285ceb73ba8bc0a3090afe619e51997749f /phpBB/includes/ucp/ucp_notifications.php | |
parent | 94ffbb4050b2985ee62be0ecc0c6a244532e43ca (diff) | |
download | forums-c5f280351a96aaebd90c27da095c9b1ff28624a5.tar forums-c5f280351a96aaebd90c27da095c9b1ff28624a5.tar.gz forums-c5f280351a96aaebd90c27da095c9b1ff28624a5.tar.bz2 forums-c5f280351a96aaebd90c27da095c9b1ff28624a5.tar.xz forums-c5f280351a96aaebd90c27da095c9b1ff28624a5.zip |
[ticket/11103] UCP Notification option grouping
Also add the ability to specify an _EXPLAIN text for the notification option
PHPBB3-11103
Diffstat (limited to 'phpBB/includes/ucp/ucp_notifications.php')
-rw-r--r-- | phpBB/includes/ucp/ucp_notifications.php | 67 |
1 files changed, 39 insertions, 28 deletions
diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php index 35783e1b56..98165a7bf7 100644 --- a/phpBB/includes/ucp/ucp_notifications.php +++ b/phpBB/includes/ucp/ucp_notifications.php @@ -44,30 +44,33 @@ class ucp_notifications $notification_methods = $phpbb_notifications->get_subscription_methods(); - foreach($phpbb_notifications->get_subscription_types() as $type => $data) + foreach($phpbb_notifications->get_subscription_types() as $group => $subscription_types) { - if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type])) + foreach($subscription_types as $type => $data) { - // add - $phpbb_notifications->add_subscription($type); - } - else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type])) - { - // remove - $phpbb_notifications->delete_subscription($type); - } - - foreach($notification_methods as $method) - { - if ($request->is_set_post($type . '_' . $method) && (!isset($subscriptions[$type]) || !in_array($method, $subscriptions[$type]))) + if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type])) { // add - $phpbb_notifications->add_subscription($type, 0, $method); + $phpbb_notifications->add_subscription($type); } - else if (!$request->is_set_post($type . '_' . $method) && isset($subscriptions[$type]) && in_array($method, $subscriptions[$type])) + else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type])) { // remove - $phpbb_notifications->delete_subscription($type, 0, $method); + $phpbb_notifications->delete_subscription($type); + } + + foreach($notification_methods as $method) + { + if ($request->is_set_post($type . '_' . $method) && (!isset($subscriptions[$type]) || !in_array($method, $subscriptions[$type]))) + { + // add + $phpbb_notifications->add_subscription($type, 0, $method); + } + else if (!$request->is_set_post($type . '_' . $method) && isset($subscriptions[$type]) && in_array($method, $subscriptions[$type])) + { + // remove + $phpbb_notifications->delete_subscription($type, 0, $method); + } } } } @@ -172,25 +175,33 @@ class ucp_notifications $notification_methods = $phpbb_notifications->get_subscription_methods(); $subscriptions = $phpbb_notifications->get_subscriptions(false, true); - foreach($phpbb_notifications->get_subscription_types() as $type => $data) + foreach($phpbb_notifications->get_subscription_types() as $group => $subscription_types) { $template->assign_block_vars($block, array( - 'TYPE' => $type, - - 'NAME' => (is_array($data) && isset($data['lang'])) ? $user->lang($data['lang']) : $user->lang('NOTIFICATION_TYPE_' . strtoupper($type)), - - 'SUBSCRIBED' => (isset($subscriptions[$type])) ? true : false, + 'GROUP_NAME' => $user->lang($group), )); - foreach($notification_methods as $method) + foreach($subscription_types as $type => $data) { - $template->assign_block_vars($block . '.notification_methods', array( - 'METHOD' => $method, + $template->assign_block_vars($block, array( + 'TYPE' => $type, - 'NAME' => $user->lang('NOTIFICATION_METHOD_' . strtoupper($method)), + 'NAME' => $user->lang($data['lang']), + 'EXPLAIN' => (isset($user->lang[$data['lang'] . '_EXPLAIN'])) ? $user->lang($data['lang'] . '_EXPLAIN') : '', - 'SUBSCRIBED' => (isset($subscriptions[$type]) && in_array($method, $subscriptions[$type])) ? true : false, + 'SUBSCRIBED' => (isset($subscriptions[$type])) ? true : false, )); + + foreach($notification_methods as $method) + { + $template->assign_block_vars($block . '.notification_methods', array( + 'METHOD' => $method, + + 'NAME' => $user->lang('NOTIFICATION_METHOD_' . strtoupper($method)), + + 'SUBSCRIBED' => (isset($subscriptions[$type]) && in_array($method, $subscriptions[$type])) ? true : false, + )); + } } } } |