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) |
|
167 | |||
168 | /** |
||
169 | * @param array $sql_array |
||
170 | * @param bool $change_user |
||
171 | */ |
||
172 | 7 | private function query_featured(array &$sql_array, $change_user) |
|
176 | |||
177 | /** |
||
178 | * @param array $sql_array |
||
179 | */ |
||
180 | 1 | private function query_recent(array &$sql_array) |
|
184 | |||
185 | /** |
||
186 | * @param array $sql_array |
||
187 | */ |
||
188 | 1 | private function query_posts(array &$sql_array) |
|
192 | |||
193 | /** |
||
194 | * @param string $query_type |
||
195 | * @param string $rotation |
||
196 | * @return int |
||
197 | */ |
||
198 | 9 | private function get_cache_time($query_type, $rotation) |
|
202 | |||
203 | /** |
||
204 | * @return bool |
||
205 | */ |
||
206 | 10 | private function change_user() |
|
217 | |||
218 | /** |
||
219 | */ |
||
220 | 8 | private function explain_view() |
|
230 | |||
231 | /** |
||
232 | * @param array $bdata |
||
233 | * @return array |
||
234 | */ |
||
235 | 10 | private function get_settings(array $bdata) |
|
243 | |||
244 | /** |
||
245 | * @param int $bid |
||
246 | * @param bool $change_user |
||
247 | */ |
||
248 | 10 | private function save_settings($bid, $change_user) |
|
261 | |||
262 | /** |
||
263 | * @param int $block_id |
||
264 | * @param array $row |
||
265 | * @param bool $change_user |
||
266 | * @return string |
||
267 | */ |
||
268 | 10 | private function display_user($block_id, array $row, $change_user) |
|
287 | |||
288 | /** |
||
289 | * @param array $row |
||
290 | * @return array |
||
291 | */ |
||
292 | 8 | private function get_template_data(array $row) |
|
316 | |||
317 | /** |
||
318 | * @param int $user_posts |
||
319 | * @return int|mixed |
||
320 | */ |
||
321 | 8 | private function calculate_percent_posts($user_posts) |
|
325 | |||
326 | /** |
||
327 | * @param int $last_visited |
||
328 | * @param string $date_format |
||
329 | * @return string |
||
330 | */ |
||
331 | 8 | private function get_last_visit_date($last_visited, $date_format) |
|
335 | |||
336 | /** |
||
337 | * @param string $qtype |
||
338 | * @return string |
||
339 | */ |
||
340 | 10 | private function get_block_title($qtype) |
|
345 | |||
346 | /** |
||
347 | * @return array |
||
348 | */ |
||
349 | 1 | private function get_rotation_frequencies() |
|
359 | |||
360 | /** |
||
361 | * @return array |
||
362 | */ |
||
363 | 11 | private function get_query_types() |
|
371 | } |
||
372 |