init() защищенный Метод

Here you can do any instance initialization and overwrite any default values. You should avoid doing time consuming initialization here and if possible delay as long as possible. An instance of this report will be created in most page requests.
protected init ( )
Пример #1
0
 protected function init()
 {
     parent::init();
     $this->reportsToMerge = $this->getReportsToMerge();
     $this->module = 'API';
     $this->action = 'get';
     $this->categoryId = 'API';
     $this->name = Piwik::translate('General_MainMetrics');
     $this->documentation = '';
     $this->processedMetrics = array();
     foreach ($this->reportsToMerge as $report) {
         if (!is_array($report->processedMetrics)) {
             continue;
         }
         $this->processedMetrics = array_merge($this->processedMetrics, $report->processedMetrics);
     }
     $this->metrics = array();
     foreach ($this->reportsToMerge as $report) {
         if (!is_array($report->metrics)) {
             continue;
         }
         $this->metrics = array_merge($this->metrics, $report->metrics);
     }
     $this->order = 6;
 }
Пример #2
0
 protected function init()
 {
     parent::init();
     $this->name = 'My Custom Report Name';
     $this->order = 20;
     $this->module = 'TestPlugin';
     $this->action = 'getBasicReport';
     $this->category = 'Goals_Goals';
 }
Пример #3
0
 protected function init()
 {
     parent::init();
     $this->category = 'General_Visitors';
     $this->name = Piwik::translate('VisitFrequency_ColumnReturningVisits');
     $this->documentation = '';
     // TODO
     $this->processedMetrics = array(new ReturningMetric(new AverageTimeOnSite()), new ReturningMetric(new ActionsPerVisit()), new ReturningMetric(new BounceRate()));
     $this->metrics = array('nb_visits_returning', 'nb_actions_returning', 'nb_uniq_visitors_returning', 'nb_users_returning', 'max_actions_returning');
     $this->order = 40;
 }
Пример #4
0
 protected function init()
 {
     parent::init();
     $this->category = 'General_Visitors';
     $this->name = Piwik::translate('VisitFrequency_ColumnReturningVisits');
     $this->documentation = '';
     // TODO
     $this->metrics = array('nb_visits_returning', 'nb_actions_returning', 'avg_time_on_site_returning', 'bounce_rate_returning', 'nb_actions_per_visit_returning', 'nb_uniq_visitors_returning');
     $this->processedMetrics = false;
     $this->order = 40;
 }
Пример #5
0
 protected function init()
 {
     parent::init();
     $this->category = 'VisitsSummary_VisitsSummary';
     $this->name = Piwik::translate('VisitsSummary_VisitsSummary');
     $this->documentation = '';
     // TODO
     $this->processedMetrics = array(new BounceRate(), new ActionsPerVisit(), new AverageTimeOnSite());
     $this->metrics = array('nb_uniq_visitors', 'nb_visits', $this->usersColumn, 'nb_actions', 'max_actions');
     // Used to process metrics, not displayed/used directly
     //								'sum_visit_length',
     //								'nb_visits_converted',
     $this->order = 1;
 }
Пример #6
0
 protected function init()
 {
     parent::init();
     $this->category = 'VisitsSummary_VisitsSummary';
     $this->name = Piwik::translate('VisitsSummary_VisitsSummary');
     $this->documentation = '';
     // TODO
     $this->processedMetrics = false;
     $this->metrics = array('nb_uniq_visitors', 'nb_visits', 'nb_actions', 'nb_actions_per_visit', 'bounce_rate', 'avg_time_on_site', 'max_actions');
     // Used to process metrics, not displayed/used directly
     //								'sum_visit_length',
     //								'nb_visits_converted',
     $this->order = 1;
 }
 protected function init()
 {
     parent::init();
     $this->categoryId = 'CustomDimensions_CustomDimensions';
     $this->name = Piwik::translate($this->categoryId);
     $this->order = 100;
     $this->actionToLoadSubTables = $this->action;
     $idDimension = Common::getRequestVar('idDimension', 0, 'int');
     $idSite = Common::getRequestVar('idSite', 0, 'int');
     if ($idDimension > 0 && $idSite > 0) {
         $dimensions = $this->getActiveDimensionsForSite($idSite);
         foreach ($dimensions as $dimension) {
             if ((int) $dimension['idcustomdimension'] === $idDimension) {
                 $this->initThisReportFromDimension($dimension);
             }
         }
     }
 }