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


PHP DataTable::addRowsFromArray方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $this->currentTable = new DataTable();
     $this->currentTable->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'val1', 'nb_visits' => 120)), array(Row::COLUMNS => array('label' => 'val2', 'nb_visits' => 70)), array(Row::COLUMNS => array('label' => 'val3', 'nb_visits' => 90)), array(Row::COLUMNS => array('label' => 'val4', 'nb_visits' => 99)), array(Row::COLUMNS => array('label' => 'val5', 'nb_visits' => 0)), array(Row::COLUMNS => array('label' => 'val6', 'nb_visits' => 0)), array(Row::COLUMNS => array('label' => 'val7', 'nb_visits' => 134)), array(Row::COLUMNS => array('label' => 'val8', 'nb_visits' => 100)), array(Row::COLUMNS => array('label' => 'val9', 'nb_visits' => 7)), array(Row::COLUMNS => array('label' => 'val10', 'nb_visits' => 89))));
     $this->pastTable = new DataTable();
     $this->pastTable->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'val1', 'nb_visits' => 102)), array(Row::COLUMNS => array('label' => 'val102', 'nb_visits' => 29)), array(Row::COLUMNS => array('label' => 'val4', 'nb_visits' => 120)), array(Row::COLUMNS => array('label' => 'val6', 'nb_visits' => 313)), array(Row::COLUMNS => array('label' => 'val109', 'nb_visits' => 0)), array(Row::COLUMNS => array('label' => 'val8', 'nb_visits' => 140)), array(Row::COLUMNS => array('label' => 'val9', 'nb_visits' => 72)), array(Row::COLUMNS => array('label' => 'val107', 'nb_visits' => 415)), array(Row::COLUMNS => array('label' => 'val10', 'nb_visits' => 0))));
     $this->table = new DataTable();
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:8,代码来源:FilterInsightTest.php

示例2: filterTable

 private function filterTable($withUser = 5)
 {
     $dataTable = new DataTable();
     $dataTable->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'val1', Metrics::INDEX_NB_USERS => 0)), array(Row::COLUMNS => array('label' => 'val2')), array(Row::COLUMNS => array('label' => 'val2 5w ö?', Metrics::INDEX_NB_USERS => $withUser))));
     $dataTable->filter($this->filter, array($idSite = 1, $period = 'day', $date = 'today'));
     return $dataTable->getColumn(Metrics::INDEX_NB_USERS);
 }
开发者ID:ep123,项目名称:plugin-CustomDimensions,代码行数:7,代码来源:RemoveUserIfNeededTest.php

示例3: testRangeCheckOnMetadata

 public function testRangeCheckOnMetadata()
 {
     $table = new DataTable();
     $table->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'foo'), Row::METADATA => array('count' => 5)), array(Row::COLUMNS => array('label' => 'bar'), Row::METADATA => array('count' => 10)), array(Row::COLUMNS => array('label' => 'bar'), Row::METADATA => array('count' => 15))));
     $filter = new RangeCheck($table, 'count', 0, 10);
     $filter->filter($table);
     $this->assertEquals(array(5, 10, 10), $table->getRowsMetadata('count'));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:8,代码来源:RangeCheckTest.php

示例4: test_filter

 public function test_filter()
 {
     $dataTable = new DataTable();
     $dataTable->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'val1', 'nb_visits' => 120)), array(Row::COLUMNS => array('nb_visits' => 90)), array(Row::COLUMNS => array('label' => 'val2 5w ö?', 'nb_visits' => 99)), array(Row::COLUMNS => array('label' => Archiver::LABEL_CUSTOM_VALUE_NOT_DEFINED, 'nb_visits' => 99))));
     $dataTable->filter($this->filter, array($idDimension = 5));
     $metadata = $dataTable->getRowsMetadata('segment');
     $expected = array('dimension5==val1', false, 'dimension5==val2+5w+%C3%B6%3F', 'dimension5==');
     $this->assertSame($expected, $metadata);
 }
开发者ID:ep123,项目名称:plugin-CustomDimensions,代码行数:9,代码来源:AddSegmentMetadataTest.php

示例5: testRangeCheckNormalDataTableNonIntegerValues

 /**
  * @group Core
  */
 public function testRangeCheckNormalDataTableNonIntegerValues()
 {
     $table = new DataTable();
     $table->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'ask', 'count' => '3')), array(Row::COLUMNS => array('label' => 'nintendo', 'count' => 'test')), array(Row::COLUMNS => array('label' => 'test', 'count' => 0x1232)), array(Row::COLUMNS => array('label' => 'piwik', 'count' => 0x5)), array(Row::COLUMNS => array('label' => 'google', 'count' => '9test')), array(Row::COLUMNS => array('label' => 'yahoo', 'count' => 'test4'))));
     $filter = new 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:carriercomm,项目名称:piwik,代码行数:12,代码来源:RangeCheckTest.php

