當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Metrics::getDefaultMetricsDocumentation方法代碼示例

本文整理匯總了PHP中Piwik\Metrics::getDefaultMetricsDocumentation方法的典型用法代碼示例。如果您正苦於以下問題:PHP Metrics::getDefaultMetricsDocumentation方法的具體用法?PHP Metrics::getDefaultMetricsDocumentation怎麽用?PHP Metrics::getDefaultMetricsDocumentation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik\Metrics的用法示例。


在下文中一共展示了Metrics::getDefaultMetricsDocumentation方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: render

 /**
  * @see ViewDataTable::main()
  * @return mixed
  */
 public function render()
 {
     $view = new View('@CoreVisualizations/_dataTableViz_sparklines.twig');
     $columnsList = array();
     if ($this->config->hasSparklineMetrics()) {
         foreach ($this->config->getSparklineMetrics() as $cols) {
             $columns = $cols['columns'];
             if (!is_array($columns)) {
                 $columns = array($columns);
             }
             $columnsList = array_merge($columns, $columnsList);
         }
     }
     $view->allMetricsDocumentation = Metrics::getDefaultMetricsDocumentation();
     $this->requestConfig->request_parameters_to_modify['columns'] = $columnsList;
     $this->requestConfig->request_parameters_to_modify['format_metrics'] = '1';
     if (!empty($this->requestConfig->apiMethodToRequestDataTable)) {
         $this->fetchConfiguredSparklines();
     }
     $view->sparklines = $this->config->getSortedSparklines();
     $view->isWidget = Common::getRequestVar('widget', 0, 'int');
     $view->titleAttributes = $this->config->title_attributes;
     $view->footerMessage = $this->config->show_footer_message;
     $view->areSparklinesLinkable = $this->config->areSparklinesLinkable();
     $view->title = '';
     if ($this->config->show_title) {
         $view->title = $this->config->title;
     }
     return $view->render();
 }
開發者ID:piwik,項目名稱:piwik,代碼行數:34,代碼來源:Sparklines.php

示例2: getMetricsDocumentation

 /**
  * Returns an array of metric documentations and their corresponding translations. Eg
  * `array('nb_visits' => 'If a visitor comes to your website for the first time or if he visits a page more than 30 minutes after...')`.
  * By default the given {@link $metrics} are used and their corresponding translations are looked up automatically.
  * If there is a metric documentation not found, you should add the default metric documentation translation for
  * this metric using the {@hook Metrics.getDefaultMetricDocumentationTranslations} event. If you want to overwrite
  * any default metric translation you should overwrite this method, call this parent method to get all default
  * translations and overwrite any custom metric translations.
  * @return array
  * @api
  */
 protected function getMetricsDocumentation()
 {
     $translations = Metrics::getDefaultMetricsDocumentation();
     $documentation = array();
     foreach ($this->metrics as $metric) {
         if (!empty($translations[$metric])) {
             $documentation[$metric] = $translations[$metric];
         }
     }
     return $documentation;
 }
開發者ID:josl,項目名稱:CGE-File-Sharing,代碼行數:22,代碼來源:Report.php

