deleteRow() 공개 메소드

Deletes a row by ID.
public deleteRow ( integer $id )
$id integer The row ID.
예제 #1
0
 /**
  * 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();
 }
 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);
         }
     }
 }
 /**
  * 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
0
 /**
  * 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
0
파일: Dashboard.php 프로젝트: piwik/piwik
 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
0
 /**
  * @param DataTable $table
  */
 private function filterOutKeywordNotDefined($table)
 {
     if ($table instanceof DataTable) {
         $row = $table->getRowIdFromLabel('');
         if ($row) {
             $table->deleteRow($row);
         }
     }
 }
예제 #7
0
 /**
  * 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);
         }
     }
 }
 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);
         }
     }
 }