phpDocumentor

GambioCustomersStructure extends WidgetDefinition

Class representing a widget showing the customer's demographic.

Table of Contents

DATA_QUERY_TIMESPAN_FORMAT_END  = 'Y-m-d 23:59:59'
Date and time format for the end of a time range used for database queries.
DATA_QUERY_TIMESPAN_FORMAT_START  = 'Y-m-d 00:00:00'
Date and time format for the beginning of a time range used for database queries.
EXCLUDED_ORDER_STATUS_IDS  = [99]
Order status IDs to be excluded from SQL queries.
LANGUAGE_CODE_ENGLISH  = 'en'
English language code.
LANGUAGE_CODE_GERMAN  = 'de'
German language code.
LANGUAGE_ID_GERMAN  = 2
German language ID.
CATEGORIES  = [self::LANGUAGE_CODE_GERMAN => ['> 90', '81-90', '71-80', '61-70', '51-60', '41-50', '31-40', '21-30', '18-20', '< 18', 'Nicht angegeben'], self::LANGUAGE_CODE_ENGLISH => ['> 90', '81-90', '71-80', '61-70', '51-60', '41-50', '31-40', '21-30', '18-20', '< 18', 'Not specified']]
Multilingual categories.
ID  = 'GambioCustomersStructure'
ID.
ITEM_TITLES  = ['left' => [self::LANGUAGE_CODE_GERMAN => 'Frauen', self::LANGUAGE_CODE_ENGLISH => 'Females'], 'right' => [self::LANGUAGE_CODE_GERMAN => 'Männer', self::LANGUAGE_CODE_ENGLISH => 'Males']]
Multilingual item titles.
WIDGET_NAME  = [self::LANGUAGE_CODE_GERMAN => 'Kundenstruktur', self::LANGUAGE_CODE_ENGLISH => 'Customers Structure']
Multilingual titles.
$category  : WidgetCategory
Category.
$connection  : Connection
Database connection.
$factory  : StatisticsOverviewFactory
Factory.
$id  : WidgetId
ID.
$names  : WidgetNames
Multilingual titles.
$options  : WidgetOptions
Options.
$userPreferences  : UserPreferences
User's preferences.
$visualization  : WidgetVisualization
Visualization type.
__construct()  : mixed
Constructor.
category()  : WidgetCategory
Return category.
data()  : WidgetData
Return data.
id()  : WidgetId
Return ID.
names()  : WidgetNames
Return multilingual titles.
options()  : WidgetOptions
Return options.
visualization()  : WidgetVisualization
Return visualization type.
ageGroupIsBiggerOrEqualToLowerEndOfAgeRange()  : bool
Return whether the age group is bigger or equal to a given age.
ageGroupIsBiggerThanUpperEndOfAgeRange()  : bool
Return whether the age group is bigger than the biggest range group.
getSumOfMaleAndFemaleCustomersGroupedByAgeFromDatabase()  : array<string|int, mixed>
Fetch customers data from database.
groupDemographicByAgeRanges()  : array<string|int, array<string|int, mixed>>
Group customers by age groups.

Constants

DATA_QUERY_TIMESPAN_FORMAT_END

Date and time format for the end of a time range used for database queries.

protected mixed DATA_QUERY_TIMESPAN_FORMAT_END = 'Y-m-d 23:59:59'

DATA_QUERY_TIMESPAN_FORMAT_START

Date and time format for the beginning of a time range used for database queries.

protected mixed DATA_QUERY_TIMESPAN_FORMAT_START = 'Y-m-d 00:00:00'

EXCLUDED_ORDER_STATUS_IDS

Order status IDs to be excluded from SQL queries.

protected mixed EXCLUDED_ORDER_STATUS_IDS = [99]

LANGUAGE_CODE_ENGLISH

English language code.

protected mixed LANGUAGE_CODE_ENGLISH = 'en'

LANGUAGE_CODE_GERMAN

German language code.

protected mixed LANGUAGE_CODE_GERMAN = 'de'

LANGUAGE_ID_GERMAN

German language ID.

protected mixed LANGUAGE_ID_GERMAN = 2

CATEGORIES

Multilingual categories.

private mixed CATEGORIES = [self::LANGUAGE_CODE_GERMAN => ['> 90', '81-90', '71-80', '61-70', '51-60', '41-50', '31-40', '21-30', '18-20', '< 18', 'Nicht angegeben'], self::LANGUAGE_CODE_ENGLISH => ['> 90', '81-90', '71-80', '61-70', '51-60', '41-50', '31-40', '21-30', '18-20', '< 18', 'Not specified']]

ITEM_TITLES

Multilingual item titles.

private mixed ITEM_TITLES = ['left' => [self::LANGUAGE_CODE_GERMAN => 'Frauen', self::LANGUAGE_CODE_ENGLISH => 'Females'], 'right' => [self::LANGUAGE_CODE_GERMAN => 'Männer', self::LANGUAGE_CODE_ENGLISH => 'Males']]

WIDGET_NAME

Multilingual titles.

private mixed WIDGET_NAME = [self::LANGUAGE_CODE_GERMAN => 'Kundenstruktur', self::LANGUAGE_CODE_ENGLISH => 'Customers Structure']

Properties

Methods

ageGroupIsBiggerOrEqualToLowerEndOfAgeRange()

Return whether the age group is bigger or equal to a given age.

private ageGroupIsBiggerOrEqualToLowerEndOfAgeRange(int $currentAgeGroup, int $currentAgeRangeLowerEnd) : bool
Parameters
$currentAgeGroup : int

Current age group.

$currentAgeRangeLowerEnd : int

Lower end of current age range.

Return values
bool

Result.

ageGroupIsBiggerThanUpperEndOfAgeRange()

Return whether the age group is bigger than the biggest range group.

private ageGroupIsBiggerThanUpperEndOfAgeRange(int $currentAgeGroup, int $currentAgeRangeUpperEnd) : bool
Parameters
$currentAgeGroup : int

Current age group.

$currentAgeRangeUpperEnd : int

Upper end of current age range.

Return values
bool

Result.

getSumOfMaleAndFemaleCustomersGroupedByAgeFromDatabase()

Fetch customers data from database.

private getSumOfMaleAndFemaleCustomersGroupedByAgeFromDatabase() : array<string|int, mixed>
Return values
array<string|int, mixed>

Sum of customers per gender.

groupDemographicByAgeRanges()

Group customers by age groups.

private groupDemographicByAgeRanges(array<string|int, mixed> $customersDemographic, array<string|int, mixed> $ageRanges) : array<string|int, array<string|int, mixed>>
Parameters
$customersDemographic : array<string|int, mixed>

Customer's demographic.

$ageRanges : array<string|int, mixed>

Age ranges.

Return values
array<string|int, array<string|int, mixed>>

Customers grouped by ages.

Search results