本文整理汇总了PHP中Piwik\DataTable::deleteRow方法的典型用法代码示例。如果您正苦于以下问题:PHP DataTable::deleteRow方法的具体用法?PHP DataTable::deleteRow怎么用?PHP DataTable::deleteRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\DataTable
的用法示例。
在下文中一共展示了DataTable::deleteRow方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
/**
* See {@link PatternRecursive}.
*
* @param DataTable $table
* @return int The number of deleted rows.
*/
public function filter($table)
{
$rows = $table->getRows();
foreach ($rows as $key => $row) {
// A row is deleted if
// 1 - its label doesnt contain the pattern
// AND 2 - the label is not found in the children
$patternNotFoundInChildren = false;
try {
$idSubTable = $row->getIdSubDataTable();
$subTable = Manager::getInstance()->getTable($idSubTable);
// we delete the row if we couldn't find the pattern in any row in the
// children hierarchy
if ($this->filter($subTable) == 0) {
$patternNotFoundInChildren = true;
}
} catch (Exception $e) {
// there is no subtable loaded for example
$patternNotFoundInChildren = true;
}
if ($patternNotFoundInChildren && !Pattern::match($this->patternToSearchQuoted, $row->getColumn($this->columnToFilter), $invertedMatch = false)) {
$table->deleteRow($key);
}
}
return $table->getRowsCount();
}
示例2: deleteRowsWithNoVisit
private function deleteRowsWithNoVisit(DataTable $table)
{
foreach ($table->getRows() as $key => $row) {
$nbVisits = Metric::getMetric($row, 'nb_visits');
$nbActions = Metric::getMetric($row, 'nb_actions');
if ($nbVisits == 0 && $nbActions == 0) {
// case of keyword/website/campaign with a conversion for this day, but no visit, we don't show it
$table->deleteRow($key);
}
}
}
示例3: filter
/**
* Filters the given data table
*
* @param DataTable $table
*/
public function filter($table)
{
foreach ($table->getRows() as $key => $row) {
$params = array();
foreach ($this->columnsToFilter as $column) {
$params[] = $row->getColumn($column);
}
$params = array_merge($params, $this->functionParams);
if (call_user_func_array($this->function, $params) === true) {
$table->deleteRow($key);
}
$this->filterSubTable($row);
}
}
示例4: filter
/**
* See {@link PatternRecursive}.
*
* @param DataTable $table
* @return int The number of deleted rows.
*/
public function filter($table)
{
$rows = $table->getRows();
foreach ($rows as $key => $row) {
// A row is deleted if
// 1 - its label doesnt contain the pattern
// AND 2 - the label is not found in the children
$patternNotFoundInChildren = false;
$subTable = $row->getSubtable();
if (!$subTable) {
$patternNotFoundInChildren = true;
} else {
// we delete the row if we couldn't find the pattern in any row in the
// children hierarchy
if ($this->filter($subTable) == 0) {
$patternNotFoundInChildren = true;
}
}
if ($patternNotFoundInChildren && !Pattern::match($this->patternToSearchQuoted, $row->getColumn($this->columnToFilter), $invertedMatch = false)) {
$table->deleteRow($key);
}
}
return $table->getRowsCount();
}
示例5: nestedSearch
private function nestedSearch(DataTable $sitesByGroup, $pattern)
{
foreach ($sitesByGroup->getRows() as $index => $site) {
$label = strtolower($site->getColumn('label'));
$labelMatches = false !== strpos($label, $pattern);
if ($site->getMetadata('isGroup')) {
$subtable = $site->getSubtable();
$this->nestedSearch($subtable, $pattern);
if (!$labelMatches && !$subtable->getRowsCount()) {
// we keep the group if at least one site within the group matches the pattern
$sitesByGroup->deleteRow($index);
}
} elseif (!$labelMatches) {
$group = $site->getMetadata('group');
if (!$group || false === strpos(strtolower($group), $pattern)) {
$sitesByGroup->deleteRow($index);
}
}
}
}
示例6: filterOutKeywordNotDefined
/**
* @param DataTable $table
*/
private function filterOutKeywordNotDefined($table)
{
if ($table instanceof DataTable) {
$row = $table->getRowIdFromLabel('');
if ($row) {
$table->deleteRow($row);
}
}
}
示例7: filter
/**
* See {@link Pattern}.
*
* @param DataTable $table
*/
public function filter($table)
{
foreach ($table->getRows() as $key => $row) {
//instead search must handle
// - negative search with -piwik
// - exact match with ""
// see (?!pattern) A subexpression that performs a negative lookahead search, which matches the search string at any point where a string not matching pattern begins.
$value = $row->getColumn($this->columnToFilter);
if ($value === false) {
$value = $row->getMetadata($this->columnToFilter);
}
if (!self::match($this->patternToSearchQuoted, $value, $this->invertedMatch)) {
$table->deleteRow($key);
}
}
}
示例8: deleteRowsWithNoVisit
private function deleteRowsWithNoVisit(DataTable $table)
{
$metrics = new Metrics\Processed();
foreach ($table->getRows() as $key => $row) {
$nbVisits = $metrics->getColumn($row, Metrics::INDEX_NB_VISITS);
$nbActions = $metrics->getColumn($row, Metrics::INDEX_NB_ACTIONS);
if ($nbVisits == 0 && $nbActions == 0) {
// case of keyword/website/campaign with a conversion for this day, but no visit, we don't show it
$table->deleteRow($key);
}
}
}