本文整理汇总了PHP中eZContentLanguage类的典型用法代码示例。如果您正苦于以下问题:PHP eZContentLanguage类的具体用法?PHP eZContentLanguage怎么用?PHP eZContentLanguage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZContentLanguage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testFetchByContentObjectIDList
/**
* Test FetchByContentObjectList
*/
public function testFetchByContentObjectIDList()
{
$language = eZContentLanguage::fetchByLocale('eng-GB');
$languageID = $language->attribute('id');
$time = time();
$comment1 = array('contentobject_id' => 15, 'language_id' => $languageID, 'created' => $time, 'modified' => $time, 'text' => 'comment1', 'user_id' => 15);
$comment2 = array('contentobject_id' => 15, 'language_id' => $languageID, 'created' => $time + 1, 'modified' => $time + 1, 'text' => 'comment2', 'user_id' => 15);
$comment3 = array('contentobject_id' => 15, 'language_id' => $languageID, 'created' => $time + 2, 'modified' => $time + 2, 'text' => 'comment3', 'user_id' => 15);
$comment4 = array('contentobject_id' => 14, 'language_id' => $languageID, 'created' => $time + 3, 'modified' => $time + 3, 'text' => 'comment4', 'user_id' => 14);
$comment = ezcomComment::create($comment1);
$comment->store();
$comment = ezcomComment::create($comment2);
$comment->store();
$comment = ezcomComment::create($comment3);
$comment->store();
$comment = ezcomComment::create($comment4);
$comment->store();
// test null contentobject id and user id
$result = ezcomComment::fetchByContentObjectIDList(null, 15, 'eng-GB', null, array('modified' => 'desc'), 0);
$this->assertEquals('comment3', $result[0]->attribute('text'));
$this->assertEquals('comment1', $result[2]->attribute('text'));
// test null contentobject id array and empty user_id
$result = ezcomComment::fetchByContentObjectIDList(null, null, 'eng-GB', null, array('modified' => 'desc'), 0);
$this->assertEquals('comment1', $result[3]->attribute('text'));
// test one contentobject id array
$result = ezcomComment::fetchByContentObjectIDList(array(14), null, 'eng-GB', null, array('modified' => 'desc'), 0);
$this->assertEquals('comment4', $result[0]->attribute('text'));
// test many contentobjects array and sort
$result = ezcomComment::fetchByContentObjectIDList(array(14, 15), null, 'eng-GB', null, array('modified' => 'asc'), 0);
$this->assertEquals('comment3', $result[2]->attribute('text'));
// test length with all null
$result = ezcomComment::fetchByContentObjectIDList(null, null, null, null, null, null, 3);
$this->assertEquals(3, count($result));
}
开发者ID:ezsystems,项目名称:ezcomments-ls-extension,代码行数:37,代码来源:ezcomcomment_test.php
示例2: fetchUrlAlias
public function fetchUrlAlias($nodeId = null, $path = null, $locale)
{
if (!$nodeId && !$path) {
return array('result' => false);
}
if (empty($locale) || !is_string($locale)) {
return array('result' => false);
}
if (is_numeric($nodeId)) {
$destinationElement = eZURLAliasML::fetchByAction('eznode', $nodeId, $locale, false);
} else {
if (is_string($path)) {
$nodeId = eZURLAliasML::fetchNodeIDByPath($path);
$destinationElement = eZURLAliasML::fetchByAction('eznode', $nodeId, $locale, false);
}
}
if (empty($destinationElement) || !isset($destinationElement[0]) && !$destinationElement[0] instanceof eZURLAliasML) {
// Either no translation exists for $locale or $path was not pointing to a node
return array('result' => false);
}
$currentLanguageCodes = eZContentLanguage::prioritizedLanguageCodes();
array_unshift($currentLanguageCodes, $locale);
$currentLanguageCodes = array_unique($currentLanguageCodes);
$urlAlias = $destinationElement[0]->getPath($locale, $currentLanguageCodes);
return array('result' => $urlAlias);
}
开发者ID:netbliss,项目名称:ezpublish,代码行数:26,代码来源:ezpLanguageSwitcherFunctionCollection.php
示例3: setUp
public function setUp()
{
parent::setUp();
$this->xxx = eZContentLanguage::addLanguage('xxx-XX', 'XXXX');
ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'SiteLanguageList', array('xxx-XX', 'eng-GB'));
eZContentLanguage::clearPrioritizedLanguages();
}
开发者ID:nfrp,项目名称:ezpublish,代码行数:7,代码来源:ezobjectrelationlist_regression.php
示例4: validNodes
/**
* Return valid items for block with given $blockID
*
* @static
* @param string $blockID
* @param bool $asObject
* @return array(eZContentObjectTreeNode)
*/
static function validNodes($blockID, $asObject = true)
{
if (isset($GLOBALS['eZFlowPool']) === false) {
$GLOBALS['eZFlowPool'] = array();
}
if (isset($GLOBALS['eZFlowPool'][$blockID])) {
return $GLOBALS['eZFlowPool'][$blockID];
}
$visibilitySQL = "";
if (eZINI::instance('site.ini')->variable('SiteAccessSettings', 'ShowHiddenNodes') !== 'true') {
$visibilitySQL = "AND ezcontentobject_tree.is_invisible = 0 ";
}
$db = eZDB::instance();
$validNodes = $db->arrayQuery("SELECT ezm_pool.node_id\n FROM ezm_pool, ezcontentobject_tree, ezcontentobject\n WHERE ezm_pool.block_id='{$blockID}'\n AND ezm_pool.ts_visible>0\n AND ezm_pool.ts_hidden=0\n AND ezcontentobject_tree.node_id = ezm_pool.node_id\n AND ezcontentobject.id = ezm_pool.object_id\n AND " . eZContentLanguage::languagesSQLFilter('ezcontentobject') . "\n {$visibilitySQL}\n ORDER BY ezm_pool.priority DESC");
if ($asObject && !empty($validNodes)) {
$validNodesObjects = array();
foreach ($validNodes as $node) {
$validNodeObject = eZContentObjectTreeNode::fetch($node['node_id']);
if ($validNodeObject instanceof eZContentObjectTreeNode && $validNodeObject->canRead()) {
$validNodesObjects[] = $validNodeObject;
}
}
$GLOBALS['eZFlowPool'][$blockID] = $validNodesObjects;
return $validNodesObjects;
} else {
return $validNodes;
}
}
开发者ID:kuborgh,项目名称:ezflow-ls-extension,代码行数:36,代码来源:ezflowpool.php
示例5: modify
function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
{
$parentNodeID = $namedParameters['parent_node_id'];
switch ($operatorName) {
case 'ezkeywordlist':
include_once 'lib/ezdb/classes/ezdb.php';
$db = eZDB::instance();
if ($parentNodeID) {
$node = eZContentObjectTreeNode::fetch($parentNodeID);
if ($node) {
$pathString = "AND ezcontentobject_tree.path_string like '" . $node->attribute('path_string') . "%'";
}
$parentNodeIDSQL = "AND ezcontentobject_tree.node_id != " . (int) $parentNodeID;
}
$showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(true, false);
$limitation = false;
$limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
$sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
$versionNameJoins = " AND ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id AND\n ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version AND ";
$languageFilter = " AND " . eZContentLanguage::languagesSQLFilter('ezcontentobject');
$versionNameJoins .= eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject');
$quotedClassIdentifiers = array();
foreach ((array) $namedParameters['class_identifier'] as $classIdentifier) {
$quotedClassIdentifiers[] = "'" . $db->escapeString($classIdentifier) . "'";
}
$rs = $db->arrayQuery("SELECT DISTINCT ezkeyword.keyword\n FROM ezkeyword_attribute_link,\n ezkeyword,\n ezcontentobject,\n ezcontentobject_name,\n ezcontentobject_attribute,\n ezcontentobject_tree,\n ezcontentclass\n {$sqlPermissionChecking['from']}\n WHERE ezkeyword.id = ezkeyword_attribute_link.keyword_id\n AND ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id\n AND ezcontentobject_tree.contentobject_id = ezcontentobject_attribute.contentobject_id\n AND ezkeyword.class_id = ezcontentclass.id\n AND " . $db->generateSQLINStatement($quotedClassIdentifiers, 'ezcontentclass.identifier') . "\n {$pathString}\n {$parentNodeIDSQL} " . ($namedParameters['depth'] > 0 ? "AND ezcontentobject_tree.depth=" . (int) $namedParameters['depth'] : '') . "\n {$showInvisibleNodesCond}\n {$sqlPermissionChecking['where']}\n {$languageFilter}\n {$versionNameJoins}\n ORDER BY ezkeyword.keyword ASC");
$operatorValue = $rs;
break;
}
}
开发者ID:BGCX067,项目名称:ezpublish-thetechtalent-svn-to-git,代码行数:30,代码来源:ezkeywordlist.php
示例6: testIssue13497
/**
* Test for regression #13497:
* attribute operator throws a PHP fatal error on a node without parent in a displayable language
*
* Situation:
* - siteaccess with one language (fre-FR) and ShowUntranslatedObjects disabled
* - parent content node in another language (eng-GB) with always available disabled
* - content node in the siteaccess' language (fre-FR)
* - fetch this fre-FR node from anywhere, and call attribute() on it
*
* Result:
* - Fatal error: Call to a member function attribute() on a non-object in
* kernel/classes/ezcontentobjecttreenode.php on line 4225
*
* Explanation: the error actually comes from the can_remove_location attribute
**/
public function testIssue13497()
{
// Create a folder in english only
$folder = new ezpObject("folder", 2, 14, 1, 'eng-GB');
$folder->setAlwaysAvailableLanguageID(false);
$folder->name = "Parent for " . __FUNCTION__;
$folder->publish();
$locale = eZLocale::instance('fre-FR');
$translation = eZContentLanguage::addLanguage($locale->localeCode(), $locale->internationalLanguageName());
// Create an article in french only, as a subitem of the previously created folder
$article = new ezpObject("article", $folder->attribute('main_node_id'), 14, 1, 'fre-FR');
$article->title = "Object for " . __FUNCTION__;
$article->short_description = "Description of test for " . __FUNCTION__;
$article->publish();
$articleNodeID = $article->attribute('main_node_id');
// INi changes: set language to french only, untranslatedobjects disabled
ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'ContentObjectLocale', 'fre-FR');
ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'SiteLanguageList', array('fre-FR'));
ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'ShowUntranslatedObjects', 'disabled');
eZContentLanguage::expireCache();
// This should crash
eZContentObjectTreeNode::fetch($articleNodeID)->attribute('can_remove_location');
ezpINIHelper::restoreINISettings();
// re-expire cache for further tests
eZContentLanguage::expireCache();
}
开发者ID:runelangseid,项目名称:ezpublish,代码行数:42,代码来源:ezcontentobjecttreenode_regression.php
示例7: testMapLanguage
/**
* Test that fetching the language listing, works after languages
* have been altered in database, and then later refetched.
*
* @link http://issues.ez.no/15484
*/
public function testMapLanguage()
{
$db = eZDB::instance();
eZContentLanguage::addLanguage('nno-NO', 'Nynorsk');
$localeToChangeInto = 'dan-DK';
$languageNameToChangeInto = 'Danish';
$langObject = eZContentLanguage::fetchByLocale('nno-NO');
$langId = (int) $langObject->attribute('id');
$updateSql = <<<END
UPDATE ezcontent_language
SET
locale='{$localeToChangeInto}',
name='{$languageNameToChangeInto}'
WHERE
id={$langId}
END;
$db->query($updateSql);
eZContentLanguage::expireCache();
$newLangObject = eZContentLanguage::fetchByLocale($localeToChangeInto);
if (!$newLangObject instanceof eZContentLanguage) {
self::fail("Language object not returned. Old version provided by cache?");
}
$newLangId = (int) $newLangObject->attribute('id');
self::assertEquals($langId, $newLangId, "New language not mapped to existing language");
}
开发者ID:rmiguel,项目名称:ezpublish,代码行数:31,代码来源:ezcontentlanguage_regression.php
示例8: testIssue19174
/**
* Regression test for issue {@see #19174 http://issues.ez.no/19174}
*/
public function testIssue19174()
{
$bkpLanguages = eZContentLanguage::prioritizedLanguageCodes();
// add a secondary language
$locale = eZLocale::instance('fre-FR');
$translation = eZContentLanguage::addLanguage($locale->localeCode(), $locale->internationalLanguageName());
// create related objects
$relatedObjectsIds = array($this->createObjectForRelation(), $this->createObjectForRelation(), $this->createObjectForRelation(), $this->createObjectForRelation());
$xmlTextEn = "<embed href=\"ezobject://{$relatedObjectsIds[0]}\" /><link href=\"ezobject://{$relatedObjectsIds[1]}\">link</link>";
$xmlTextFr = "<embed href=\"ezobject://{$relatedObjectsIds[2]}\" /><link href=\"ezobject://{$relatedObjectsIds[3]}\">link</link>";
// Create an article in eng-GB, and embed related object one in the intro
$article = new ezpObject('article', 2, 14, 1, 'eng-GB');
$article->title = __METHOD__ . ' eng-GB';
$article->intro = $xmlTextEn;
$articleId = $article->publish();
// Workaround as setting folder->name directly doesn't produce the expected result
$article->addTranslation('fre-FR', array('title' => __METHOD__ . ' fre-FR', 'intro' => $xmlTextFr));
$relatedObjects = eZContentObject::fetch($articleId)->relatedObjects(false, false, 0, false, array('AllRelations' => eZContentObject::RELATION_LINK | eZContentObject::RELATION_EMBED));
self::assertEquals(4, count($relatedObjects));
$expectedRelations = array_flip($relatedObjectsIds);
foreach ($relatedObjects as $relatedObject) {
if (isset($expectedRelations[$relatedObject->ID])) {
unset($expectedRelations[$relatedObject->ID]);
}
}
self::assertEquals(0, count($expectedRelations));
$article->remove();
$translation->removeThis();
eZContentLanguage::setPrioritizedLanguages($bkpLanguages);
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:33,代码来源:ezxmltexttype_regression.php
示例9: sqlAppendFilter
static function sqlAppendFilter($languageTable = 'ezcontentclass')
{
$def = eZContentClassName::definition();
$languageListTable = $def['name'];
$sqlFilter = array('nameField' => ", {$languageListTable}.name", 'from' => ", {$languageListTable}", 'where' => "AND {$languageTable}.id = {$languageListTable}.contentclass_id AND\n {$languageTable}.version = {$languageListTable}.contentclass_version AND " . eZContentLanguage::sqlFilter($languageListTable, $languageTable), 'orderBy' => "{$languageListTable}.name");
return $sqlFilter;
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:7,代码来源:ezcontentclassname.php
示例10: addUrlALias
/**
* Code taken from content/urlalias module
*/
static function addUrlALias($node, $aliasText, $languageId, $aliasRedirects = false, $parentIsRoot = false)
{
$infoCode = 'no-errors';
$language = eZContentLanguage::fetch($languageId);
if (!$language) {
$infoCode = "error-invalid-language";
$infoData['language'] = $languageCode;
} else {
$parentID = 0;
$linkID = 0;
$filter = new eZURLAliasQuery();
$filter->actions = array('eznode:' . $node->attribute('node_id'));
$filter->type = 'name';
$filter->limit = false;
$existingElements = $filter->fetchAll();
// TODO: add error handling when $existingElements is empty
if (count($existingElements) > 0) {
$parentID = (int) $existingElements[0]->attribute('parent');
$linkID = (int) $existingElements[0]->attribute('id');
}
if ($parentIsRoot) {
$parentID = 0;
// Start from the top
}
$mask = $language->attribute('id');
$obj = $node->object();
$alwaysMask = $obj->attribute('language_mask') & 1;
$mask |= $alwaysMask;
$origAliasText = $aliasText;
$result = eZURLAliasML::storePath($aliasText, 'eznode:' . $node->attribute('node_id'), $language, $linkID, $alwaysMask, $parentID, true, false, false, $aliasRedirects);
if ($result['status'] === eZURLAliasML::LINK_ALREADY_TAKEN) {
$lastElements = eZURLAliasML::fetchByPath($result['path']);
if (count($lastElements) > 0) {
$lastElement = $lastElements[0];
$infoCode = "feedback-alias-exists";
$infoData['new_alias'] = $aliasText;
$infoData['url'] = $lastElement->attribute('path');
$infoData['action_url'] = $lastElement->actionURL();
//$aliasText = $origAliasText;
}
} else {
if ($result['status'] === true) {
$aliasText = $result['path'];
if (strcmp($aliasText, $origAliasText) != 0) {
$infoCode = "feedback-alias-cleanup";
$infoData['orig_alias'] = $origAliasText;
$infoData['new_alias'] = $aliasText;
} else {
$infoData['new_alias'] = $aliasText;
}
if ($infoCode == 'no-errors') {
$infoCode = "feedback-alias-created";
}
//$aliasText = false;
}
}
}
return array('infoCode' => $infoCode, 'infoData' => $infoData);
}
开发者ID:gggeek,项目名称:ezworkflowcollection,代码行数:62,代码来源:addurlaliastype.php
示例11: tearDown
public function tearDown()
{
$this->folder->remove();
$this->article->remove();
eZPendingActions::removeByAction('index_object');
$this->nodeIds = array();
$this->objectIds = array();
$anonymousUser = eZUser::fetchByName('anonymous');
eZUser::setCurrentlyLoggedInUser($anonymousUser, $anonymousUser->attribute('contentobject_id'));
eZContentLanguage::expireCache();
parent::tearDown();
}
开发者ID:schwabokaner,项目名称:ezpublish-legacy,代码行数:12,代码来源:ezcontentoperationdelete_regression.php
示例12: createSqlParts
function createSqlParts($params)
{
$sqlJoins = '';
if (isset($params['locales'])) {
$language_mask = 0;
$locales = eZContentLanguage::fetchList();
foreach ($locales as $locale) {
if (in_array($locale->attribute('locale'), $params['locales'])) {
$language_mask |= $locale->attribute('id');
}
}
if ($language_mask) {
$sqlJoins = " ezcontentobject.language_mask & {$language_mask} AND ";
}
}
return array('tables' => '', 'joins' => $sqlJoins, 'columns' => '');
}
开发者ID:honchoman,项目名称:Batchtool,代码行数:17,代码来源:translations_filter.php
示例13: attribute
function attribute($attr)
{
switch ($attr) {
case 'sections':
$sections = eZSection::fetchList(false);
foreach ($sections as $key => $section) {
$sections[$key]['Name'] = $section['name'];
$sections[$key]['value'] = $section['id'];
}
return $sections;
break;
case 'languages':
return eZContentLanguage::fetchList();
break;
}
return eZWorkflowEventType::attribute($attr);
}
开发者ID:gggeek,项目名称:ezworkflowcollection,代码行数:17,代码来源:approvelocationtype.php
示例14: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
$ret = '';
switch ($operatorName) {
case 'get_url_alias_by_lang':
$node = eZContentObjectTreeNode::fetch($namedParameters['node_id'], $namedParameters['lang_code']);
$originalPrioritizedLanguages = eZContentLanguage::prioritizedLanguageCodes();
eZContentLanguage::setPrioritizedLanguages(array($namedParameters['lang_code']));
$urlAlias = '';
if (is_object($node)) {
$urlAlias = '/' . $node->urlAlias();
}
eZContentLanguage::setPrioritizedLanguages($originalPrioritizedLanguages);
$ret = $urlAlias;
break;
}
$operatorValue = $ret;
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:18,代码来源:langHelper.php
示例15: __construct
public function __construct($theClass = '', $name = '')
{
parent::__construct($theClass, $name);
if (!self::$script instanceof eZScript) {
self::$script = eZScript::instance(array('description' => "eZ Publish Test Runner\n\nsets up an eZ Publish testing environment\n", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true));
// Override INI override folder from settings/override to
// tests/settings to not read local override settings
$ini = eZINI::instance();
$ini->setOverrideDirs(array(array('tests/settings', true)), 'override');
$ini->loadCache();
// Be sure to have clean content language data
eZContentLanguage::expireCache();
self::$script->startup();
self::$script->initialize();
// Avoids Fatal error: eZ Publish did not finish its request if die() is used.
eZExecution::setCleanExit();
}
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:18,代码来源:ezptestsuite.php
示例16: execute
public function execute($process, $event)
{
$processParameters = $process->attribute('parameter_list');
$object = eZContentObject::fetch($processParameters['object_id']);
$node = $object->mainNode();
$href = '/push/node/' . $node->attribute('node_id');
$version = eZContentObjectVersion::fetchVersion($processParameters['version'], $processParameters['object_id']);
if ($version instanceof eZContentObjectVersion) {
$language = eZContentLanguage::fetch($version->attribute('initial_language_id'));
if ($language instanceof eZContentLanguage) {
$href .= '/' . $language->attribute('locale');
}
}
eZURI::transformURI($href, false, 'full');
$http = eZHTTPTool::instance();
$http->setSessionVariable('RedirectURIAfterPublish', $href);
return eZWorkflowType::STATUS_ACCEPTED;
}
开发者ID:netgen,项目名称:ngpush,代码行数:18,代码来源:ngpushredirecttype.php
示例17: __construct
/**
* Initialize ezpClass object
*
* @param string $name
* @param string $identifier
* @param string $contentObjectName
* @param int $creatorID
* @param string $language
* @param int $groupID
* @param string $groupName
*/
public function __construct($name = 'Test class', $identifier = 'test_class', $contentObjectName = '<test_attribute>', $creatorID = 14, $language = 'eng-GB', $groupID = 1, $groupName = 'Content')
{
if (eZContentLanguage::fetchByLocale($language) === false) {
$topPriorityLanguage = eZContentLanguage::topPriorityLanguage();
if ($topPriorityLanguage) {
$language = $topPriorityLanguage->attribute('locale');
}
}
$this->language = $language;
$this->class = eZContentClass::create($creatorID, array(), $this->language);
$this->class->setName($name, $this->language);
$this->class->setAttribute('contentobject_name', $contentObjectName);
$this->class->setAttribute('identifier', $identifier);
$this->class->store();
$languageID = eZContentLanguage::idByLocale($this->language);
$this->class->setAlwaysAvailableLanguageID($languageID);
$this->classGroup = eZContentClassClassGroup::create($this->id, $this->version, $groupID, $groupName);
$this->classGroup->store();
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:30,代码来源:class.php
示例18: restoreXmlRelations
/**
* Parses the XML for the attributes in $classAttributeIdentifiers, and fixes the relations for $object
* @param eZContentObject $object
* @param array $classAttributeIdentifiers
* @return int The number of created relations
*/
function restoreXmlRelations(eZContentObject $object, array $classAttributeIdentifiers)
{
$currentVersion = $object->currentVersion();
$langMask = $currentVersion->attribute('language_mask');
$languageList = eZContentLanguage::decodeLanguageMask($langMask, true);
$languageList = $languageList['language_list'];
// nothing to do if the object isn't translated
if (count($languageList) < 2) {
return 0;
}
$attributeArray = $object->fetchAttributesByIdentifier($classAttributeIdentifiers, $currentVersion->attribute('version'), $languageList);
$embedRelationsCount = $object->relatedContentObjectCount(false, 0, array('AllRelations' => eZContentObject::RELATION_EMBED));
$linkRelationsCount = $object->relatedContentObjectCount(false, 0, array('AllRelations' => eZContentObject::RELATION_LINK));
$embeddedObjectIdArray = $linkedObjectIdArray = array();
foreach ($attributeArray as $attribute) {
$xmlText = eZXMLTextType::rawXMLText($attribute);
$dom = new DOMDocument('1.0', 'utf-8');
if (!$dom->loadXML($xmlText)) {
continue;
}
// linked objects
$linkedObjectIdArray = array_merge($linkedObjectIdArray, getRelatedObjectList($dom->getElementsByTagName('link')));
// embedded objects
$embeddedObjectIdArray = array_merge($embeddedObjectIdArray, getRelatedObjectList($dom->getElementsByTagName('embed')), getRelatedObjectList($dom->getElementsByTagName('embed-inline')));
}
$doCommit = false;
$restoredRelations = 0;
if (!empty($embeddedObjectIdArray)) {
$object->appendInputRelationList($embeddedObjectIdArray, eZContentObject::RELATION_EMBED);
$restoredRelations += count($embeddedObjectIdArray) - $embedRelationsCount;
$doCommit = true;
}
if (!empty($linkedObjectIdArray)) {
$object->appendInputRelationList($linkedObjectIdArray, eZContentObject::RELATION_LINK);
$restoredRelations += count($linkedObjectIdArray) - $linkRelationsCount;
$doCommit = true;
}
if ($doCommit) {
$object->commitInputRelations($currentVersion->attribute('version'));
}
return $restoredRelations;
}
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:48,代码来源:restorexmlrelations.php
示例19: checkContentRequirements
public static function checkContentRequirements($module, $http)
{
// Check that the object params are 'ok'
if (!$http->hasPostVariable('ContentObjectID')) {
eZDebug::writeError('No content object id is provided', 'ezcomments');
return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$contentObjectId = (int) $http->postVariable('ContentObjectID');
// Either use provided language code, or fallback on siteaccess default
if ($http->hasPostVariable('CommentLanguageCode')) {
$languageCode = $http->postVariable('CommentLanguageCode');
$language = eZContentLanguage::fetchByLocale($languageCode);
if ($language === false) {
eZDebug::writeError("The language code [{$languageCode}] given is not valid in the system.", 'ezcomments');
return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
} else {
$defaultLanguage = eZContentLanguage::topPriorityLanguage();
$languageCode = $defaultLanguage->attribute('locale');
}
// Check that our object is actually a valid holder of comments
$contentObject = eZContentObject::fetch($contentObjectId);
if (!$contentObject instanceof eZContentObject) {
eZDebug::writeError('No content object exists for the given id.', 'ezcomments');
return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$dataMap = $contentObject->fetchDataMap(false, $languageCode);
$foundCommentAttribute = false;
foreach ($dataMap as $attr) {
if ($attr->attribute('data_type_string') === 'ezcomcomments') {
$foundCommentAttribute = $attr;
break;
}
}
// if there is no ezcomcomments attribute inside the content, return
if (!$foundCommentAttribute) {
eZDebug::writeError("Content object with id [{$contentObjectId}], does not contain an ezcomments attribute.", 'ezcomments');
return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
return compact('contentObjectId', 'languageCode', 'contentObject', 'foundCommentAttribute');
}
开发者ID:legende91,项目名称:ez,代码行数:41,代码来源:ezcomposthelper.php
示例20: modify
function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
{
$parentNodeID = $namedParameters['parent_node_id'];
switch ($operatorName) {
case 'ezkeywordlist':
include_once 'lib/ezdb/classes/ezdb.php';
$db = eZDB::instance();
if ($parentNodeID) {
$node = eZContentObjectTreeNode::fetch($parentNodeID);
if ($node) {
$pathString = "AND ezcontentobject_tree.path_string like '" . $node->attribute('path_string') . "%'";
}
$parentNodeIDSQL = "AND ezcontentobject_tree.node_id != " . (int) $parentNodeID;
}
$limitation = false;
$sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL(eZContentObjectTreeNode::getLimitationList($limitation));
// eZContentObjectTreeNode::classIDByIdentifier() might need to be used for eZ Publish < 4.1
$classIDs = eZContentClass::classIDByIdentifier($namedParameters['class_identifier']);
$operatorValue = $db->arrayQuery("SELECT DISTINCT ezkeyword.keyword\n FROM ezkeyword\n JOIN ezkeyword_attribute_link ON ezkeyword.id = ezkeyword_attribute_link.keyword_id\n JOIN ezcontentobject_attribute ON ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id\n JOIN ezcontentobject ON ezcontentobject_attribute.contentobject_id = ezcontentobject.id\n JOIN ezcontentobject_name ON ezcontentobject.id = ezcontentobject_name.contentobject_id\n JOIN ezcontentobject_tree ON ezcontentobject_name.contentobject_id = ezcontentobject_tree.contentobject_id AND ezcontentobject_name.content_version = ezcontentobject_tree.contentobject_version\n {$sqlPermissionChecking['from']}\n WHERE " . eZContentLanguage::languagesSQLFilter('ezcontentobject') . "\n AND " . eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject') . (empty($classIDs) ? '' : ' AND ' . $db->generateSQLINStatement($classIDs, 'ezkeyword.class_id')) . "\n {$pathString}\n {$parentNodeIDSQL} " . ($namedParameters['depth'] > 0 ? "AND ezcontentobject_tree.depth=" . (int) $namedParameters['depth'] : '') . "\n " . eZContentObjectTreeNode::createShowInvisibleSQLString(true, false) . "\n {$sqlPermissionChecking['where']}\n ORDER BY ezkeyword.keyword ASC");
break;
}
}
开发者ID:heliopsis,项目名称:ezwebin,代码行数:22,代码来源:ezkeywordlist.php
注:本文中的eZContentLanguage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论