示例3: getReportMetadata

 /**
  * Triggers a hook to ask plugins for available Reports.
  * Returns metadata information about each report (category, name, dimension, metrics, etc.)
  *
  * @param string $idSites Comma separated list of website Ids
  * @param bool|string $period
  * @param bool|Date $date
  * @param bool $hideMetricsDoc
  * @param bool $showSubtableReports
  * @return array
  */
 public function getReportMetadata($idSites, $period = false, $date = false, $hideMetricsDoc = false, $showSubtableReports = false)
 {
     $idSites = Site::getIdSitesFromIdSitesString($idSites);
     if (!empty($idSites)) {
         Piwik::checkUserHasViewAccess($idSites);
     }
     // as they cache key contains a lot of information there would be an even better cache result by caching parts of
     // this huge method separately but that makes it also more complicated. leaving it like this for now.
     $key = $this->buildReportMetadataCacheKey($idSites, $period, $date, $hideMetricsDoc, $showSubtableReports);
     $key = CacheId::pluginAware($key);
     $cache = PiwikCache::getTransientCache();
     if ($cache->contains($key)) {
         return $cache->fetch($key);
     }
     $parameters = array('idSites' => $idSites, 'period' => $period, 'date' => $date);
     $availableReports = array();
     foreach (Report::getAllReports() as $report) {
         $report->configureReportMetadata($availableReports, $parameters);
     }
     /**
      * Triggered when gathering metadata for all available reports.
      *
      * Plugins that define new reports should use this event to make them available in via
      * the metadata API. By doing so, the report will become available in scheduled reports
      * as well as in the Piwik Mobile App. In fact, any third party app that uses the metadata
      * API will automatically have access to the new report.
      *
      * @param string &$availableReports The list of available reports. Append to this list
      *                                  to make a report available.
      *
      *                                  Every element of this array must contain the following
      *                                  information:
      *
      *                                  - **category**: A translated string describing the report's category.
      *                                  - **name**: The translated display title of the report.
      *                                  - **module**: The plugin of the report.
      *                                  - **action**: The API method that serves the report.
      *
      *                                  The following information is optional:
      *
      *                                  - **dimension**: The report's [dimension](/guides/all-about-analytics-data#dimensions) if any.
      *                                  - **metrics**: An array mapping metric names with their display names.
      *                                  - **metricsDocumentation**: An array mapping metric names with their
      *                                                              translated documentation.
      *                                  - **processedMetrics**: The array of metrics in the report that are
      *                                                          calculated using existing metrics. Can be set to
      *                                                          `false` if the report contains no processed
      *                                                          metrics.
      *                                  - **order**: The order of the report in the list of reports
      *                                               with the same category.
      *
      * @param array $parameters Contains the values of the sites and period we are
      *                          getting reports for. Some reports depend on this data.
      *                          For example, Goals reports depend on the site IDs being
      *                          requested. Contains the following information:
      *
      *                          - **idSites**: The array of site IDs we are getting reports for.
      *                          - **period**: The period type, eg, `'day'`, `'week'`, `'month'`,
      *                                        `'year'`, `'range'`.
      *                          - **date**: A string date within the period or a date range, eg,
      *                                      `'2013-01-01'` or `'2012-01-01,2013-01-01'`.
      *
      * TODO: put dimensions section in all about analytics data
      * @deprecated since 2.5.0 Use Report Classes instead.
      * @ignore
      */
     Piwik::postEvent('API.getReportMetadata', array(&$availableReports, $parameters));
     // TODO we can remove this one once we remove API.getReportMetadata event (except hideMetricsDoc)
     foreach ($availableReports as &$availableReport) {
         // can be removed once we remove hook API.getReportMetadata
         if (!isset($availableReport['metrics'])) {
             $availableReport['metrics'] = Metrics::getDefaultMetrics();
         }
         // can be removed once we remove hook API.getReportMetadata
         if (!isset($availableReport['processedMetrics'])) {
             $availableReport['processedMetrics'] = Metrics::getDefaultProcessedMetrics();
         }
         if ($hideMetricsDoc) {
             unset($availableReport['metricsDocumentation']);
         } else {
             if (!isset($availableReport['metricsDocumentation'])) {
                 // set metric documentation to default if it's not set
                 // can be removed once we remove hook API.getReportMetadata
                 $availableReport['metricsDocumentation'] = Metrics::getDefaultMetricsDocumentation();
             }
         }
     }
     /**
      * Triggered after all available reports are collected.
//.........這裏部分代碼省略.........
開發者ID:CaptainSharf,項目名稱:SSAD_Project,代碼行數:101,代碼來源:ProcessedReport.php

示例4: getMetricsDocumentation

 /**
  * Returns an array of metric documentations and their corresponding translations. Eg
  * `array('nb_visits' => 'If a visitor comes to your website for the first time or if he visits a page more than 30 minutes after...')`.
  * By default the given {@link $metrics} are used and their corresponding translations are looked up automatically.
  * If there is a metric documentation not found, you should add the default metric documentation translation for
  * this metric using the {@hook Metrics.getDefaultMetricDocumentationTranslations} event. If you want to overwrite
  * any default metric translation you should overwrite this method, call this parent method to get all default
  * translations and overwrite any custom metric translations.
  * @return array
  * @api
  */
 protected function getMetricsDocumentation()
 {
     $translations = Metrics::getDefaultMetricsDocumentation();
     $documentation = array();
     foreach ($this->metrics as $metric) {
         if (!empty($translations[$metric])) {
             $documentation[$metric] = $translations[$metric];
         }
     }
     $processedMetrics = $this->processedMetrics ?: array();
     foreach ($processedMetrics as $processedMetric) {
         if (is_string($processedMetric) && !empty($translations[$processedMetric])) {
             $documentation[$processedMetric] = $translations[$processedMetric];
         } elseif ($processedMetric instanceof ProcessedMetric) {
             $name = $processedMetric->getName();
             $metricDocs = $processedMetric->getDocumentation();
             if (empty($metricDocs)) {
                 $metricDocs = @$translations[$name];
             }
             if (!empty($metricDocs)) {
                 $documentation[$processedMetric->getName()] = $metricDocs;
             }
         }
     }
     return $documentation;
 }
開發者ID:bossrabbit,項目名稱:piwik,代碼行數:37,代碼來源:Report.php


注:本文中的Piwik\Metrics::getDefaultMetricsDocumentation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。