eZPublishCommunityProject(LegacyStack)  2013.5
eZContentLanguage Class Reference
+ Inheritance diagram for eZContentLanguage:
+ Collaboration diagram for eZContentLanguage:

Public Member Functions

 classCount ()
 
 eZContentLanguage ($row=array())
 Constructor. More...
 
 localeObject ()
 
 objectCount ()
 
 objectInitialCount ()
 
 removeThis ()
 Removes the language if there is no object having translation in it. More...
 
 translation ()
 
- Public Member Functions inherited from eZPersistentObject
 attribute ($attr, $noFunction=false)
 Returns the attribute data for $attr, this is either returned from the member variables or a member function depending on whether the definition field or function attributes matched. More...
 
 attributes ()
 Returns the attributes for this object, taken from the definition fields and function attributes. More...
 
 eZPersistentObject ($row)
 Initializes the object with the $row. More...
 
 fill ($row)
 Tries to fill in the data in the object by using the object definition which is returned by the function definition() and the database row data $row. More...
 
 hasAttribute ($attr)
 Checks if $attr is part of the definition fields or function attributes. More...
 
 hasDirtyData ()
 Returns true if the data is considered dirty and needs to be stored. More...
 
 remove ($conditions=null, $extraConditions=null)
 Removes the object from the database, it will use the keys in the object definition to figure out which table row should be removed unless $conditions is defined as an array with fieldnames. More...
 
 setAttribute ($attr, $val)
 Sets the attribute $attr to the value $val. More...
 
 setHasDirtyData ($hasDirtyData)
 Sets whether the object has dirty data or not. More...
 
 store ($fieldFilters=null)
 Stores the object in the database, uses storeObject() to do the actual job and passes $fieldFilters to it. More...
 
 sync ($fieldFilters=null)
 Makes sure data is stored if the data is considered dirty. More...
 

Static Public Member Functions

static addLanguage ($locale, $name=null)
 Adds new language to the site. More...
 
static clearCronjobMode ()
 Switches off the cronjob mode. More...
 
static clearPrioritizedLanguages ()
 Clears the prioritized language list set by eZContentLanguage::setPrioritizedLanguages and reloading the list from INI settings. More...
 
static decodeLanguageMask ($langMask, $returnLanguageLocale=false)
 Decodes $langMask into all languages it comprises and whether or not the language mask signifies always available or not. More...
 
static definition ()
 Persistent object's definition. More...
 
static expireCache ()
 Removes all memory cache forcing it to read from database again for next method calls. More...
 
static fetch ($id)
 Fetches the language identified by ID. More...
 
static fetchByLocale ($locale, $createIfNotExist=false)
 Fetches the language identified by locale code. More...
 
static fetchLimitationList ($forceReloading=false)
 Fetches the array with names and IDs of the languages used on the site. More...
 
static fetchList ($forceReloading=false)
 Fetches the list of the languages used on the site. More...
 
static fetchLocaleList ()
 Fetches the array of locale codes of the languages used on the site. More...
 
static idByLocale ($locale)
 Returns id of the language specified. More...
 
static jsArrayByMask ($mask)
 Returns the Javascript array with locale codes and names of the languages which have set the corresponding bit in specified mask. More...
 
static languagesByMask ($mask)
 Returns array of languages which have set the corresponding bit in the mask. More...
 
static languagesSQLFilter ($languageListTable, $languageListAttributeName= 'language_mask')
 Returns the SQL where-condition for selecting the rows (objects, object versions) which exist in any of prioritized languages or are always available. More...
 
static maskByLocale ($locales, $setZerothBit=false)
 Returns bitmap mask for the specified languages. More...
 
static maskForRealLanguages ()
 
static prioritizedLanguageCodes ()
 Returns the array of the locale codes of the prioritized languages (in the correct order). More...
 
static prioritizedLanguages ($languageList=false)
 Fetches the list of the prioritized languages (in the correct order). More...
 
