CSValueRange
in package
This API offers an interface to the CONTENTSERV value range concept
Using the CSValueRange API you can read and modify ValueRange Types and Values.
Tags
Table of Contents
- INDEPENDENT_LANG_FIELD_NAME = 'value'
- Stores the column name of language independent fields during import/export.
- createRangeType() : CSValueRangeType
- Creates a CSValueRangeType
- createRangeValue() : CSValueRangeValue
- Creates a new CSValueRangeValue
- exportToCSV() : mixed
- Exports all ValueRangeTypes and ValueRangeValues into one Excel or CSV file
- exportToFile() : mixed
- Exports all ValueRangeTypes and ValueRangeValues into one Excel or CSV file
- getRangeType() : CSValueRangeType
- Loads and returns a CSValueRangeType Object
- getRangeTypeByExternalKey() : CSValueRangeType
- Loads and returns a CSValueRangeType Object for a given type label
- getRangeTypeByLabel() : CSValueRangeType
- Loads and returns a CSValueRangeType Object for a given type label
- getRangeTypes() : array<string|int, CSValueRangeType>
- Returns CSValueRangeTypes with a given sql filter
- getRangeValue() : CSValueRangeValue
- Returns a CSValueRangeValue for a given ID
- getRangeValueByExternalKey() : CSValueRangeValue
- Returns a CSValueRangeValue for a given ExternalKey (optional within a given type)
- getRangeValues() : array<string|int, CSValueRangeValue>
- Returns CSValueRangeValues with a given sql filter
- getRangeValuesForType() : array<string|int, CSValueRangeValue>
- Returns all CSValueRangeValues for a given CSValueRangeType ID
- importFromCSV() : int
- Imports all ValueRangeTypes and ValueRangeValues from one Excel or CSV file in the format of the exportToCSV method
- importFromFile() : int
- Imports all ValueRangeTypes and ValueRangeValues from one Excel or CSV file in the format of the exportToFile method
Constants
INDEPENDENT_LANG_FIELD_NAME
Stores the column name of language independent fields during import/export.
public
mixed
INDEPENDENT_LANG_FIELD_NAME
= 'value'
Tags
Methods
createRangeType()
Creates a CSValueRangeType
public
static createRangeType(string $label[, bool $isLanguageDependant = 1 ][, string $description = '' ][, int $ValuerangetypeID = null ][, string $category = '' ][, bool $hasIcon = false ][, mixed $externalKey = null ][, bool $bManualSorting = false ]) : CSValueRangeType
Parameters
- $label : string
-
The new Label of the type
- $isLanguageDependant : bool = 1
-
Whether the type is LanguageDependant
- $description : string = ''
-
The description of the type
- $ValuerangetypeID : int = null
-
An option ID the type should have (it must not exists in the database)
- $category : string = ''
-
The category of the CSType
- $hasIcon : bool = false
-
Whether the type has icons
- $externalKey : mixed = null
- $bManualSorting : bool = false
-
Whether the type values can be sorted manually.
Tags
Return values
CSValueRangeType —createRangeValue()
Creates a new CSValueRangeValue
public
static createRangeValue(int $typeID, string $externalKey[, array<string|int, CSValueRangeLanguageValue>|array<string|int, mixed>|string $values = array() ], int $parentID, bool $isFolder[, int $valueRangeValueID = null ][, string $sIcon = '' ]) : CSValueRangeValue
Parameters
- $typeID : int
-
The ID of the CSValueRangeValue CSValueRangeType
- $externalKey : string
-
The External Key
- $values : array<string|int, CSValueRangeLanguageValue>|array<string|int, mixed>|string = array()
-
The value range values which should be created. Expected format if the range type is language independent:
- (string) Value
- (object) CSValueRangeLanguageValue
Expected format if the range type is language dependent:
- (array) array(LanguageID/LanguageShortName => Value)
- (array) array(CSValueRangeLanguageValue, CSValueRangeLanguageValue)
- $parentID : int
-
The ParentID
- $isFolder : bool
-
Whether the new value is a folder
- $valueRangeValueID : int = null
-
An optional ID to insert this value with - it must not be defined in the database
- $sIcon : string = ''
-
The icon to be used for each value
Tags
Return values
CSValueRangeValue —exportToCSV()
Exports all ValueRangeTypes and ValueRangeValues into one Excel or CSV file
public
static exportToCSV(string $file[, bool $excel = false ][, mixed $defaultAction = 'U' ]) : mixed
Parameters
- $file : string
-
the path to the target file
- $excel : bool = false
-
whether a Excel (true) or CSV (false) file should be created
- $defaultAction : mixed = 'U'
Tags
Return values
mixed —exportToFile()
Exports all ValueRangeTypes and ValueRangeValues into one Excel or CSV file
public
static exportToFile(string $sFile[, bool $bExcel = false ][, string $sDefaultAction = 'U' ]) : mixed
Parameters
- $sFile : string
-
the path to the target file
- $bExcel : bool = false
-
whether an Excel (true) or CSV (false) file should be created
- $sDefaultAction : string = 'U'
Tags
Return values
mixed —getRangeType()
Loads and returns a CSValueRangeType Object
public
static getRangeType(int $ID) : CSValueRangeType
Parameters
- $ID : int
-
the id of the type
Tags
Return values
CSValueRangeType —getRangeTypeByExternalKey()
Loads and returns a CSValueRangeType Object for a given type label
public
static getRangeTypeByExternalKey(string $sExternalKey) : CSValueRangeType
Parameters
- $sExternalKey : string
-
the ExternalKey of the type
Tags
Return values
CSValueRangeType —getRangeTypeByLabel()
Loads and returns a CSValueRangeType Object for a given type label
public
static getRangeTypeByLabel(string $label) : CSValueRangeType
Parameters
- $label : string
-
the label of the type
Tags
Return values
CSValueRangeType —getRangeTypes()
Returns CSValueRangeTypes with a given sql filter
public
static getRangeTypes([string $filter = '1=1' ][, string $sortorder = '' ]) : array<string|int, CSValueRangeType>
Parameters
- $filter : string = '1=1'
-
the sql filter to filter the types for
- $sortorder : string = ''
-
the sort order in which the types should be returned
Tags
Return values
array<string|int, CSValueRangeType> —array of value range types
getRangeValue()
Returns a CSValueRangeValue for a given ID
public
static getRangeValue(string $ID) : CSValueRangeValue
Parameters
- $ID : string
-
the ID of the requested ValueRangeValue
Tags
Return values
CSValueRangeValue —with the given ID
getRangeValueByExternalKey()
Returns a CSValueRangeValue for a given ExternalKey (optional within a given type)
public
static getRangeValueByExternalKey(string $sValueExternalKey[, mixed $mTypeExternalKey = NULL ]) : CSValueRangeValue
Parameters
- $sValueExternalKey : string
-
the ExternalKey of the requested ValueRangeValue
- $mTypeExternalKey : mixed = NULL
-
the ExternalKey (as string) or the ID (as casted integer) of the requested ValueRangeType
Tags
Return values
CSValueRangeValue —with the given ExternalKey
getRangeValues()
Returns CSValueRangeValues with a given sql filter
public
static getRangeValues(string $filter[, string $sortorder = '' ]) : array<string|int, CSValueRangeValue>
Parameters
- $filter : string
-
the sql filter to filter the values for
- $sortorder : string = ''
-
the sort order in which the values should be returned
Tags
Return values
array<string|int, CSValueRangeValue> —array of values
getRangeValuesForType()
Returns all CSValueRangeValues for a given CSValueRangeType ID
public
static getRangeValuesForType(int $typeID) : array<string|int, CSValueRangeValue>
Parameters
- $typeID : int
-
the ID of the requested CSValueRangeType
Tags
Return values
array<string|int, CSValueRangeValue> —array with values range values
importFromCSV()
Imports all ValueRangeTypes and ValueRangeValues from one Excel or CSV file in the format of the exportToCSV method
public
static importFromCSV(string $file) : int
Parameters
- $file : string
-
the path to the file containing the data
Tags
Return values
int —the count of inserted elements
importFromFile()
Imports all ValueRangeTypes and ValueRangeValues from one Excel or CSV file in the format of the exportToFile method
public
static importFromFile(string $sFile) : int
Parameters
- $sFile : string
-
the path to the file containing the data
Tags
Return values
int —the count of inserted elements
