1 | <?php |
||
18 | class featured_member extends block |
||
19 | { |
||
20 | /** @var \phpbb\cache\driver\driver_interface */ |
||
21 | protected $cache; |
||
22 | |||
23 | /** @var \phpbb\config\config */ |
||
24 | protected $config; |
||
25 | |||
26 | /** @var \phpbb\db\driver\driver_interface */ |
||
27 | protected $db; |
||
28 | |||
29 | /** @var \phpbb\user */ |
||
30 | protected $user; |
||
31 | |||
32 | /** @var \blitze\sitemaker\services\profilefields */ |
||
33 | protected $profilefields; |
||
34 | |||
35 | /** @var string */ |
||
36 | protected $phpbb_root_path; |
||
37 | |||
38 | /** @var string */ |
||
39 | protected $php_ext; |
||
40 | |||
41 | /** @var string */ |
||
42 | protected $blocks_table; |
||
43 | |||
44 | /** @var int */ |
||
45 | protected $cache_time; |
||
46 | |||
47 | /** @var array */ |
||
48 | private $settings; |
||
49 | |||
50 | /** @var array */ |
||
51 | private static $rotations = array( |
||
52 | 'hourly' => 'hour', |
||
53 | 'daily' => 'day', |
||
54 | 'weekly' => 'week', |
||
55 | 'monthly' => 'month' |
||
56 | ); |
||
57 | |||
58 | /** |
||
59 | * Constructor |
||
60 | * |
||
61 | * @param \phpbb\cache\driver\driver_interface $cache Cache driver interface |
||
62 | * @param \phpbb\config\config $config Config object |
||
63 | * @param \phpbb\db\driver\driver_interface $db Database connection |
||
64 | * @param \blitze\sitemaker\services\profilefields $profilefields Profile fields manager object |
||
65 | * @param \phpbb\user $user User object |
||
66 | * @param string $phpbb_root_path Path to the phpbb includes directory. |
||
67 | * @param string $php_ext php file extension |
||
68 | * @param string $blocks_table Name of blocks database table |
||
69 | * @param int $cache_time |
||
70 | */ |
||
71 | 11 | public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, \blitze\sitemaker\services\profilefields $profilefields, $phpbb_root_path, $php_ext, $blocks_table, $cache_time = 3600) |
|
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | 1 | public function get_config(array $settings) |
|
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | 10 | public function display(array $bdata, $edit_mode = false, $loop_count = 0) |
|
136 | |||
137 | /** |
||
138 | * @param bool $change_user |
||
139 | * @return array|false |
||
140 | */ |
||
141 | 10 | private function get_user_data($change_user) |
|
162 | |||
163 | /** |
||
164 | * @return array |
||
165 | */ |
||
166 | 10 | private function get_sql_array() |
|
174 | |||
175 | /** |
||
176 | * @param array $sql_array |
||
177 | * @param bool $change_user |
||
178 | */ |
||
179 | 7 | private function query_featured(array &$sql_array, $change_user) |
|
183 | |||
184 | /** |
||
185 | * @param array $sql_array |
||
186 | */ |
||
187 | 1 | private function query_recent(array &$sql_array) |
|
191 | |||
192 | /** |
||
193 | * @param array $sql_array |
||
194 | */ |
||
195 | 1 | private function query_posts(array &$sql_array) |
|
199 | |||
200 | /** |
||
201 | * @param string $query_type |
||
202 | * @param string $rotation |
||
203 | * @return int |
||
204 | */ |
||
205 | 9 | private function get_cache_time($query_type, $rotation) |
|
209 | |||
210 | /** |
||
211 | * @return bool |
||
212 | */ |
||
213 | 10 | private function change_user() |
|
224 | |||
225 | /** |
||
226 | */ |
||
227 | 8 | private function explain_view() |
|
237 | |||
238 | /** |
||
239 | * @param array $bdata |
||
240 | * @return array |
||
241 | */ |
||
242 | 10 | private function get_settings(array $bdata) |
|
250 | |||
251 | /** |
||
252 | * @param int $bid |
||
253 | * @param bool $change_user |
||
254 | */ |
||
255 | 10 | private function save_settings($bid, $change_user) |
|
268 | |||
269 | /** |
||
270 | * @param int $block_id |
||
271 | * @param array $row |
||
272 | * @param bool $change_user |
||
273 | * @return string |
||
274 | */ |
||
275 | 10 | private function display_user($block_id, array $row, $change_user) |
|
294 | |||
295 | /** |
||
296 | * @param array $row |
||
297 | * @return array |
||
298 | */ |
||
299 | 8 | private function get_template_data(array $row) |
|
323 | |||
324 | /** |
||
325 | * @param int $user_posts |
||
326 | * @return int|mixed |
||
327 | */ |
||
328 | 8 | private function calculate_percent_posts($user_posts) |
|
332 | |||
333 | /** |
||
334 | * @param int $last_visited |
||
335 | * @param string $date_format |
||
336 | * @return string |
||
337 | */ |
||
338 | 8 | private function get_last_visit_date($last_visited, $date_format) |
|
342 | |||
343 | /** |
||
344 | * @param string $qtype |
||
345 | * @return string |
||
346 | */ |
||
347 | 10 | private function get_block_title($qtype) |
|
352 | |||
353 | /** |
||
354 | * @return array |
||
355 | */ |
||
356 | 1 | private function get_rotation_frequencies() |
|
366 | |||
367 | /** |
||
368 | * @return array |
||
369 | */ |
||
370 | 11 | private function get_query_types() |
|
378 | } |
||
379 |