当前位置: 首页>>代码示例>>PHP>>正文


PHP Piwik_DataTable::addSummaryRow方法代码示例

本文整理汇总了PHP中Piwik_DataTable::addSummaryRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_DataTable::addSummaryRow方法的具体用法?PHP Piwik_DataTable::addSummaryRow怎么用?PHP Piwik_DataTable::addSummaryRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik_DataTable的用法示例。


在下文中一共展示了Piwik_DataTable::addSummaryRow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: filter

 /**
  * Adds a summary row to the given data table
  *
  * @param Piwik_DataTable  $table
  */
 public function filter($table)
 {
     if ($table->getRowsCount() <= $this->startRowToSummarize + 1) {
         return;
     }
     $table->filter('Sort', array($this->columnToSortByBeforeTruncating, 'desc'));
     $rows = $table->getRows();
     $count = $table->getRowsCount();
     $newRow = new Piwik_DataTable_Row();
     for ($i = $this->startRowToSummarize; $i < $count; $i++) {
         if (!isset($rows[$i])) {
             // case when the last row is a summary row, it is not indexed by $cout but by Piwik_DataTable::ID_SUMMARY_ROW
             $summaryRow = $table->getRowFromId(Piwik_DataTable::ID_SUMMARY_ROW);
             //FIXME: I'm not sure why it could return false, but it was reported in: http://forum.piwik.org/read.php?2,89324,page=1#msg-89442
             if ($summaryRow) {
                 $newRow->sumRow($summaryRow, $enableCopyMetadata = false);
             }
         } else {
             $newRow->sumRow($rows[$i], $enableCopyMetadata = false);
         }
     }
     $newRow->setColumns(array('label' => $this->labelSummaryRow) + $newRow->getColumns());
     if ($this->deleteRows) {
         $table->filter('Limit', array(0, $this->startRowToSummarize));
     }
     $table->addSummaryRow($newRow);
     unset($rows);
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:33,代码来源:AddSummaryRow.php

示例2: filter

 /**
  * Limits the given data table
  *
  * @param Piwik_DataTable  $table
  */
 public function filter($table)
 {
     $table->setRowsCountBeforeLimitFilter();
     if ($this->keepSummaryRow) {
         $summaryRow = $table->getRowFromId(Piwik_DataTable::ID_SUMMARY_ROW);
     }
     // we delete from 0 to offset
     if ($this->offset > 0) {
         $table->deleteRowsOffset(0, $this->offset);
     }
     // at this point the array has offset less elements. We delete from limit to the end
     if ($this->limit >= 0) {
         $table->deleteRowsOffset($this->limit);
     }
     if ($this->keepSummaryRow && $summaryRow) {
         $table->addSummaryRow($summaryRow);
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:23,代码来源:Limit.php

示例3: generateDataTable

 /**
  * Generates a dataTable given a multidimensional PHP array that associates LABELS to Piwik_DataTableRows
  * This is used for the "Actions" DataTable, where a line is the aggregate of all the subtables
  * Example: the category /blog has 3 visits because it has /blog/index (2 visits) + /blog/about (1 visit)
  *
  * @param array  $table
  * @param array  $parents
  * @return Piwik_DataTable
  */
 public static function generateDataTable($table, $parents = array())
 {
     $dataTableToReturn = new Piwik_DataTable();
     foreach ($table as $label => $maybeDatatableRow) {
         // case the aInfo is a subtable-like array
         // it means that we have to go recursively and process it
         // then we build the row that is an aggregate of all the children
         // and we associate this row to the subtable
         if (!$maybeDatatableRow instanceof Piwik_DataTable_Row) {
             array_push($parents, array($dataTableToReturn->getId(), $label));
             $subTable = self::generateDataTable($maybeDatatableRow, $parents);
             $subTable->setParents($parents);
             $row = new Piwik_DataTable_Row_DataTableSummary($subTable);
             $row->setColumns(array('label' => $label) + $row->getColumns());
             $row->addSubtable($subTable);
             array_pop($parents);
         } else {
             $row = $maybeDatatableRow;
         }
         if ($row->getMetadata('issummaryrow') == true) {
             $row->deleteMetadata('issummaryrow');
             $dataTableToReturn->addSummaryRow($row);
         } else {
             $dataTableToReturn->addRow($row);
         }
     }
     return $dataTableToReturn;
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:37,代码来源:Day.php


注:本文中的Piwik_DataTable::addSummaryRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。