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


PHP Piwik_DataTable::addRowsFromArray方法代码示例

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


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

示例1: testRangeCheckNormalDataTableNonIntegerValues

 /**
  *
  * @group Core
  * @group DataTable
  * @group DataTable_Filter
  * @group DataTable_Filter_RangeCheck
  */
 public function testRangeCheckNormalDataTableNonIntegerValues()
 {
     $table = new Piwik_DataTable();
     $table->addRowsFromArray(array(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'ask', 'count' => '3')), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'nintendo', 'count' => 'test')), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'test', 'count' => 0x1232)), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'piwik', 'count' => 0x5)), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'google', 'count' => '9test')), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'yahoo', 'count' => 'test4'))));
     $filter = new Piwik_DataTable_Filter_RangeCheck($table, 'count', 3.97, 10);
     $filter->filter($table);
     $expectedOrder = array(3.97, 3.97, 10, 5, '9test', 3.97);
     $this->assertEquals($expectedOrder, $table->getColumn('count'));
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:16,代码来源:RangeCheckTest.php

示例2: getTable

 protected function getTable()
 {
     $subtableAskPath1 = new Piwik_DataTable();
     $subtableAskPath1->addRowsFromArray(array(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'path1-index-page.html')), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'another-page'))));
     $subtableAsk = new Piwik_DataTable();
     $subtableAsk->addRowsFromArray(array(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'path1'), Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subtableAskPath1), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'index.html'))));
     $table = new Piwik_DataTable();
     $rows = array(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'http://www.ask.com'), Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subtableAsk), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'yahoo')));
     $table->addRowsFromArray($rows);
     return $table;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:11,代码来源:PatternRecursive.test.php

