本文整理汇总了PHP中Piwik_DataTable::deleteRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_DataTable::deleteRow方法的具体用法?PHP Piwik_DataTable::deleteRow怎么用?PHP Piwik_DataTable::deleteRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_DataTable
的用法示例。
在下文中一共展示了Piwik_DataTable::deleteRow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
/**
* @param Piwik_DataTable $table
* @return int
*/
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 = Piwik_DataTable_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 && !Piwik_DataTable_Filter_Pattern::match($this->patternToSearch, $this->patternToSearchQuoted, $row->getColumn($this->columnToFilter), $invertedMatch = false)) {
$table->deleteRow($key);
}
}
return $table->getRowsCount();
}
示例2: filter
/**
* Filters the given data table
*
* @param Piwik_DataTable $table
*/
public function filter($table)
{
foreach ($table->getRows() as $key => $row) {
$columnValue = $row->getColumn($this->columnToFilter);
if (!call_user_func($this->function, $columnValue)) {
$table->deleteRow($key);
}
$this->filterSubTable($row);
}
}
示例3: filter
/**
* Filters the given data table
*
* @param Piwik_DataTable $table
*/
public function filter($table)
{
foreach ($table->getRows() as $key => $row) {
$columnValue = $row->getColumn($this->columnToFilter);
if (!call_user_func_array($this->function, array_merge(array($columnValue), $this->functionParams))) {
$table->deleteRow($key);
}
$this->filterSubTable($row);
}
}
示例4: filterCollectionTableContent
/**
* Filtert Kollektionsdaten nach Strings. -> z.B. Unterscheidung Standard <-> Projekt
* @param Piwik_DataTable $dataTable
* @param String $filter
* @param boolean $bool
*/
private static function filterCollectionTableContent($dataTable, $filter, $bool)
{
$rows = $dataTable->getRows();
Piwik_cdebug::clog('filterCollectionTableContent: rows: ' . count($rows));
foreach ($rows as $i => $row) {
$label = $row->getColumn('label');
if (strpos($label, $filter) !== false xor $bool) {
$dataTable->deleteRow($i);
}
}
}
示例5: filter
/**
* @param Piwik_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.
if (!self::match($this->patternToSearch, $this->patternToSearchQuoted, $row->getColumn($this->columnToFilter), $this->invertedMatch)) {
$table->deleteRow($key);
}
}
}
示例6: getFilterPageDatatableSearch
/**
* Will search in the DataTable for a Label matching the searched string
* and return only the matching row, or an empty datatable
*/
protected function getFilterPageDatatableSearch( $callBackParameters, $search, $actionType, $table = false, $searchTree = false, $searchCurrentLevel = 0 )
{
if($table === false)
{
$table = call_user_func_array(array('Piwik_Archive', 'getDataTableFromArchive'), $callBackParameters);
}
if($searchTree === false)
{
if($actionType == Piwik_Tracker_Action::TYPE_ACTION_NAME)
{
$searchedString = Piwik_Common::unsanitizeInputValue($search);
}
else
{
$searchedString = Piwik_Tracker_Action::excludeQueryParametersFromUrl($search, $idSite = $callBackParameters[1]);
}
$searchTree = Piwik_Actions::getActionExplodedNames($searchedString, $actionType);
}
if(!($table instanceof Piwik_DataTable))
{
throw new Exception("For this API function, date=lastN or date=previousM is not supported");
}
$rows = $table->getRows();
$labelSearch = $searchTree[$searchCurrentLevel];
$isEndSearch = ((count($searchTree)-1) == $searchCurrentLevel);
foreach($rows as $key => $row)
{
$found = false;
// Found a match at this level
$label = $row->getColumn('label');
if($label === $labelSearch)
{
// Is this the end of the search tree? then we found the requested row
if($isEndSearch)
{
// var_dump($label); var_dump($labelSearch); exit;
$table = new Piwik_DataTable();
$table->addRow($row);
return $table;
}
// If we still need to search deeper, call search
$idSubTable = $row->getIdSubDataTable();
// Update the idSubtable in the callback parameter list, to fetch this subtable from the archive
$callBackParameters[6] = $idSubTable;
$subTable = call_user_func_array(array('Piwik_Archive', 'getDataTableFromArchive'), $callBackParameters);
$found = $this->getFilterPageDatatableSearch($callBackParameters, $search, $actionType, $subTable, $searchTree, $searchCurrentLevel+1);
if($found)
{
return $found;
}
}
if(!$found)
{
$table->deleteRow($key);
}
}
// Case the DataTable was searched but nothing was found, @see getFilterPageDatatableSearch()
if($searchCurrentLevel == 0)
{
return new Piwik_DataTable;
}
return false;
}