static prioritizedLanguagesByLocaleList ($languageLocaleList)
 Returns array of prioritized languages which are listed in $languageLocaleList. More...
 
static prioritizedLanguagesByMask ($mask)
 Returns array of prioritized languages which have set the corresponding bit in the mask. More...
 
static removeLanguage ($id)
 Removes the language specified by ID. More...
 
static setCronjobMode ($enable=true)
 Switches on the cronjob mode. More...
 
static setPrioritizedLanguages ($languages)
 Overrides the prioritized languages set by INI settings with the specified languages. More...
 
static sqlFilter ($languageTable, $languageListTable=null, $languageAttributeName= 'language_id', $languageListAttributeName= 'language_mask', $lang=false)
 Returns the SQL where-condition for selecting the rows (with object names, attributes etc.) in the correct language, i. More...
 
static topPriorityLanguage ()
 Returns the most prioritized language. More...
 
static topPriorityLanguageByLocaleList ($languageLocaleList)
 Returns the most prioritized language from specified by $languageLocaleList list of language locales. More...
 
static topPriorityLanguageByMask ($mask)
 Returns the most prioritized language which has set the corresponding bit in the mask. More...
 
- Static Public Member Functions inherited from eZPersistentObject
static conditionText ($conditions)
 Calls conditionTextByRow with an empty row and $conditions. More...
 
static conditionTextByRow ($conditions, $row)
 Generates an SQL sentence from the conditions $conditions and row data $row. More...
 
static count ($def, $conds=null, $field=null)
 Fetches the number of rows by using the object definition. More...
 
static definition ()
 Returns the definition for the object, the default implementation is to return an empty array. More...
 
static escapeArray ($array)
 Escapes strings in an array with the help of eZDBInterface::escapeString(). More...
 
static fetchObject ($def, $field_filters, $conds, $asObject=true, $grouping=null, $custom_fields=null)
 Fetches and returns an object based on the given parameters and returns is either as an object or as an array. More...
 
static fetchObjectList ($def, $field_filters=null, $conds=null, $sorts=null, $limit=null, $asObject=true, $grouping=false, $custom_fields=null, $custom_tables=null, $custom_conds=null)
 Creates an SQL query out of the different parameters and returns an array with the result. More...
 
static getShortAttributeName ($db, $def, $attrName)
 Returns the short attribute name (alias) if it's defined, given attribute name otherwise. More...
 
static handleRows ($rows, $class_name, $asObject)
 Creates PHP objects out of the database rows $rows. More...
 
static newObjectOrder ($def, $orderField, $conditions)
 Returns an order value which can be used for new items in table, for instance placement. More...
 
static removeObject ($def, $conditions=null, $extraConditions=null)
 Deletes the object from the table defined in $def with conditions $conditions and extra conditions $extraConditions. More...
 
static reorderObject ($def, $orderField, $conditions, $down=true)
 Moves a row in a database table. More...
 
static replaceFieldsWithShortNames ($db, $fieldDefs, &$fields)
 For the given array $fields treats its keys (for associative array) or values (for non-associative array) as table fields names and replaces them with short names (aliases) found in $fieldDefs. More...
 
static storeObject ($obj, $fieldFilters=null)
 Stores the data in $obj to database. More...
 
static swapRow ($table, $keys, $order_id, $rows, $id1, $id2)
 Sets row id $id2 to have the placement of row id $id1. More...
 
static updateObjectList ($parameters)
 Updates rows matching the given parameters. More...
 

Public Attributes

const MAX_COUNT = 30
 
- Public Attributes inherited from eZPersistentObject
 $PersistentDataDirty
 

Member Function Documentation

static eZContentLanguage::addLanguage (   $locale,
  $name = null 
)
static

Adds new language to the site.

Parameters
localeLocale code (e.g. 'slk-SK') of language to add.
nameOptional. Name of the language. If not specified, the international language name for the $locale locale will be used.
Returns
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).

