kernel/classes/ezcontentlanguage.php
File containing the eZContentLanguage class.
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Package
- kernel
- Version
- 4.6.0
\eZContentLanguage
File containing the eZContentLanguage class.
- Parent(s)
- \eZPersistentObject
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Version
- 4.6.0
Constants
Properties

$PersistentDataDirty= ''
- Type
- n/a
- Inherited_from
- \eZPersistentObject::$$PersistentDataDirty
Methods

addLanguage(
$locale, $name
=
null
)
:
voidAdds new language to the site.
\param locale Locale code (e.g. 'slk-SK') of language to add. \param name Optional. Name of the language. If not specified, the international language name for the $locale locale will be used. \return eZContentLanguage object of the added language (or the existing one if specified language has been already used) or false in case of any error (invalid locale code or already reached eZContentLanguage::MAX_COUNT languages). \static
| Name | Type | Description |
|---|---|---|
| $locale | ||
| $name |

attribute(
$attr, $noFunction
=
false
)
:
void| Name | Type | Description |
|---|---|---|
| $attr | ||
| $noFunction |

clearCronjobMode(
)
:
voidSwitches off the cronjob mode.
\see eZContentLanguage::setCronjobMode()

clearPrioritizedLanguages(
)
:
voidClears the prioritized language list set by eZContentLanguage::setPrioritizedLanguages and reloading the list from INI settings.
\static

count(
$def, $conds
=
null, $field
=
null
)
:
void
| Name | Type | Description |
|---|---|---|
| $def | ||
| $conds | ||
| $field |

decodeLanguageMask(
int $langMask, boolean $returnLanguageLocale
=
false
)
:
arrayDecodes $langMask into all languages it comprises and whether or not the language mask signifies always available or not.
The constituent languages are returned as an array of language ids. If the second parameter, $returnLanguageLocale is set to TRUE, locale-codes are used instead of language ids.
| Name | Type | Description |
|---|---|---|
| $langMask | int | |
| $returnLanguageLocale | boolean |
| Type | Description |
|---|---|
| array |

eZContentLanguage(
$row
=
array()
)
:
voidConstructor.
\param row Parameter passed to the constructor of eZPersistentObject.
| Name | Type | Description |
|---|---|---|
| $row |

eZPersistentObject(
$row
)
:
void| Name | Type | Description |
|---|---|---|
| $row |

expireCache(
)
:
voidRemoves all memory cache forcing it to read from database again for next method calls.
\static

fetch(
$id
)
:
voidFetches the language identified by ID.
\param id Identifier of the language to fetch. \return eZContentLanguage object of language identified by ID $id. \static
| Name | Type | Description |
|---|---|---|
| $id |

fetchByLocale(
$locale, $createIfNotExist
=
false
)
:
voidFetches the language identified by locale code.
\param locale Locale of the language to fetch, e. g. 'slk-SK'. \return eZContentLanguage object identified by locale code $locale.
| Name | Type | Description |
|---|---|---|
| $locale | ||
| $createIfNotExist |

fetchLimitationList(
$forceReloading
=
false
)
:
voidFetches the array with names and IDs of the languages used on the site. This method is used by the permission system.
\param forceReloading Optional. If true, the list will be fetched from database even if it is cached in memory. Default value is false. \return Array with names and IDs of the languages used on the site. \static
| Name | Type | Description |
|---|---|---|
| $forceReloading |

fetchList(
$forceReloading
=
false
)
:
voidFetches the list of the languages used on the site.
\param forceReloading Optional. If true, the list will be fetched from database even if it is cached in memory. Default value is false. \return Array of the eZContentLanguage objects of languages used on the site. \static
| Name | Type | Description |
|---|---|---|
| $forceReloading |

fetchLocaleList(
)
:
voidFetches the array of locale codes of the languages used on the site.
\return Array of locale codes of the languages used on the site. \static

fetchObject(
$def, $field_filters, $conds, $asObject
=
true, $grouping
=
null, $custom_fields
=
null
)
:
void
| Name | Type | Description |
|---|---|---|
| $def | ||
| $field_filters | ||
| $conds | ||
| $asObject | ||
| $grouping | ||
| $custom_fields |

fetchObjectList(
$def, $field_filters
=
null, $conds
=
null, $sorts
=
null, $limit
=
null, $asObject
=
true, $grouping
=
false, $custom_fields
=
null, $custom_tables
=
null, $custom_conds
=
null
)
:
void
| Name | Type | Description |
|---|---|---|
| $def | ||
| $field_filters | ||
| $conds | ||
| $sorts | ||
| $limit | ||
| $asObject | ||
| $grouping | ||
| $custom_fields | ||
| $custom_tables | ||
| $custom_conds |

