Exemplo n.º 1
0
 protected function configureViewActions($view)
 {
     $view->setTemplate('CoreHome/templates/datatable_actions.tpl');
     if (Piwik_Common::getRequestVar('idSubtable', -1) != -1) {
         $view->setTemplate('CoreHome/templates/datatable_actions_subdatable.tpl');
     }
     $currentlySearching = $view->setSearchRecursive();
     if ($currentlySearching) {
         $view->setTemplate('CoreHome/templates/datatable_actions_recursive.tpl');
     }
     $view->disableSort();
     $view->disableOffsetInformation();
     $view->disableShowAllViewsIcons();
     $view->disableShowAllColumns();
     $view->setLimit(100);
     $view->setColumnsToDisplay(array('label', 'nb_hits', 'nb_visits'));
     $view->setColumnTranslation('label', Piwik_Translate('Actions_ColumnPageName'));
     $view->setColumnTranslation('nb_hits', Piwik_Translate('General_ColumnPageviews'));
     $view->setColumnTranslation('nb_visits', Piwik_Translate('General_ColumnUniquePageviews'));
     if (Piwik_Common::getRequestVar('enable_filter_excludelowpop', '0', 'string') != '0') {
         // computing minimum value to exclude
         require_once "VisitsSummary/Controller.php";
         $visitsInfo = Piwik_VisitsSummary_Controller::getVisitsSummary();
         $visitsInfo = $visitsInfo->getFirstRow();
         $nbActions = $visitsInfo->getColumn('nb_actions');
         $nbActionsLowPopulationThreshold = floor(0.02 * $nbActions);
         // 2 percent of the total number of actions
         // we remove 1 to make sure some actions/downloads are displayed in the case we have a very few of them
         // and each of them has 1 or 2 hits...
         $nbActionsLowPopulationThreshold = min($visitsInfo->getColumn('max_actions') - 1, $nbActionsLowPopulationThreshold - 1);
         $view->setExcludeLowPopulation('nb_hits', $nbActionsLowPopulationThreshold);
     }
     $view->main();
     // we need to rewrite the phpArray so it contains all the recursive arrays
     if ($currentlySearching) {
         $phpArrayRecursive = $this->getArrayFromRecursiveDataTable($view->getDataTable());
         $view->getView()->arrayDataTable = $phpArrayRecursive;
     }
     return $view;
 }
Exemplo n.º 2
0
 protected function configureViewActions($view, $doSetTranslations = true)
 {
     if ($doSetTranslations) {
         $view->setColumnTranslation('nb_hits', Piwik_Translate('General_ColumnPageviews'));
         $view->setColumnTranslation('nb_visits', Piwik_Translate('General_ColumnUniquePageviews'));
         $view->setColumnTranslation('avg_time_on_page', Piwik_Translate('General_ColumnAverageTimeOnPage'));
         $view->setColumnTranslation('bounce_rate', Piwik_Translate('General_ColumnBounceRate'));
         $view->setColumnTranslation('exit_rate', Piwik_Translate('General_ColumnExitRate'));
         $view->queueFilter('ColumnCallbackReplace', array('avg_time_on_page', array('Piwik', 'getPrettyTimeFromSeconds')));
     }
     if (Piwik_Common::getRequestVar('enable_filter_excludelowpop', '0', 'string') != '0') {
         // computing minimum value to exclude
         $visitsInfo = Piwik_VisitsSummary_Controller::getVisitsSummary();
         $visitsInfo = $visitsInfo->getFirstRow();
         $nbActions = $visitsInfo->getColumn('nb_actions');
         $nbActionsLowPopulationThreshold = floor(0.02 * $nbActions);
         // 2 percent of the total number of actions
         // we remove 1 to make sure some actions/downloads are displayed in the case we have a very few of them
         // and each of them has 1 or 2 hits...
         $nbActionsLowPopulationThreshold = min($visitsInfo->getColumn('max_actions') - 1, $nbActionsLowPopulationThreshold - 1);
         $view->setExcludeLowPopulation('nb_hits', $nbActionsLowPopulationThreshold);
     }
     $this->configureGenericViewActions($view);
     return $view;
 }