Referenced by fetchByLocale(), eZStepCreateSites\initializePackage(), eZContentObjectVersion\unserialize(), and eZContentObject\unserialize().

eZContentLanguage::classCount ( )
Returns
The count of classes containing the translation in this language.

Referenced by removeThis().

static eZContentLanguage::clearCronjobMode ( )
static

Switches off the cronjob mode.

See Also
eZContentLanguage::setCronjobMode()
static eZContentLanguage::clearPrioritizedLanguages ( )
static
static eZContentLanguage::decodeLanguageMask (   $langMask,
  $returnLanguageLocale = false 
)
static

Decodes $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.

Parameters
int$langMask
boolean$returnLanguageLocale
Returns
array

Referenced by eZXMLTextType\onPublish(), and restoreXmlRelations().

static eZContentLanguage::definition ( )
static

Persistent object's definition.

Referenced by fetchList().

static eZContentLanguage::expireCache ( )
static

Removes all memory cache forcing it to read from database again for next method calls.

Referenced by eZStepCreateSites\initializePackage().

eZContentLanguage::eZContentLanguage (   $row = array())

Constructor.

Parameters
rowParameter passed to the constructor of eZPersistentObject.

Referenced by addLanguage().

static eZContentLanguage::fetchLimitationList (   $forceReloading = false)
static

Fetches the array with names and IDs of the languages used on the site.

This method is used by the permission system.

Parameters
forceReloadingOptional. If true, the list will be fetched from database even if it is cached in memory. Default value is false.
Returns
Array with names and IDs of the languages used on the site.
static eZContentLanguage::fetchList (   $forceReloading = false)
static

Fetches the list of the languages used on the site.

Parameters
forceReloadingOptional. If true, the list will be fetched from database even if it is cached in memory. Default value is false.
Returns
Array of the eZContentLanguage objects of languages used on the site.

Referenced by addLanguage(), eZContentObjectStateGroup\allTranslations(), eZContentObjectState\allTranslations(), eZMultiplexerType\attribute(), eZApproveType\attribute(), fetch(), fetchByLocale(), fetchLimitationList(), fetchLocaleList(), languagesByMask(), maskForRealLanguages(), prioritizedLanguages(), removeThis(), eZContentObject\translationList(), and eZContentObject\translationStringList().

static eZContentLanguage::fetchLocaleList ( )
static

Fetches the array of locale codes of the languages used on the site.

Returns
Array of locale codes of the languages used on the site.

Referenced by eZContentObject\canCreateClassList(), eZContentObjectTreeNode\canCreateClassList(), eZContentClass\canInstantiateClassList(), and eZContentObjectPackageHandler\handleParameters().

static eZContentLanguage::jsArrayByMask (   $mask)
static

Returns the Javascript array with locale codes and names of the languages which have set the corresponding bit in specified mask.

Parameters
maskBitmap mask specifying which languages should be considered.
Returns
JavaScript array described above.

Referenced by eZContentObject\availableLanguagesJsArray(), eZContentStructureTreeOperator\createContentStructureNode(), and eZContentStructureTreeOperator\initContentStructureTree().

static eZContentLanguage::languagesByMask (   $mask)
static

Returns array of languages which have set the corresponding bit in the mask.

Parameters
maskBitmap specifying which languages should be returned.
Returns
Array of eZContentLanguage objects of languages which have set the corresponding bit in $mask.

Referenced by eZContentObject\allLanguages(), eZMultiplexerType\attributeDecoder(), eZApproveType\attributeDecoder(), and eZContentOperationCollection\copyTranslations().

static eZContentLanguage::languagesSQLFilter (   $languageListTable,
  $languageListAttributeName = 'language_mask' 
)
static

Returns the SQL where-condition for selecting the rows (objects, object versions) which exist in any of prioritized languages or are always available.

