Vtiger_ChartFilter_Model
extends Base
in package
Widget chart model with a filter.
Table of Contents
- $value : array<string|int, mixed>
- $additionalFiltersFields : array<string|int, mixed>
- Additional filters for chart.
- $additionalFiltersFieldsNames : array<string|int, mixed>
- Names of the additional filters fileds.
- $chartType : string
- Type of the chart 'Bar','Line' etc.
- $colors : array<string|int, string>
- Colors.
- $colorsFrom : string
- Colors are from picklist? assigned_user_id? row id? record number? contain value from const (look at the top).
- $colorsFromDividingField : bool
- Should colors be taken from dividing field? (or group field).
- $colorsFromFilter : bool
- Should color be taken from filters?
- $colorsFromRow : string
- Same as above but in ROW_ format look at the top const.
- $customView : CustomView
- Custom view instance.
- $data : array<string|int, mixed>
- Main object we are working on.
- $dividingColumnName : string
- Dividing field name.
- $dividingFieldModel : Vtiger_Field_Model
- Divide field model (for stacked/dividing charts).
- $dividingName : string
- Dividing name (database compatible).
- $extraData : array<string|int, mixed>
- Extra data.
- $fields : array<string|int, mixed>
- All fields for the module.
- $fieldValueColors : array<string|int, string>
- Colors that was used in data already grouped by $groupValue or $dividingValue - it depends on areColorsFromDividingField.
- $filterIds : array<string|int, int>
- Filter ids.
- $groupColumnName : string
- Group field name.
- $groupFieldModel : Vtiger_Field_Model
- Group field model.
- $groupName : string
- Group name (database table compatible).
- $numRows : array<string|int, mixed>
- Total number of rows grouped by fieldName and displayValue.
- $queries : array<string|int, mixed>
- Query generator queries (for multiple filters).
- $rows : array<string|int, mixed>
- Rows from query.
- $searchParams : array<string|int, mixed>
- Url search params.
- $sectors : string
- Do we have sector?
- $sectorValues : array<string|int, mixed>
- Sector values.
- $singleColors : array<string|int, mixed>
- Colors for dataset color generation.
- $stacked : bool
- Chart has stacked scales ?
- $targetModuleModel : Vtiger_Module_Model
- Target module model.
- $valueFieldModel : Vtiger_Field_Model
- Sum value field object.
- $valueName : string
- Value name from extra data.
- $valueType : string
- Value type from extra data.
- $viewNames : array<string|int, mixed>
- Custom view names.
- $widgetModel : Vtiger_Widget_Model
- Widget model.
- __construct() : mixed
- Constructor.
- areColorsFromDividingField() : bool
- Determine if colors should be taken from dividingField.
- areColorsFromFilter() : bool
- Determine if colors should be taken from filters.
- convertToUserFormat() : mixed
- Convert to user format.
- get() : mixed
- Function to get the value for a given key.
- getAdditionalFiltersFields() : array<string|int, mixed>
- Get additional filters fields.
- getArray() : array<string|int, mixed>
- Function to get the array values for a given key.
- getChartData() : array<string|int, mixed>
- Get chart data.
- getData() : array<string|int, mixed>
- Function to get all the values of the Object.
- getExtraData() : mixed
- Get extra data.
- getFields() : array<string|int, mixed>
- Get all available fields for additional filter.
- getFilterId() : int
- Get filter id.
- getFilterIds() : array<string|int, int>
- Get filters ids.
- getForHtml() : mixed
- Function to get the html encoded value for a given key.
- getForSql() : mixed
- Function to get the value if its safe to use for SQL Query (column).
- getInstance() : self
- Get instance.
- getKeys() : array<string|int, string>
- Function to get keys.
- getListViewURL() : string
- Get list view url.
- getTargetModule() : string
- Get target module.
- getTargetModuleModel() : Vtiger_Module_Model
- Get target module model.
- getTitle() : string
- Get title.
- getTotalCountURL() : string
- Get total count url.
- getType() : string
- Get type.
- getValueType() : string
- Gets value type.
- has() : bool
- Function to check if the key exists.
- isColor() : mixed
- isDividedByField() : bool
- Is chart divided (grouped by two fields).
- isDownloadable() : bool
- Check if widget is downloadable.
- isEmpty() : bool
- Function to check if the key is empty.
- isGrouped() : bool
- Is chart grouped by field?
- isMultiFilter() : bool
- Do we have multiple filters?
- isSingleColored() : bool
- Some of chart types doesn't have colors for each data.
- isStacked() : bool
- Determine if chart is stacked.
- remove() : mixed
- Function to remove the value.
- set() : $this
- Function to set the value for a given key.
- setData() : $this
- Function to set all the values.
- setWidgetModel() : mixed
- Set widget model.
- addData() : mixed
- Add data to data placeholder ;).
- addPicklistsToQuery() : mixed
- Add query to get picklists id (for colors).
- addRow() : mixed
- Add row.
- addValue() : mixed
- Add value to rows (other than $this->valueType).
- buildSingleColors() : mixed
- Build single color from array of dataset colors It could be used to generate gradient for line charts or return one color that will represent line background.
- calculateAverage() : mixed
- Calculate average data if needed.
- convertSectorsToData() : array<string|int, mixed>
- Convert collected sectors to data (funnel chart).
- findOutColorsFromRows() : string
- Find out on which color type we are operating.
- getCurrentRows() : mixed
- Get current rows.
- getFieldValueColor() : string
- Get color from existing colors.
- getFieldValuesFromRow() : array<string|int, mixed>
- Get field values from row.
- getQueries() : array<string|int, Query>
- Get chart queries.
- getQuery() : Query
- Get query for specified filter.
- getRows() : array<string|int, mixed>
- Get rows.
- getRowsDb() : array<string|int, mixed>
- Get rows for dividing field chart.
- getSearchParamValue() : array<string|int, mixed>
- Get search param value.
- getValue() : int
- Get concrete value from data.
- getValueFromRow() : mixed
- Get value from db record.
- getViewIdFromName() : int|string|null
- Get view id from view name.
- getViewNameFromId() : mixed
- Get view name.
- incNumRows() : mixed
- Increase number of rows for average calculation.
- iterateAllRows() : mixed
- Iterate through all rows collected from db.
- normalizeData() : mixed
- Normalize dividing charts so they have equal number of data.
- setChartDatasetsColorsMulti() : mixed
- By default all charts except line can have multiple colors in dataset each data should have individual color this function is trying to get color from couple sources if available.
- setChartDatasetsColorsSingle() : mixed
- Gather information about data colors Later we can build gradient or generate one color for line charts.
- setColorFromRow() : mixed
- Set color for row in $this->data.
- setColorsFrom() : mixed
- Set colors.
- setColorsFromAssignedUserId() : mixed
- Set colors from assigned user.
- setColorsFromFilters() : mixed
- Set colors from filters.
- setColorsFromPickList() : mixed
- Set colors from picklist.
- setColorsFromRecordId() : mixed
- Set colors from record id.
- setColorsFromRecordNumber() : mixed
- Set colors from record number (array index).
- setLinkFromRow() : mixed
- Set link from row in $this->data.
- setUpModelFields() : mixed
- Set up model fields.
- setValueFromRow() : array<string|int, mixed>
- Get chart value for row (dividing chart).
- setChartHeaders() : mixed
- Get headers from list view that are used in chart.
- setFilterIds() : array<string|int, int>
- Set filter ids.
Properties
$value
protected
array<string|int, mixed>
$value
Values
$additionalFiltersFields
Additional filters for chart.
private
array<string|int, mixed>
$additionalFiltersFields
= []
$additionalFiltersFieldsNames
Names of the additional filters fileds.
private
array<string|int, mixed>
$additionalFiltersFieldsNames
= []
$chartType
Type of the chart 'Bar','Line' etc.
private
string
$chartType
$colors
Colors.
private
array<string|int, string>
$colors
= []
$colorsFrom
Colors are from picklist? assigned_user_id? row id? record number? contain value from const (look at the top).
private
string
$colorsFrom
$colorsFromDividingField
Should colors be taken from dividing field? (or group field).
private
bool
$colorsFromDividingField
= \false
$colorsFromFilter
Should color be taken from filters?
private
bool
$colorsFromFilter
= \false
$colorsFromRow
Same as above but in ROW_ format look at the top const.
private
string
$colorsFromRow
$customView
Custom view instance.
private
CustomView
$customView
$data
Main object we are working on.
private
array<string|int, mixed>
$data
= []
$dividingColumnName
Dividing field name.
private
string
$dividingColumnName
$dividingFieldModel
Divide field model (for stacked/dividing charts).
private
Vtiger_Field_Model
$dividingFieldModel
$dividingName
Dividing name (database compatible).
private
string
$dividingName
$extraData
Extra data.
private
array<string|int, mixed>
$extraData
$fields
All fields for the module.
private
array<string|int, mixed>
$fields
= []
$fieldValueColors
Colors that was used in data already grouped by $groupValue or $dividingValue - it depends on areColorsFromDividingField.
private
array<string|int, string>
$fieldValueColors
= []
$filterIds
Filter ids.
private
array<string|int, int>
$filterIds
= []
$groupColumnName
Group field name.
private
string
$groupColumnName
$groupFieldModel
Group field model.
private
Vtiger_Field_Model
$groupFieldModel
$groupName
Group name (database table compatible).
private
string
$groupName
$numRows
Total number of rows grouped by fieldName and displayValue.
private
array<string|int, mixed>
$numRows
= []
['leadstatus']['Odrzucone'] === 2
$queries
Query generator queries (for multiple filters).
private
array<string|int, mixed>
$queries
= []
$rows
Rows from query.
private
array<string|int, mixed>
$rows
= []
$searchParams
Url search params.
private
array<string|int, mixed>
$searchParams
= []
$sectors
Do we have sector?
private
string
$sectors
$sectorValues
Sector values.
private
array<string|int, mixed>
$sectorValues
= []
$singleColors
Colors for dataset color generation.
private
array<string|int, mixed>
$singleColors
= []
$stacked
Chart has stacked scales ?
private
bool
$stacked
= \false
$targetModuleModel
Target module model.
private
Vtiger_Module_Model
$targetModuleModel
$valueFieldModel
Sum value field object.
private
Vtiger_Field_Model
$valueFieldModel
$valueName
Value name from extra data.
private
string
$valueName
$valueType
Value type from extra data.
private
string
$valueType
$viewNames
Custom view names.
private
array<string|int, mixed>
$viewNames
= []
$widgetModel
Widget model.
private
Vtiger_Widget_Model
$widgetModel
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $values = [] ]) : mixed
Parameters
- $values : array<string|int, mixed> = []
Return values
mixed —areColorsFromDividingField()
Determine if colors should be taken from dividingField.
public
areColorsFromDividingField() : bool
Return values
bool —areColorsFromFilter()
Determine if colors should be taken from filters.
public
areColorsFromFilter() : bool
Return values
bool —convertToUserFormat()
Convert to user format.
public
convertToUserFormat(mixed $value) : mixed
Parameters
- $value : mixed
Return values
mixed —get()
Function to get the value for a given key.
public
get(string $key) : mixed
Parameters
- $key : string
Return values
mixed —Value for the given key
getAdditionalFiltersFields()
Get additional filters fields.
public
getAdditionalFiltersFields() : array<string|int, mixed>
Return values
array<string|int, mixed> —getArray()
Function to get the array values for a given key.
public
getArray(string $key[, array<string|int, mixed> $value = [] ]) : array<string|int, mixed>
Parameters
- $key : string
- $value : array<string|int, mixed> = []
Return values
array<string|int, mixed> —getChartData()
Get chart data.
public
getChartData() : array<string|int, mixed>
Return values
array<string|int, mixed> —getData()
Function to get all the values of the Object.
public
getData() : array<string|int, mixed>
Return values
array<string|int, mixed> —getExtraData()
Get extra data.
public
getExtraData(string $key) : mixed
Parameters
- $key : string
Return values
mixed —getFields()
Get all available fields for additional filter.
public
getFields() : array<string|int, mixed>
Return values
array<string|int, mixed> —getFilterId()
Get filter id.
public
getFilterId(int|string $dividingValue) : int
Parameters
- $dividingValue : int|string
Return values
int —getFilterIds()
Get filters ids.
public
getFilterIds() : array<string|int, int>
Return values
array<string|int, int> —getForHtml()
Function to get the html encoded value for a given key.
public
getForHtml(string $key) : mixed
Parameters
- $key : string
Return values
mixed —getForSql()
Function to get the value if its safe to use for SQL Query (column).
public
getForSql(string $key[, bool $skipEmtpy = true ]) : mixed
Parameters
- $key : string
- $skipEmtpy : bool = true
-
Skip the check if string is empty
Return values
mixed —Value for the given key
getInstance()
Get instance.
public
static getInstance(int $linkId, int $userId) : self
Parameters
- $linkId : int
- $userId : int
Return values
self —getKeys()
Function to get keys.
public
getKeys() : array<string|int, string>
Return values
array<string|int, string> —getListViewURL()
Get list view url.
public
getListViewURL(int $dividingValue) : string
Parameters
- $dividingValue : int
Return values
string —getTargetModule()
Get target module.
public
getTargetModule() : string
Return values
string —getTargetModuleModel()
Get target module model.
public
getTargetModuleModel() : Vtiger_Module_Model
Return values
Vtiger_Module_Model —getTitle()
Get title.
public
getTitle([string $prefix = '' ]) : string
Parameters
- $prefix : string = ''
Return values
string —getTotalCountURL()
Get total count url.
public
getTotalCountURL() : string
Return values
string —getType()
Get type.
public
getType([bool $lowerCase = false ]) : string
Parameters
- $lowerCase : bool = false
Return values
string —getValueType()
Gets value type.
public
getValueType() : string
Return values
string —has()
Function to check if the key exists.
public
has(string $key) : bool
Parameters
- $key : string
Return values
bool —isColor()
public
isColor() : mixed
Return values
mixed —isDividedByField()
Is chart divided (grouped by two fields).
public
isDividedByField() : bool
Return values
bool —isDownloadable()
Check if widget is downloadable.
public
isDownloadable() : bool
Return values
bool —isEmpty()
Function to check if the key is empty.
public
isEmpty(string $key) : bool
Parameters
- $key : string
Return values
bool —isGrouped()
Is chart grouped by field?
public
isGrouped() : bool
Return values
bool —isMultiFilter()
Do we have multiple filters?
public
isMultiFilter() : bool
Return values
bool —isSingleColored()
Some of chart types doesn't have colors for each data.
public
isSingleColored() : bool
Return values
bool —isStacked()
Determine if chart is stacked.
public
isStacked() : bool
Return values
bool —remove()
Function to remove the value.
public
remove(string $key) : mixed
Parameters
- $key : string
Return values
mixed —set()
Function to set the value for a given key.
public
set(string $key, mixed $value) : $this
Parameters
- $key : string
- $value : mixed
Return values
$this —setData()
Function to set all the values.
public
setData(mixed $values) : $this
Parameters
- $values : mixed
Return values
$this —setWidgetModel()
Set widget model.
public
setWidgetModel(Vtiger_Widget_Model $widgetModel) : mixed
Parameters
- $widgetModel : Vtiger_Widget_Model
Tags
Return values
mixed —addData()
Add data to data placeholder ;).
protected
addData(mixed $value, int|string $groupValue, int|string $dividingValue) : mixed
Parameters
- $value : mixed
- $groupValue : int|string
- $dividingValue : int|string
Return values
mixed —addPicklistsToQuery()
Add query to get picklists id (for colors).
protected
addPicklistsToQuery(QueryGenerator $queryGenerator) : mixed
Parameters
- $queryGenerator : QueryGenerator
Return values
mixed —addRow()
Add row.
protected
addRow(array<string|int, mixed> $row, int|string $groupValue, int|string $dividingValue) : mixed
Parameters
- $row : array<string|int, mixed>
- $groupValue : int|string
- $dividingValue : int|string
Return values
mixed —addValue()
Add value to rows (other than $this->valueType).
protected
addValue(string $valueType, mixed $value, int|string $groupValue, int|string $dividingValue) : mixed
Parameters
- $valueType : string
- $value : mixed
- $groupValue : int|string
- $dividingValue : int|string
Return values
mixed —buildSingleColors()
Build single color from array of dataset colors It could be used to generate gradient for line charts or return one color that will represent line background.
protected
buildSingleColors( &$chartData) : mixed
Parameters
Return values
mixed —calculateAverage()
Calculate average data if needed.
protected
calculateAverage() : mixed
Return values
mixed —convertSectorsToData()
Convert collected sectors to data (funnel chart).
protected
convertSectorsToData() : array<string|int, mixed>
Return values
array<string|int, mixed> —findOutColorsFromRows()
Find out on which color type we are operating.
protected
findOutColorsFromRows() : string
Return values
string —getCurrentRows()
Get current rows.
protected
getCurrentRows(int|string $groupValue, int|string $dividingValue) : mixed
Parameters
- $groupValue : int|string
- $dividingValue : int|string
Return values
mixed —getFieldValueColor()
Get color from existing colors.
protected
getFieldValueColor( $groupValue, $dividingValue) : string
Parameters
Return values
string —getFieldValuesFromRow()
Get field values from row.
protected
getFieldValuesFromRow(array<string|int, mixed> $row, int|string $dividingValue) : array<string|int, mixed>
We are operating on groupValue and dividingValue regularly so this fn will return this values from row.
Parameters
- $row : array<string|int, mixed>
- $dividingValue : int|string
Return values
array<string|int, mixed> —getQueries()
Get chart queries.
protected
getQueries() : array<string|int, Query>
Return values
array<string|int, Query> —getQuery()
Get query for specified filter.
protected
getQuery( $filter) : Query
Parameters
Return values
Query —getRows()
Get rows.
protected
getRows() : array<string|int, mixed>
Return values
array<string|int, mixed> —getRowsDb()
Get rows for dividing field chart.
protected
getRowsDb(Query $query, int|string $dividingValue) : array<string|int, mixed>
Parameters
- $query : Query
- $dividingValue : int|string
Return values
array<string|int, mixed> —getSearchParamValue()
Get search param value.
protected
getSearchParamValue(Vtiger_Field_Model $fieldModel, mixed $value) : array<string|int, mixed>
Parameters
- $fieldModel : Vtiger_Field_Model
- $value : mixed
Return values
array<string|int, mixed> —getValue()
Get concrete value from data.
protected
getValue(string $valueType, int|string $groupValue, int|string $dividingValue) : int
Parameters
- $valueType : string
- $groupValue : int|string
- $dividingValue : int|string
Return values
int —getValueFromRow()
Get value from db record.
protected
getValueFromRow(array<string|int, mixed> $row) : mixed
Parameters
- $row : array<string|int, mixed>
Return values
mixed —getViewIdFromName()
Get view id from view name.
protected
getViewIdFromName(string $viewName) : int|string|null
Parameters
- $viewName : string
Return values
int|string|null —getViewNameFromId()
Get view name.
protected
getViewNameFromId(int $cvid) : mixed
Parameters
- $cvid : int
Return values
mixed —incNumRows()
Increase number of rows for average calculation.
protected
incNumRows( $groupValue, $dividingValue, mixed $count) : mixed
Parameters
Return values
mixed —iterateAllRows()
Iterate through all rows collected from db.
protected
iterateAllRows(callable $callback) : mixed
Parameters
- $callback : callable
Return values
mixed —normalizeData()
Normalize dividing charts so they have equal number of data.
protected
normalizeData() : mixed
Return values
mixed —setChartDatasetsColorsMulti()
By default all charts except line can have multiple colors in dataset each data should have individual color this function is trying to get color from couple sources if available.
protected
setChartDatasetsColorsMulti( &$chartData, $datasetIndex, $dataset, $groupValue, $group, $dividingValue, $dividing) : mixed
Parameters
Return values
mixed —setChartDatasetsColorsSingle()
Gather information about data colors Later we can build gradient or generate one color for line charts.
protected
setChartDatasetsColorsSingle(array<string|int, mixed> &$chartData, mixed $datasetIndex, mixed $dataset, mixed $groupValue, array<string|int, mixed> $group, mixed $dividingValue, mixed $dividing) : mixed
Parameters
- $chartData : array<string|int, mixed>
- $datasetIndex : mixed
- $dataset : mixed
- $groupValue : mixed
- $group : array<string|int, mixed>
- $dividingValue : mixed
- $dividing : mixed
Return values
mixed —setColorFromRow()
Set color for row in $this->data.
protected
setColorFromRow(array<string|int, mixed> $row, mixed $groupValue, mixed $dividingValue) : mixed
Parameters
- $row : array<string|int, mixed>
- $groupValue : mixed
- $dividingValue : mixed
Return values
mixed —setColorsFrom()
Set colors.
protected
setColorsFrom(string $from) : mixed
Parameters
- $from : string
Return values
mixed —setColorsFromAssignedUserId()
Set colors from assigned user.
protected
setColorsFromAssignedUserId() : mixed
Return values
mixed —setColorsFromFilters()
Set colors from filters.
protected
setColorsFromFilters() : mixed
Return values
mixed —setColorsFromPickList()
Set colors from picklist.
protected
setColorsFromPickList() : mixed
Return values
mixed —setColorsFromRecordId()
Set colors from record id.
protected
setColorsFromRecordId() : mixed
Return values
mixed —setColorsFromRecordNumber()
Set colors from record number (array index).
protected
setColorsFromRecordNumber() : mixed
Return values
mixed —setLinkFromRow()
Set link from row in $this->data.
protected
setLinkFromRow(array<string|int, mixed> $row, mixed $groupValue, mixed $dividingValue) : mixed
Parameters
- $row : array<string|int, mixed>
- $groupValue : mixed
- $dividingValue : mixed
Tags
Return values
mixed —setUpModelFields()
Set up model fields.
protected
setUpModelFields() : mixed
Return values
mixed —setValueFromRow()
Get chart value for row (dividing chart).
protected
setValueFromRow(array<string|int, mixed> $row, int|string $groupValue, int|string $dividingValue) : array<string|int, mixed>
Parameters
- $row : array<string|int, mixed>
- $groupValue : int|string
- $dividingValue : int|string
Return values
array<string|int, mixed> —setChartHeaders()
Get headers from list view that are used in chart.
private
setChartHeaders() : mixed
Return values
mixed —setFilterIds()
Set filter ids.
private
setFilterIds() : array<string|int, int>