本文整理汇总了PHP中Piwik\DataTable\BaseFilter类的典型用法代码示例。如果您正苦于以下问题:PHP BaseFilter类的具体用法?PHP BaseFilter怎么用?PHP BaseFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*
* @param DataTable $table The table to eventually filter.
*/
public function __construct($table, $idSite, $period, $date)
{
parent::__construct($table);
$this->idSite = $idSite;
$this->period = $period;
$this->date = $date;
}
示例2: __construct
/**
* Constructor.
*
* @param DataTable $table The DataTable that will be filtered eventually.
* @param int $offset The starting row index to keep.
* @param int $limit Number of rows to keep (specify -1 to keep all rows).
* @param bool $keepSummaryRow Whether to keep the summary row or not.
*/
public function __construct($table, $offset, $limit = -1, $keepSummaryRow = false)
{
parent::__construct($table);
$this->offset = $offset;
$this->limit = $limit;
$this->keepSummaryRow = $keepSummaryRow;
}
示例3: __construct
/**
* Constructor.
*
* @param DataTable $table The DataTable to filter.
* @param string $groupByColumn The column name to reduce.
* @param callable $reduceFunction The reduce function. This must alter the `$groupByColumn`
* columng in some way.
* @param array $parameters deprecated - use an [anonymous function](http://php.net/manual/en/functions.anonymous.php)
* instead.
*/
public function __construct($table, $groupByColumn, $reduceFunction, $parameters = array())
{
parent::__construct($table);
$this->groupByColumn = $groupByColumn;
$this->reduceFunction = $reduceFunction;
$this->parameters = $parameters;
}
示例4: __construct
/**
* Constructor.
*
* @param DataTable $table The table to eventually filter.
* @param string $columnToFilter The column to match with the `$patternToSearch` pattern.
* @param string $patternToSearch The regex pattern to use.
* @param bool $invertedMatch Whether to invert the pattern or not. If true, will remove
* rows if they match the pattern.
*/
public function __construct($table, $columnToFilter, $patternToSearch, $invertedMatch = false)
{
parent::__construct($table);
$this->patternToSearch = $patternToSearch;
$this->patternToSearchQuoted = self::getPatternQuoted($patternToSearch);
$this->columnToFilter = $columnToFilter;
$this->invertedMatch = $invertedMatch;
}
示例5: __construct
/**
* Constructor.
*
* @param DataTable $table The table that will eventually be filtered.
* @param string|null $newLabel The new label for summary row. If null, defaults to
* `Piwik::translate('General_Others')`.
*/
public function __construct($table, $newLabel = null)
{
parent::__construct($table);
if (is_null($newLabel)) {
$newLabel = Piwik::translate('General_Others');
}
$this->newLabel = $newLabel;
}
示例6: __construct
/**
* Constructor.
*
* @param DataTable $table The table that will be eventually filtered.
* @param array|null $mappingToApply The name mapping to apply. Must map old column names
* with new ones, eg,
*
* array('OLD_COLUMN_NAME' => 'NEW_COLUMN NAME',
* 'OLD_COLUMN_NAME2' => 'NEW_COLUMN NAME2')
*
* If null, {@link Piwik\Metrics::$mappingFromIdToName} is used.
*/
public function __construct($table, $mappingToApply = null)
{
parent::__construct($table);
$this->mappingToApply = Metrics::$mappingFromIdToName;
if (!is_null($mappingToApply)) {
$this->mappingToApply = $mappingToApply;
}
}
示例7: __construct
/**
* Constructor.
*
* @param DataTable $table The table to eventually filter.
* @param int $idSite
* @param string $period
* @param string $date
* @param string $segment
* @param bool $expanded
*/
public function __construct($table, $idSite, $period, $date, $segment, $expanded)
{
parent::__construct($table);
$this->idSite = $idSite;
$this->period = $period;
$this->date = $date;
$this->segment = $segment;
$this->expanded = $expanded;
}
示例8: __construct
/**
* @param DataTable $table
* @param string $columnToFilter name of the column to filter
* @param float $minimumValue minimum value for range
* @param float $maximumValue maximum value for range
*/
public function __construct($table, $columnToFilter, $minimumValue = 0.0, $maximumValue = 100.0)
{
parent::__construct($table);
$this->columnToFilter = $columnToFilter;
if ($minimumValue < $maximumValue) {
self::$minimumValue = $minimumValue;
self::$maximumValue = $maximumValue;
}
}
示例9: __construct
/**
* Generates a segment filter based on the label column and the given segment names
*
* @param DataTable $table
* @param string|array $segmentOrSegments Either one segment or an array of segments.
* If more than one segment is given a delimter has to be defined.
* @param string $delimiter The delimiter by which the label should be splitted.
*/
public function __construct($table, $segmentOrSegments, $delimiter = '')
{
parent::__construct($table);
if (!is_array($segmentOrSegments)) {
$segmentOrSegments = array($segmentOrSegments);
}
$this->segments = $segmentOrSegments;
$this->delimiter = $delimiter;
}
示例10: __construct
/**
* Constructor.
*
* @param DataTable $table The table to eventually filter.
* @param string $columnToFilter The column to match with the `$patternToSearch` pattern.
* @param string $patternToSearch The regex pattern to use.
*/
public function __construct($table, $columnToFilter, $patternToSearch)
{
parent::__construct($table);
$this->patternToSearch = $patternToSearch;
$this->patternToSearchQuoted = Pattern::getPatternQuoted($patternToSearch);
$this->patternToSearch = $patternToSearch;
//preg_quote($patternToSearch);
$this->columnToFilter = $columnToFilter;
}
示例11: __construct
/**
* Constructor.
*
* @param DataTable $table The table to eventually filter.
* @param string $columnToSort The name of the column to sort by.
* @param string $order order `'asc'` or `'desc'`.
* @param bool $naturalSort Whether to use a natural sort or not (see {@link http://php.net/natsort}).
* @param bool $recursiveSort Whether to sort all subtables or not.
*/
public function __construct($table, $columnToSort, $order = 'desc', $naturalSort = true, $recursiveSort = false)
{
parent::__construct($table);
if ($recursiveSort) {
$table->enableRecursiveSort();
}
$this->columnToSort = $columnToSort;
$this->naturalSort = $naturalSort;
$this->setOrder($order);
}
示例12: __construct
/**
* Constructor.
*
* @param DataTable $table The DataTable that will be filtered.
* @param array|string $columns The names of the columns to pass to the callback.
* @param string $columnToAdd The name of the column to add.
* @param callable $functionToApply The callback to apply to each row of a DataTable. The columns
* specified in `$columns` are passed to this callback.
* @param array $functionParameters deprecated - use an [anonymous function](http://php.net/manual/en/functions.anonymous.php)
* instead.
*/
public function __construct($table, $columns, $columnToAdd, $functionToApply, $functionParameters = array())
{
parent::__construct($table);
if (!is_array($columns)) {
$columns = array($columns);
}
$this->columns = $columns;
$this->columnToAdd = $columnToAdd;
$this->functionToApply = $functionToApply;
$this->functionParameters = $functionParameters;
}
示例13: __construct
/**
* Constructor.
*
* @param DataTable $table The table to eventually filter.
* @param string $columnToSort The name of the column to sort by.
* @param string $order order `'asc'` or `'desc'`.
* @param bool $naturalSort Whether to use a natural sort or not (see {@link http://php.net/natsort}).
* @param bool $recursiveSort Whether to sort all subtables or not.
* @param bool $doSortBySecondaryColumn If true will sort by a secondary column. The column is automatically
* detected and will be either nb_visits or label, if possible.
*/
public function __construct($table, $columnToSort, $order = 'desc', $naturalSort = true, $recursiveSort = true, $doSortBySecondaryColumn = false)
{
parent::__construct($table);
if ($recursiveSort) {
$table->enableRecursiveSort();
}
$this->columnToSort = $columnToSort;
$this->naturalSort = $naturalSort;
$this->order = strtolower($order);
$this->isSecondaryColumnSortEnabled = $doSortBySecondaryColumn;
}
示例14: __construct
/**
* Constructor.
*
* @param DataTable $table The DataTable to filter.
* @param array|string $columnsToFilter The columns whose values should be passed to the callback
* and then replaced with the callback's result.
* @param callable $functionToApply The function to execute. Must take the column value as a parameter
* and return a value that will be used to replace the original.
* @param array|null $functionParameters deprecated - use an [anonymous function](http://php.net/manual/en/functions.anonymous.php)
* instead.
* @param array $extraColumnParameters Extra column values that should be passed to the callback, but
* shouldn't be replaced.
*/
public function __construct($table, $columnsToFilter, $functionToApply, $functionParameters = null, $extraColumnParameters = array())
{
parent::__construct($table);
$this->functionToApply = $functionToApply;
$this->functionParameters = $functionParameters;
if (!is_array($columnsToFilter)) {
$columnsToFilter = array($columnsToFilter);
}
$this->columnsToFilter = $columnsToFilter;
$this->extraColumnParameters = $extraColumnParameters;
}
示例15: __construct
/**
* Constructor.
*
* @param DataTable $table The table that will be filtered eventually.
* @param int $truncateAfter The row index to truncate at. All rows passed this index will
* be removed.
* @param string $labelSummaryRow The label to use for the summary row. Defaults to
* `Piwik::translate('General_Others')`.
* @param string $columnToSortByBeforeTruncating The column to sort by before truncation, eg,
* `'nb_visits'`.
* @param bool $filterRecursive If true executes this filter on all subtables descending from
* `$table`.
*/
public function __construct($table, $truncateAfter, $labelSummaryRow = null, $columnToSortByBeforeTruncating = null, $filterRecursive = true)
{
parent::__construct($table);
$this->truncateAfter = $truncateAfter;
if ($labelSummaryRow === null) {
$labelSummaryRow = Piwik::translate('General_Others');
}
$this->labelSummaryRow = $labelSummaryRow;
$this->columnToSortByBeforeTruncating = $columnToSortByBeforeTruncating;
$this->filterRecursive = $filterRecursive;
}