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


PHP DataTable::setMaximumAllowedRows方法代码示例

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


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

示例1: walkPath

 /**
  * Traverses a DataTable tree using an array of labels and returns the row
  * it finds or `false` if it cannot find one. The number of path segments that
  * were successfully walked is also returned.
  *
  * If `$missingRowColumns` is supplied, the specified path is created. When
  * a subtable is encountered w/o the required label, a new row is created
  * with the label, and a new subtable is added to the row.
  *
  * Read [http://en.wikipedia.org/wiki/Tree_(data_structure)#Traversal_methods](http://en.wikipedia.org/wiki/Tree_(data_structure)#Traversal_methods)
  * for more information about tree walking.
  *
  * @param array $path The path to walk. An array of label values. The first element
  *                    refers to a row in this DataTable, the second in a subtable of
  *                    the first row, the third a subtable of the second row, etc.
  * @param array|bool $missingRowColumns The default columns to use when creating new rows.
  *                                      If this parameter is supplied, new rows will be
  *                                      created for path labels that cannot be found.
  * @param int $maxSubtableRows The maximum number of allowed rows in new subtables. New
  *                             subtables are only created if `$missingRowColumns` is provided.
  * @return array First element is the found row or `false`. Second element is
  *               the number of path segments walked. If a row is found, this
  *               will be == to `count($path)`. Otherwise, it will be the index
  *               of the path segment that we could not find.
  */
 public function walkPath($path, $missingRowColumns = false, $maxSubtableRows = 0)
 {
     $pathLength = count($path);
     $table = $this;
     $next = false;
     for ($i = 0; $i < $pathLength; ++$i) {
         $segment = $path[$i];
         $next = $table->getRowFromLabel($segment);
         if ($next === false) {
             // if there is no table to advance to, and we're not adding missing rows, return false
             if ($missingRowColumns === false) {
                 return array(false, $i);
             } else {
                 // if we're adding missing rows, add a new row
                 $row = new DataTableSummaryRow();
                 $row->setColumns(array('label' => $segment) + $missingRowColumns);
                 $next = $table->addRow($row);
                 if ($next !== $row) {
                     // if the row wasn't added, the table is full
                     // Summary row, has no metadata
                     $next->deleteMetadata();
                     return array($next, $i);
                 }
             }
         }
         $table = $next->getSubtable();
         if ($table === false) {
             // if the row has no table (and thus no child rows), and we're not adding
             // missing rows, return false
             if ($missingRowColumns === false) {
                 return array(false, $i);
             } elseif ($i != $pathLength - 1) {
                 // create subtable if missing, but only if not on the last segment
                 $table = new DataTable();
                 $table->setMaximumAllowedRows($maxSubtableRows);
                 $table->metadata[self::COLUMN_AGGREGATION_OPS_METADATA_NAME] = $this->getMetadata(self::COLUMN_AGGREGATION_OPS_METADATA_NAME);
                 $next->setSubtable($table);
                 // Summary row, has no metadata
                 $next->deleteMetadata();
             }
         }
     }
     return array($next, $i);
 }
开发者ID:piwik,项目名称:piwik,代码行数:69,代码来源:DataTable.php

示例2: initActionsTables

 /**
  * Initializes the DataTables created by the archiveDay function.
  */
 private function initActionsTables()
 {
     $this->actionsTablesByType = array();
     foreach (self::$actionTypes as $type) {
         $dataTable = new DataTable();
         $dataTable->setMaximumAllowedRows(ArchivingHelper::$maximumRowsInDataTableLevelZero);
         if ($type == Action::TYPE_PAGE_URL || $type == Action::TYPE_PAGE_TITLE) {
             // for page urls and page titles, performance metrics exist and have to be aggregated correctly
             $dataTable->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, self::$columnsAggregationOperation);
         }
         $this->actionsTablesByType[$type] = $dataTable;
     }
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:16,代码来源:Archiver.php


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