本文整理匯總了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);
}
}
}