public function getVisitorLog($fetch = false) { // If previous=1 is set, user clicked previous // we can't deal with previous so we force display of the first page if (Piwik_Common::getRequestVar('previous', 0, 'int') == 1) { $_GET['maxIdVisit'] = ''; } $view = Piwik_ViewDataTable::factory(); $view->init($this->pluginName, __FUNCTION__, 'Live.getLastVisitsDetails'); $view->disableGenericFilters(); $view->disableSort(); $view->setTemplate("Live/templates/visitorLog.tpl"); $view->setSortedColumn('idVisit', 'ASC'); $view->disableSearchBox(); $view->setLimit(20); $view->disableOffsetInformation(); $view->disableExcludeLowPopulation(); // disable the tag cloud, pie charts, bar chart icons $view->disableShowAllViewsIcons(); // disable the button "show more datas" $view->disableShowAllColumns(); // disable the RSS feed $view->disableShowExportAsRssFeed(); // disable all row actions if ($view instanceof Piwik_ViewDataTable_HtmlTable) { $view->disableRowActions(); } $view->setReportDocumentation(Piwik_Translate('Live_VisitorLogDocumentation', array('<br />', '<br />'))); $view->setCustomParameter('dataTablePreviousIsFirst', 1); $view->setCustomParameter('filterEcommerce', Piwik_Common::getRequestVar('filterEcommerce', 0, 'int')); $view->setCustomParameter('pageUrlNotDefined', Piwik_Translate('General_NotDefined', Piwik_Translate('Actions_ColumnPageURL'))); return $this->renderView($view, $fetch); }
public function getVisitorLog($fetch = false) { // If previous=1 is set, user clicked previous // we can't deal with previous so we force display of the first page if (Piwik_Common::getRequestVar('previous', 0, 'int') == 1) { $_GET['maxIdVisit'] = ''; } $view = Piwik_ViewDataTable::factory(); $view->init($this->pluginName, __FUNCTION__, 'Live.getLastVisitsDetails'); $view->disableGenericFilters(); $view->disableSort(); $view->setTemplate("Live/templates/visitorLog.tpl"); $view->setSortedColumn('idVisit', 'ASC'); $view->disableSearchBox(); $view->setLimit(20); $view->disableOffsetInformation(); $view->disableExcludeLowPopulation(); // disable the tag cloud, pie charts, bar chart icons $view->disableShowAllViewsIcons(); // disable the button "show more datas" $view->disableShowAllColumns(); // disable the RSS feed $view->disableShowExportAsRssFeed(); $view->setCustomParameter('pageUrlNotDefined', Zend_Registry::get('config')->General->action_default_url_when_not_defined); return $this->renderView($view, $fetch); }
public function collections_projects($fetch = false) { $view = Piwik_ViewDataTable::factory(); $view->init($this->pluginName, __FUNCTION__, "DigitalCollections.getCollectionTableProjects"); $this->configView($view); return $this->renderView($view, $fetch); }
public function getOutlinksSubDataTable($fetch = false) { $view = Piwik_ViewDataTable::factory(); $view->init($this->pluginName, __FUNCTION__, 'Actions.getOutlinks', 'getOutlinksSubDataTable'); $this->configureViewOutlinks($view); $view->disableSearchBox(); return $this->renderView($view, $fetch); }
function getCustomVariablesValuesFromNameId($fetch = false) { $view = Piwik_ViewDataTable::factory(); $view->init($this->pluginName, __FUNCTION__, 'CustomVariables.getCustomVariablesValuesFromNameId'); $view->disableSearchBox(); $view->disableExcludeLowPopulation(); $view->setColumnsToDisplay(array('label', 'nb_visits')); $view->setColumnTranslation('label', Piwik_Translate('CustomVariables_ColumnCustomVariableValue')); return $this->renderView($view, $fetch); }
function getPagesFromVisitId($fetch = false) { $view = Piwik_ViewDataTable::factory(''); $view->init($this->pluginName, __FUNCTION__, 'Live.getLastVisitsForVisitor', 'getPagesFromVisitId'); #$view->disableSearchBox(); #$view->disableExcludeLowPopulation(); #$view->setColumnsToDisplay( array('label','nb_visits') ); #$view->setColumnTranslation('label', Piwik_Translate('Referers_ColumnKeyword')); return $this->renderView($view, $fetch); }
protected function getStandardDataTableUserCountry($currentControllerAction, $APItoCall, $defaultDatatableType = null) { $view = Piwik_ViewDataTable::factory($defaultDatatableType); $view->init($this->pluginName, $currentControllerAction, $APItoCall); $view->disableExcludeLowPopulation(); $this->setPeriodVariablesView($view); $this->setMetricsVariablesView($view); $view->enableShowGoals(); return $view; }
private function getGraph($controllerMethod, $apiMethod, $labelTranslation, $limit = 24) { $view = Piwik_ViewDataTable::factory('graphVerticalBar'); $view->init($this->pluginName, $controllerMethod, $apiMethod); $view->setColumnTranslation('label', Piwik_Translate($labelTranslation)); $view->setSortedColumn('label', 'asc'); $view->setLimit($limit); $view->setGraphLimit($limit); $view->disableSearchBox(); $view->disableExcludeLowPopulation(); $view->disableOffsetInformationAndPaginationControls(); $this->setMetricsVariablesView($view); return $view; }
function getNumberOfVisitsPerPage($fetch = false) { $view = Piwik_ViewDataTable::factory('cloud'); $view->init($this->pluginName, __FUNCTION__, "VisitorInterest.getNumberOfVisitsPerPage"); $view->setColumnsToDisplay(array('label', 'nb_visits')); $view->setSortedColumn('nb_visits', 'asc'); $view->setColumnTranslation('label', Piwik_Translate('VisitorInterest_ColumnPagesPerVisit')); $view->disableExcludeLowPopulation(); $view->disableOffsetInformation(); $view->disableSearchBox(); $view->disableSort(); $view->disableShowAllColumns(); return $this->renderView($view, $fetch); }
function getVisitInformationPerLocalTime($fetch = false) { $view = Piwik_ViewDataTable::factory('graphVerticalBar'); $view->init($this->pluginName, __FUNCTION__, "VisitTime.getVisitInformationPerLocalTime"); $view->setColumnTranslation('label', Piwik_Translate('VisitTime_ColumnLocalTime')); $view->setColumnsToDisplay(array('label', 'nb_visits')); $view->setSortedColumn('label', 'asc'); $view->setLimit(24); $view->setGraphLimit(24); $view->disableSearchBox(); $view->disableExcludeLowPopulation(); $view->disableOffsetInformation(); return $this->renderView($view, $fetch); }
/** * Provider */ function getProvider($fetch = false) { $view = Piwik_ViewDataTable::factory(); $view->init($this->pluginName, __FUNCTION__, "Provider.getProvider"); $this->setPeriodVariablesView($view); $column = 'nb_visits'; if ($view->period == 'day') { $column = 'nb_uniq_visitors'; } $view->setColumnsToDisplay(array('label', $column)); $view->setColumnTranslation('label', Piwik_Translate('Provider_ColumnProvider')); $view->setSortedColumn($column); $view->setLimit(5); return $this->renderView($view, $fetch); }
protected function getStandardDataTableUserCountry($currentControllerAction, $APItoCall, $defaultDatatableType = null) { $view = Piwik_ViewDataTable::factory($defaultDatatableType); $view->init($this->pluginName, $currentControllerAction, $APItoCall); $view->disableExcludeLowPopulation(); $this->setPeriodVariablesView($view); $column = 'nb_visits'; if ($view->period == 'day') { $column = 'nb_uniq_visitors'; } $view->setColumnsToDisplay(array('label', $column)); $view->setSortedColumn($column); $view->enableShowGoals(); return $view; }
/** * IntranetSubNetwork */ function getIntranetSubNetwork($fetch = false) { $view = Piwik_ViewDataTable::factory(); $view->init($this->pluginName, __FUNCTION__, "IntranetSubNetwork.getIntranetSubNetwork"); $this->setPeriodVariablesView($view); $column = 'nb_visits'; $percCol = 'nb_visits_percentage'; $percColName = 'General_ColumnPercentageVisits'; if ($view->period == 'day') { $column = 'nb_uniq_visitors'; } $view->setColumnsToDisplay(array('label', $percCol, $column)); $view->setColumnTranslation('label', Piwik_Translate('IntranetSubNetwork_ColumnIntranetSubNetwork')); $view->setColumnTranslation($percCol, str_replace('% ', '% ', Piwik_Translate($percColName))); $view->setSortedColumn($percCol); $view->setLimit(5); return $this->renderView($view, $fetch); }
function generateSparkline() { $serverRequested = Piwik_Common::getRequestVar('server'); $view = Piwik_ViewDataTable::factory('sparkline'); $view->init($this->pluginName, __FUNCTION__, 'ExampleUI.getTemperaturesEvolution'); $view->setColumnsToDisplay($serverRequested); $this->renderView($view); }
/** * Generic method to get an evolution graph or a sparkline for the row evolution popover. * Do as much as possible from outside the controller. * @return Piwik_ViewDataTable */ public function getRowEvolutionGraph() { // set up the view data table $view = Piwik_ViewDataTable::factory($this->graphType); $view->setDataTable($this->dataTable); $view->init('CoreHome', 'getRowEvolutionGraph', $this->apiMethod); if (!empty($this->graphMetrics)) { $view->setColumnsToDisplay(array_keys($this->graphMetrics)); } $view->hideAllViewsIcons(); foreach ($this->availableMetrics as $metric => $metadata) { $view->setColumnTranslation($metric, $metadata['name']); } if (method_exists($view, 'addRowEvolutionSeriesToggle')) { $view->addRowEvolutionSeriesToggle($this->initiallyShowAllMetrics); } return $view; }
/** * Returns a rendered report that lists the count of visits for different ranges * of days since a visitor's last visit. * * @param bool $fetch Whether to return the rendered view as a string or echo it. * @return string The rendered report or nothing if $fetch is set to false. */ public function getNumberOfVisitsByDaysSinceLast($fetch = false) { $view = Piwik_ViewDataTable::factory(); $view->init($this->pluginName, __FUNCTION__, 'VisitorInterest.getNumberOfVisitsByDaysSinceLast'); $view->setColumnsToDisplay(array('label', 'nb_visits')); $view->setSortedColumn('label', 'asc'); $view->setColumnTranslation('label', Piwik_Translate('General_DaysSinceLastVisit')); $view->disableExcludeLowPopulation(); $view->disableOffsetInformationAndPaginationControls(); $view->disableShowAllViewsIcons(); $view->setLimit(15); $view->disableSearchBox(); $view->disableSort(); $view->disableShowAllColumns(); return $this->renderView($view, $fetch); }
public function getDeviceMobile($fetch = false) { $view = Piwik_ViewDataTable::factory('graphPie'); $view->init($this->pluginName, __FUNCTION__, "MobileAnalytics.getDeviceMobile"); $this->setPeriodVariablesView($view); $column = 'nb_visits'; $view->setColumnsToDisplay(array('label', $column)); $view->setColumnTranslation('label', 'Mobile / Non-Mobile'); $view->setSortedColumn($column); $view->setLimit(2); return $this->renderView($view, $fetch); }
/** * Returns a ViewDataTable object of an Evolution graph * for the last30 days/weeks/etc. of the current period, relative to the current date. * * @param string $currentModuleName * @param string $currentControllerAction * @param string $apiMethod * @return Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution */ protected function getLastUnitGraph($currentModuleName, $currentControllerAction, $apiMethod) { $view = Piwik_ViewDataTable::factory('graphEvolution'); $view->init($currentModuleName, $currentControllerAction, $apiMethod); return $view; }
/** * Returns a ViewDataTable object of an Evolution graph * for the last30 days/weeks/etc. of the current period, relative to the current date. * * @param string $currentModuleName * @param string $currentControllerAction * @param string $apiMethod * @return Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution */ protected function getLastUnitGraph($currentModuleName, $currentControllerAction, $apiMethod) { require_once "ViewDataTable/GenerateGraphHTML.php"; $view = Piwik_ViewDataTable::factory('graphEvolution'); $view->init($currentModuleName, $currentControllerAction, $apiMethod); // if the date is not yet a nicely formatted date range ie. YYYY-MM-DD,YYYY-MM-DD we build it // otherwise the current controller action is being called with the good date format already so it's fine // see constructor if (!is_null($this->date)) { $view->setParametersToModify($this->getGraphParamsModified(array('date' => $this->strDate))); } return $view; }
/** * Utility function that creates and prepares a ViewDataTable for this plugin. */ private function getDataTableView($function, $viewType = 'table', $orderDir = 'asc', $addPercentColumn = false, $labelKey = 'DBStats_Table', $sizeColumns = array('data_size', 'index_size'), $limit = 25) { $columnTranslations = array('label' => Piwik_Translate($labelKey), 'year' => Piwik_Translate('CoreHome_PeriodYear'), 'data_size' => Piwik_Translate('DBStats_DataSize'), 'index_size' => Piwik_Translate('DBStats_IndexSize'), 'total_size' => Piwik_Translate('DBStats_TotalSize'), 'row_count' => Piwik_Translate('DBStats_RowCount'), 'percent_total' => '% ' . Piwik_Translate('DBStats_DBSize'), 'estimated_size' => Piwik_Translate('DBStats_EstimatedSize')); $view = Piwik_ViewDataTable::factory($viewType); $view->init($this->pluginName, $function, "DBStats.{$function}"); $view->setSortedColumn('label', $orderDir); $view->setLimit($limit); $view->setHighlightSummaryRow(true); $view->disableSearchBox(); $view->disableExcludeLowPopulation(); $view->disableTagCloud(); $view->disableShowAllColumns(); $view->alwaysShowSummaryRow(); // translate columns foreach ($columnTranslations as $columnName => $translation) { $view->setColumnTranslation($columnName, $translation); } // add total_size column (if necessary columns are present) if (in_array('data_size', $sizeColumns) && in_array('index_size', $sizeColumns)) { $getTotalTableSize = array($this, 'getTotalTableSize'); $view->queueFilter('ColumnCallbackAddColumn', array(array('data_size', 'index_size'), 'total_size', $getTotalTableSize), $runBeforeGenericFilters = true); $sizeColumns[] = 'total_size'; } $runPrettySizeFilterBeforeGeneric = false; $fixedMemoryUnit = false; if ($view instanceof Piwik_ViewDataTable_HtmlTable) { $view->disableRowEvolution(); // add summary row only if displaying a table $view->queueFilter('AddSummaryRow', array(0, Piwik_Translate('General_Total'), 'label', false), $runBeforeGenericFilters = true); // add other filters if ($addPercentColumn && in_array('total_size', $sizeColumns)) { $view->queueFilter('ColumnCallbackAddColumnPercentage', array('percent_total', 'total_size', 'total_size', $quotientPrecision = 0, $shouldSkipRows = false, $getDivisorFromSummaryRow = true), $runBeforeGenericFilters = true); $view->setSortedColumn('percent_total', $orderDir); } } else { if ($view instanceof Piwik_ViewDataTable_GenerateGraphData) { if (in_array('total_size', $sizeColumns)) { $view->setColumnsToDisplay(array('label', 'total_size')); // when displaying a graph, we force sizes to be shown as the same unit so axis labels // will be readable. NOTE: The unit should depend on the smallest value of the data table, // however there's no way to know this information, short of creating a custom filter. For // now, just assume KB. $fixedMemoryUnit = 'K'; $view->setAxisYUnit(' K'); $view->setSortedColumn('total_size', 'desc'); $runPrettySizeFilterBeforeGeneric = true; } else { $view->setColumnsToDisplay(array('label', 'row_count')); $view->setAxisYUnit(' ' . Piwik_Translate('General_Rows')); $view->setSortedColumn('row_count', 'desc'); } } } $getPrettySize = array('Piwik', 'getPrettySizeFromBytes'); $params = $fixedMemoryUnit === false ? array() : array($fixedMemoryUnit); $view->queueFilter('ColumnCallbackReplace', array($sizeColumns, $getPrettySize, $params), $runPrettySizeFilterBeforeGeneric); // jqPlot will display as, well, ' ', so don't replace the spaces when rendering as a graph if (!$view instanceof Piwik_ViewDataTable_GenerateGraphData) { $replaceSpaces = array($this, 'replaceColumnSpaces'); $view->queueFilter('ColumnCallbackReplace', array($sizeColumns, $replaceSpaces)); } $getPrettyNumber = array('Piwik', 'getPrettyNumber'); $view->queueFilter('ColumnCallbackReplace', array(array('row_count'), $getPrettyNumber)); return $view; }
/** * Generic method to get an evolution graph or a sparkline for the row evolution popup. * Do as much as possible from outside the controller. * @return Piwik_ViewDataTable */ public function getRowEvolutionGraph() { // update period and date in $_GET because this is what is passed to the export icons // under the evolution graph // TODO: can we find a way around this? $_GET['period'] = $this->period; $_GET['date'] = $this->date; // set up the view data table $view = Piwik_ViewDataTable::factory($this->graphType); $view->setDataTable($this->dataTable); $view->init('CoreHome', 'getRowEvolutionGraph', $this->apiMethod); $view->setColumnsToDisplay(array_keys($this->graphMetrics)); $view->hideAllViewsIcons(); foreach ($this->availableMetrics as $metric => $metadata) { $view->setColumnTranslation($metric, $metadata['name']); } if (method_exists($view, 'addRowEvolutionSeriesToggle')) { $view->addRowEvolutionSeriesToggle($this->initiallyShowAllMetrics); } return $view; }
/** * Gets the 'days to conversion' report using the requested view type. */ public function getDaysToConversion($fetch = false) { $view = Piwik_ViewDataTable::factory(); $view->init($this->pluginName, __FUNCTION__, 'Goals.getDaysToConversion', 'getDaysToConversion'); $view->disableSearchBox(); $view->disableExcludeLowPopulation(); $view->disableSubTableWhenShowGoals(); $view->disableShowAllColumns(); $view->setColumnsToDisplay(array('label', 'nb_conversions')); $view->setSortedColumn('label', 'asc'); $view->setColumnTranslation('label', Piwik_Translate('Goals_DaysToConv')); $view->setColumnTranslation('nb_conversions', Piwik_Translate('Goals_ColumnConversions')); $view->disableShowAllViewsIcons(); $view->setLimit(count(Piwik_Goals::$daysToConvRanges)); $view->disableOffsetInformationAndPaginationControls(); return $this->renderView($view, $fetch); }
function getUrlsFromWebsiteId($fetch = false) { $view = Piwik_ViewDataTable::factory(); $view->init($this->pluginName, __FUNCTION__, 'Referers.getUrlsFromWebsiteId'); $view->disableSearchBox(); $view->disableExcludeLowPopulation(); $view->setColumnsToDisplay(array('label', 'nb_visits')); $view->setColumnTranslation('label', Piwik_Translate('Referers_ColumnWebsitePage')); return $this->renderView($view, $fetch); }
/** * Generic method to get an evolution graph or a sparkline for the row evolution popover. * Do as much as possible from outside the controller. * @return Piwik_ViewDataTable */ public function getRowEvolutionGraph() { // Not ideal to overwrite _GET FIXME // Useful for "Export" buttons under graphs to export the data displayed in graph if (!empty($this->date)) { $_GET['date'] = $this->date; } // set up the view data table $view = Piwik_ViewDataTable::factory($this->graphType); $view->setDataTable($this->dataTable); $view->init('CoreHome', 'getRowEvolutionGraph', $this->apiMethod); $view->setColumnsToDisplay(array_keys($this->graphMetrics)); $view->hideAllViewsIcons(); foreach ($this->availableMetrics as $metric => $metadata) { $view->setColumnTranslation($metric, $metadata['name']); } if (method_exists($view, 'addRowEvolutionSeriesToggle')) { $view->addRowEvolutionSeriesToggle($this->initiallyShowAllMetrics); } return $view; }