Notification
in package
implements
ActionInterface
uses
ActionTrait, BackwardCompatibility
Handles preferences related to notifications.
Table of Contents
Interfaces
- ActionInterface
- Interface for all action classes.
Properties
- $alert_types : array<string|int, mixed>
- $group_options : array<string|int, mixed>
- $subaction : string
- $subactions : array<string|int, mixed>
- $subtemplates : array<string|int, mixed>
- $obj : static
Methods
- boards() : void
- Handles preferences related to board-level notifications.
- call() : void
- Convenience method to load() and execute() an instance of this class.
- canBeLogged() : bool
- Determines whether this action can be logged in the online log.
- canShowDebuggingInfo() : bool
- Determines whether debugging info should be shown.
- canShowInMaintenanceMode() : bool
- Determines whether this action allows access in maintenance mode.
- configuration() : void
- Handles configuration of alert preferences.
- execute() : void
- Dispatcher to whichever sub-action method is necessary.
- getOutputType() : OutputTypeInterface
- Gets the output type for this action.
- isAgreementAction() : bool
- Determines whether this action can be accessed without accepting the registration agreement and privacy policy.
- isRestrictedGuestAccessAllowed() : bool
- Determines whether this action allows access if guest access is restricted.
- isSimpleAction() : bool
- Determines whether this is a simple action.
- list_getBoardNotifications() : array<string|int, mixed>
- Gets information about all the boards the user has requested notifications for.
- list_getTopicNotificationCount() : int
- Determines how many topics the user has requested notifications for.
- list_getTopicNotifications() : array<string|int, mixed>
- Gets information about all the topics the user has requested notifications for.
- load() : static
- Static wrapper for constructor.
- markRead() : void
- Marks all alerts as read for user.
- subActionProvider() : void
- Backwards compatibility function for handling profile-related subactions
- topics() : void
- Handles alerts related to topics and posts.
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
- changeNotifications() : void
- Make any notification changes that need to be made.
Properties
$alert_types
public
array<string|int, mixed>
$alert_types
= ['board' => ['topic_notify' => ['alert' => 'yes', 'email' => 'yes'], 'board_notify' => ['alert' => 'yes', 'email' => 'yes']], 'msg' => ['msg_mention' => ['alert' => 'yes', 'email' => 'yes'], 'msg_quote' => ['alert' => 'yes', 'email' => 'yes'], 'msg_like' => ['alert' => 'yes', 'email' => 'never'], 'unapproved_reply' => ['alert' => 'yes', 'email' => 'yes']], 'pm' => ['pm_new' => ['alert' => 'never', 'email' => 'yes', 'help' => 'alert_pm_new', 'permission' => ['name' => 'pm_read', 'is_board' => false]], 'pm_reply' => ['alert' => 'never', 'email' => 'yes', 'help' => 'alert_pm_new', 'permission' => ['name' => 'pm_send', 'is_board' => false]]], 'groupr' => ['groupr_approved' => ['alert' => 'yes', 'email' => 'yes'], 'groupr_rejected' => ['alert' => 'yes', 'email' => 'yes']], 'moderation' => ['unapproved_attachment' => ['alert' => 'yes', 'email' => 'yes', 'permission' => ['name' => 'approve_posts', 'is_board' => true]], 'unapproved_post' => ['alert' => 'yes', 'email' => 'yes', 'permission' => ['name' => 'approve_posts', 'is_board' => true]], 'msg_report' => ['alert' => 'yes', 'email' => 'yes', 'permission' => ['name' => 'moderate_board', 'is_board' => true]], 'msg_report_reply' => ['alert' => 'yes', 'email' => 'yes', 'permission' => ['name' => 'moderate_board', 'is_board' => true]], 'member_report' => ['alert' => 'yes', 'email' => 'yes', 'permission' => ['name' => 'moderate_forum', 'is_board' => false]], 'member_report_reply' => ['alert' => 'yes', 'email' => 'yes', 'permission' => ['name' => 'moderate_forum', 'is_board' => false]]], 'members' => ['member_register' => ['alert' => 'yes', 'email' => 'yes', 'permission' => ['name' => 'moderate_forum', 'is_board' => false]], 'request_group' => ['alert' => 'yes', 'email' => 'yes'], 'warn_any' => ['alert' => 'yes', 'email' => 'yes', 'permission' => ['name' => 'issue_warning', 'is_board' => false]], 'buddy_request' => ['alert' => 'yes', 'email' => 'never'], 'birthday' => ['alert' => 'yes', 'email' => 'yes']], 'calendar' => ['event_new' => ['alert' => 'yes', 'email' => 'yes', 'help' => 'alert_event_new']], 'paidsubs' => ['paidsubs_expiring' => ['alert' => 'yes', 'email' => 'yes']]]
Defines all the types of alerts and their default values.
The 'alert' and 'email' keys are required for each alert type. The 'help' and 'permission' keys are optional.
Valid values for 'alert' and 'email' keys are: 'always', 'yes', 'never'. If using 'always' or 'never' you should add a help string.
$group_options
public
array<string|int, mixed>
$group_options
= ['board' => ['msg_auto_notify' => ['check', 'msg_auto_notify', 'label' => 'after'], 'msg_receive_body' => ['check', 'msg_receive_body', 'label' => 'after'], 'msg_notify_pref' => ['select', 'msg_notify_pref', 'label' => 'before', 'opts' => [0 => 'alert_opt_msg_notify_pref_never', 1 => 'alert_opt_msg_notify_pref_instant', 2 => 'alert_opt_msg_notify_pref_first', 3 => 'alert_opt_msg_notify_pref_daily', 4 => 'alert_opt_msg_notify_pref_weekly']], 'msg_notify_type' => ['select', 'msg_notify_type', 'label' => 'before', 'opts' => [1 => 'notify_send_type_everything', 2 => 'notify_send_type_everything_own', 3 => 'notify_send_type_only_replies', 4 => 'notify_send_type_nothing']]], 'pm' => ['pm_notify' => ['select', 'pm_notify', 'label' => 'before', 'opts' => [1 => 'email_notify_all', 2 => 'email_notify_buddies']]]]
The group level options.
$subaction
public
string
$subaction
= 'alerts'
The requested sub-action. This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['alerts' => 'configuration', 'markread' => 'markRead', 'topics' => 'topics', 'boards' => 'boards']
Available sub-actions.
$subtemplates
public
static array<string|int, mixed>
$subtemplates
= ['alerts' => 'alert_configuration', 'markread' => 'alert_markread', 'topics' => 'alert_notifications_topics', 'boards' => 'alert_notifications_boards']
Available sub-actions.
$obj
protected
static static
$obj
An instance of this class. This is used by the load() method to prevent multiple instantiations.
Methods
boards()
Handles preferences related to board-level notifications.
public
boards() : void
call()
Convenience method to load() and execute() an instance of this class.
public
static call() : void
canBeLogged()
Determines whether this action can be logged in the online log.
public
canBeLogged() : bool
Return values
boolcanShowDebuggingInfo()
Determines whether debugging info should be shown.
public
canShowDebuggingInfo() : bool
Return values
boolcanShowInMaintenanceMode()
Determines whether this action allows access in maintenance mode.
public
canShowInMaintenanceMode() : bool
Return values
bool —True if access is allowed, false otherwise.
configuration()
Handles configuration of alert preferences.
public
configuration([bool $defaultSettings = false ]) : void
Parameters
- $defaultSettings : bool = false
-
If true, we are loading default options.
execute()
Dispatcher to whichever sub-action method is necessary.
public
execute() : void
getOutputType()
Gets the output type for this action.
public
getOutputType() : OutputTypeInterface
Return values
OutputTypeInterfaceisAgreementAction()
Determines whether this action can be accessed without accepting the registration agreement and privacy policy.
public
isAgreementAction() : bool
Return values
boolisRestrictedGuestAccessAllowed()
Determines whether this action allows access if guest access is restricted.
public
isRestrictedGuestAccessAllowed() : bool
Return values
bool —True if access is allowed, false otherwise.
isSimpleAction()
Determines whether this is a simple action.
public
isSimpleAction() : bool
Return values
boollist_getBoardNotifications()
Gets information about all the boards the user has requested notifications for.
public
static list_getBoardNotifications(int $start, int $items_per_page, string $sort) : array<string|int, mixed>
Parameters
- $start : int
-
Which item to start with (not used here).
- $items_per_page : int
-
How many items to show on each page (not used here).
- $sort : string
-
A string indicating how to sort the results.
Return values
array<string|int, mixed> —An array of information about all the boards the user is subscribed to.
list_getTopicNotificationCount()
Determines how many topics the user has requested notifications for.
public
static list_getTopicNotificationCount() : int
Return values
int —The number of topics the user has subscribed to.
list_getTopicNotifications()
Gets information about all the topics the user has requested notifications for.
public
static list_getTopicNotifications(int $start, int $items_per_page, string $sort) : array<string|int, mixed>
Parameters
- $start : int
-
Which item to start with (for pagination purposes).
- $items_per_page : int
-
How many items to display on each page.
- $sort : string
-
A string indicating how to sort the results.
Return values
array<string|int, mixed> —An array of information about the topics the user has subscribed to.
load()
Static wrapper for constructor.
public
static load() : static
Return values
static —An instance of this class.
markRead()
Marks all alerts as read for user.
public
markRead() : void
subActionProvider()
Backwards compatibility function for handling profile-related subactions
public
static subActionProvider(int $memID[, null|string $sa = null ][, bool $updateRequest = false ][, bool $loadSelfFirst = true ][, bool $loadProfile = false ][, bool $defaultSettings = false ]) : void
Parameters
- $memID : int
-
The member ID
- $sa : null|string = null
-
The subaction
- $updateRequest : bool = false
-
Whether to update $_REQUEST['u']
- $loadSelfFirst : bool = true
-
Whether to load the current user's profile first
- $loadProfile : bool = false
-
Whether to load the profile of the specified member
- $defaultSettings : bool = false
-
Not used?
topics()
Handles alerts related to topics and posts.
public
topics() : void
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed
changeNotifications()
Make any notification changes that need to be made.
protected
changeNotifications() : void