Parameters
languageListTableName of the table
languageListAttributeNameOptional. Name of the attribute in the table which contains the bitmap mask. 'language_mask' by default.
Returns
SQL where-condition described above.

Referenced by eZURLAliasML\fetchByAction(), eZContentObjectStateGroup\fetchByConditions(), eZContentObjectState\fetchByConditions(), eZURLAliasML\fetchByParentID(), eZURLAliasML\fetchByPath(), eZContentObjectTreeNode\fetchNode(), eZURLAliasML\fetchPathByActionList(), eZURLAliasQuery\generateSQL(), eZURLAliasML\getPath(), eZURLAliasML\reverseTranslate(), eZSearchEngine\search(), eZContentObjectTreeNode\subTreeByNodeID(), eZContentObjectTreeNode\subTreeMultiPaths(), eZURLAliasML\translate(), and eZContentObjectTrashNode\trashList().

eZContentLanguage::localeObject ( )
Returns
Locale object for this language.
static eZContentLanguage::maskByLocale (   $locales,
  $setZerothBit = false 
)
static

Returns bitmap mask for the specified languages.

Parameters
localesArray of strings or a string specifying locale codes of the languages, e. g. 'slk-SK' or array( 'eng-GB', 'nor-NO' )
setZerothBitOptional. Specifies if the 0-th bit of mask should be set. False by default.
Returns
Bitmap mask having set the corresponding bits for the specified languages.

Referenced by eZContentObjectVersion\checkAccess(), eZContentObject\checkAccess(), eZContentObjectTreeNode\checkAccess(), eZURLAliasML\fetchByAction(), eZContentOperationCollection\setObjectStatusPublished(), and eZContentObjectVersion\updateLanguageMask().

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

Referenced by eZContentObject\removeTranslation().

eZContentLanguage::objectCount ( )
Returns
The count of objects containing the translation in this language.

Referenced by removeThis().

eZContentLanguage::objectInitialCount ( )
Returns
The count of objects having this language as the initial/main one.
static eZContentLanguage::prioritizedLanguageCodes ( )
static

Returns the array of the locale codes of the prioritized languages (in the correct order).

Returns
Array of the locale codes of the prioritized languages (in the correct order).
See Also
eZContentLanguage::prioritizedLanguages()

Referenced by eZContentClass\canInstantiateLanguages(), eZContentFunctionCollection\fetchPrioritizedLanguageCodes(), and ezpLanguageSwitcherFunctionCollection\fetchUrlAlias().

static eZContentLanguage::prioritizedLanguagesByLocaleList (   $languageLocaleList)
static

Returns array of prioritized languages which are listed in $languageLocaleList.

The function does the same as 'prioritizedLanguagesByMask' but uses language locale list instead of language mask.

Parameters
languageLocaleListList of language locales to choose from.
Returns
Array of eZContentLanguage objects of prioritized languages which have set the corresponding bit in $mask.

Referenced by eZSerializedObjectNameList\prioritizedLanguages().

static eZContentLanguage::prioritizedLanguagesByMask (   $mask)
static

Returns array of prioritized languages which have set the corresponding bit in the mask.

Parameters
maskBitmap specifying which languages should be returned.
Returns
Array of eZContentLanguage objects of prioritized languages which have set the corresponding bit in $mask.

Referenced by jsArrayByMask(), eZContentObjectStateGroup\languages(), eZContentObjectState\languages(), and eZContentObject\languages().

static eZContentLanguage::removeLanguage (   $id)
static

Removes the language specified by ID.

Parameters
idID of the language to be removed.
Returns
True if the language was removed from the site, false otherwise.
eZContentLanguage::removeThis ( )

Removes the language if there is no object having translation in it.

Returns
True if the language was removed from the site, false otherwise.
static eZContentLanguage::setCronjobMode (   $enable = true)
static

Switches 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.

