Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 29 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
StrikePager | |
0.00% |
0 / 29 |
|
0.00% |
0 / 7 |
110 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
getQueryInfo | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
2 | |||
formatValue | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
20 | |||
getDefaultSort | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getFieldNames | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
getTitle | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isFieldSortable | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\SecurePoll\Pages; |
4 | |
5 | use MediaWiki\Linker\Linker; |
6 | use MediaWiki\Pager\TablePager; |
7 | |
8 | /** |
9 | * Pager for the strike log. See TablePager documentation. |
10 | */ |
11 | class StrikePager extends TablePager { |
12 | /** |
13 | * @var DetailsPage |
14 | */ |
15 | public $detailsPage; |
16 | |
17 | /** @var int */ |
18 | public $voteId; |
19 | |
20 | /** |
21 | * @param DetailsPage $detailsPage |
22 | * @param int $voteId |
23 | */ |
24 | public function __construct( $detailsPage, $voteId ) { |
25 | $this->detailsPage = $detailsPage; |
26 | $this->voteId = $voteId; |
27 | parent::__construct(); |
28 | } |
29 | |
30 | /** @inheritDoc */ |
31 | public function getQueryInfo() { |
32 | return [ |
33 | 'tables' => [ |
34 | 'user', |
35 | 'securepoll_strike' |
36 | ], |
37 | 'fields' => '*', |
38 | 'conds' => [ |
39 | 'st_vote' => $this->voteId, |
40 | 'st_user=user_id', |
41 | ], |
42 | 'options' => [] |
43 | ]; |
44 | } |
45 | |
46 | /** |
47 | * @param string $name |
48 | * @param string $value |
49 | * @return string HTML |
50 | */ |
51 | public function formatValue( $name, $value ) { |
52 | switch ( $name ) { |
53 | case 'st_user': |
54 | return Linker::userLink( (int)$value, $this->mCurrentRow->user_name ); |
55 | case 'st_timestamp': |
56 | return htmlspecialchars( $this->getLanguage()->timeanddate( $value ) ); |
57 | default: |
58 | return htmlspecialchars( $value ); |
59 | } |
60 | } |
61 | |
62 | /** @inheritDoc */ |
63 | public function getDefaultSort() { |
64 | return 'st_timestamp'; |
65 | } |
66 | |
67 | /** @inheritDoc */ |
68 | protected function getFieldNames() { |
69 | return [ |
70 | 'st_timestamp' => $this->msg( 'securepoll-header-timestamp' )->escaped(), |
71 | 'st_user' => $this->msg( 'securepoll-header-admin' )->escaped(), |
72 | 'st_action' => $this->msg( 'securepoll-header-action' )->escaped(), |
73 | 'st_reason' => $this->msg( 'securepoll-header-reason' )->escaped(), |
74 | ]; |
75 | } |
76 | |
77 | /** @inheritDoc */ |
78 | public function getTitle() { |
79 | return $this->detailsPage->getTitle(); |
80 | } |
81 | |
82 | /** @inheritDoc */ |
83 | protected function isFieldSortable( $field ) { |
84 | return $field === 'st_timestamp'; |
85 | } |
86 | } |