本文整理汇总了PHP中eZContentObjectVersion类的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectVersion类的具体用法?PHP eZContentObjectVersion怎么用?PHP eZContentObjectVersion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZContentObjectVersion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeDrafts
function removeDrafts($user)
{
$list = eZPersistentObject::fetchObjectList(eZContentObjectVersion::definition(), null, array('creator_id' => $user->id(), 'status' => array(EZ_VERSION_STATUS_DRAFT, EZ_VERSION_STATUS_INTERNAL_DRAFT)), null, null, true);
foreach ($list as $item) {
$item->remove();
}
}
示例2: groupedUserDrafts
/**
* @return array
*/
static function groupedUserDrafts()
{
$return = array();
$user = eZUser::currentUser();
$fetchParameters = array('status' => array(array(eZContentObjectVersion::STATUS_DRAFT, eZContentObjectVersion::STATUS_INTERNAL_DRAFT)), 'creator_id' => $user->attribute('contentobject_id'));
$versions = eZPersistentObject::fetchObjectList(eZContentObjectVersion::definition(), null, $fetchParameters);
$return = array();
foreach ($versions as $version) {
$return[$version->attribute('contentobject_id')] = array('version' => $version, 'related' => array());
}
foreach ($return as $id => $entry) {
$eZObj = $entry['version']->attribute('contentobject');
switch ($eZObj->attribute('class_identifier')) {
case 'image':
$revese_related_objects = $eZObj->reverseRelatedObjectList(false, 0, false, array('AllRelations' => true));
foreach ($revese_related_objects as $rr_eZObj) {
if (isset($return[$rr_eZObj->attribute('id')])) {
$return[$rr_eZObj->attribute('id')]['related'][] = $entry['version'];
unset($return[$eZObj->attribute('id')]);
}
}
}
}
return array('result' => $return);
}
示例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: 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;
}
示例5: 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;
}
示例6: getDraftVersions
public function getDraftVersions($objects)
{
$return = array();
$user = eZUser::currentUser();
foreach ($objects as $object) {
// If this user already has a draft in this language
$filters = array('contentobject_id' => $object->attribute('id'), 'status' => array(array(eZContentObjectVersion::STATUS_DRAFT, eZContentObjectVersion::STATUS_INTERNAL_DRAFT)), 'creator_id' => $user->attribute('contentobject_id'));
$existingDrafts = eZContentObjectVersion::fetchFiltered($filters, 0, 1);
if (!empty($existingDrafts)) {
$return[] = $existingDrafts[0];
} else {
$return[] = $object->createNewVersion(false, true);
}
}
return $return;
}
示例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
$ini = eZINI::instance('content.ini');
$internalDraftsCleanUpLimit = $ini->hasVariable('VersionManagement', 'InternalDraftsCleanUpLimit') ? $ini->variable('VersionManagement', 'InternalDraftsCleanUpLimit') : 0;
$durationSetting = $ini->hasVariable('VersionManagement', 'InternalDraftsDuration') ? $ini->variable('VersionManagement', 'InternalDraftsDuration') : array('hours' => 24);
// by default, only remove drafts older than 1 day
$isDurationSet = false;
$duration = 0;
if (is_array($durationSetting)) {
if (isset($durationSetting['days']) and is_numeric($durationSetting['days'])) {
$duration += $durationSetting['days'] * 60 * 60 * 24;
$isDurationSet = true;
}
if (isset($durationSetting['hours']) and is_numeric($durationSetting['hours'])) {
$duration += $durationSetting['hours'] * 60 * 60;
$isDurationSet = true;
}
if (isset($durationSetting['minutes']) and is_numeric($durationSetting['minutes'])) {
$duration += $durationSetting['minutes'] * 60;
$isDurationSet = true;
}
if (isset($durationSetting['seconds']) and is_numeric($durationSetting['seconds'])) {
$duration += $durationSetting['seconds'];
$isDurationSet = true;
}
}
if ($isDurationSet) {
$expiryTime = time() - $duration;
$processedCount = eZContentObjectVersion::removeVersions(eZContentObjectVersion::STATUS_INTERNAL_DRAFT, $internalDraftsCleanUpLimit, $expiryTime);
$cli->output("Cleaned up " . $processedCount . " internal drafts");
} else {
$cli->output("Lifetime is not set for internal drafts (see your ini-settings, content.ini, VersionManagement section).");
}
示例10: 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;
}
示例11: 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__);
}
}
}
示例12: getenv
} else {
$domain = getenv('HTTP_HOST');
$protocol = eZSys::serverProtocol();
$preFix = $protocol . "://" . $domain;
$preFix .= eZSys::wwwDir();
$link = preg_replace("/^\\//e", "", $link);
$link = $preFix . "/" . $link;
}
$viewParameters = array('offset' => $offset, 'limit' => $limit);
$http = eZHTTPTool::instance();
$objectList = eZURLObjectLink::fetchObjectVersionList($urlID, $viewParameters);
$urlViewCount = eZURLObjectLink::fetchObjectVersionCount($urlID);
if ($Module->isCurrentAction('EditObject')) {
if ($http->hasPostVariable('ObjectList')) {
$versionID = $http->postVariable('ObjectList');
$version = eZContentObjectVersion::fetch($versionID);
$contentObjectID = $version->attribute('contentobject_id');
$versionNr = $version->attribute('version');
$Module->redirect('content', 'edit', array($contentObjectID, $versionNr));
}
}
$tpl = eZTemplate::factory();
$tpl->setVariable('Module', $Module);
$tpl->setVariable('url_object', $url);
$tpl->setVariable('full_url', $link);
$tpl->setVariable('object_list', $objectList);
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('url_view_count', $urlViewCount);
$Result = array();
$Result['content'] = $tpl->fetch('design:url/view.tpl');
$Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/url', 'URL')), array('url' => false, 'text' => ezpI18n::tr('kernel/url', 'View')));
示例13: eventContent
function eventContent($event)
{
return eZContentObjectVersion::fetchVersion($event->attribute('data_int2'), $event->attribute('data_int1'));
}
示例14: foreach
foreach ( $deleteIDArray as $deleteID )
{
$version = eZContentObjectVersion::fetch( $deleteID );
if ( $version instanceof eZContentObjectVersion )
{
eZDebug::writeNotice( $deleteID, "deleteID" );
$version->removeThis();
}
}
$db->commit();
}
}
if ( $http->hasPostVariable( 'EmptyButton' ) )
{
$versions = eZContentObjectVersion::fetchForUser( $userID );
$db = eZDB::instance();
$db->begin();
foreach ( $versions as $version )
{
$version->removeThis();
}
$db->commit();
}
$tpl = eZTemplate::factory();
$tpl->setVariable('view_parameters', $viewParameters );
$Result = array();
$Result['content'] = $tpl->fetch( 'design:content/draft.tpl' );
示例15: removeVersions
/**
* @param int|bool $versionStatus
* @deprecated This method is left here only for backward compatibility. Use eZContentObjectVersion::removeVersions() method instead.
*/
static function removeVersions( $versionStatus = false )
{
eZContentObjectVersion::removeVersions( $versionStatus );
}