MediaWiki  master
ChangesListBooleanFilterGroup.php
Go to the documentation of this file.
1 <?php
2 
4 
17  public const TYPE = 'send_unselected_if_any';
18 
41  public function __construct( array $groupDefinition ) {
42  $groupDefinition['isFullCoverage'] = true;
43  $groupDefinition['type'] = self::TYPE;
44 
45  parent::__construct( $groupDefinition );
46  }
47 
51  protected function createFilter( array $filterDefinition ) {
52  return new ChangesListBooleanFilter( $filterDefinition );
53  }
54 
61  public function registerFilter( ChangesListBooleanFilter $filter ) {
62  $this->filters[$filter->getName()] = $filter;
63  }
64 
68  public function modifyQuery( IDatabase $dbr, ChangesListSpecialPage $specialPage,
69  &$tables, &$fields, &$conds, &$query_options, &$join_conds,
70  FormOptions $opts, $isStructuredFiltersEnabled
71  ) {
73  foreach ( $this->getFilters() as $filter ) {
74  if ( $filter->isActive( $opts, $isStructuredFiltersEnabled ) ) {
75  $filter->modifyQuery( $dbr, $specialPage, $tables, $fields, $conds,
76  $query_options, $join_conds );
77  }
78  }
79  }
80 
84  public function addOptions( FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled ) {
86  foreach ( $this->getFilters() as $filter ) {
87  $defaultValue = $allowDefaults ? $filter->getDefault( $isStructuredFiltersEnabled ) : false;
88  $opts->add( $filter->getName(), $defaultValue );
89  }
90  }
91 }
ChangesListSpecialPage
Special page which uses a ChangesList to show query results.
Definition: ChangesListSpecialPage.php:38
ChangesListBooleanFilter
Represents a hide-based boolean filter (used on ChangesListSpecialPage and descendants)
Definition: ChangesListBooleanFilter.php:31
ChangesListFilter\getName
getName()
Definition: ChangesListFilter.php:270
ChangesListFilterGroup
Represents a filter group (used on ChangesListSpecialPage and descendants)
Definition: ChangesListFilterGroup.php:37
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
$dbr
$dbr
Definition: testCompression.php:54
FormOptions\add
add( $name, $default, $type=self::AUTO)
Add an option to be handled by this FormOptions instance.
Definition: FormOptions.php:83
ChangesListBooleanFilterGroup\registerFilter
registerFilter(ChangesListBooleanFilter $filter)
Registers a filter in this group.
Definition: ChangesListBooleanFilterGroup.php:61
ChangesListFilterGroup\getFilters
getFilters()
Definition: ChangesListFilterGroup.php:311
ChangesListBooleanFilterGroup\__construct
__construct(array $groupDefinition)
Create a new filter group with the specified configuration.
Definition: ChangesListBooleanFilterGroup.php:41
ChangesListBooleanFilterGroup\modifyQuery
modifyQuery(IDatabase $dbr, ChangesListSpecialPage $specialPage, &$tables, &$fields, &$conds, &$query_options, &$join_conds, FormOptions $opts, $isStructuredFiltersEnabled)
Modifies the query to include the filter group.The modification is only done if the filter group is i...
Definition: ChangesListBooleanFilterGroup.php:68
ChangesListBooleanFilterGroup
If the group is active, any unchecked filters will translate to hide parameters in the URL.
Definition: ChangesListBooleanFilterGroup.php:13
FormOptions
Helper class to keep track of options when mixing links and form elements.
Definition: FormOptions.php:35
ChangesListBooleanFilterGroup\TYPE
const TYPE
Type marker, used by JavaScript.
Definition: ChangesListBooleanFilterGroup.php:17
ChangesListBooleanFilterGroup\createFilter
createFilter(array $filterDefinition)
Creates a filter of the appropriate type for this group, from the definition.Filter definition Change...
Definition: ChangesListBooleanFilterGroup.php:51
ChangesListBooleanFilterGroup\addOptions
addOptions(FormOptions $opts, $allowDefaults, $isStructuredFiltersEnabled)
All the options represented by this filter group to $opts.
Definition: ChangesListBooleanFilterGroup.php:84