/** * Output all the notification types to the template * * @param array $subscriptions Array containing global subscriptions * @param \phpbb\notification\manager $phpbb_notifications * @param \phpbb\template\template $template * @param \phpbb\user $user * @param string $block */ public function output_notification_types($subscriptions, \phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user, $block = 'notification_types') { $notification_methods = $phpbb_notifications->get_subscription_methods(); foreach ($phpbb_notifications->get_subscription_types() as $group => $subscription_types) { $template->assign_block_vars($block, array('GROUP_NAME' => $user->lang($group))); foreach ($subscription_types as $type => $data) { $template->assign_block_vars($block, array('TYPE' => $type, 'NAME' => $user->lang($data['lang']), 'EXPLAIN' => isset($user->lang[$data['lang'] . '_EXPLAIN']) ? $user->lang($data['lang'] . '_EXPLAIN') : '', 'SUBSCRIBED' => isset($subscriptions[$type]) ? true : false)); foreach ($notification_methods as $method => $method_data) { $template->assign_block_vars($block . '.notification_methods', array('METHOD' => $method_data['id'], 'NAME' => $user->lang($method_data['lang']), 'SUBSCRIBED' => isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type]) ? true : false)); } } } $template->assign_vars(array(strtoupper($block) . '_COLS' => sizeof($notification_methods) + 2)); }