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


PHP Piwik_DataTable::getRowsCountRecursive方法代码示例

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


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

示例1: testCountRowsComplex

 /**
  * we test the count rows and the count rows recursive version
  * on a Complex array (rows with 2 and 3 levels only)
  * 
  * the recursive count returns 
  *         the sum of the number of rows of all the subtables 
  *         + the number of rows in the parent table
  * 
  * @group Core
  * @group DataTable
  */
 public function testCountRowsComplex()
 {
     $idcol = Piwik_DataTable_Row::COLUMNS;
     $idsubtable = Piwik_DataTable_Row::DATATABLE_ASSOCIATED;
     // table to go in the SUB table of RoW1
     $tableSubOfSubOfRow1 = new Piwik_DataTable();
     $rows1sub = array(array($idcol => array('label' => 'google')), array($idcol => array('label' => 'google78')), array($idcol => array('label' => 'googlaegge')), array($idcol => array('label' => 'gogeoggle')), array($idcol => array('label' => 'goaegaegaogle')), array($idcol => array('label' => 'ask')), array($idcol => array('label' => '238975247578949')));
     $tableSubOfSubOfRow1->addRowsFromArray($rows1sub);
     // table to go in row1
     $tableSubOfRow1 = new Piwik_DataTable();
     $rows1 = array(array($idcol => array('label' => 'google'), $idsubtable => $tableSubOfSubOfRow1), array($idcol => array('label' => 'ask')), array($idcol => array('label' => '238975247578949')));
     $tableSubOfRow1->addRowsFromArray($rows1);
     // table to go in row2
     $tableSubOfRow2 = new Piwik_DataTable();
     $rows2 = array(array($idcol => array('label' => 'google')), array($idcol => array('label' => 'ask')), array($idcol => array('label' => '238975247578949')), array($idcol => array('label' => 'agaegaesk')), array($idcol => array('label' => '23g  8975247578949')));
     $tableSubOfRow2->addRowsFromArray($rows2);
     // main parent table
     $table = new Piwik_DataTable();
     $rows = array(array($idcol => array('label' => 'row1')), array($idcol => array('label' => 'row2'), $idsubtable => $tableSubOfRow1), array($idcol => array('label' => 'row3'), $idsubtable => $tableSubOfRow2));
     $table->addRowsFromArray($rows);
     $this->assertEquals(count($rows), $table->getRowsCount());
     $countAllRows = count($rows) + count($rows1) + count($rows2) + count($rows1sub);
     $this->assertEquals($countAllRows, $table->getRowsCountRecursive());
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:35,代码来源:DataTableTest.php


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