1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* |
5
|
|
|
* @package sitemaker |
6
|
|
|
* @copyright (c) 2021 Daniel A. (blitze) |
7
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace blitze\sitemaker\blocks; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Popular Topics Block |
15
|
|
|
*/ |
16
|
|
|
class popular_topics extends forum_topics |
17
|
|
|
{ |
18
|
|
|
/** @var \phpbb\config\config */ |
19
|
|
|
protected $config; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Constructor |
23
|
|
|
* |
24
|
|
|
* @param \phpbb\auth\auth $auth Permission object |
25
|
|
|
* @param \phpbb\content_visibility $content_visibility Content visibility object |
26
|
|
|
* @param \phpbb\language\language $translator Language object |
27
|
|
|
* @param \phpbb\user $user User object |
28
|
|
|
* @param \Urodoz\Truncate\TruncateService $truncator Truncator service |
29
|
|
|
* @param \blitze\sitemaker\services\date_range $date_range Date Range Object |
30
|
|
|
* @param \blitze\sitemaker\services\forum\data $forum_data Forum Data object |
31
|
|
|
* @param \blitze\sitemaker\services\forum\options $forum_options Forum Data object |
32
|
|
|
* @param string $phpbb_root_path Path to the phpbb includes directory. |
33
|
|
|
* @param string $php_ext php file extension |
34
|
|
|
* @param \phpbb\config\config $config phpBB configuration |
35
|
|
|
*/ |
36
|
|
|
public function __construct(\phpbb\auth\auth $auth, \phpbb\content_visibility $content_visibility, \phpbb\language\language $translator, \phpbb\user $user, \Urodoz\Truncate\TruncateService $truncator, \blitze\sitemaker\services\date_range $date_range, \blitze\sitemaker\services\forum\data $forum_data, \blitze\sitemaker\services\forum\options $forum_options, $phpbb_root_path, $php_ext, \phpbb\config\config $config) |
37
|
|
|
{ |
38
|
|
|
parent::__construct($auth, $content_visibility, $translator, $user, $truncator, $date_range, $forum_data, $forum_options, $phpbb_root_path, $php_ext); |
39
|
|
|
|
40
|
|
|
$this->config = $config; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* {@inheritdoc} |
45
|
|
|
*/ |
46
|
|
|
public function get_config(array $settings) |
47
|
|
|
{ |
48
|
|
|
$config = parent::get_config($settings); |
49
|
|
|
unset($config['topic_type']); |
50
|
|
|
|
51
|
|
|
return $config; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @return string |
56
|
|
|
*/ |
57
|
|
|
protected function get_block_title() |
58
|
|
|
{ |
59
|
|
|
return 'POPULAR_TOPICS'; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* {@inheritdoc} |
64
|
|
|
*/ |
65
|
|
|
protected function build_query() |
66
|
|
|
{ |
67
|
|
|
parent::build_query(); |
68
|
|
|
|
69
|
|
|
$this->forum_data->fetch_custom([ |
70
|
|
|
'WHERE' => array('t.topic_posts_approved >' . $this->config['hot_threshold']) |
71
|
|
|
]); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|