Parameters
enableOptional. If false, it will switch off the cronjob mode. True by default.

Referenced by clearCronjobMode().

static eZContentLanguage::setPrioritizedLanguages (   $languages)
static

Overrides the prioritized languages set by INI settings with the specified languages.

Parameters
languagesLocale codes of the languages which will override the prioritized languages (the order is relevant).

Referenced by clearPrioritizedLanguages(), eZContentObjectTreeNode\createAttributeFilterSQLStrings(), eZURLAliasML\getPath(), eZStepCreateSites\initializePackage(), eZContentObjectTreeNode\subTreeByNodeID(), eZContentObjectTreeNode\subTreeCountByNodeID(), and eZContentObjectTreeNode\subTreeMultiPaths().

static eZContentLanguage::sqlFilter (   $languageTable,
  $languageListTable = null,
  $languageAttributeName = 'language_id',
  $languageListAttributeName = 'language_mask',
  $lang = false 
)
static

Returns 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.

Parameters
string$languageTableName of the table containing the attribute with the language id.
string$languageListTableName of the table containing the attribute with the available languages bitmap.
string$languageAttributeNameOptional. Name of the attribute in $languageTable which contains the language id. 'language_id' by default.
string$languageListAttributeNameOptional. Name of the attribute in $languageListTable which contains the bitmap mask. 'language_mask' by default.
string$langLanguage code of the most prioritized language
Returns
string

Referenced by eZContentObjectTreeNode\calendar(), eZContentObjectTreeNode\createAttributeFilterSQLStrings(), eZContentObjectTreeNode\createSortingSQLStrings(), eZContentObjectTreeNode\createVersionNameJoinsSQLString(), eZContentObjectTreeNode\fetch(), eZContentObjectVersion\fetchAttributes(), eZContentObject\fetchAttributesByIdentifier(), eZContentObjectStateGroup\fetchByConditions(), eZContentObjectState\fetchByConditions(), eZContentObject\fetchByNodeID(), eZContentObject\fetchIDArray(), eZContentObjectTreeNode\fetchNodesByPathString(), eZContentObject\relatedObjects(), eZSearchEngine\search(), eZContentClassName\sqlAppendFilter(), eZContentClassName\sqlFilter(), eZContentStructureTreeOperator\subTree(), eZContentObjectTreeNode\subTreeByNodeID(), eZContentObjectTreeNode\subTreeCountByNodeID(), eZContentObjectTreeNode\subTreeMultiPaths(), and eZContentObjectTrashNode\trashList().

static eZContentLanguage::topPriorityLanguage ( )
static

Returns the most prioritized language.

Returns
eZContentLanguage object for the most prioritized language.

Referenced by decodeLanguageMask(), eZSerializedObjectNameList\defaultLanguage(), eZContentObject\defaultLanguage(), and eZURLAliasML\storePath().

static eZContentLanguage::topPriorityLanguageByLocaleList (   $languageLocaleList)
static

Returns the most prioritized language from specified by $languageLocaleList list of language locales.

The function does the same as 'topPriorityLanguageByMask' but uses language locale list instead of language mask.

Parameters
languageLocaleListList of language locales to choose from.
Returns
eZContentLanguage object of the most prioritized language.

Referenced by eZSerializedObjectNameList\topPriorityLanguage().

static eZContentLanguage::topPriorityLanguageByMask (   $mask)
static

Returns the most prioritized language which has set the corresponding bit in the mask.

Parameters
maskBitmap specifying which languages should be checked.
Returns
eZContentLanguage object of the most prioritized language which have set the corresponding bit in $mask.

Referenced by eZContentObject\eZContentObject().

eZContentLanguage::translation ( )
Returns
Reference to itself. Kept because of the backward compatibility.

Member Data Documentation

const eZContentLanguage::MAX_COUNT = 30

Referenced by addLanguage(), and decodeLanguageMask().


The documentation for this class was generated from the following file: