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\language\language */ |
||
30 | protected $translator; |
||
31 | |||
32 | /** @var \phpbb\user */ |
||
33 | protected $user; |
||
34 | |||
35 | /** @var \blitze\sitemaker\services\profilefields */ |
||
36 | protected $profilefields; |
||
37 | |||
38 | /** @var string */ |
||
39 | protected $phpbb_root_path; |
||
40 | |||
41 | /** @var string */ |
||
42 | protected $php_ext; |
||
43 | |||
44 | /** @var string */ |
||
45 | protected $blocks_table; |
||
46 | |||
47 | /** @var int */ |
||
48 | protected $cache_time; |
||
49 | |||
50 | /** @var array */ |
||
51 | private $settings; |
||
52 | |||
53 | /** @var array */ |
||
54 | private static $rotations = array( |
||
55 | 'hourly' => 'hour', |
||
56 | 'daily' => 'day', |
||
57 | 'weekly' => 'week', |
||
58 | 'monthly' => 'month' |
||
59 | ); |
||
60 | |||
61 | /** |
||
62 | * Constructor |
||
63 | * |
||
64 | * @param \phpbb\cache\driver\driver_interface $cache Cache driver interface |
||
65 | * @param \phpbb\config\config $config Config object |
||
66 | * @param \phpbb\db\driver\driver_interface $db Database connection |
||
67 | * @param \phpbb\language\language $translator Language object |
||
68 | * @param \phpbb\user $user User object |
||
69 | * @param \blitze\sitemaker\services\profilefields $profilefields Profile fields manager object |
||
70 | * @param string $phpbb_root_path Path to the phpbb includes directory. |
||
71 | * @param string $php_ext php file extension |
||
72 | * @param string $blocks_table Name of blocks database table |
||
73 | * @param int $cache_time |
||
74 | */ |
||
75 | 11 | public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\language\language $translator, \phpbb\user $user, \blitze\sitemaker\services\profilefields $profilefields, $phpbb_root_path, $php_ext, $blocks_table, $cache_time = 3600) |
|
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | 1 | public function get_config(array $settings) |
|
110 | |||
111 | /** |
||
112 | * {@inheritdoc} |
||
113 | */ |
||
114 | 10 | public function display(array $bdata, $edit_mode = false, $loop_count = 0) |
|
141 | |||
142 | /** |
||
143 | * @param bool $change_user |
||
144 | * @return array|false |
||
145 | */ |
||
146 | 10 | private function get_user_data($change_user) |
|
169 | |||
170 | /** |
||
171 | * @param string $sql |
||
172 | * @param bool $change_user |
||
173 | */ |
||
174 | 7 | private function query_featured(&$sql, $change_user) |
|
178 | |||
179 | /** |
||
180 | * @param string $sql |
||
181 | */ |
||
182 | 1 | private function query_recent(&$sql) |
|
186 | |||
187 | /** |
||
188 | * @param string $sql |
||
189 | */ |
||
190 | 1 | private function query_posts(&$sql) |
|
194 | |||
195 | /** |
||
196 | * @param string $query_type |
||
197 | * @param string $rotation |
||
198 | * @return int |
||
199 | */ |
||
200 | 9 | private function get_cache_time($query_type, $rotation) |
|
204 | |||
205 | /** |
||
206 | * @return bool |
||
207 | */ |
||
208 | 10 | private function change_user() |
|
219 | |||
220 | /** |
||
221 | */ |
||
222 | 8 | private function explain_view() |
|
232 | |||
233 | /** |
||
234 | * @param array $bdata |
||
235 | * @return array |
||
236 | */ |
||
237 | 10 | private function get_settings(array $bdata) |
|
245 | |||
246 | /** |
||
247 | * @param int $bid |
||
248 | * @param bool $change_user |
||
249 | */ |
||
250 | 10 | private function save_settings($bid, $change_user) |
|
263 | |||
264 | /** |
||
265 | * @param int $block_id |
||
266 | * @param array $row |
||
267 | * @param bool $change_user |
||
268 | * @return string |
||
269 | */ |
||
270 | 10 | private function display_user($block_id, array $row, $change_user) |
|
289 | |||
290 | /** |
||
291 | * @param array $row |
||
292 | * @return array |
||
293 | */ |
||
294 | 8 | private function get_template_data(array $row) |
|
318 | |||
319 | /** |
||
320 | * @param int $user_posts |
||
321 | * @return int|mixed |
||
322 | */ |
||
323 | 8 | private function calculate_percent_posts($user_posts) |
|
327 | |||
328 | /** |
||
329 | * @param int $last_visited |
||
330 | * @param string $date_format |
||
331 | * @return string |
||
332 | */ |
||
333 | 8 | private function get_last_visit_date($last_visited, $date_format) |
|
337 | |||
338 | /** |
||
339 | * @param string $qtype |
||
340 | * @return string |
||
341 | */ |
||
342 | 10 | private function get_block_title($qtype) |
|
347 | |||
348 | /** |
||
349 | * @return array |
||
350 | */ |
||
351 | 1 | private function get_rotation_frequencies() |
|
361 | |||
362 | /** |
||
363 | * @return array |
||
364 | */ |
||
365 | 11 | private function get_query_types() |
|
373 | } |
||
374 |