本文整理汇总了PHP中eZContentClass::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentClass::fetch方法的具体用法?PHP eZContentClass::fetch怎么用?PHP eZContentClass::fetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentClass
的用法示例。
在下文中一共展示了eZContentClass::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modify
function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
{
$canCreateClassList = $namedParameters['can_create_class_list'];
switch ($operatorName) {
case 'ezcreateclasslistgroups':
$groupArray = array();
$ini = eZINI::instance('websitetoolbar.ini');
foreach ($canCreateClassList as $class) {
$contentClass = eZContentClass::fetch($class['id']);
if (!$contentClass) {
return false;
}
foreach ($contentClass->fetchGroupList() as $group) {
$isHidden = false;
if (in_array($contentClass->attribute('identifier'), $ini->variable('WebsiteToolbarSettings', 'HiddenContentClasses'))) {
$isHidden = true;
}
if (array_key_exists($group->attribute('group_id'), $groupArray)) {
if (!$isHidden) {
$groupArray[$group->attribute('group_id')]['items'][] = $contentClass;
}
} else {
if (!$isHidden) {
$groupArray[$group->attribute('group_id')]['items'] = array($contentClass);
$groupArray[$group->attribute('group_id')]['group_name'] = $group->attribute('group_name');
}
}
}
}
$operatorValue = $groupArray;
break;
}
}
示例2: remove
static function remove($classID)
{
$contentClass = eZContentClass::fetch($classID);
if ($contentClass == null or !$contentClass->isRemovable()) {
return false;
}
// Remove all objects
$contentObjects = eZContentObject::fetchSameClassList($classID);
foreach ($contentObjects as $contentObject) {
eZContentObjectOperations::remove($contentObject->attribute('id'));
}
if (count($contentObjects) == 0) {
eZContentObject::expireAllViewCache();
}
eZContentClassClassGroup::removeClassMembers($classID, 0);
eZContentClassClassGroup::removeClassMembers($classID, 1);
// Fetch real version and remove it
$contentClass->remove(true);
// Fetch temp version and remove it
$tempDeleteClass = eZContentClass::fetch($classID, true, 1);
if ($tempDeleteClass != null) {
$tempDeleteClass->remove(true, 1);
}
return true;
}
示例3: removeGroup
static function removeGroup( $classID, $classVersion, $selectedGroup )
{
$class = eZContentClass::fetch( $classID, true, eZContentClass::VERSION_STATUS_DEFINED );
if ( !$class )
return false;
$groups = $class->attribute( 'ingroup_list' );
foreach ( array_keys( $groups ) as $key )
{
if ( in_array( $groups[$key]->attribute( 'group_id' ), $selectedGroup ) )
{
unset( $groups[$key] );
}
}
if ( count( $groups ) == 0 )
{
return false;
}
else
{
foreach( $selectedGroup as $group_id )
{
eZContentClassClassGroup::removeGroup( $classID, $classVersion, $group_id );
}
}
return true;
}
示例4: testContentClassStillInGroupAfterEdition
/**
* Test that saving a content class in DEFINED version status
* correctly manipulate associated class groups
*
* @link http://issues.ez.no/16197
*/
public function testContentClassStillInGroupAfterEdition()
{
$class = eZContentClass::fetch( $this->class->id );
// This is logic contained in kernel/class/edit.php
foreach ( eZContentClassClassGroup::fetchGroupList( $class->attribute( 'id' ),
eZContentClass::VERSION_STATUS_DEFINED ) as $classGroup )
{
eZContentClassClassGroup::create( $class->attribute( 'id' ),
eZContentClass::VERSION_STATUS_TEMPORARY,
$classGroup->attribute( 'group_id' ),
$classGroup->attribute( 'group_name' ) )
->store();
}
$attributes = $class->fetchAttributes();
$class->setAttribute( 'version', eZContentClass::VERSION_STATUS_TEMPORARY );
$class->NameList->setHasDirtyData();
foreach ( $attributes as $attribute )
{
$attribute->setAttribute( 'version', eZContentClass::VERSION_STATUS_TEMPORARY );
if ( $dataType = $attribute->dataType() )
$dataType->initializeClassAttribute( $attribute );
}
$class->store( $attributes );
$db = eZDB::instance();
$db->begin();
$class->storeVersioned( $attributes, eZContentClass::VERSION_STATUS_DEFINED );
$db->commit();
$this->assertTrue( eZContentClassClassGroup::classInGroup( $class->attribute( 'id' ),
eZContentClass::VERSION_STATUS_DEFINED,
1 ) );
}
示例5: createUser
/**
* Creates a user with provided auth data
*
* @param array $authResult
*
* @return bool|eZUser
*/
public static function createUser($authResult)
{
$ngConnectINI = eZINI::instance('ngconnect.ini');
$siteINI = eZINI::instance('site.ini');
$defaultUserPlacement = $ngConnectINI->variable('LoginMethod_' . $authResult['login_method'], 'DefaultUserPlacement');
$placementNode = eZContentObjectTreeNode::fetch($defaultUserPlacement);
if (!$placementNode instanceof eZContentObjectTreeNode) {
$defaultUserPlacement = $siteINI->variable('UserSettings', 'DefaultUserPlacement');
$placementNode = eZContentObjectTreeNode::fetch($defaultUserPlacement);
if (!$placementNode instanceof eZContentObjectTreeNode) {
return false;
}
}
$contentClass = eZContentClass::fetch($siteINI->variable('UserSettings', 'UserClassID'));
$userCreatorID = $siteINI->variable('UserSettings', 'UserCreatorID');
$defaultSectionID = $siteINI->variable('UserSettings', 'DefaultSectionID');
$db = eZDB::instance();
$db->begin();
$contentObject = $contentClass->instantiate($userCreatorID, $defaultSectionID);
$contentObject->store();
$nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $contentObject->attribute('id'), 'contentobject_version' => 1, 'parent_node' => $placementNode->attribute('node_id'), 'is_main' => 1));
$nodeAssignment->store();
$currentTimeStamp = eZDateTime::currentTimeStamp();
/** @var eZContentObjectVersion $version */
$version = $contentObject->currentVersion();
$version->setAttribute('modified', $currentTimeStamp);
$version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
$version->store();
$dataMap = $version->dataMap();
self::fillUserObject($version->dataMap(), $authResult);
if (!isset($dataMap['user_account'])) {
$db->rollback();
return false;
}
$userLogin = 'ngconnect_' . $authResult['login_method'] . '_' . $authResult['id'];
$userPassword = (string) rand() . 'ngconnect_' . $authResult['login_method'] . '_' . $authResult['id'] . (string) rand();
$userExists = false;
if (eZUser::requireUniqueEmail()) {
$userExists = eZUser::fetchByEmail($authResult['email']) instanceof eZUser;
}
if (empty($authResult['email']) || $userExists) {
$email = md5('ngconnect_' . $authResult['login_method'] . '_' . $authResult['id']) . '@localhost.local';
} else {
$email = $authResult['email'];
}
$user = new eZUser(array('contentobject_id' => $contentObject->attribute('id'), 'email' => $email, 'login' => $userLogin, 'password_hash' => md5("{$userLogin}\n{$userPassword}"), 'password_hash_type' => 1));
$user->store();
$userSetting = new eZUserSetting(array('is_enabled' => true, 'max_login' => 0, 'user_id' => $contentObject->attribute('id')));
$userSetting->store();
$dataMap['user_account']->setContent($user);
$dataMap['user_account']->store();
$operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $contentObject->attribute('id'), 'version' => $version->attribute('version')));
if (array_key_exists('status', $operationResult) && $operationResult['status'] == eZModuleOperationInfo::STATUS_CONTINUE) {
$db->commit();
return $user;
}
$db->rollback();
return false;
}
示例6: className
function className()
{
if ($this->ClassName === null) {
$contentClass = eZContentClass::fetch($this->attribute('contentclass_id'));
$this->ClassName = $contentClass->attribute('name');
}
return $this->ClassName;
}
示例7: updateClass
function updateClass($classId, $scheduledScript)
{
$cli = eZCLI::instance();
/*
// If the class is not stored yet, store it now
$class = eZContentClass::fetch( $classId, true, eZContentClass::VERSION_STATUS_TEMPORARY );
if ( $class )
{
$cli->output( "Storing class" );
$class->storeDefined( $class->fetchAttributes() );
}
*/
// Fetch the stored class
$class = eZContentClass::fetch($classId, true, eZContentClass::VERSION_STATUS_MODIFIED);
if (!$class) {
$cli->error('No class in a modified version status with ID: ' . $classId);
return;
}
// Fetch attributes and definitions
$attributes = $class->fetchAttributes($classId, true, eZContentClass::VERSION_STATUS_MODIFIED);
$oldClassAttributes = $class->fetchAttributes($classId, true, eZContentClass::VERSION_STATUS_DEFINED);
// Delete object attributes which have been removed.
foreach ($oldClassAttributes as $oldClassAttribute) {
$attributeExist = false;
$oldClassAttributeID = $oldClassAttribute->attribute('id');
foreach ($attributes as $newClassAttribute) {
if ($oldClassAttributeID == $newClassAttribute->attribute('id')) {
$attributeExist = true;
}
}
if (!$attributeExist) {
foreach (eZContentObjectAttribute::fetchSameClassAttributeIDList($oldClassAttributeID) as $objectAttribute) {
$objectAttribute->removeThis($objectAttribute->attribute('id'));
}
}
}
$class->storeVersioned($attributes, eZContentClass::VERSION_STATUS_DEFINED);
// Add object attributes which have been added.
foreach ($attributes as $newClassAttribute) {
$attributeExist = false;
foreach ($oldClassAttributes as $oldClassAttribute) {
if ($oldClassAttribute->attribute('id') == $newClassAttribute->attribute('id')) {
$attributeExist = true;
break;
}
}
if (!$attributeExist) {
$objects = null;
$newClassAttribute->initializeObjectAttributes($objects);
}
}
if ($scheduledScript !== false) {
$scheduledScript->updateProgress(100);
}
}
示例8: contentClassList
private function contentClassList()
{
$db = eZDB::instance();
$query = "SELECT ezcontentclass.id\n FROM ezcontentclass,\n ezcontentclass_attribute ezcontentclass_attribute1,\n ezcontentclass_attribute ezcontentclass_attribute2\n WHERE ezcontentclass.version='0' AND\n ezcontentclass.id=ezcontentclass_attribute1.contentclass_id AND\n ezcontentclass_attribute1.is_information_collector='0' AND\n ezcontentclass.id=ezcontentclass_attribute2.contentclass_id AND\n ezcontentclass_attribute2.is_information_collector='0' AND\n ezcontentclass_attribute1.contentclass_id=ezcontentclass_attribute2.contentclass_id AND\n ezcontentclass_attribute1.data_type_string='ezxmltext' AND\n ezcontentclass_attribute2.data_type_string='eztext'";
$contentClassArray = $db->arrayQuery($query);
$retArray = array();
foreach ($contentClassArray as $contentClass) {
$retArray[] = eZContentClass::fetch($contentClass['id']);
}
return $retArray;
}
示例9: className
function className()
{
if ($this->ClassName === null) {
$contentClass = eZContentClass::fetch($this->attribute('contentclass_id'));
if (!$contentClass instanceof eZContentClass) {
eZDebug::writeError('Unable to find eZContentClass #' . $this->attribute('contentclass_id'), __METHOD__);
return null;
}
$this->ClassName = $contentClass->attribute('name');
}
return $this->ClassName;
}
示例10:
function &classAttributes()
{
if (isset($this->ClassID) and $this->ClassID) {
$contentClass = eZContentClass::fetch($this->ClassID);
if ($contentClass) {
$attributes = $contentClass->fetchAttributes();
} else {
$attributes = null;
}
} else {
$attributes = null;
}
return $attributes;
}
示例11: getClassConstraintListAsArray
function getClassConstraintListAsArray($class_identifier = false, $contentclass_id = false, $debug = false)
{
//todo debug
if (!$contentclass_id && !$class_identifier) {
return;
}
if ($contentclass_id && $class_identifier) {
return;
}
$ezobjectrelationlist = eZContentClassAttribute::fetchFilteredList(array('data_type_string' => 'ezobjectrelationlist'));
$return = array();
if ($contentclass_id) {
foreach ($ezobjectrelationlist as $attribute) {
if ($attribute->attribute('contentclass_id') == $contentclass_id) {
$attributeContent = $attribute->content();
if (!empty($attributeContent['class_constraint_list'])) {
$return = array_merge($return, $attributeContent['class_constraint_list']);
}
}
}
if (!empty($return)) {
return $return;
} else {
return false;
}
}
if ($class_identifier) {
foreach ($ezobjectrelationlist as $attribute) {
$attributeContent = $attribute->content();
if (!empty($attributeContent['class_constraint_list'])) {
if (in_array($class_identifier, $attributeContent['class_constraint_list'])) {
$class = eZContentClass::fetch($attribute->attribute('contentclass_id'));
$classIdentifier = eZContentClass::classIdentifierByID($attribute->attribute('contentclass_id'));
$return[$classIdentifier][] = array('class_id' => $attribute->attribute('contentclass_id'), 'class_name' => $class->attribute('name'), 'attribute_identifier' => $attribute->attribute('identifier'), 'attribute_name' => $attribute->attribute('name'), 'class_constraint_list' => $attributeContent['class_constraint_list'], 'search_filter' => $classIdentifier . '/' . $attribute->attribute('identifier') . '/main_node_id');
}
}
}
//eZDebug::writeNotice( $return, __METHOD__ );
if (!empty($return)) {
return $return;
} else {
return false;
}
}
return false;
}
示例12: getFieldMapping
/**
* Retrieve mapping between content attribute css id and swarm attribute identifier
*
* @return array
*/
public function getFieldMapping()
{
$siteIni = eZINI::instance('site.ini');
$swarmIni = eZINI::instance('ezswarm.ini');
$userAttribMapping = $swarmIni->variable('SwarmSettings', 'UserAttributeMapping');
$userClassId = $siteIni->variable('UserSettings', 'UserClassID');
$userAccountAttribute = $swarmIni->variable('SwarmSettings', 'UserAccountAttribute');
$userClass = eZContentClass::fetch($userClassId);
$userClassAttributes = $userClass->dataMap();
$fieldMapping = array();
$userAccountAttributeId = $userClassAttributes[$userAccountAttribute]->attribute('id');
$fieldMapping["#ezcoa-" . $userAccountAttributeId . "_" . $userAccountAttribute . "_email"] = 'email';
if ($siteIni->variable('UserSettings', 'RequireConfirmEmail') == 'true') {
$fieldMapping["#ezcoa-" . $userAccountAttributeId . "_" . $userAccountAttribute . "_email_confirm"] = 'email';
}
foreach ($userAttribMapping as $attribIdentifier => $swarmField) {
$attributeId = $userClassAttributes[$attribIdentifier]->attribute('id');
$fieldMapping["#ezcoa-" . $attributeId . "_" . $attribIdentifier] = $swarmField;
}
return $fieldMapping;
}
示例13: fetchOverrideTemplateList
function fetchOverrideTemplateList($classID)
{
$class = eZContentClass::fetch($classID);
$classIdentifier = $class->attribute('identifier');
$result = array();
$ini = eZINI::instance();
$siteAccessArray = $ini->variable('SiteAccessSettings', 'AvailableSiteAccessList');
foreach ($siteAccessArray as $siteAccess) {
$overrides = eZTemplateDesignResource::overrideArray($siteAccess);
foreach ($overrides as $override) {
if (isset($override['custom_match'])) {
foreach ($override['custom_match'] as $customMatch) {
if (isset($customMatch['conditions']['class_identifier']) && $customMatch['conditions']['class_identifier'] == $classIdentifier) {
$result[] = array('siteaccess' => $siteAccess, 'block' => $customMatch['override_name'], 'source' => $override['template'], 'target' => $customMatch['match_file']);
}
if (isset($customMatch['conditions']['class']) && $customMatch['conditions']['class'] == $classID) {
$result[] = array('siteaccess' => $siteAccess, 'block' => $customMatch['override_name'], 'source' => $override['template'], 'target' => $customMatch['match_file']);
}
}
}
}
}
return array('result' => $result);
}
示例14: importRSSItem
function importRSSItem($item, $rssImport, $cli, $channel)
{
$rssImportID = $rssImport->attribute('id');
$rssOwnerID = $rssImport->attribute('object_owner_id');
// Get owner user id
$parentContentObjectTreeNode = eZContentObjectTreeNode::fetch($rssImport->attribute('destination_node_id'));
// Get parent treenode object
if ($parentContentObjectTreeNode == null) {
$cli->output('RSSImport ' . $rssImport->attribute('name') . ': Destination tree node seems to be unavailable');
return 0;
}
$parentContentObject = $parentContentObjectTreeNode->attribute('object');
// Get parent content object
$titleElement = $item->getElementsByTagName('title')->item(0);
$title = is_object($titleElement) ? $titleElement->textContent : '';
// Test for link or guid as unique identifier
$link = $item->getElementsByTagName('link')->item(0);
$guid = $item->getElementsByTagName('guid')->item(0);
$rssId = '';
if ($link->textContent) {
$rssId = $link->textContent;
} elseif ($guid->textContent) {
$rssId = $guid->textContent;
} else {
$cli->output('RSSImport ' . $rssImport->attribute('name') . ': Item has no unique identifier. RSS guid or link missing.');
return 0;
}
$md5Sum = md5($rssId);
// Try to fetch RSSImport object with md5 sum matching link.
$existingObject = eZPersistentObject::fetchObject(eZContentObject::definition(), null, array('remote_id' => 'RSSImport_' . $rssImportID . '_' . $md5Sum));
// if object exists, continue to next import item
if ($existingObject != null) {
$cli->output('RSSImport ' . $rssImport->attribute('name') . ': Object ( ' . $existingObject->attribute('id') . ' ) with ID: "' . $rssId . '" already exists');
unset($existingObject);
// delete object to preserve memory
return 0;
}
// Fetch class, and create ezcontentobject from it.
$contentClass = eZContentClass::fetch($rssImport->attribute('class_id'));
// Instantiate the object with user $rssOwnerID and use section id from parent. And store it.
$contentObject = $contentClass->instantiate($rssOwnerID, $parentContentObject->attribute('section_id'));
$db = eZDB::instance();
$db->begin();
$contentObject->store();
$contentObjectID = $contentObject->attribute('id');
// Create node assignment
$nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $contentObjectID, 'contentobject_version' => $contentObject->attribute('current_version'), 'is_main' => 1, 'parent_node' => $parentContentObjectTreeNode->attribute('node_id')));
$nodeAssignment->store();
$version = $contentObject->version(1);
$version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
$version->store();
// Get object attributes, and set their values and store them.
$dataMap = $contentObject->dataMap();
$importDescription = $rssImport->importDescription();
// Set content object attribute values.
$classAttributeList = $contentClass->fetchAttributes();
foreach ($classAttributeList as $classAttribute) {
$classAttributeID = $classAttribute->attribute('id');
if (isset($importDescription['class_attributes'][$classAttributeID])) {
if ($importDescription['class_attributes'][$classAttributeID] == '-1') {
continue;
}
$importDescriptionArray = explode(' - ', $importDescription['class_attributes'][$classAttributeID]);
if (count($importDescriptionArray) < 1) {
$cli->output('RSSImport ' . $rssImport->attribute('name') . ': Invalid import definition. Please redit.');
break;
}
$elementType = $importDescriptionArray[0];
array_shift($importDescriptionArray);
switch ($elementType) {
case 'item':
setObjectAttributeValue($dataMap[$classAttribute->attribute('identifier')], recursiveFindRSSElementValue($importDescriptionArray, $item));
break;
case 'channel':
setObjectAttributeValue($dataMap[$classAttribute->attribute('identifier')], recursiveFindRSSElementValue($importDescriptionArray, $channel));
break;
}
}
}
$contentObject->setAttribute('remote_id', 'RSSImport_' . $rssImportID . '_' . $md5Sum);
$contentObject->store();
$db->commit();
// Publish new object. The user id is sent to make sure any workflow
// requiring the user id has access to it.
$operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $contentObject->attribute('id'), 'version' => 1, 'user_id' => $rssOwnerID));
if (!isset($operationResult['status']) || $operationResult['status'] != eZModuleOperationInfo::STATUS_CONTINUE) {
if (isset($operationResult['result']) && isset($operationResult['result']['content'])) {
$failReason = $operationResult['result']['content'];
} else {
$failReason = "unknown error";
}
$cli->error("Publishing failed: {$failReason}");
unset($failReason);
}
$db->begin();
unset($contentObject);
unset($version);
$contentObject = eZContentObject::fetch($contentObjectID);
$version = $contentObject->attribute('current');
// Set object Attributes like modified and published timestamps
//.........这里部分代码省略.........
示例15: storeRSSExport
static function storeRSSExport($Module, $http, $publish = false, $skipValuesID = null)
{
$valid = true;
$validationErrors = array();
/* Kill the RSS cache in all siteaccesses */
$config = eZINI::instance('site.ini');
$cacheDir = eZSys::cacheDirectory();
$availableSiteAccessList = $config->variable('SiteAccessSettings', 'AvailableSiteAccessList');
foreach ($availableSiteAccessList as $siteAccess) {
$cacheFilePath = $cacheDir . '/rss/' . md5($siteAccess . $http->postVariable('Access_URL')) . '.xml';
$cacheFile = eZClusterFileHandler::instance($cacheFilePath);
if ($cacheFile->exists()) {
$cacheFile->delete();
}
}
$db = eZDB::instance();
$db->begin();
/* Create the new RSS feed */
for ($itemCount = 0; $itemCount < $http->postVariable('Item_Count'); $itemCount++) {
if ($skipValuesID == $http->postVariable('Item_ID_' . $itemCount)) {
continue;
}
$rssExportItem = eZRSSExportItem::fetch($http->postVariable('Item_ID_' . $itemCount), true, eZRSSExport::STATUS_DRAFT);
if ($rssExportItem == null) {
continue;
}
// RSS is supposed to feed certain objects from the subnodes
if ($http->hasPostVariable('Item_Subnodes_' . $itemCount)) {
$rssExportItem->setAttribute('subnodes', 1);
} else {
$rssExportItem->setAttribute('subnodes', 0);
}
$rssExportItem->setAttribute('class_id', $http->postVariable('Item_Class_' . $itemCount));
$class = eZContentClass::fetch($http->postVariable('Item_Class_' . $itemCount));
$titleClassAttributeIdentifier = $http->postVariable('Item_Class_Attribute_Title_' . $itemCount);
$descriptionClassAttributeIdentifier = $http->postVariable('Item_Class_Attribute_Description_' . $itemCount);
$categoryClassAttributeIdentifier = $http->postVariable('Item_Class_Attribute_Category_' . $itemCount);
if (!$class) {
$validated = false;
$validationErrors[] = ezpI18n::tr('kernel/rss/edit_export', 'Selected class does not exist');
} else {
$dataMap = $class->attribute('data_map');
if (!isset($dataMap[$titleClassAttributeIdentifier])) {
$valid = false;
$validationErrors[] = ezpI18n::tr('kernel/rss/edit_export', 'Invalid selection for title class %1 does not have attribute "%2"', null, array($class->attribute('name'), $titleClassAttributeIdentifier));
}
if ($descriptionClassAttributeIdentifier != '' && !isset($dataMap[$descriptionClassAttributeIdentifier])) {
$valid = false;
$validationErrors[] = ezpI18n::tr('kernel/rss/edit_export', 'Invalid selection for description class %1 does not have attribute "%2"', null, array($class->attribute('name'), $descriptionClassAttributeIdentifier));
}
if ($categoryClassAttributeIdentifier != '' && !isset($dataMap[$categoryClassAttributeIdentifier])) {
$valid = false;
$validationErrors[] = ezpI18n::tr('kernel/rss/edit_export', 'Invalid selection for category class %1 does not have attribute "%2"', null, array($class->attribute('name'), $categoryClassAttributeIdentifier));
}
}
$rssExportItem->setAttribute('title', $http->postVariable('Item_Class_Attribute_Title_' . $itemCount));
$rssExportItem->setAttribute('description', $http->postVariable('Item_Class_Attribute_Description_' . $itemCount));
$rssExportItem->setAttribute('category', $http->postVariable('Item_Class_Attribute_Category_' . $itemCount));
if ($http->hasPostVariable('Item_Class_Attribute_Enclosure_' . $itemCount)) {
$rssExportItem->setAttribute('enclosure', $http->postVariable('Item_Class_Attribute_Enclosure_' . $itemCount));
}
if ($publish && $valid) {
$rssExportItem->setAttribute('status', eZRSSExport::STATUS_VALID);
$rssExportItem->store();
// delete drafts
$rssExportItem->setAttribute('status', eZRSSExport::STATUS_DRAFT);
$rssExportItem->remove();
} else {
$rssExportItem->store();
}
}
$rssExport = eZRSSExport::fetch($http->postVariable('RSSExport_ID'), true, eZRSSExport::STATUS_DRAFT);
$rssExport->setAttribute('title', $http->postVariable('title'));
$rssExport->setAttribute('url', $http->postVariable('url'));
// $rssExport->setAttribute( 'site_access', $http->postVariable( 'SiteAccess' ) );
$rssExport->setAttribute('description', $http->postVariable('Description'));
$rssExport->setAttribute('rss_version', $http->postVariable('RSSVersion'));
$rssExport->setAttribute('number_of_objects', $http->postVariable('NumberOfObjects'));
$rssExport->setAttribute('image_id', $http->postVariable('RSSImageID'));
if ($http->hasPostVariable('active')) {
$rssExport->setAttribute('active', 1);
} else {
$rssExport->setAttribute('active', 0);
}
$rssExport->setAttribute('access_url', str_replace(array('/', '?', '&', '>', '<'), '', $http->postVariable('Access_URL')));
if ($http->hasPostVariable('MainNodeOnly')) {
$rssExport->setAttribute('main_node_only', 1);
} else {
$rssExport->setAttribute('main_node_only', 0);
}
$published = false;
if ($publish && $valid) {
$rssExport->store(true);
// remove draft
$rssExport->remove();
$published = true;
} else {
$rssExport->store();
}
$db->commit();
//.........这里部分代码省略.........