CoolCMS API

EditStatisticsTrait

"Statistics" section of the edit page.

Shows the advert views chart (ChartJS). The granularity (daily, weekly, monthly, yearly) and the date range are chosen by a form and travel in the GET parameters statG, statFrom and statTo. A missing range falls back to the default of the granularity.

Tags
requires

EditAdvertFormTrait: shares $advert; renderEdit() calls prepareEditStatistics()

Table of Contents

Properties

$advertStatisticsManager  : AdvertStatisticsManager

Methods

prepareEditStatistics()  : void
Prepares the data of the statistics tab; `renderEdit()` calls it only when the tab is active.
parseStatDate()  : DateTimeImmutable|null
Parses a date in the Y-m-d format; returns null otherwise.
resolveStatGranularity()  : string
Validates the granularity from the request against the allowed values.
resolveStatRange()  : DateTimeImmutable}
Returns the date range from the request. When a bound is missing or invalid, the default range of the granularity is used.

Properties

Methods

prepareEditStatistics()

Prepares the data of the statistics tab; `renderEdit()` calls it only when the tab is active.

protected prepareEditStatistics() : void

parseStatDate()

Parses a date in the Y-m-d format; returns null otherwise.

private parseStatDate(string $value) : DateTimeImmutable|null
Parameters
$value : string
Return values
DateTimeImmutable|null

resolveStatGranularity()

Validates the granularity from the request against the allowed values.

private resolveStatGranularity() : string
Return values
string

resolveStatRange()

Returns the date range from the request. When a bound is missing or invalid, the default range of the granularity is used.

private resolveStatRange(string $granularity) : DateTimeImmutable}
Parameters
$granularity : string
Return values
DateTimeImmutable} —

[from, to]

On this page

Search results