Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14namespace phpbb\notification\type;
15
16/**
17* Base notifications interface
18*/
19interface type_interface
20{
21    /**
22    * Get notification type name
23    *
24    * @return string
25    */
26    public function get_type();
27
28    /**
29    * Set initial data from the database
30    *
31    * @param array $data Row directly from the database
32    */
33    public function set_initial_data($data);
34
35    /**
36    * Get the id of the item
37    *
38    * @param array $type_data The type specific data
39    */
40    public static function get_item_id($type_data);
41
42    /**
43    * Get the id of the parent
44    *
45    * @param array $type_data The type specific data
46    */
47    public static function get_item_parent_id($type_data);
48
49    /**
50    * Is this type available to the current user (defines whether or not it will be shown in the UCP Edit notification options)
51    *
52    * @return bool True/False whether or not this is available to the user
53    */
54    public function is_available();
55
56    /**
57    * Find the users who want to receive notifications
58    *
59    * @param array $type_data The type specific data
60    * @param array $options Options for finding users for notification
61    *         ignore_users => array of users and user types that should not receive notifications from this type because they've already been notified
62    *                         e.g.: array(2 => array(''), 3 => array('', 'email'), ...)
63    *
64    * @return array
65    */
66    public function find_users_for_notification($type_data, $options);
67
68    /**
69    * Users needed to query before this notification can be displayed
70    *
71    * @return array Array of user_ids
72    */
73    public function users_to_query();
74
75    /**
76    * Get the special items to load
77    *
78    * @return array Data will be combined sent to load_special() so you can run a single query and get data required for this notification type
79    */
80    public function get_load_special();
81
82    /**
83    * Load the special items
84    *
85    * @param array $data Data from get_load_special()
86    * @param array $notifications Array of notifications (key is notification_id, value is the notification objects)
87    */
88    public function load_special($data, $notifications);
89
90    /**
91    * Get the CSS style class of the notification
92    *
93    * @return string
94    */
95    public function get_style_class();
96
97    /**
98    * Get the HTML formatted title of this notification
99    *
100    * @return string
101    */
102    public function get_title();
103
104    /**
105    * Get the HTML formatted reference of the notification
106    *
107    * @return string
108    */
109    public function get_reference();
110
111    /**
112    * Get the forum of the notification reference
113    *
114    * @return string
115    */
116    public function get_forum();
117
118    /**
119    * Get the url to this item
120    *
121    * @return string URL
122    */
123    public function get_url();
124
125    /**
126    * Get the url to redirect after the item has been marked as read
127    *
128    * @return string URL
129    */
130    public function get_redirect_url();
131
132    /**
133    * URL to unsubscribe to this notification
134    *
135    * @param string|bool $method Method name to unsubscribe from (email|jabber|etc), False to unsubscribe from all notifications for this item
136    */
137    public function get_unsubscribe_url($method);
138
139    /**
140    * Get the user's avatar (the user who caused the notification typically)
141    *
142    * @return array
143    */
144    public function get_avatar();
145
146    /**
147    * Prepare to output the notification to the template
148    */
149    public function prepare_for_display();
150
151    /**
152    * Get email template
153    *
154    * @return string|bool
155    */
156    public function get_email_template();
157
158    /**
159    * Get email template variables
160    *
161    * @return array
162    */
163    public function get_email_template_variables();
164
165    /**
166    * Pre create insert array function
167    * This allows you to perform certain actions, like run a query
168    * and load data, before create_insert_array() is run. The data
169    * returned from this function will be sent to create_insert_array().
170    *
171    * @param array $type_data The type specific data
172    * @param array $notify_users Notify users list
173    *         Formatted from find_users_for_notification()
174    * @return array Whatever you want to send to create_insert_array().
175    */
176    public function pre_create_insert_array($type_data, $notify_users);
177
178    /**
179    * Function for preparing the data for insertion in an SQL query
180    *
181    * @param array $type_data The type specific data
182    * @param array $pre_create_data Data from pre_create_insert_array()
183    */
184    public function create_insert_array($type_data, $pre_create_data);
185
186    /**
187    * Function for getting the data for insertion in an SQL query
188    *
189    * @return array Array of data ready to be inserted into the database
190    */
191    public function get_insert_array();
192
193    /**
194    * Function for preparing the data for update in an SQL query
195    * (The service handles insertion)
196    *
197    * @param array $type_data Data unique to this notification type
198    *
199    * @return array Array of data ready to be updated in the database
200    */
201    public function create_update_array($type_data);
202
203    /**
204    * Mark this item read
205    *
206    * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False)
207    * @return string
208    */
209    public function mark_read($return = false);
210
211    /**
212    * Mark this item unread
213    *
214    * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False)
215    * @return string
216    */
217    public function mark_unread($return = false);
218}