示例3: array

 /**
  * Test to exclude low population filter
  */
 function test_filter_Lowpop1()
 {
     $idcol = Piwik_DataTable_Row::COLUMNS;
     $table = new Piwik_DataTable();
     $rows = array(array($idcol => array('label' => 'google', 'nb_visits' => 897)), array($idcol => array('label' => 'ask', 'nb_visits' => -152)), array($idcol => array('label' => 'piwik', 'nb_visits' => 1.5)), array($idcol => array('label' => 'piwik2', 'nb_visits' => 1.4)), array($idcol => array('label' => 'yahoo', 'nb_visits' => 154)), array($idcol => array('label' => 'amazon', 'nb_visits' => 30)), array($idcol => array('label' => '238949', 'nb_visits' => 0)), array($idcol => array('label' => 'Q*(%&*', 'nb_visits' => 1)), array($idcol => array('label' => 'Q*(%&*2', 'nb_visits' => -1.5)));
     $table->addRowsFromArray($rows);
     $expectedtable = new Piwik_DataTable();
     $rows = array(array($idcol => array('label' => 'google', 'nb_visits' => 897)), array($idcol => array('label' => 'piwik', 'nb_visits' => 1.5)), array($idcol => array('label' => 'piwik2', 'nb_visits' => 1.4)), array($idcol => array('label' => 'yahoo', 'nb_visits' => 154)), array($idcol => array('label' => 'amazon', 'nb_visits' => 30)));
     $expectedtable->addRowsFromArray($rows);
     $filter = new Piwik_DataTable_Filter_ExcludeLowPopulation($table, 'nb_visits', 1.4);
     $this->assertTrue(Piwik_DataTable::isEqual($table, $expectedtable));
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:15,代码来源:ExcludeLowPopulation.test.php

示例4: testFilterPattern

 /**
  * Test to filter a column with a pattern
  * 
  * @group Core
  * @group DataTable
  * @group DataTable_Filter
  * @group DataTable_Filter_Pattern
  * @dataProvider getTestData
  */
 public function testFilterPattern($test)
 {
     $table = new Piwik_DataTable();
     $idcol = Piwik_DataTable_Row::COLUMNS;
     $rows = array(array($idcol => array('label' => 'google')), array($idcol => array('label' => 'ask')), array($idcol => array('label' => 'piwik')), array($idcol => array('label' => 'yahoo')), array($idcol => array('label' => 'amazon')), array($idcol => array('label' => '2389752/47578949')), array($idcol => array('label' => 'Q*(%&*("$&%*(&"$*")"))')));
     $table->addRowsFromArray($rows);
     $rowIds = array_keys($rows);
     $pattern = $test[0];
     $expectedRows = $test[1];
     $rowToDelete = array_diff($rowIds, $expectedRows);
     $expectedtable = clone $table;
     $expectedtable->deleteRows($rowToDelete);
     $filteredTable = clone $table;
     $filteredTable->filter('Pattern', array('label', $pattern));
     $this->assertEquals($expectedtable->getRows(), $filteredTable->getRows());
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:25,代码来源:PatternTest.php

示例5: array

 /**
  * Test to sort by visit
  */
 function test_filter_SortNumeric()
 {
     $idcol = Piwik_DataTable_Row::COLUMNS;
     $table = new Piwik_DataTable();
     $rows = array(array($idcol => array('label' => 'google', 'nb_visits' => 897)), array($idcol => array('label' => 'ask', 'nb_visits' => -152)), array($idcol => array('label' => 'piwik', 'nb_visits' => 1.5)), array($idcol => array('label' => 'yahoo', 'nb_visits' => 154)), array($idcol => array('label' => 'amazon', 'nb_visits' => 30)), array($idcol => array('label' => '238949', 'nb_visits' => 0)), array($idcol => array('label' => 'Q*(%&*', 'nb_visits' => 1)));
     $table->addRowsFromArray($rows);
     $expectedtable = new Piwik_DataTable();
     $rows = array(array($idcol => array('label' => 'ask', 'nb_visits' => -152)), array($idcol => array('label' => '238949', 'nb_visits' => 0)), array($idcol => array('label' => 'Q*(%&*', 'nb_visits' => 1)), array($idcol => array('label' => 'piwik', 'nb_visits' => 1.5)), array($idcol => array('label' => 'amazon', 'nb_visits' => 30)), array($idcol => array('label' => 'yahoo', 'nb_visits' => 154)), array($idcol => array('label' => 'google', 'nb_visits' => 897)));
     $expectedtable->addRowsFromArray($rows);
     $expectedtableReverse = new Piwik_DataTable();
     $expectedtableReverse->addRowsFromArray(array_reverse($rows));
     $filter = new Piwik_DataTable_Filter_Sort($table, 'nb_visits', 'asc');
     $this->assertTrue(Piwik_DataTable::isEqual($table, $expectedtable));
     $filter = new Piwik_DataTable_Filter_Sort($table, 'nb_visits', 'desc');
     $this->assertTrue(Piwik_DataTable::isEqual($table, $expectedtableReverse));
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:19,代码来源:Sort.test.php

示例6: array

 /**
  * Test to filter a column with a pattern
  */
 function test_filter_Pattern()
 {
     $table = new Piwik_DataTable();
     $idcol = Piwik_DataTable_Row::COLUMNS;
     $rows = array(array($idcol => array('label' => 'google')), array($idcol => array('label' => 'ask')), array($idcol => array('label' => 'piwik')), array($idcol => array('label' => 'yahoo')), array($idcol => array('label' => 'amazon')), array($idcol => array('label' => '2389752/47578949')), array($idcol => array('label' => 'Q*(%&*("$&%*(&"$*")"))')));
     $table->addRowsFromArray($rows);
     $rowIds = array_keys($rows);
     $tests = array(array('ask', array(1)), array('oo', array(0, 3)), array('^yah', array(3)), array('\\*', array(6)), array('2/4', array(5)), array('amazon|yahoo', array(3, 4)));
     foreach ($tests as $test) {
         $pattern = $test[0];
         $expectedRows = $test[1];
         $rowToDelete = array_diff($rowIds, $expectedRows);
         $expectedtable = clone $table;
         $expectedtable->deleteRows($rowToDelete);
         $filteredTable = clone $table;
         $filteredTable->filter('Pattern', array('label', $pattern));
         $this->assertEqual($filteredTable->getRows(), $expectedtable->getRows(), "pattern search failed for pattern {$pattern}");
     }
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:22,代码来源:Pattern.test.php

示例7: _getDataTableArrayTest

 /**
  * DATA OF DATATABLE_ARRAY
  * -------------------------
  */
 protected function _getDataTableArrayTest()
 {
     $array1 = array(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'Google', 'nb_uniq_visitors' => 11, 'nb_visits' => 11), Piwik_DataTable_Row::METADATA => array('url' => 'http://www.google.com', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png')), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'Yahoo!', 'nb_uniq_visitors' => 15, 'nb_visits' => 151), Piwik_DataTable_Row::METADATA => array('url' => 'http://www.yahoo.com', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png')));
     $table1 = new Piwik_DataTable();
     $table1->addRowsFromArray($array1);
     $array2 = array(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'Google1©', 'nb_uniq_visitors' => 110, 'nb_visits' => 110), Piwik_DataTable_Row::METADATA => array('url' => 'http://www.google.com1', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png1')), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'Yahoo!1', 'nb_uniq_visitors' => 150, 'nb_visits' => 1510), Piwik_DataTable_Row::METADATA => array('url' => 'http://www.yahoo.com1', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png1')));
     $table2 = new Piwik_DataTable();
     $table2->addRowsFromArray($array2);
     $table3 = new Piwik_DataTable();
     $table = new Piwik_DataTable_Array();
     $table->setKeyName('testKey');
     $table->addTable($table1, 'date1');
     $table->addTable($table2, 'date2');
     $table->addTable($table3, 'date3');
     return $table;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:20,代码来源:JSONTest.php

示例8: _getDataTable2ForTest

 protected function _getDataTable2ForTest()
 {
     $rows = $this->_getRowsDataTable2ForTest();
     $table = new Piwik_DataTable();
     $table->addRowsFromArray($rows);
     return $table;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:7,代码来源:DataTableTest.php

示例9: getTableBrowserByType

 protected function getTableBrowserByType($tableBrowser)
 {
     $nameToRow = array();
     foreach ($tableBrowser->getRows() as $row) {
         $browserLabel = $row->getColumn('label');
         $familyNameToUse = Piwik_getBrowserFamily($browserLabel);
         if (!isset($nameToRow[$familyNameToUse])) {
             $nameToRow[$familyNameToUse] = new Piwik_DataTable_Row();
             $nameToRow[$familyNameToUse]->addColumn('label', $familyNameToUse);
         }
         $nameToRow[$familyNameToUse]->sumRow($row);
     }
     $tableBrowserType = new Piwik_DataTable();
     $tableBrowserType->addRowsFromArray($nameToRow);
     return $tableBrowserType;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:16,代码来源:UserSettings.php

示例10: mergeSubtables

 /**
  * Returns a new DataTable that contains the rows of each of this table's
  * subtables.
  * 
  * @return Piwik_DataTable
  */
 public function mergeSubtables()
 {
     $result = new Piwik_DataTable();
     foreach ($this->getRows() as $row) {
         $subtable = $row->getSubtable();
         if ($subtable !== false) {
             $result->addRowsFromArray($subtable->getRows());
         }
     }
     return $result;
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:17,代码来源:DataTable.php

示例11: createTestDataTable

 private function createTestDataTable()
 {
     $result = new Piwik_DataTable();
     $result->addRowsFromArray(array(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'row1', 'col1' => 1)), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'row2', 'col1' => 2))));
     return $result;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:6,代码来源:Array.test.php

示例12: array

 /**
  * Test to filter a column with a offset, limit 3
  */
 function test_filter_OffsetLimit3()
 {
     $table = new Piwik_DataTable();
     $idcol = Piwik_DataTable_Row::COLUMNS;
     $rows = array(array($idcol => array('label' => 'google')), array($idcol => array('label' => 'ask')), array($idcol => array('label' => 'piwik')), array($idcol => array('label' => 'yahoo')), array($idcol => array('label' => 'amazon')), array($idcol => array('label' => '238975247578949')), array($idcol => array('label' => 'Q*(%&*("$&%*(&"$*")"))')));
     $table->addRowsFromArray($rows);
     $expectedtable = new Piwik_DataTable();
     $filter = new Piwik_DataTable_Filter_Limit($table, 8, 15);
     $filter->filter($table);
     $colAfter = $colExpected = array();
     foreach ($table->getRows() as $row) {
         $colAfter[] = $row->getColumn('label');
     }
     foreach ($expectedtable->getRows() as $row) {
         $colExpected[] = $row->getColumn('label');
     }
     $this->assertEqual(array_values($table->getRows()), array_values($expectedtable->getRows()));
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:21,代码来源:Limit.test.php


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