本文整理汇总了PHP中eZContentObjectVersion::fetchVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectVersion::fetchVersion方法的具体用法?PHP eZContentObjectVersion::fetchVersion怎么用?PHP eZContentObjectVersion::fetchVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectVersion
的用法示例。
在下文中一共展示了eZContentObjectVersion::fetchVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Adds a draft to the publishing queue
*
* @param int $objectId
* @param int $version
*
* @return ezpContentPublishingProcess
*/
public static function add($objectId, $version)
{
self::init();
self::signals()->emit('preQueue', $version, $objectId);
$processObject = ezpContentPublishingProcess::queue(eZContentObjectVersion::fetchVersion($version, $objectId));
return $processObject;
}
示例2: getCollectionData
/**
* @deprecated since eZ Find 2.1
* Get collection data. Returns list of ezfSolrDocumentFieldBase documents.
*
* @return array List of ezfSolrDocumentFieldBase objects.
*/
public function getCollectionData()
{
$returnList = array();
switch( $this->ContentObjectAttribute->attribute( 'data_type_string' ) )
{
case 'ezobjectrelation':
{
$returnList = $this->getBaseList( $this->ContentObjectAttribute->attribute( 'object_version' ) );
} break;
case 'ezobjectrelationlist':
{
$content = $this->ContentObjectAttribute->content();
foreach ( $content['relation_list'] as $relationItem )
{
$subObjectID = $relationItem['contentobject_id'];
if ( !$subObjectID )
continue;
$subObject = eZContentObjectVersion::fetchVersion( $relationItem['contentobject_version'], $subObjectID );
if ( !$subObject )
continue;
$returnList = array_merge( $this->getBaseList( $subObject ),
$returnList );
}
} break;
}
return $returnList;
}
示例3: testLinksAcrossTranslations
/**
* Test scenario for issue #13492: Links are lost after removing version
*
* Test Outline
* ------------
* 1. Create a Folder in English containing a link (in the short_description attribute).
* 2. Translate Folder into Norwegian containing another link (not the same link as above.)
* 3. Remove Folder version 1. (Version 2 is created when translating).
*
* @result: short_description in version 2 will have an empty link.
* @expected: short_description should contain same link as in version 1.
* @link http://issues.ez.no/13492
*/
public function testLinksAcrossTranslations()
{
ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'ContentObjectLocale', 'eng-GB');
$xmlDataEng = '<link href="/some-where-random">a link</link>';
$xmlDataNor = '<link href="/et-tilfeldig-sted">en link</link>';
// Step 1: Create folder
$folder = new ezpObject("folder", 2);
$folder->name = "Folder Eng";
$folder->short_description = $xmlDataEng;
$folder->publish();
$version1Xml = $folder->short_description->attribute('output')->attribute('output_text');
// Step 2: Translate folder
$trData = array("name" => "Folder Nor", "short_description" => $xmlDataNor);
$folder->addTranslation("nor-NO", $trData);
// addTranslation() publishes too.
// Step 3: Remove version 1
$version1 = eZContentObjectVersion::fetchVersion(1, $folder->id);
$version1->removeThis();
// Grab current versions data and make sure it's fresh.
$folder->refresh();
$version2Xml = $folder->short_description->attribute('output')->attribute('output_text');
$folder->remove();
ezpINIHelper::restoreINISettings();
self::assertEquals($version1Xml, $version2Xml);
}
示例4: status
public static function status( $args )
{
if ( count( $args ) != 2 )
{
throw new ezcBaseFunctionalityNotSupportedException( 'status', 'Missing argument(s)' );
}
list( $contentObjectId, $version ) = $args;
$process = ezpContentPublishingProcess::fetchByContentObjectVersion( $contentObjectId, $version );
// No process: check if the object's still a draft
// @todo Change to a PENDING check when applied (operation => step 2)
if ( $process instanceof ezpContentPublishingProcess )
{
$return = array();
$status = $process->attribute( 'status' ) == ezpContentPublishingProcess::STATUS_WORKING ? 'working' : 'finished';
switch( $process->attribute( 'status' ) )
{
case ezpContentPublishingProcess::STATUS_WORKING:
$status = 'working';
break;
case ezpContentPublishingProcess::STATUS_FINISHED:
$status = 'finished';
$objectVersion = $process->attribute( 'version' );
$object = $objectVersion->attribute( 'contentobject' );
$node = $object->attribute( 'main_node' );
$uri = $node->attribute( 'url_alias' );
eZURI::transformURI( $uri );
$return['node_uri'] = $uri;
break;
case ezpContentPublishingProcess::STATUS_PENDING:
$status = 'pending';
break;
case ezpContentPublishingProcess::STATUS_DEFERRED:
$status = 'deferred';
$versionViewUri = "content/versionview/{$contentObjectId}/{$version}";
eZURI::transformURI( $versionViewUri );
$return['versionview_uri'] = $versionViewUri;
break;
}
$return['status'] = $status;
}
else
{
$version = eZContentObjectVersion::fetchVersion( $version, $contentObjectId );
if ( $version === null )
throw new ezcBaseFunctionalityNotSupportedException( 'status', 'Object version not found' );
else
$return = array( 'status' => 'queued' );
}
return $return;
}
示例5: fetchByContentObjectVersion
/**
* Fetches a process by its content object ID + version
* @param int $contentObjectId
* @param int $version
* @return ezpContentPublishingProcess
*/
public static function fetchByContentObjectVersion($contentObjectId, $version)
{
$contentObjectVersion = eZContentObjectVersion::fetchVersion($version, $contentObjectId);
if ($contentObjectVersion instanceof eZContentObjectVersion) {
$return = self::fetchByContentVersionId($contentObjectVersion->attribute('id'));
return $return;
} else {
return false;
}
}
示例6: fetchNonTranslationList
public static function fetchNonTranslationList($objectID, $version)
{
$version = eZContentObjectVersion::fetchVersion($version, $objectID);
if (!$version) {
return array('error' => array('error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND));
}
$nonTranslationList = $version->nonTranslationList();
if ($nonTranslationList === null) {
return array('error' => array('error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND));
}
return array('result' => $nonTranslationList);
}
示例7: 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;
}
示例8: fetchByListObjectVersion
/**
* Spezific function to fetch NL list
* if it is an Virtual List return a CjwNewsletterListVirtual object
* otherwise CjwNewsletterList
*
* @param int $listContentObjectId
* @param int $listContentObjectVersion
*/
static function fetchByListObjectVersion($listContentObjectId, $listContentObjectVersion)
{
if ((int) $listContentObjectVersion == 0) {
$listContentObject = eZContentObject::fetch($listContentObjectId, true);
if (!is_object($listContentObject)) {
return false;
}
$listContentObjectVersion = $listContentObject->attribute('current');
} else {
$listContentObjectVersion = eZContentObjectVersion::fetchVersion($listContentObjectVersion, $listContentObjectId);
}
if (is_object($listContentObjectVersion)) {
$dataMap = $listContentObjectVersion->attribute('data_map');
if (isset($dataMap['newsletter_list'])) {
$newsletterListAttribute = $dataMap['newsletter_list'];
$newsletterListAttributeContent = $newsletterListAttribute->attribute('content');
return $newsletterListAttributeContent;
} else {
return false;
}
} else {
return false;
}
}
示例9: array
//
// The "eZ publish professional licence" version 2 is available at
// http://ez.no/ez_publish/licences/professional/ and in the file
// PROFESSIONAL_LICENCE included in the packaging of this file.
// For pricing of this licence please contact us via e-mail to licence@ez.no.
// Further contact information is available at http://ez.no/company/contact/.
//
// The "GNU General Public License" (GPL) is available at
// http://www.gnu.org/copyleft/gpl.html.
//
// Contact licence@ez.no if any conditions of this licencing isn't clear to
// you.
//
$ObjectID = $Params['ObjectID'];
$ObjectVersion = $Params['ObjectVersion'];
$object = eZContentObjectVersion::fetchVersion($ObjectVersion, $ObjectID);
$newsletter = eZNewsletter::fetchByContentObject($ObjectID, $ObjectVersion, false, true);
$tpl = eZNewsletterTemplateWrapper::templateInit();
$tpl->setVariable('object', $object);
$tpl->setVariable('contentobject', $object);
$tpl->setVariable('newsletter', $newsletter);
if (!$newsletter) {
return false;
}
//skin selection
$skin_prefix = 'eznewsletter';
$custom_skin = $newsletter->attribute('design_to_use');
$Result = array();
if ($custom_skin) {
$skin_prefix = $custom_skin;
}
示例10: removeRelationObject
static function removeRelationObject($contentObjectAttribute, $deletionItem)
{
if (self::isItemPublished($deletionItem)) {
return;
}
$hostObject = $contentObjectAttribute->attribute('object');
$hostObjectID = $hostObject->attribute('id');
// Do not try removing the object if present in trash
// Only objects being really orphaned (not even being in trash) should be removed by this method.
// See issue #019457
if ((int) eZPersistentObject::count(eZContentObjectTrashNode::definition(), array("contentobject_id" => $hostObjectID)) > 0) {
return;
}
$hostObjectVersions = $hostObject->versions();
$isDeletionAllowed = true;
// check if the relation item to be deleted is unique in the domain of all host-object versions
foreach ($hostObjectVersions as $version) {
if ($isDeletionAllowed and $version->attribute('version') != $contentObjectAttribute->attribute('version')) {
$relationAttribute = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), null, array('version' => $version->attribute('version'), 'contentobject_id' => $hostObjectID, 'contentclassattribute_id' => $contentObjectAttribute->attribute('contentclassattribute_id')));
if (count($relationAttribute) > 0) {
$relationContent = $relationAttribute[0]->content();
if (is_array($relationContent) and is_array($relationContent['relation_list'])) {
foreach ($relationContent['relation_list'] as $relationItem) {
if ($deletionItem['contentobject_id'] == $relationItem['contentobject_id'] && $deletionItem['contentobject_version'] == $relationItem['contentobject_version']) {
$isDeletionAllowed = false;
break 2;
}
}
}
}
}
}
if ($isDeletionAllowed) {
$subObjectVersion = eZContentObjectVersion::fetchVersion($deletionItem['contentobject_version'], $deletionItem['contentobject_id']);
if ($subObjectVersion instanceof eZContentObjectVersion) {
$subObjectVersion->removeThis();
} else {
eZDebug::writeError('Cleanup of subobject-version failed. Could not fetch object from relation list.\\n' . 'Requested subobject id: ' . $deletionItem['contentobject_id'] . '\\n' . 'Requested Subobject version: ' . $deletionItem['contentobject_version'], __METHOD__);
}
}
}
示例11: contentObjectVersionObject
/**
* Returns the eZContentObjectVersionObject of the current node
*
* @param bool $asObject
* @return eZContentObjectVersion|array|bool
*/
function contentObjectVersionObject($asObject = true)
{
$version = eZContentObjectVersion::fetchVersion($this->ContentObjectVersion, $this->ContentObjectID, $asObject);
if ($this->CurrentLanguage != false) {
$version->CurrentLanguage = $this->CurrentLanguage;
}
return $version;
}
示例12: templateInit
if ($options['current_hostname']) {
$currentHostName = $options['current_hostname'];
}
if ($options['www_dir']) {
$wwwDir = $options['www_dir'];
}
if ($options['skin_name']) {
$skinName = $options['skin_name'];
}
//$iniName = $options['arguments'][0];
$ini = eZINI::instance('site.ini');
$siteUrl = $ini->variable('SiteSettings', 'SiteURL');
$locale = $ini->variable('RegionalSettings', 'Locale');
$outputContent = '';
// fetch objectversion
$contentObject = eZContentObjectVersion::fetchVersion($objectVersion, $objectId);
$tpl = templateInit();
$tpl->setVariable('contentobject', $contentObject);
if (!is_object($contentObject)) {
$script->shutdown();
}
$contentType = 'text/html';
$newsletterEditionContent = array('html' => '', 'text' => '');
$htmlMailImageInclude = 0;
$urlArray = getUrlArray($siteUrl, $currentHostName, $wwwDir);
switch ($outputFormatId) {
default:
// html 0
// html 0
case CjwNewsletterSubscription::OUTPUT_FORMAT_HTML:
// textpart
示例13: testEditAfterFetchTemplateRepeatOperation
/**
* Test regression for issue #14371 in a module/view context:
* Workflow template repeat broken by security patch.
*
* Test Outline
* ------------
* 1. Setup a workflow that features a custom workflow event that expects a
* value to be submitted before
* 2. Create & publish an article
* 3. Add a global POST variable that would be sent interactively from POST
* 4. Publish again with this variable
*
* @result: Redirection to content/history
* @expected: The object gets published without being redirected
* @link http://issues.ez.no/14371
*/
public function testEditAfterFetchTemplateRepeatOperation()
{
// first, we need to create an appropriate test workflow
$adminUser = eZUser::fetchByName('admin');
$adminUserID = $adminUser->attribute('contentobject_id');
// Create approval workflow and set up pre publish trigger
$this->workflow = $this->createWorkFlow($adminUserID);
$this->trigger = $this->createTrigger($this->workflow->attribute('id'));
// Log in as a user who's allowed to publish content
$this->currentUser = eZUser::currentUser();
eZUser::setCurrentlyLoggedInUser($adminUser, $adminUserID);
// required to avoid a notice
$GLOBALS['eZSiteBasics']['user-object-required'] = false;
$contentModule = eZModule::findModule('content');
$adminUserID = eZUser::fetchByName('admin')->attribute('contentobject_id');
// STEP 1: Create an article
// This should start the publishing process, and interrupt it because
// of the fetch template repeat workflow (expected)
$article = new ezpObject("article", 2, $adminUserID);
$article->name = "Article (with interactive workflow) for issue/regression #14371";
$objectID = $article->publish();
$version = eZContentObjectVersion::fetchVersion(1, $objectID);
// STEP 2: Add the POST variables that will allow the operation to continue
$_POST['CompletePublishing'] = 1;
// STEP 3: run content/edit again in order to simulate a POST from the custom TPL
$operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $objectID, 'version' => 1));
$this->assertInternalType('array', $operationResult);
$this->assertEquals($operationResult['status'], eZModuleOperationInfo::STATUS_CONTINUE, "The operation result wasn't CONTINUE");
$this->removeWorkflow($this->workflow);
// Log in as whoever was logged in
eZUser::setCurrentlyLoggedInUser($this->currentUser, $this->currentUser->attribute('id'));
}
示例14: sendToPublishingQueue
/**
* Sends the published object/version for publishing to the queue
* Used by the content/publish operation
* @param int $objectId
* @param int $version
*
* @return array( status => int )
* @since 4.5
*/
public static function sendToPublishingQueue($objectId, $version)
{
$behaviour = ezpContentPublishingBehaviour::getBehaviour();
if ($behaviour->disableAsynchronousPublishing) {
$asyncEnabled = false;
} else {
$asyncEnabled = eZINI::instance('content.ini')->variable('PublishingSettings', 'AsynchronousPublishing') == 'enabled';
}
$accepted = true;
if ($asyncEnabled === true) {
// Filter handlers
$ini = eZINI::instance('content.ini');
$filterHandlerClasses = $ini->variable('PublishingSettings', 'AsynchronousPublishingFilters');
if (count($filterHandlerClasses)) {
$versionObject = eZContentObjectVersion::fetchVersion($version, $objectId);
foreach ($filterHandlerClasses as $filterHandlerClass) {
if (!class_exists($filterHandlerClass)) {
eZDebug::writeError("Unknown asynchronous publishing filter handler class '{$filterHandlerClass}'", __METHOD__);
continue;
}
$handler = new $filterHandlerClass($versionObject);
if (!$handler instanceof ezpAsynchronousPublishingFilterInterface) {
eZDebug::writeError("Asynchronous publishing filter handler class '{$filterHandlerClass}' does not implement ezpAsynchronousPublishingFilterInterface", __METHOD__);
continue;
}
$accepted = $handler->accept();
if (!$accepted) {
eZDebugSetting::writeDebug("Object #{$objectId}/{$version} was excluded from asynchronous publishing by {$filterHandlerClass}", __METHOD__);
break;
}
}
}
unset($filterHandlerClasses, $handler);
}
if ($asyncEnabled && $accepted) {
// if the object is already in the process queue, we move ahead
// this test should NOT be necessary since http://issues.ez.no/17840 was fixed
if (ezpContentPublishingQueue::isQueued($objectId, $version)) {
return array('status' => eZModuleOperationInfo::STATUS_CONTINUE);
} else {
ezpContentPublishingQueue::add($objectId, $version);
return array('status' => eZModuleOperationInfo::STATUS_HALTED, 'redirect_url' => "content/queued/{$objectId}/{$version}");
}
} else {
return array('status' => eZModuleOperationInfo::STATUS_CONTINUE);
}
}
示例15: eventContent
function eventContent($event)
{
return eZContentObjectVersion::fetchVersion($event->attribute('data_int2'), $event->attribute('data_int1'));
}