Recommend this page to a friend! |
Classes of Tomáš Vojík | PHP Tournament Bracket Generator | wiki/examples/filters.md | Download |
|
DownloadIntroductionFilters are special classes used in order to filter out teams only by some given criteria. You can apply filters to Creating a filter
List of criteriaList of criteria to filter teams by | Criteria | Description | | :------: | :---------: | | points | points acquired | | score | score acquired | | wins | number of wins | | losses | number of losses | | draws | number of draws | | second | number of times where the team was second (at least 3 teams in game) | | third | number of times where the team was third (at least 4 teams in game) | | team | filter a specific team | | not-progressed | filter only teams that have not been progressed yet from certain group | | progressed | filter only teams that have been progressed from certain group | Using a filterGetting teamsA simple filter might be used in order to get for example only the teams that have won at least 3 times
This will filter all teams in a tournament and give you only the ones that satisfy given filter. <a title="progressions" id="progressions"></a> ProgressionsYou can also use filters to progress teams. Imagine a situation where you progress 2 best teams from one group, and you want to progress all others to another. We can do this, no matter the number of teams with a filter.
This will move 2 best teams from More complex filtersIf you need to, you can also combine filters to create more complex filters. This uses a helper Filter class. One way of combining filters is creating a list of them. Then it will require the teams to satisfy all of them.
This will filter only the teams that have more than 2 wins and less than 4 losses. If you want to combine the filters in much more complex way, you can create a multi-dimensional array of your filters using and and or keys;
This will give you all the teams that have more than 400 score and more than 2 wins or less than 4 losses. If you ever want to filter teams with double or or and, you can wrap it in an array like so.
Applying more complex filters to progressionsIf you want to add complex filters to progressions you can just add more with:
and this filter teams that satisfy both: filter1 and filter2. However, if you want to use complex filters with set operators, you have to use
|