fill(
$row
)
:
void| Name | Type | Description |
|---|---|---|
| $row |

getShortAttributeName(
$db, $def, $attrName
)
:
void
| Name | Type | Description |
|---|---|---|
| $db | ||
| $def | ||
| $attrName |

handleRows(
$rows, $class_name, $asObject
)
:
void
| Name | Type | Description |
|---|---|---|
| $rows | ||
| $class_name | ||
| $asObject |

hasAttribute(
$attr
)
:
void| Name | Type | Description |
|---|---|---|
| $attr |

idByLocale(
$locale
)
:
void\static Returns id of the language specified.
\param locale String specifying locale code of the language, e. g. 'slk-SK' \return ID of the language specified by locale or false if the language is not set on the site.
| Name | Type | Description |
|---|---|---|
| $locale |

jsArrayByMask(
$mask
)
:
voidReturns the Javascript array with locale codes and names of the languages which have set the corresponding bit in specified mask.
\param mask Bitmap mask specifying which languages should be considered. \return JavaScript array described above.
| Name | Type | Description |
|---|---|---|
| $mask |

languagesByMask(
$mask
)
:
voidReturns array of languages which have set the corresponding bit in the mask.
\param mask Bitmap specifying which languages should be returned. \return Array of eZContentLanguage objects of languages which have set the corresponding bit in $mask.
| Name | Type | Description |
|---|---|---|
| $mask |

languagesSQLFilter(
$languageListTable, $languageListAttributeName
=
'language_mask'
)
:
voidReturns the SQL where-condition for selecting the rows (objects, object versions) which exist in any of prioritized languages or are always available.
\param languageListTable Name of the table \param languageListAttributeName Optional. Name of the attribute in the table which contains the bitmap mask. 'language_mask' by default. \return SQL where-condition described above. \static
| Name | Type | Description |
|---|---|---|
| $languageListTable | ||
| $languageListAttributeName |

maskByLocale(
$locales, $setZerothBit
=
false
)
:
voidReturns bitmap mask for the specified languages.
\param locales Array of strings or a string specifying locale codes of the languages, e. g. 'slk-SK' or array( 'eng-GB', 'nor-NO' ) \param setZerothBit Optional. Specifies if the 0-th bit of mask should be set. False by default. \return Bitmap mask having set the corresponding bits for the specified languages.
| Name | Type | Description |
|---|---|---|
| $locales | ||
| $setZerothBit |

maskForRealLanguages(
)
:
void\return The bitmap mask containing all languages, i. e. the sum of the IDs of all languages. (The 0-th bit is set.)

newObjectOrder(
$def, $orderField, $conditions
)
:
void
| Name | Type | Description |
|---|---|---|
| $def | ||
| $orderField | ||
| $conditions |

objectInitialCount(
)
:
void\return The count of objects having this language as the initial/main one.

prioritizedLanguageCodes(
)
:
voidReturns the array of the locale codes of the prioritized languages (in the correct order).
\return Array of the locale codes of the prioritized languages (in the correct order). \see eZContentLanguage::prioritizedLanguages() \static

prioritizedLanguages(
$languageList
=
false
)
:
voidFetches the list of the prioritized languages (in the correct order).
\param languageList Optional. If specified, this array of locale codes with will override the INI settings. Usage of this parameter is restricted to methods of this class! See eZContentLanguage::setPrioritizedLanguages(). \return Array of the eZContentLanguage objects of the prioritized languages. \static
| Name | Type | Description |
|---|---|---|
| $languageList |

prioritizedLanguagesByLocaleList(
$languageLocaleList
)
:
voidReturns array of prioritized languages which are listed in \a $languageLocaleList.
The function does the same as 'prioritizedLanguagesByMask' but uses language locale list instead of language mask.
\param languageLocaleList List of language locales to choose from. \return Array of eZContentLanguage objects of prioritized languages which have set the corresponding bit in $mask.
| Name | Type | Description |
|---|---|---|
| $languageLocaleList |

prioritizedLanguagesByMask(
$mask
)
:
voidReturns array of prioritized languages which have set the corresponding bit in the mask.
\param mask Bitmap specifying which languages should be returned. \return Array of eZContentLanguage objects of prioritized languages which have set the corresponding bit in $mask.
| Name | Type | Description |
|---|---|---|
| $mask |

