mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-09 04:48:53 +00:00
[ticket/11103] More work on the UCP Notifications page
PHPBB3-11103
This commit is contained in:
parent
9b8c48a31c
commit
e66117409c
4 changed files with 175 additions and 3 deletions
|
@ -473,7 +473,26 @@ class phpbb_notifications_service
|
|||
*/
|
||||
public function get_subscription_methods()
|
||||
{
|
||||
return array_keys($this->get_subscription_files('notifications/method/'));
|
||||
$subscription_methods = array();
|
||||
|
||||
foreach ($this->get_subscription_files('notifications/method/') as $method_name => $file)
|
||||
{
|
||||
$class_name = 'phpbb_notifications_method_' . $method_name;
|
||||
|
||||
if (!class_exists($class_name))
|
||||
{
|
||||
include($file);
|
||||
}
|
||||
|
||||
$method = new $class_name($this->phpbb_container);
|
||||
|
||||
if ($method->is_available())
|
||||
{
|
||||
$subscription_methods[] = $method_name;
|
||||
}
|
||||
}
|
||||
|
||||
return $subscription_methods;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -287,6 +287,18 @@ $lang = array_merge($lang, array(
|
|||
'NEW_PASSWORD' => 'New password',
|
||||
'NEW_PASSWORD_CONFIRM_EMPTY' => 'You did not enter a confirm password.',
|
||||
'NEW_PASSWORD_ERROR' => 'The passwords you entered do not match.',
|
||||
|
||||
'NOTIFICATION_METHOD_EMAIL' => 'Email',
|
||||
'NOTIFICATION_METHOD_JABBER' => 'Jabber',
|
||||
'NOTIFICATION_TYPE' => 'Notification type',
|
||||
'NOTIFICATION_TYPE_BOOKMARK' => 'Someone replies to a topic you have bookmarked',
|
||||
'NOTIFICATION_TYPE_IN_MODERATION_QUEUE' => 'A post or topic needs approval',
|
||||
'NOTIFICATION_TYPE_MODERATION_QUEUE' => 'Your topics/posts are approved or disapproved by a moderator',
|
||||
'NOTIFICATION_TYPE_PM' => 'Someone sends you a private message',
|
||||
'NOTIFICATION_TYPE_POST' => 'Someone replies to a topic you are subscribed to',
|
||||
'NOTIFICATION_TYPE_QUOTE' => 'Someone quotes you in a post',
|
||||
'NOTIFICATION_TYPE_TOPIC' => 'Someone creates a topic in a forum you are subscribed to',
|
||||
|
||||
'NOTIFY_METHOD' => 'Notification method',
|
||||
'NOTIFY_METHOD_BOTH' => 'Both',
|
||||
'NOTIFY_METHOD_EMAIL' => 'Email only',
|
||||
|
@ -456,6 +468,8 @@ $lang = array_merge($lang, array(
|
|||
'UCP_MSNM' => 'Windows Live Messenger',
|
||||
'UCP_NO_ATTACHMENTS' => 'You have posted no files.',
|
||||
|
||||
'UCP_NOTIFICATION_OPTIONS' => 'Notification Options',
|
||||
|
||||
'UCP_PREFS' => 'Board preferences',
|
||||
'UCP_PREFS_PERSONAL' => 'Edit global settings',
|
||||
'UCP_PREFS_POST' => 'Edit posting defaults',
|
||||
|
|
48
phpBB/styles/prosilver/template/ucp_notifications.html
Normal file
48
phpBB/styles/prosilver/template/ucp_notifications.html
Normal file
|
@ -0,0 +1,48 @@
|
|||
<!-- INCLUDE ucp_header.html -->
|
||||
|
||||
<form id="ucp" method="post" action="{S_UCP_ACTION}"{S_FORM_ENCTYPE}>
|
||||
|
||||
<div class="panel">
|
||||
<div class="inner">
|
||||
<ul class="topiclist">
|
||||
<li class="header">
|
||||
<dl class="icon">
|
||||
<dt>{L_NOTIFICATION_TYPE}</dt>
|
||||
<dd class="topics">{L_NOTIFICATIONS}</dd>
|
||||
<!-- BEGIN notification_methods -->
|
||||
<dd class="topics">{notification_methods.NAME}</dd>
|
||||
<!-- END notification_methods -->
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="topiclist cplist">
|
||||
|
||||
<!-- BEGIN notification_types -->
|
||||
<li class="row<!-- IF notification_types.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
|
||||
<dl class="icon">
|
||||
<dt>
|
||||
{notification_types.NAME}<br />
|
||||
{notification_types.DESC}
|
||||
</dt>
|
||||
<dd class="topics"><input type="checkbox" name="{notification_types.TYPE}_notification" /> <dfn>{notification_methods.NAME}</dfn></dd>
|
||||
<!-- BEGIN notification_methods -->
|
||||
<dd class="topics"><input type="checkbox" name="{notification_types.TYPE}_{notification_methods.METHOD}" /> <dfn>{notification_methods.NAME}</dfn></dd>
|
||||
<!-- END notification_methods -->
|
||||
</dl>
|
||||
</li>
|
||||
<!-- END notification_types -->
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<fieldset class="submit-buttons">
|
||||
{S_HIDDEN_FIELDS}<input type="reset" value="{L_RESET}" name="reset" class="button2" />
|
||||
<input type="submit" name="submit" value="{L_SUBMIT}" class="button1" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- INCLUDE ucp_footer.html -->
|
Loading…
Add table
Reference in a new issue