本文整理汇总了PHP中eZContentOperationCollection::updateAlwaysAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentOperationCollection::updateAlwaysAvailable方法的具体用法?PHP eZContentOperationCollection::updateAlwaysAvailable怎么用?PHP eZContentOperationCollection::updateAlwaysAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentOperationCollection
的用法示例。
在下文中一共展示了eZContentOperationCollection::updateAlwaysAvailable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runOperation
function runOperation(&$node)
{
if (eZOperationHandler::operationIsAvailable('content_updatealwaysavailable')) {
$operationResult = eZOperationHandler::execute('content', 'updatealwaysavailable', array('object_id' => $node->attribute('contentobject_id'), 'new_always_available' => $this->available, 'node_id' => $node->attribute('node_id')));
} else {
eZContentOperationCollection::updateAlwaysAvailable($node->attribute('contentobject_id'), $this->available);
}
return true;
}
示例2: array
$operationResult = eZOperationHandler::execute('content', 'updateinitiallanguage', array('object_id' => $objectID, 'new_initial_language_id' => $newInitialLanguageID, 'node_id' => $nodeID));
} else {
eZContentOperationCollection::updateInitialLanguage($objectID, $newInitialLanguageID);
}
}
return $module->redirectToView('view', array($viewMode, $nodeID, $languageCode));
} else {
if ($module->isCurrentAction('UpdateAlwaysAvailable')) {
if (!$object->canEdit()) {
return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel', array());
}
$newAlwaysAvailable = $module->hasActionParameter('AlwaysAvailable');
if (eZOperationHandler::operationIsAvailable('content_updatealwaysavailable')) {
$operationResult = eZOperationHandler::execute('content', 'updatealwaysavailable', array('object_id' => $objectID, 'new_always_available' => $newAlwaysAvailable, 'node_id' => $nodeID));
} else {
eZContentOperationCollection::updateAlwaysAvailable($objectID, $newAlwaysAvailable);
}
return $module->redirectToView('view', array($viewMode, $nodeID, $languageCode));
} else {
if ($module->isCurrentAction('RemoveTranslation')) {
if (!$module->hasActionParameter('LanguageID')) {
return $module->redirectToView('view', array($viewMode, $nodeID, $languageCode));
}
$languageIDArray = $module->actionParameter('LanguageID');
if ($module->hasActionParameter('ConfirmRemoval') && $module->actionParameter('ConfirmRemoval')) {
if (eZOperationHandler::operationIsAvailable('content_removetranslation')) {
$operationResult = eZOperationHandler::execute('content', 'removetranslation', array('object_id' => $objectID, 'language_id_list' => $languageIDArray, 'node_id' => $nodeID));
} else {
eZContentOperationCollection::removeTranslation($objectID, $languageIDArray);
}
return $module->redirectToView('view', array($viewMode, $nodeID, $languageCode));
示例3: array
<?php
$params = array(
'ClassFilterArray' => array ('publisher_folder'),
'ClassFilterType' => 'include',
'Depth' => 1,
'Limit' => 1000,
'AsObject' => false,
);
$nodes = eZContentObjectTreeNode::subTreeByNodeID( $params, 59);
echo "To treat : " . count($nodes) . "\n";
foreach ( $nodes as $node )
{
$objectId = $node['contentobject_id'];
eZContentOperationCollection::updateAlwaysAvailable( $objectId, true );
}
示例4: publish
/**
* Update null field only for active language
* @param SQLIContent $content
* @param string $activeLanguage
* @throws SQLIContentException
*/
public function publish( SQLIContent $content )
{
$options = array('modification_check' => false);
$this->setOptions(new SQLIContentPublishOptions($options));
$initialLocations = array();
if( $content->isNew() && !$this->options['parent_node_id'] ) // parent_node_id is mandatory for new content
{
// Check for initial locations that may have been registered in content
if( $content->hasInitialLocations() )
{
$initialLocations = $content->getInitialLocations();
$initialMainLocation = array_shift( $initialLocations );
$this->options['parent_node_id'] = $initialMainLocation->getNodeID();
}
else
{
throw new SQLIContentException( __METHOD__.' : Initial location or "parent_node_id" option not defined for new content !' );
}
}
$contentObject = $content->getRawContentObject();
$db = eZDB::instance();
$db->begin();
$canPublish = false;
$version = null;
$activeLanguage = $content->fields->getActiveLanguage();
// Loop against all fieldsets (by language) and edit attributes
foreach( $content->fields as $lang => $fieldset )
{
// Publish only if necessary and/or allowed (will let $canPublish to false)
if( !$this->publicationAllowed( $content, $lang ) )
{
$msg = 'Content object #'.$contentObject->attribute( 'id' ).' in language '.$lang.' has no need to be modified';
eZDebug::writeNotice( $msg, __METHOD__ );
continue;
}
// Create new $version only if necessary (this is an optimization : $version->removeThis() is very very slow !)
if ( is_null( $version ) )
{
$version = $this->createNewVersion( $content );
}
$canPublish = true;
$fieldset->refreshDataMap( $version );
// Now store attributes one by one
foreach( $fieldset as $fieldName => $field )
{
$data = $field->getData();
// For non active language, don't update field if its data is null and "update_null_field" option is false
if( $lang != $activeLanguage && is_null( $data ) )
continue;
self::storeAttributeFromString($field, $data);
}
}
$db->commit();
// Publication is allowed (content modified)
if( $canPublish )
{
// Now do publish for current language
eZDebug::accumulatorStart( 'sqlicontentpublisher_publish', 'sqlicontentpublisher', 'Publishing object #'.$contentObject->attribute( 'id' ) );
$operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObject->attribute( 'id' ),
'version' => $version->attribute( 'version' ) ) );
eZDebug::accumulatorStop( 'sqlicontentpublisher_publish' );
// Now cleaning
$contentObject->cleanupInternalDrafts();
$content->refresh();
$content->addPendingClearCacheIfNeeded();
// Handling additional "initial" locations. Only for new content
if( count( $initialLocations ) > 0 )
{
foreach( $initialLocations as $initialAdditionalLocation )
{
$this->addLocationToContent( $initialAdditionalLocation , $content);
}
}
if ( $content->getRawContentObject()->attribute('class_identifier') == 'publisher_folder' )
{
eZContentOperationCollection::updateAlwaysAvailable( $content->getRawContentObject()->attribute('id'), true );
}
}
//.........这里部分代码省略.........