Property | Type | Description | |
---|---|---|---|
$date | The Date object created with ($strDate)[#strDate] or null if the requested date is a range. | ||
$idSite | integer | The value of the **idSite** query parameter. | |
$pluginName | string | The plugin name, eg. 'Referrers'. | |
$site | The Site object created with {@link $idSite}. | ||
$strDate | string | The value of the **date** query parameter. |
Method | Description | |
---|---|---|
__construct ( ) | Constructor. | |
getCalendarPrettyDate ( Piwik\Period $period ) : string | Returns a prettified date string for use in period selector widget. | |
getDefaultAction ( ) : string | Returns the name of the default method that will be called when visiting: index.php?module=PluginName without the action parameter. | |
getPrettyDate ( $date, $period ) : string | Returns the pretty date representation | |
redirectToIndex ( string $moduleToRedirect, string $actionToRedirect, integer | null $websiteId = null, string | null $defaultPeriod = null, string | null $defaultDate = null, array $parameters = [] ) | Helper method used to redirect the current HTTP request to another module/action. | |
setHostValidationVariablesView ( |
Checks if the current host is valid and sets variables on the given view, including: | |
setPeriodVariablesView ( |
Sets general period variables on a view, including: |
Method | Description | |
---|---|---|
addCustomLogoInfo ( $view ) | ||
checkSitePermission ( ) | ||
checkTokenInUrl ( ) | Checks that the token_auth in the URL matches the currently logged-in user's token_auth. | |
getDateParameterInTimezone ( string $date, string $timezone ) : |
Helper method that converts "today" or "yesterday" to the specified timezone. | |
getEnabledPeriodsInUI ( ) : array | Returns values that are enabled for the parameter &period= | |
getGraphParamsModified ( array $paramsToSet = [] ) : array | Returns the array of new processed parameters once the parameters are applied. | |
getLastUnitGraph ( string $currentModuleName, string $currentControllerAction, string $apiMethod ) : |
Returns a ViewDataTable object that will render a jqPlot evolution graph for the last30 days/weeks/etc. of the current period, relative to the current date. | |
getLastUnitGraphAcrossPlugins ( string $currentModuleName, string $currentControllerAction, array $columnsToDisplay = false, array $selectableColumns = [], boolean | string $reportDocumentation = false, string $apiMethod = 'API.get' ) : |
Same as {@link getLastUnitGraph()}, but will set some properties of the ViewDataTable object based on the arguments supplied. | |
getNumericValue ( string $methodToCall, boolean | string $date = false ) : integer | float | Returns a numeric value from the API. | |
getUrlSparkline ( string $action, array $customParameters = [] ) : string | Returns a URL to a sparkline image for a report served by the current plugin. | |
init ( ) | ||
renderReport ( string | |
Convenience method that creates and renders a ViewDataTable for a API method. | |
renderTemplate ( string $template, array $variables = [] ) : string | Assigns the given variables to the template and renders it. | |
renderView ( Piwik\View\ViewInterface $view ) : string | void | A helper method that renders a view either to the screen or to a string. | |
setBasicVariablesView ( |
Assigns a set of generally useful variables to a {@link Piwik\View} instance. | |
setDate ( |
Sets the date to be used by all other methods in the controller. | |
setGeneralVariablesView ( |
Assigns variables to {@link Piwik\View} instances that display an entire page. | |
setMaxDateView ( |
Sets the last date available in the period selector's calendar. Usually this is just the "today" date for a site (which varies based on the timezone of a site). | |
setMinDateView ( |
Sets the first date available in the period selector's calendar. |
Method | Description | |
---|---|---|
doRedirectToUrl ( $moduleToRedirect, $actionToRedirect, $websiteId, $defaultPeriod, $defaultDate, $parameters ) | ||
getEnabledPeriodsNames ( ) : array | ||
getValidDate ( |
protected checkTokenInUrl ( ) |
public static getCalendarPrettyDate ( Piwik\Period $period ) : string | ||
$period | Piwik\Period | The period to return a pretty string for. |
return | string |
protected getDateParameterInTimezone ( string $date, string $timezone ) : |
||
$date | string | `'today'`, `'yesterday'`, `'YYYY-MM-DD'` |
$timezone | string | The timezone to use. |
return |
public getDefaultAction ( ) : string | ||
return | string |
protected static getEnabledPeriodsInUI ( ) : array | ||
return | array | eg. array('day', 'week', 'month', 'year', 'range') |
protected getGraphParamsModified ( array $paramsToSet = [] ) : array | ||
$paramsToSet | array | array( 'date' => 'last50', 'viewDataTable' =>'sparkline' ) |
return | array |
protected getLastUnitGraph ( string $currentModuleName, string $currentControllerAction, string $apiMethod ) : |
||
$currentModuleName | string | The name of the current plugin. |
$currentControllerAction | string | The name of the action that renders the desired report. |
$apiMethod | string | The API method that the ViewDataTable will use to get graph data. |
return |
protected getLastUnitGraphAcrossPlugins ( string $currentModuleName, string $currentControllerAction, array $columnsToDisplay = false, array $selectableColumns = [], boolean | string $reportDocumentation = false, string $apiMethod = 'API.get' ) : |
||
$currentModuleName | string | The name of the current plugin. |
$currentControllerAction | string | The name of the action that renders the desired report. |
$columnsToDisplay | array | The value to use for the ViewDataTable's columns_to_display config property. |
$selectableColumns | array | The value to use for the ViewDataTable's selectable_columns config property. |
$reportDocumentation | boolean | string | The value to use for the ViewDataTable's documentation config property. |
$apiMethod | string | The API method that the ViewDataTable will use to get graph data. |
return |
protected getNumericValue ( string $methodToCall, boolean | string $date = false ) : integer | float | ||
$methodToCall | string | Name of method to call, eg. Referrers.getNumberOfDistinctSearchEngines |
$date | boolean | string | A custom date to use when getting the value. If false, the 'date' query parameter is used. |
return | integer | float |
public static getPrettyDate ( $date, $period ) : string | ||
$date | string | |
$period | string | |
return | string | Pretty date |
public redirectToIndex ( string $moduleToRedirect, string $actionToRedirect, integer | null $websiteId = null, string | null $defaultPeriod = null, string | null $defaultDate = null, array $parameters = [] ) | ||
$moduleToRedirect | string | The plugin to redirect to, eg. `"MultiSites"`. |
$actionToRedirect | string | Action, eg. `"index"`. |
$websiteId | integer | null | The new idSite query parameter, eg, `1`. |
$defaultPeriod | string | null | The new period query parameter, eg, `'day'`. |
$defaultDate | string | null | The new date query parameter, eg, `'today'`. |
$parameters | array | Other query parameters to append to the URL. |
protected renderReport ( string | |
||
$apiAction | string | |
The name of the API action (eg, `'getResolution'`) or an instance of an report. |
$controllerAction | boolean | The name of the Controller action name that is rendering the report. Defaults to the `$apiAction`. |
return | string | void | See `$fetch`. |
protected renderTemplate ( string $template, array $variables = [] ) : string | ||
$template | string | The name of the template file. If only a name is given it will automatically use the template within the plugin folder. For instance 'myTemplate' will result in '@$pluginName/myTemplate.twig'. Alternatively you can include the full path: '@anyOtherFolder/otherTemplate'. The trailing '.twig' is not needed. |
$variables | array | For instance array('myViewVar' => 'myValue'). In template you can use {{ myViewVar }} |
return | string |
protected renderView ( Piwik\View\ViewInterface $view ) : string | void | ||
$view | Piwik\View\ViewInterface | The view to render. |
return | string | void |
protected setBasicVariablesView ( |
||
$view |
protected setGeneralVariablesView ( |
||
$view | ||
return | void |
public static setHostValidationVariablesView ( |
||
$view |
protected setMaxDateView ( |
||
$maxDate | The max date. | |
$view | The view that contains the period selector. |
protected setMinDateView ( |
||
$minDate | The min date. | |
$view | The view that contains the period selector. |
public static setPeriodVariablesView ( |
||
$view |
protected Date,Piwik|null $date | ||
return |
protected int $idSite | ||
return | integer |
protected string $pluginName | ||
return | string |
protected Site,Piwik $site | ||
return |
protected string $strDate | ||
return | string |