remove(
$conditions
=
null, $extraConditions
=
null
)
:
void| Name | Type | Description |
|---|---|---|
| $conditions | ||
| $extraConditions |

removeLanguage(
$id
)
:
voidRemoves the language specified by ID.
\param id ID of the language to be removed. \return True if the language was removed from the site, false otherwise. \static
| Name | Type | Description |
|---|---|---|
| $id |

removeObject(
$def, $conditions
=
null, $extraConditions
=
null
)
:
void
| Name | Type | Description |
|---|---|---|
| $def | ||
| $conditions | ||
| $extraConditions |

removeThis(
)
:
voidRemoves the language if there is no object having translation in it.
\return True if the language was removed from the site, false otherwise.

reorderObject(
$def, $orderField, $conditions, $down
=
true
)
:
void
| Name | Type | Description |
|---|---|---|
| $def | ||
| $orderField | ||
| $conditions | ||
| $down |

replaceFieldsWithShortNames(
$db, $fieldDefs, $fields
)
:
void
| Name | Type | Description |
|---|---|---|
| $db | ||
| $fieldDefs | ||
| $fields |

setAttribute(
$attr, $val
)
:
void| Name | Type | Description |
|---|---|---|
| $attr | ||
| $val |

setCronjobMode(
$enable
=
true
)
:
voidSwitches on the cronjob mode. In this mode, the languages which are not in the list of the prioritized languages will be automatically added to it.
\param enable Optional. If false, it will switch off the cronjob mode. True by default.
| Name | Type | Description |
|---|---|---|
| $enable |

setHasDirtyData(
$hasDirtyData
)
:
void| Name | Type | Description |
|---|---|---|
| $hasDirtyData |

setPrioritizedLanguages(
$languages
)
:
voidOverrides the prioritized languages set by INI settings with the specified languages.
\param languages Locale codes of the languages which will override the prioritized languages (the order is relevant). \static
| Name | Type | Description |
|---|---|---|
| $languages |

sqlFilter(
$languageTable, $languageListTable
=
null, $languageAttributeName
=
'language_id', $languageListAttributeName
=
'language_mask'
)
:
voidReturns the SQL where-condition for selecting the rows (with object names, attributes etc.) in the correct language, i. e. in the most prioritized language from those in which an object exists.
\param languageTable Name of the table containing the attribute with the language id. \param languageListTable Name of the table containing the attribute with the available languages bitmap. \param languageAttributeName Optional. Name of the attribute in $languageTable which contains the language id. 'language_id' by default. \param languageListAttributeName Optional. Name of the attribute in $languageListTable which contains the bitmap mask. 'language_mask' by default. \return SQL where-condition described above.
| Name | Type | Description |
|---|---|---|
| $languageTable | ||
| $languageListTable | ||
| $languageAttributeName | ||
| $languageListAttributeName |

store(
$fieldFilters
=
null
)
:
void| Name | Type | Description |
|---|---|---|
| $fieldFilters |

storeObject(
$obj, $fieldFilters
=
null
)
:
void
| Name | Type | Description |
|---|---|---|
| $obj | ||
| $fieldFilters |

swapRow(
$table, $keys, $order_id, $rows, $id1, $id2
)
:
void
| Name | Type | Description |
|---|---|---|
| $table | ||
| $keys | ||
| $order_id | ||
| $rows | ||
| $id1 | ||
| $id2 |

sync(
$fieldFilters
=
null
)
:
void| Name | Type | Description |
|---|---|---|
| $fieldFilters |

topPriorityLanguage(
)
:
voidReturns the most prioritized language.
\return eZContentLanguage object for the most prioritized language. \static

topPriorityLanguageByLocaleList(
$languageLocaleList
)
:
voidReturns the most prioritized language from specified by \a $languageLocaleList list of language locales.
The function does the same as 'topPriorityLanguageByMask' but uses language locale list instead of language mask.
\param languageLocaleList List of language locales to choose from. \return eZContentLanguage object of the most prioritized language.
| Name | Type | Description |
|---|---|---|
| $languageLocaleList |

topPriorityLanguageByMask(
$mask
)
:
voidReturns the most prioritized language which has set the corresponding bit in the mask.
\param mask Bitmap specifying which languages should be checked. \return eZContentLanguage object of the most prioritized language which have set the corresponding bit in $mask.
| Name | Type | Description |
|---|---|---|
| $mask |