示例6: getTable

 /**
  * Returns a data table for testing
  * @return DataTable
  */
 protected function getTable()
 {
     $subtableAskPath1 = new DataTable();
     $subtableAskPath1->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'path1-index-page.html')), array(Row::COLUMNS => array('label' => 'another-page'))));
     $subtableAsk = new DataTable();
     $subtableAsk->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'path1'), Row::DATATABLE_ASSOCIATED => $subtableAskPath1), array(Row::COLUMNS => array('label' => 'index.html'))));
     $table = new DataTable();
     $rows = array(array(Row::COLUMNS => array('label' => 'http://www.ask.com'), Row::DATATABLE_ASSOCIATED => $subtableAsk), array(Row::COLUMNS => array('label' => 'yahoo')));
     $table->addRowsFromArray($rows);
     return $table;
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:15,代码来源:PatternRecursiveTest.php

示例7: testFilterLowpop1

 /**
  * Test to exclude low population filter
  *
  * @group Core
  */
 public function testFilterLowpop1()
 {
     $idcol = Row::COLUMNS;
     $table = new 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 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 ExcludeLowPopulation($table, 'nb_visits', 1.4);
     $filter->filter($table);
     $this->assertTrue(DataTable::isEqual($table, $expectedtable));
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:18,代码来源:ExcludeLowPopulationTest.php

示例8: testFilterPattern

 /**
  * Test to filter a column with a pattern
  *
  * _Pattern
  * @dataProvider getTestData
  */
 public function testFilterPattern($pattern, $expectedRows)
 {
     $table = new DataTable();
     $idcol = 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(Row::METADATA => array('label' => 'amazon')), array($idcol => array('label' => '2389752/47578949')), array($idcol => array('label' => 'Q*(%&*("$&%*(&"$*")"))')));
     $table->addRowsFromArray($rows);
     $rowIds = array_keys($rows);
     $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:FluentDevelopment,项目名称:piwik,代码行数:20,代码来源:PatternTest.php

示例9: _getDataTableMapTest

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

示例10: getDataTable

 private function getDataTable()
 {
     $dataTable = new DataTable();
     $dataTable->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'ten', 'visits' => 10)), array(Row::COLUMNS => array('label' => '3test', 'visits' => 33)), array(Row::COLUMNS => array('label' => 'ninety', 'visits' => 90)), array(Row::COLUMNS => array('label' => '3test', 'visits' => 65)), array(Row::COLUMNS => array('label' => '3teste', 'visits' => 67)), array(Row::COLUMNS => array('label' => 'hundred', 'visits' => 100))));
     return $dataTable;
 }
开发者ID:andrzejewsky,项目名称:plugin-CustomAlerts,代码行数:6,代码来源:ProcessorTest.php

示例11: _getDataTable2ForTest

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

示例12: testFilterOffsetLimit3

 /**
  * Test to filter a column with a offset, limit 3
  *
  * @group Core
  */
 public function testFilterOffsetLimit3()
 {
     $table = new DataTable();
     $idcol = 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 DataTable();
     $filter = new Limit($table, 8, 15);
     $filter->filter($table);
     $this->assertEquals(array_values($expectedtable->getRows()), array_values($table->getRows()));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:16,代码来源:LimitTest.php

示例13: createTestDataTable

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

示例14: getRow3Subtable

 private function getRow3Subtable()
 {
     $table = new DataTable();
     $table->addRowsFromArray(array(new Row(array(Row::COLUMNS => array('label' => 'col 2', 'nb_visits' => 7, 'nb_actions' => 8))), new Row(array(Row::COLUMNS => array('label' => 'col 3', 'nb_visits' => 9, 'nb_actions' => 31))), new Row(array(Row::COLUMNS => array('label' => 'col 4', 'nb_visits' => 32, 'nb_actions' => 33)))));
     return $table;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:6,代码来源:PivotByDimensionTest.php

示例15: matchVisitorsEmail

 public function matchVisitorsEmail()
 {
     $table = new DataTable();
     $visitors = Db::fetchAll("\tSELECT DISTINCT idvisitor FROM " . Common::prefixTable("snoopy_visitors"));
     //$visitors_to_score = \Piwik\API\Request::processRequest('Snoopy.getVisitorEmail', array('idvisitor' => $visitor));
     foreach ($visitors as $visitor) {
         $email = \Piwik\API\Request::processRequest('SnoopyBehavioralScoring.getVisitorEmail', array('idvisitor' => $visitor['idvisitor']));
         //var_dump($email->getRows());
         $table->addRowsFromArray($email->getRows());
     }
     return $table;
 }
开发者ID:spletnik,项目名称:snoopy-behavioral-scoring,代码行数:12,代码来源:API.php


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