1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* PayPal Donation extension for the phpBB Forum Software package. |
5
|
|
|
* |
6
|
|
|
* @copyright (c) 2017 Skouat |
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace skouat\ppde\controller; |
12
|
|
|
|
13
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Class admin_donors_controller |
17
|
|
|
* |
18
|
|
|
* @property \phpbb\config\config config Config object |
19
|
|
|
* @property ContainerInterface container Service container interface |
20
|
|
|
* @property \phpbb\request\request request Request object. |
21
|
|
|
* @property \phpbb\template\template template Template object |
22
|
|
|
* |
23
|
|
|
* @package skouat\ppde\controller |
24
|
|
|
*/ |
25
|
|
|
class admin_donors_controller extends admin_main |
|
|
|
|
26
|
|
|
{ |
27
|
|
|
protected $ppde_entity_transactions; |
28
|
|
|
protected $ppde_main_controller; |
29
|
|
|
protected $ppde_operator_transactions; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* constructor |
33
|
|
|
* |
34
|
|
|
* @param \phpbb\config\config $config Config object |
35
|
|
|
* @param ContainerInterface $container Service container interface |
36
|
|
|
* @param \skouat\ppde\entity\transactions $ppde_entity_transactions Entity object |
37
|
|
|
* @param \skouat\ppde\controller\main_controller $ppde_main_controller Main controller object |
38
|
|
|
* @param \skouat\ppde\operators\transactions $ppde_operator_transactions Operator object |
39
|
|
|
* @param \phpbb\request\request $request Request object |
40
|
|
|
* @param \phpbb\template\template $template Template object |
41
|
|
|
*/ |
42
|
|
|
public function __construct(\phpbb\config\config $config, ContainerInterface $container, \skouat\ppde\entity\transactions $ppde_entity_transactions, \skouat\ppde\controller\main_controller $ppde_main_controller, \skouat\ppde\operators\transactions $ppde_operator_transactions, \phpbb\request\request $request, \phpbb\template\template $template) |
43
|
|
|
{ |
44
|
|
|
$this->config = $config; |
45
|
|
|
$this->container = $container; |
46
|
|
|
$this->ppde_entity_transactions = $ppde_entity_transactions; |
47
|
|
|
$this->ppde_main_controller = $ppde_main_controller; |
48
|
|
|
$this->ppde_operator_transactions = $ppde_operator_transactions; |
49
|
|
|
$this->request = $request; |
50
|
|
|
$this->template = $template; |
51
|
|
|
parent::__construct( |
52
|
|
|
'donors', |
53
|
|
|
'PPDE_DD', |
54
|
|
|
'' |
55
|
|
|
); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Display the donors list |
60
|
|
|
* |
61
|
|
|
* @return void |
62
|
|
|
* @access public |
63
|
|
|
*/ |
64
|
|
|
public function display_donors() |
65
|
|
|
{ |
66
|
|
|
$start = $this->request->variable('start', 0); |
67
|
|
|
|
68
|
|
|
// Build SQL Query |
69
|
|
|
$get_donorlist_sql_ary = $this->ppde_operator_transactions->get_sql_donorlist_ary(false); |
|
|
|
|
70
|
|
|
// adds fields to the table schema needed by entity->import() |
71
|
|
|
$additional_table_schema = array( |
72
|
|
|
'item_username' => array('name' => 'username', 'type' => 'string'), |
73
|
|
|
'item_user_colour' => array('name' => 'user_colour', 'type' => 'string'), |
74
|
|
|
'item_amount' => array('name' => 'amount', 'type' => 'float'), |
75
|
|
|
'item_max_txn_id' => array('name' => 'max_txn_id', 'type' => 'integer'), |
76
|
|
|
); |
77
|
|
|
|
78
|
|
|
// Get the donors list |
79
|
|
|
$data_ary = $this->ppde_entity_transactions->get_data($this->ppde_operator_transactions->build_sql_donorlist_data($get_donorlist_sql_ary), $additional_table_schema, $this->config['topics_per_page'], $start); |
|
|
|
|
80
|
|
|
|
81
|
|
|
// Get default currency data from the database |
82
|
|
|
$default_currency_data = $this->get_last_element($this->ppde_main_controller->get_default_currency_data($this->config['ppde_default_currency'])); |
|
|
|
|
83
|
|
|
|
84
|
|
|
// Build pagination |
85
|
|
|
/** @type \phpbb\pagination $pagination */ |
86
|
|
|
$pagination = $this->container->get('pagination'); |
87
|
|
|
$pagination_url = append_sid($this->u_action); |
88
|
|
|
$total_donors = $this->ppde_operator_transactions->query_sql_count($get_donorlist_sql_ary, 'txn.user_id'); |
89
|
|
|
$start = $pagination->validate_start($start, $this->config['topics_per_page'], $total_donors); |
|
|
|
|
90
|
|
|
$pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_donors, $this->config['topics_per_page'], $start); |
|
|
|
|
91
|
|
|
|
92
|
|
|
foreach ($data_ary as $data) |
93
|
|
|
{ |
94
|
|
|
$get_last_transaction_sql_ary = $this->ppde_operator_transactions->get_sql_donorlist_ary($data['max_txn_id']); |
95
|
|
|
$last_donation_data = $this->get_last_element($this->ppde_entity_transactions->get_data($this->ppde_operator_transactions->build_sql_donorlist_data($get_last_transaction_sql_ary))); |
96
|
|
|
|
97
|
|
|
$this->template->assign_block_vars('donorrow', array( |
98
|
|
|
'PPDE_DD_DONATED_AMOUNT' => $this->ppde_main_controller->currency_on_left(number_format($data['amount'], 2), $default_currency_data['currency_symbol'], (bool) $default_currency_data['currency_on_left']), |
|
|
|
|
99
|
|
|
'PPDE_DD_LAST_DONATION' => $this->ppde_main_controller->currency_on_left(number_format($last_donation_data['mc_gross'], 2), $default_currency_data['currency_symbol'], (bool) $default_currency_data['currency_on_left']), |
100
|
|
|
'PPDE_DD_USERNAME' => get_username_string('full', $data['user_id'], $data['username'], $data['user_colour']), |
101
|
|
|
)); |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths