Example #1
0
 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);
 }
Example #2
0
 /**
  * @see Piwik_ViewDataTable::init()
  */
 function init($currentControllerName, $currentControllerAction, $moduleNameAndMethod)
 {
     parent::init($currentControllerName, $currentControllerAction, $moduleNameAndMethod);
     $this->dataTableTemplate = 'Home/templates/cloud.tpl';
     $this->disableOffsetInformation();
     $this->disableExcludeLowPopulation();
 }
Example #3
0
 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);
 }
Example #4
0
 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);
 }
Example #5
0
 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);
 }
Example #6
0
 /**
  * We persist the parametersToModify values in the javascript footer.
  * This is used by the "export links" that use the "date" attribute
  * from the json properties array in the datatable footer.
  * @return array
  */
 protected function getJavascriptVariablesToSet()
 {
     $original = parent::getJavascriptVariablesToSet();
     $originalViewDataTable = $original['viewDataTable'];
     $result = $this->parametersToModify + $original;
     $result['viewDataTable'] = $originalViewDataTable;
     return $result;
 }
Example #7
0
 /**
  * @see Piwik_ViewDataTable::init()
  *
  */
 function init($currentControllerName, $currentControllerAction, $moduleNameAndMethod)
 {
     parent::init($currentControllerName, $currentControllerAction, $moduleNameAndMethod);
     $this->dataTableTemplate = 'Home/templates/graph.tpl';
     $this->disableOffsetInformation();
     $this->disableExcludeLowPopulation();
     $this->disableSearchBox();
     $this->parametersToModify = array('viewDataTable' => $this->valueParameterViewDataTable, 'module' => $currentControllerName, 'action' => $currentControllerAction);
 }
Example #8
0
 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);
 }
Example #9
0
 /**
  * @see Piwik_ViewDataTable::init()
  */
 function init($currentControllerName, $currentControllerAction, $moduleNameAndMethod, $actionToLoadTheSubTable = null)
 {
     parent::init($currentControllerName, $currentControllerAction, $moduleNameAndMethod, $actionToLoadTheSubTable);
     $this->dataTableTemplate = 'Home/templates/datatable.tpl';
     $this->variablesDefault['enable_sort'] = true;
     // load general columns translations
     $this->setColumnTranslation('nb_visits', Piwik_Translate('General_ColumnNbVisits'));
     $this->setColumnTranslation('label', Piwik_Translate('General_ColumnLabel'));
     $this->setColumnTranslation('nb_uniq_visitors', Piwik_Translate('General_ColumnNbUniqVisitors'));
 }
Example #10
0
 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);
 }
Example #11
0
 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;
 }
Example #12
0
 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);
 }
Example #13
0
 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);
 }
Example #14
0
 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;
 }
Example #15
0
 /**
  * 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);
 }
Example #16
0
 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('% ', '%&nbsp;', Piwik_Translate($percColName)));
     $view->setSortedColumn($percCol);
     $view->setLimit(5);
     return $this->renderView($view, $fetch);
 }
Example #18
0
 function getColumnToDisplay()
 {
     $columns = parent::getColumnsToDisplay();
     // not label, but the first numeric column
     return $columns[1];
 }
Example #19
0
 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);
 }
 /**
  * We persist the parametersToModify values in the javascript footer.
  * This is used by the "export links" that use the "date" attribute
  * from the json properties array in the datatable footer.
  */
 protected function getJavascriptVariablesToSet()
 {
     return $this->parametersToModify + parent::getJavascriptVariablesToSet();
 }
 /**
  * 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;
 }
Example #22
0
 /**
  * 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;
 }
 protected function initChartObjectData()
 {
     $this->dataTable->applyQueuedFilters();
     // We apply a filter to the DataTable, decoding the label column (useful for keywords for example)
     $this->dataTable->filter('ColumnCallbackReplace', array('label', 'urldecode'));
     $xLabels = $this->dataTable->getColumn('label');
     $columnNames = parent::getColumnsToDisplay();
     if (($labelColumnFound = array_search('label', $columnNames)) !== false) {
         unset($columnNames[$labelColumnFound]);
     }
     $columnNameToTranslation = $columnNameToValue = array();
     foreach ($columnNames as $columnName) {
         $columnNameToTranslation[$columnName] = $this->getColumnTranslation($columnName);
         $columnNameToValue[$columnName] = $this->dataTable->getColumn($columnName);
     }
     $this->view->setAxisXLabels($xLabels);
     $this->view->setAxisYValues($columnNameToValue);
     $this->view->setAxisYLabels($columnNameToTranslation);
     $this->view->setAxisYUnit($this->yAxisUnit);
     $this->view->setDisplayPercentageInTooltip($this->displayPercentageInTooltip);
 }
Example #24
0
 /**
  * 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' => '%&nbsp;' . 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 &nbsp; as, well, '&nbsp;', 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;
 }
Example #25
0
 /**
  * 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);
 }
Example #26
0
 /**
  * Set metrics variables (displayed metrics, available metrics) used by template
  * Handles the server-side of the metrics picker
  *
  * @param Piwik_View|Piwik_ViewDataTable  $view
  * @param string                          $defaultMetricDay      name of the default metric for period=day
  * @param string                          $defaultMetric         name of the default metric for other periods
  * @param array                           $metricsForDay         metrics that are only available for period=day
  * @param array                           $metricsForAllPeriods  metrics that are available for all periods
  * @param bool                            $labelDisplayed        add 'label' to columns to display?
  * @return void
  */
 protected function setMetricsVariablesView(Piwik_ViewDataTable $view, $defaultMetricDay = 'nb_uniq_visitors', $defaultMetric = 'nb_visits', $metricsForDay = array('nb_uniq_visitors'), $metricsForAllPeriods = array('nb_visits', 'nb_actions'), $labelDisplayed = true)
 {
     // columns is set in the request if metrics picker has been used
     $columns = Piwik_Common::getRequestVar('columns', false);
     if ($columns !== false) {
         $columns = Piwik::getArrayFromApiParameter($columns);
         $firstColumn = $columns[0];
     } else {
         // default columns
         $firstColumn = isset($view->period) && $view->period == 'day' ? $defaultMetricDay : $defaultMetric;
         $columns = array($firstColumn);
     }
     // displayed columns
     if ($labelDisplayed && !$view instanceof Piwik_ViewDataTable_GenerateGraphData) {
         array_unshift($columns, 'label');
     }
     $view->setColumnsToDisplay($columns);
     // Continue only for graphs
     if (!$view instanceof Piwik_ViewDataTable_GenerateGraphData) {
         return;
     }
     // do not sort if sorted column was initially "label" or eg. it would make "Visits by Server time" not pretty
     if ($view->getSortedColumn() != 'label') {
         $view->setSortedColumn($firstColumn);
     }
     // selectable columns
     if (isset($view->period) && $view->period == 'day') {
         $selectableColumns = array_merge($metricsForDay, $metricsForAllPeriods);
     } else {
         $selectableColumns = $metricsForAllPeriods;
     }
     $view->setSelectableColumns($selectableColumns);
 }
Example #27
0
 protected function getRequestString()
 {
     $requestString = parent::getRequestString();
     if ($this->recursiveDataTableLoad) {
         $requestString .= '&expanded=1';
     }
     return $requestString;
 }
Example #28
0
 protected function initChartObjectData()
 {
     // if the loaded datatable is a simple DataTable, it is most likely a plugin plotting some custom data
     // we don't expect plugin developers to return a well defined Piwik_DataTable_Array
     if ($this->dataTable instanceof Piwik_DataTable) {
         return parent::initChartObjectData();
     }
     $this->dataTable->applyQueuedFilters();
     if (!$this->dataTable instanceof Piwik_DataTable_Array) {
         throw new Exception("Expecting a DataTable_Array with custom format to draw an evolution chart");
     }
     // the X label is extracted from the 'period' object in the table's metadata
     $xLabels = $uniqueIdsDataTable = array();
     foreach ($this->dataTable->getArray() as $idDataTable => $metadataDataTable) {
         //eg. "Aug 2009"
         $xLabels[] = $metadataDataTable->getMetadata('period')->getLocalizedShortString();
         // we keep track of all unique data table that we need to set a Y value for
         $uniqueIdsDataTable[] = $idDataTable;
     }
     $idSite = Piwik_Common::getRequestVar('idSite', null, 'int');
     $requestedColumnNames = $this->getColumnsToDisplay();
     $units = $this->getUnitsForColumnsToDisplay();
     $yAxisLabelToUnit = array();
     $yAxisLabelToValue = array();
     foreach ($this->dataTable->getArray() as $idDataTable => $dataTable) {
         foreach ($dataTable->getRows() as $row) {
             $rowLabel = $row->getColumn('label');
             // put together configuration for row picker.
             // do this for every data table in the array because rows do not
             // have to present for each date.
             if ($this->rowPicker !== false) {
                 $rowVisible = $this->handleRowForRowPicker($rowLabel);
                 if (!$rowVisible) {
                     continue;
                 }
             }
             // build data for request columns
             foreach ($requestedColumnNames as $requestedColumnName) {
                 $yAxisLabel = $this->getSeriesLabel($rowLabel, $requestedColumnName);
                 if (($columnValue = $row->getColumn($requestedColumnName)) !== false) {
                     $yAxisLabelToValue[$yAxisLabel][$idDataTable] = $columnValue;
                     $yAxisLabelToUnit[$yAxisLabel] = $units[$requestedColumnName];
                 }
             }
         }
     }
     // make sure all column values are set to at least zero (no gap in the graph)
     $yAxisLabelToValueCleaned = array();
     foreach ($uniqueIdsDataTable as $uniqueIdDataTable) {
         foreach ($yAxisLabelToValue as $yAxisLabel => $idDataTableToColumnValue) {
             if (isset($idDataTableToColumnValue[$uniqueIdDataTable])) {
                 $columnValue = $idDataTableToColumnValue[$uniqueIdDataTable];
             } else {
                 $columnValue = 0;
             }
             $yAxisLabelToValueCleaned[$yAxisLabel][] = $columnValue;
         }
     }
     $this->view->setAxisXLabels($xLabels);
     $this->view->setAxisYValues($yAxisLabelToValueCleaned);
     $this->view->setAxisYUnits($yAxisLabelToUnit);
     $countGraphElements = $this->dataTable->getRowsCount();
     $dataTables = $this->dataTable->getArray();
     $firstDatatable = reset($dataTables);
     $period = $firstDatatable->getMetadata('period');
     $stepSize = $this->getXAxisStepSize($period->getLabel(), $countGraphElements);
     $this->view->setXSteps($stepSize);
     if ($this->isLinkEnabled()) {
         $axisXOnClick = array();
         $queryStringAsHash = $this->getQueryStringAsHash();
         foreach ($this->dataTable->getArray() as $idDataTable => $metadataDataTable) {
             $period = $metadataDataTable->getMetadata('period');
             $dateInUrl = $period->getDateStart();
             $parameters = array('idSite' => $idSite, 'period' => $period->getLabel(), 'date' => $dateInUrl->toString(), 'segment' => Piwik_ViewDataTable::getRawSegmentFromRequest());
             $hash = '';
             if (!empty($queryStringAsHash)) {
                 $hash = '#' . Piwik_Url::getQueryStringFromParameters($queryStringAsHash + $parameters);
             }
             $link = 'index.php?' . Piwik_Url::getQueryStringFromParameters(array('module' => 'CoreHome', 'action' => 'index') + $parameters) . $hash;
             $axisXOnClick[] = $link;
         }
         $this->view->setAxisXOnClick($axisXOnClick);
     }
     $this->addSeriesPickerToView();
     if ($this->rowPicker !== false) {
         // configure the row picker
         $this->view->setSelectableRows(array_values($this->rowPickerConfig));
     }
 }
 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);
 }
Example #30
0
 /**
  * @see Piwik_ViewDataTable::init()
  */
 function init($currentControllerName, $currentControllerAction, $moduleNameAndMethod)
 {
     parent::init($currentControllerName, $currentControllerAction, $moduleNameAndMethod);
 }