本文整理汇总了PHP中eZContentObject::fetchDataMap方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject::fetchDataMap方法的具体用法?PHP eZContentObject::fetchDataMap怎么用?PHP eZContentObject::fetchDataMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObject
的用法示例。
在下文中一共展示了eZContentObject::fetchDataMap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchByObject
static function fetchByObject(eZContentObject $object)
{
$attributes = $object->fetchDataMap();
foreach ($attributes as $attribute) {
if ($attribute->DataTypeString == 'xrowmetadata' and $attribute->hasContent()) {
return $attribute->content();
}
}
return false;
}
示例2: fromContentObject
/**
* Initializes a level one ezpContentFieldSet from an eZContentObject
* @param eZContentObject $contentObject
* @return ezpContentFieldSet
*/
public static function fromContentObject(eZContentObject $contentObject)
{
$set = new ezpContentFieldSet();
$languages = $contentObject->availableLanguages();
foreach ($languages as $language) {
$set->childrenFieldSets[$language] = ezpContentFieldSet::fromDataMap($contentObject->fetchDataMap(false, $language));
}
// this sequence is REALLY ugly
reset($languages);
$set->setActiveLanguage(current($languages));
return $set;
}
示例3: addTranslation
/**
* Adds a new translation and creates a new dedicated fieldset.
* If $lang is an invalid locale (ie. malformed or not declared in site.ini/RegionalSettings.Locale), will throw a SQLIContentException
* @param string $lang Translation code to add, as a locale (xxx-XX)
* @throws SQLIContentException
*/
public function addTranslation($lang)
{
$language = eZContentLanguage::fetchByLocale($lang, true);
if (!$language instanceof eZContentLanguage) {
throw new SQLIContentException("Invalid language '{$lang}'. Must be a valid locale declared in site.ini, RegionalSettings.Locale !");
}
$db = eZDB::instance();
$db->begin();
$version = $this->getCurrentDraft($lang);
$versionNumber = $version->attribute('version');
$objectID = $this->contentObject->attribute('id');
$translatedDataMap = $this->contentObject->fetchDataMap($versionNumber, $lang);
// Check if data map exists for this language in the current draft
// Indeed, several translations can be created for only one publication of an object
if (!$translatedDataMap) {
$classAttributes = $this->contentObject->fetchClassAttributes();
foreach ($classAttributes as $classAttribute) {
// TODO : Check if attribute is translatable
$classAttribute->instantiate($objectID, $lang, $versionNumber);
}
// Now clears in-memory cache for this datamap (it was fetched once above)
// Then re-fetch the newly created translated data map
global $eZContentObjectDataMapCache;
unset($eZContentObjectDataMapCache[$objectID][$versionNumber][$lang]);
unset($this->contentObject->ContentObjectAttributes[$versionNumber][$lang]);
unset($this->contentObject->DataMap[$versionNumber][$lang]);
$translatedDataMap = $this->contentObject->fetchDataMap($versionNumber, $lang);
}
$version->setAttribute('initial_language_id', $language->attribute('id'));
$version->updateLanguageMask();
$version->store();
$db->commit();
$set = SQLIContentFieldset::fromDataMap($translatedDataMap);
$set->setLanguage($lang);
$this->fieldsets[$lang] = $set;
$this->initIterator();
}
示例4: modify
//.........这里部分代码省略.........
unset($isHidden);
}
ClusterTool::resetCurrentCluster();
$concernedNode = $contentMainNode;
$concernedNode->setCurrentLanguage($articleLanguageArray[0]);
if ( $contentMainNode->attribute('depth') > 4 )
{
$concernedNode = $contentMainNode->fetchParent();
$concernedNode->setCurrentLanguage($articleLanguageArray[0]);
}
/* @type $concernedDM eZContentObjectAttribute[] */
$concernedDM = $concernedNode->dataMap();
$tags = $concernedDM['tags'];
$MerckManualAboutSectionId = eZIni::instance('merck.ini')->variable('MerckManualAboutSettings', 'SectionSourceId');
$taxonomiesAttribute = $concernedDM['serialized_taxonomies'];
if( $taxonomiesAttribute instanceof eZContentObjectAttribute && $taxonomiesAttribute->hasContent() )
{
$taxonomies = $taxonomiesAttribute->content();
foreach( array_keys($publisherFolderRelations['clusters']) as $cluster )
{
self::addValueToDoc(
$docList,
"attr_exclude_from_search_{$cluster}_b",
$MerckManualAboutSectionId && in_array($MerckManualAboutSectionId, $taxonomies['section']),
false
);
}
}
if( $tags instanceof eZContentObjectAttribute && $tags->hasContent() )
self::addValueToDoc( $docList, 'subattr_tags____ms', explode("|", $tags->content()) );
if ( $isMerckManualShowcase )
$this->processSpecificMerckManual($docList, $concernedNode, $concernedDM, $publisherFolderRelations);
foreach ( $publisherFolderRelations['clusters'] as $cluster => $applications )
{
ClusterTool::setCurrentCluster( $cluster );
foreach( $applications as $key => $applicationIdentifier )
{
if ( !isset(self::$_applicationIdentifierToId[$applicationIdentifier]) )
{
$applicationLocalized = CacheApplicationTool::buildLocalizedApplicationByIdentifier( $applicationIdentifier );
if( !($applicationLocalized instanceof ApplicationLocalized) )
{
eZDebug::writeError(
sprintf('Cluster: %s; Identifier: %s; ObjectId: %s', $cluster, $applicationIdentifier, $contentObject->attribute('id') ),
'Error getting application localized' );
unset( $publisherFolderRelations['clusters'][$cluster][$key] );
}
else
self::$_applicationIdentifierToId[$applicationIdentifier] = $applicationLocalized->applicationObject()->attribute('id');
}
}
}
ClusterTool::resetCurrentCluster();
$applicationIds = array();
foreach ( $publisherFolderRelations['clusters'] as $cluster => $applications )
foreach( $applications as $applicationIdentifier )
$applicationIds[] = self::$_applicationIdentifierToId[$applicationIdentifier];
$uniqueApplicationIds = array_unique($applicationIds);
foreach( $docList as $languageCode => $doc )
{
$dataMap = $contentObject->fetchDataMap(false, $languageCode);
$headline = $dataMap['headline']->content();
$headlineLowerCase = mb_strtolower( StringTool::removeAccents($headline, 'utf-8', false), 'utf-8' );
$unaccentedFirstLetter = mb_substr($headlineLowerCase, 0, 1, 'utf-8');
$doc->addField( 'attr_headline_first_letter_lc_s', $unaccentedFirstLetter );
$doc->addField( 'attr_headline_lc_s', $headlineLowerCase );
foreach( $uniqueApplicationIds as $id )
{
$doc->addField( 'subattr_local_application___source_id____s', $id );
}
foreach( $publisherFolderRelations['clusters'] as $cluster => $applications )
{
foreach( $applications as $applicationIdentifier )
{
$doc->addField('subattr_local_application___source_mixed____s', $cluster . '##unused##' . self::$_applicationIdentifierToId[$applicationIdentifier]);
}
}
}
}