CoolCMS API

EditStatisticsTrait

"Statistics" section of the edit page.

Shows the view chart of the company profile (ChartJS). The granularity (daily, weekly, monthly, yearly) and the date range are chosen in 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; its 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 `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 either end 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 `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 either end 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