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


PHP Map::filter方法代码示例

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


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

示例1: filterActionsDataTable

 /**
  * Common filters for all Actions API
  *
  * @param DataTable|DataTable\Simple|DataTable\Map $dataTable
  * @param bool $expanded
  */
 protected function filterActionsDataTable($dataTable, $expanded = false)
 {
     // Must be applied before Sort in this case, since the DataTable can contain both int and strings indexes
     // (in the transition period between pre 1.2 and post 1.2 datatable structure)
     $dataTable->filter('ReplaceColumnNames');
     $dataTable->filter('Sort', array('nb_visits', 'desc', $naturalSort = false, $expanded));
     $dataTable->queueFilter('ReplaceSummaryRowLabel');
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:14,代码来源:API.php

示例2: handleTableReport

 /**
  * Enhance a $dataTable using metadata :
  *
  * - remove metrics based on $reportMetadata['metrics']
  * - add 0 valued metrics if $dataTable doesn't provide all $reportMetadata['metrics']
  * - format metric values to a 'human readable' format
  * - extract row metadata to a separate Simple|Set : $rowsMetadata
  * - translate metric names to a separate array : $columns
  *
  * @param int $idSite enables monetary value formatting based on site currency
  * @param \Piwik\DataTable\Map|\Piwik\DataTable\Simple $dataTable
  * @param array $reportMetadata
  * @param bool $showRawMetrics
  * @return array Simple|Set $newReport with human readable format & array $columns list of translated column names & Simple|Set $rowsMetadata
  */
 private function handleTableReport($idSite, $dataTable, &$reportMetadata, $showRawMetrics = false)
 {
     $hasDimension = isset($reportMetadata['dimension']);
     $columns = $reportMetadata['metrics'];
     if ($hasDimension) {
         $columns = array_merge(array('label' => $reportMetadata['dimension']), $columns);
         if (isset($reportMetadata['processedMetrics'])) {
             $processedMetricsAdded = Metrics::getDefaultProcessedMetrics();
             foreach ($processedMetricsAdded as $processedMetricId => $processedMetricTranslation) {
                 // this processed metric can be displayed for this report
                 if (isset($reportMetadata['processedMetrics'][$processedMetricId])) {
                     $columns[$processedMetricId] = $processedMetricTranslation;
                 }
             }
         }
         // Display the global Goal metrics
         if (isset($reportMetadata['metricsGoal'])) {
             $metricsGoalDisplay = array('revenue');
             // Add processed metrics to be displayed for this report
             foreach ($metricsGoalDisplay as $goalMetricId) {
                 if (isset($reportMetadata['metricsGoal'][$goalMetricId])) {
                     $columns[$goalMetricId] = $reportMetadata['metricsGoal'][$goalMetricId];
                 }
             }
         }
         if (isset($reportMetadata['processedMetrics'])) {
             // Add processed metrics
             $dataTable->filter('AddColumnsProcessedMetrics', array($deleteRowsWithNoVisit = false));
         }
     }
     $columns = $this->hideShowMetrics($columns);
     $totals = array();
     // $dataTable is an instance of Set when multiple periods requested
     if ($dataTable instanceof DataTable\Map) {
         // Need a new Set to store the 'human readable' values
         $newReport = new DataTable\Map();
         $newReport->setKeyName("prettyDate");
         // Need a new Set to store report metadata
         $rowsMetadata = new DataTable\Map();
         $rowsMetadata->setKeyName("prettyDate");
         // Process each Simple entry
         foreach ($dataTable->getDataTables() as $label => $simpleDataTable) {
             $this->removeEmptyColumns($columns, $reportMetadata, $simpleDataTable);
             list($enhancedSimpleDataTable, $rowMetadata) = $this->handleSimpleDataTable($idSite, $simpleDataTable, $columns, $hasDimension, $showRawMetrics);
             $enhancedSimpleDataTable->setAllTableMetadata($simpleDataTable->getAllTableMetadata());
             $period = $simpleDataTable->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX)->getLocalizedLongString();
             $newReport->addTable($enhancedSimpleDataTable, $period);
             $rowsMetadata->addTable($rowMetadata, $period);
             $totals = $this->aggregateReportTotalValues($simpleDataTable, $totals);
         }
     } else {
         $this->removeEmptyColumns($columns, $reportMetadata, $dataTable);
         list($newReport, $rowsMetadata) = $this->handleSimpleDataTable($idSite, $dataTable, $columns, $hasDimension, $showRawMetrics);
         $totals = $this->aggregateReportTotalValues($dataTable, $totals);
     }
     return array($newReport, $columns, $rowsMetadata, $totals);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:72,代码来源:ProcessedReport.php

示例3: initChartObjectData

 /**
  * @param DataTable|DataTable\Map $dataTable
  * @param $visualization
  */
 protected function initChartObjectData($dataTable, $visualization)
 {
     // We apply a filter to the DataTable, decoding the label column (useful for keywords for example)
     $dataTable->filter('ColumnCallbackReplace', array('label', 'urldecode'));
     $xLabels = $dataTable->getColumn('label');
     $columnNames = $this->properties['columns_to_display'];
     if (($labelColumnIndex = array_search('label', $columnNames)) !== false) {
         unset($columnNames[$labelColumnIndex]);
     }
     $columnNameToTranslation = $columnNameToValue = array();
     foreach ($columnNames as $columnName) {
         $columnNameToTranslation[$columnName] = @$this->properties['translations'][$columnName];
         $columnNameToValue[$columnName] = $dataTable->getColumn($columnName);
     }
     $visualization->dataTable = $dataTable;
     $visualization->properties = $this->properties;
     $visualization->setAxisXLabels($xLabels);
     $visualization->setAxisYValues($columnNameToValue);
     $visualization->setAxisYLabels($columnNameToTranslation);
     $units = $this->getUnitsForColumnsToDisplay();
     $visualization->setAxisYUnits($units);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:26,代码来源:JqplotDataGenerator.php

示例4: filterActionsDataTable

 /**
  * Common filters for all Actions API
  *
  * @param DataTable|DataTable\Simple|DataTable\Map $dataTable
  */
 private function filterActionsDataTable($dataTable)
 {
     // Must be applied before Sort in this case, since the DataTable can contain both int and strings indexes
     // (in the transition period between pre 1.2 and post 1.2 datatable structure)
     $dataTable->filter('Piwik\\Plugins\\Actions\\DataTable\\Filter\\Actions');
     return $dataTable;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:12,代码来源:API.php


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