diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2012-09-26 22:39:12 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2012-09-26 22:39:12 -0500 |
commit | e66117409c68242832f76cdb456d16c40573639e (patch) | |
tree | 7b7a72330f8fd963f67ff77450e8c04145d3ac67 /phpBB/includes/ucp/ucp_notifications.php | |
parent | 9b8c48a31c2310ae1c1e358b3e13a250092aa1ac (diff) | |
download | forums-e66117409c68242832f76cdb456d16c40573639e.tar forums-e66117409c68242832f76cdb456d16c40573639e.tar.gz forums-e66117409c68242832f76cdb456d16c40573639e.tar.bz2 forums-e66117409c68242832f76cdb456d16c40573639e.tar.xz forums-e66117409c68242832f76cdb456d16c40573639e.zip |
[ticket/11103] More work on the UCP Notifications page
PHPBB3-11103
Diffstat (limited to 'phpBB/includes/ucp/ucp_notifications.php')
-rw-r--r-- | phpBB/includes/ucp/ucp_notifications.php | 95 |
1 files changed, 93 insertions, 2 deletions
diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php index 92a899af7d..0a01cd1cde 100644 --- a/phpBB/includes/ucp/ucp_notifications.php +++ b/phpBB/includes/ucp/ucp_notifications.php @@ -17,10 +17,101 @@ if (!defined('IN_PHPBB')) class ucp_notifications { - var $u_action; + public $u_action; - function main($id, $mode) + public function main($id, $mode) { + global $phpbb_container; + $phpbb_notifications = $phpbb_container->get('notifications'); + $template = $phpbb_container->get('template'); + $user = $phpbb_container->get('user'); + $request = $phpbb_container->get('request'); + + if ($request->is_set_post('submit')) + { + $notification_methods = $phpbb_notifications->get_subscription_methods(); + foreach($phpbb_notifications->get_subscription_types() as $type) + { + if ($request->is_set_post($type . '_notification')) + { + // add + } + else + { + // remove + } + + foreach($notification_methods as $method) + { + if ($request->is_set_post($type . '_' . $method)) + { + // add + } + else + { + // remove + } + } + } + } + + // todo include language files for extensions? + + $this->output_notification_methods('notification_methods', $phpbb_notifications, $template, $user); + + $this->output_notification_types('notification_types', $phpbb_notifications, $template, $user); + + $this->tpl_name = 'ucp_notifications'; + $this->page_title = 'UCP_NOTIFICATIONS'; + } + + /** + * Output all the notification types to the template + * + * @param string $block + * @param phpbb_notifications_service $phpbb_notifications + * @param phpbb_template $template + * @param phpbb_user $user + */ + public function output_notification_types($block = 'notification_types', phpbb_notifications_service $phpbb_notifications, phpbb_template $template, phpbb_user $user) + { + foreach($phpbb_notifications->get_subscription_types() as $type) + { + $template->assign_block_vars($block, array( + 'TYPE' => $type, + + 'NAME' => $user->lang('NOTIFICATION_TYPE_' . strtoupper($type)), + )); + + $this->output_notification_methods($block . '.notification_methods', $phpbb_notifications, $template, $user); + } + } + + /** + * Output all the notification methods to the template + * + * @param string $block + * @param phpbb_notifications_service $phpbb_notifications + * @param phpbb_template $template + * @param phpbb_user $user + */ + public function output_notification_methods($block = 'notification_methods', phpbb_notifications_service $phpbb_notifications, phpbb_template $template, phpbb_user $user) + { + static $notification_methods = false; + + if ($notification_methods === false) + { + $notification_methods = $phpbb_notifications->get_subscription_methods(); + } + + foreach($notification_methods as $method) + { + $template->assign_block_vars($block, array( + 'METHOD' => $method, + + 'NAME' => $user->lang('NOTIFICATION_METHOD_' . strtoupper($method)), + )); + } } } |