-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathCaptchaQuestionGridView.class.php
More file actions
97 lines (88 loc) · 3.36 KB
/
CaptchaQuestionGridView.class.php
File metadata and controls
97 lines (88 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
namespace wcf\system\gridView\admin;
use wcf\acp\form\CaptchaQuestionEditForm;
use wcf\data\captcha\question\CaptchaQuestion;
use wcf\data\captcha\question\I18nCaptchaQuestionList;
use wcf\event\gridView\admin\CaptchaQuestionGridViewInitialized;
use wcf\system\gridView\AbstractGridView;
use wcf\system\gridView\GridViewColumn;
use wcf\system\gridView\GridViewRowLink;
use wcf\system\gridView\renderer\ObjectIdColumnRenderer;
use wcf\system\interaction\admin\CaptchaQuestionInteractions;
use wcf\system\interaction\bulk\admin\CaptchaQuestionBulkInteractions;
use wcf\system\interaction\Divider;
use wcf\system\interaction\EditInteraction;
use wcf\system\interaction\ToggleInteraction;
use wcf\system\view\filter\I18nTextFilter;
use wcf\system\view\filter\IntegerFilter;
use wcf\system\WCF;
/**
* Grid view for the list of user ranks.
*
* @author Olaf Braun
* @copyright 2001-2025 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 6.2
*
* @extends AbstractGridView<CaptchaQuestion, I18nCaptchaQuestionList>
*/
final class CaptchaQuestionGridView extends AbstractGridView
{
public function __construct()
{
$this->addColumns([
GridViewColumn::for('questionID')
->label('wcf.global.objectID')
->renderer(new ObjectIdColumnRenderer())
->sortable(),
GridViewColumn::for('question')
->label('wcf.acp.captcha.question.question')
->titleColumn()
->filter(I18nTextFilter::class)
->sortable(sortByDatabaseColumn: 'questionI18n'),
GridViewColumn::for('views')
->label('wcf.acp.captcha.question.views')
->sortable()
->filter(IntegerFilter::class),
GridViewColumn::for('correctSubmissions')
->label('wcf.acp.captcha.question.correctSubmissions')
->sortable()
->filter(IntegerFilter::class),
GridViewColumn::for('incorrectSubmissions')
->label('wcf.acp.captcha.question.incorrectSubmissions')
->sortable()
->filter(IntegerFilter::class),
]);
$provider = new CaptchaQuestionInteractions();
$provider->addInteractions([
new Divider(),
new EditInteraction(CaptchaQuestionEditForm::class)
]);
$this->setInteractionProvider($provider);
$this->setBulkInteractionProvider(new CaptchaQuestionBulkInteractions());
$this->addQuickInteraction(
new ToggleInteraction(
'enable',
'core/captchas/questions/%s/enable',
'core/captchas/questions/%s/disable'
)
);
$this->setDefaultSortField('questionID');
$this->addRowLink(new GridViewRowLink(CaptchaQuestionEditForm::class));
}
#[\Override]
public function isAccessible(): bool
{
return WCF::getSession()->getPermission('admin.captcha.canManageCaptchaQuestion');
}
#[\Override]
protected function createObjectList(): I18nCaptchaQuestionList
{
return new I18nCaptchaQuestionList();
}
#[\Override]
protected function getInitializedEvent(): CaptchaQuestionGridViewInitialized
{
return new CaptchaQuestionGridViewInitialized($this);
}
}