• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP eZContentCacheManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中eZContentCacheManager的典型用法代码示例。如果您正苦于以下问题:PHP eZContentCacheManager类的具体用法?PHP eZContentCacheManager怎么用?PHP eZContentCacheManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了eZContentCacheManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: remove

 static function remove($objectID, $removeSubtrees = true)
 {
     eZContentCacheManager::clearContentCacheIfNeeded($objectID);
     $object = eZContentObject::fetch($objectID);
     if (!is_object($object)) {
         return false;
     }
     // TODO: Is content cache cleared for all objects in subtree ??
     if ($removeSubtrees) {
         $assignedNodes = $object->attribute('assigned_nodes');
         if (count($assignedNodes) == 0) {
             $object->purge();
             eZContentObject::expireAllViewCache();
             return true;
         }
         $assignedNodeIDArray = array();
         foreach ($assignedNodes as $node) {
             $assignedNodeIDArray[] = $node->attribute('node_id');
         }
         eZContentObjectTreeNode::removeSubtrees($assignedNodeIDArray, false);
     } else {
         $object->purge();
     }
     return true;
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:25,代码来源:ezcontentobjectoperations.php


示例2: feZMetaData_ContentActionHandler

function feZMetaData_ContentActionHandler( &$module, &$http, &$objectID )
{
	// Action when user clicks on the Add Button
	if( $http->hasPostVariable( 'AddMetaDataButton' ) )
	{
		$link = 'fezmetadata/edit/0/(contentObjectID)/'.$objectID;
		$link .= '/(metaDataName)/'.$_POST['metaDataName'];
		$link .= '/(language)/'.$_POST['language'];
		eZURI::transformURI( $link );
		$http->redirect( $link );
	}

	// Action when user clicks on the Remove Button
	if( $http->hasPostVariable( 'RemoveMetaDataButton' ) and $http->hasPostVariable( 'MetaDataIDSelection' ) )
	{
		$metaDataSelection = $http->postVariable( 'MetaDataIDSelection' );
		foreach( $metaDataSelection as $metaData )
		{
			$metaDataObject = feZMetaData::fetch( $metaData );
			$metaDataObject->remove();
		}
		eZContentCacheManager::clearContentCache( $objectID );
		$ContentObject = eZContentObject::fetch( $objectID );
		$ContentNodeID = $ContentObject->mainNodeID();
		return $module->redirect( 'content', 'view', array( 'full', $ContentNodeID ) );
	}
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:27,代码来源:content_actionhandler.php


示例3: sectionEditActionCheck

function sectionEditActionCheck($module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage)
{
    if (!$module->isCurrentAction('SectionEdit')) {
        return;
    }
    $http = eZHTTPTool::instance();
    if (!$http->hasPostVariable('SelectedSectionId')) {
        return;
    }
    $selectedSection = eZSection::fetch((int) $http->postVariable('SelectedSectionId'));
    if (!$selectedSection instanceof eZSection) {
        return;
    }
    $selectedSection->applyTo($object);
    eZContentCacheManager::clearContentCacheIfNeeded($object->attribute('id'));
    $module->redirectToView('edit', array($object->attribute('id'), $editVersion, $editLanguage, $fromLanguage));
}
开发者ID:nlescure,项目名称:ezpublish,代码行数:17,代码来源:section_edit.php


示例4: execute

 function execute($process, $event)
 {
     // get object being published
     $parameters = $process->attribute('parameter_list');
     $objectId = $parameters['object_id'];
     eZDebug::writeDebug('Expire remote cache event begins execution for object ' . $objectId);
     $ini = eZINI::instance('ezworkflowcollection.ini');
     $object = eZContentObject::fetch($objectId);
     if ($object != null) {
         if ($ini->variable('ExpireRemoteCacheFlowSettings', 'ExpireOnlyObjectNodes') == 'enabled') {
             // basic version
             // get list of nodes this object is published with
             $assigned_nodes = $object->attribute('assigned_nodes');
         } else {
             // smart-cache enabled version
             // get list of nodes whose view-cache is expired
             $assigned_nodes = array();
             eZContentCacheManager::nodeListForObject($object, true, eZContentCacheManager::CLEAR_DEFAULT, $assigned_nodes, $handledObjectList);
             foreach ($assigned_nodes as $i => $nodeID) {
                 $assigned_nodes[$i] = eZContentObjectTreeNode::fetch($nodeID);
             }
         }
         $domains = $ini->variable('ExpireRemoteCacheFlowSettings', 'ExpireDomains');
         foreach ($assigned_nodes as $assigned_node) {
             // for every node, call eZHTTPCacheManager to clean the remote cache
             $url = $assigned_node->urlAlias();
             if (is_array($domains) && (count($domains) > 1 || count($domains) > 0 && $domains[0] != '')) {
                 eZURI::transformURI($url);
                 foreach ($domains as $domain) {
                     eZHTTPCacheManager::execute($domain . $url);
                 }
             } else {
                 eZURI::transformURI($url, false, 'full');
                 eZHTTPCacheManager::execute($url);
             }
         }
     } else {
         eZDebug::writeError('Expire remote cache event triggered for inexisting object: ' . $objectId);
         return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
     }
     return eZWorkflowType::STATUS_ACCEPTED;
 }
开发者ID:gggeek,项目名称:ezworkflowcollection,代码行数:42,代码来源:expireremotecacheflowtype.php


示例5: updatePriority

    /**
     * Updating priority sorting for given node
     *
     * @param mixed $args
     * @return array
     */
    public static function updatePriority( $args )
    {
        $http = eZHTTPTool::instance();

        if ( !$http->hasPostVariable('ContentNodeID')
                || !$http->hasPostVariable('PriorityID')
                    || !$http->hasPostVariable('Priority') )
        {
            return array();
        }

        $contentNodeID = $http->postVariable('ContentNodeID');
        $priorityArray = $http->postVariable('Priority');
        $priorityIDArray = $http->postVariable('PriorityID');

        $contentNode = eZContentObjectTreeNode::fetch( $contentNodeID );
        if ( !$contentNode->attribute( 'can_edit' ) )
        {
            eZDebug::writeError( 'Current user can not update the priorities because he has no permissions to edit the node' );
            return array();
        }

        if ( eZOperationHandler::operationIsAvailable( 'content_updatepriority' ) )
        {
            $operationResult = eZOperationHandler::execute( 'content', 'updatepriority',
                                                             array( 'node_id' => $contentNodeID,
                                                                    'priority' => $priorityArray,
                                                                    'priority_id' => $priorityIDArray ), null, true );
        }
        else
        {
            eZContentOperationCollection::updatePriority( $contentNodeID, $priorityArray, $priorityIDArray );
        }

        if ( $http->hasPostVariable( 'ContentObjectID' ) )
        {
            $objectID = $http->postVariable( 'ContentObjectID' );
            eZContentCacheManager::clearContentCache( $objectID );
        }
    }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:46,代码来源:ezwtservercallfunctions.php


示例6: execute

    /**
     * @param eZWorkflowProcess $process
     * @param eZWorkflowEvent $event
     * @return int
     */
    function execute( $process, $event )
    {
        // Get some information about the object being passed
        $parameters = $process->attribute( 'parameter_list' );
        $object     = eZContentObject::fetch( $parameters['object_id'] );

        if($object->ClassIdentifier != 'article')
            return self::STATUS_ACCEPTED;

        /* @type $dataMap eZContentObjectAttribute[] */
        $dataMap = $object->dataMap();

        if(isset($dataMap['source']))
        {
            $sourceString = MMNewsSource::getSourceString($object);
            if($sourceString)
            {
                $dataMap['source']->setAttribute('data_text', $sourceString);
                $dataMap['source']->store();
            }
            eZContentCacheManager::clearContentCache($object->attribute('id'));
        }
        return self::STATUS_ACCEPTED;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:29,代码来源:updatenewssourcetype.php


示例7: removeRelatedCache

function removeRelatedCache($siteAccess)
{
    // Delete compiled template
    $ini = eZINI::instance();
    $iniPath = eZSiteAccess::findPathToSiteAccess($siteAccess);
    $siteINI = eZINI::instance('site.ini.append', $iniPath);
    if ($siteINI->hasVariable('FileSettings', 'CacheDir')) {
        $cacheDir = $siteINI->variable('FileSettings', 'CacheDir');
        if ($cacheDir[0] == "/") {
            $cacheDir = eZDir::path(array($cacheDir));
        } else {
            if ($siteINI->hasVariable('FileSettings', 'VarDir')) {
                $varDir = $siteINI->variable('FileSettings', 'VarDir');
                $cacheDir = eZDir::path(array($varDir, $cacheDir));
            }
        }
    } else {
        if ($siteINI->hasVariable('FileSettings', 'VarDir')) {
            $varDir = $siteINI->variable('FileSettings', 'VarDir');
            $cacheDir = $ini->variable('FileSettings', 'CacheDir');
            $cacheDir = eZDir::path(array($varDir, $cacheDir));
        } else {
            $cacheDir = eZSys::cacheDirectory();
        }
    }
    $compiledTemplateDir = $cacheDir . "/template/compiled";
    eZDir::unlinkWildcard($compiledTemplateDir . "/", "*pagelayout*.*");
    eZCache::clearByTag('template-block');
    // Expire content view cache
    eZContentCacheManager::clearAllContentCache();
}
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:toolbar.php


示例8: setFailedLoginAttempts

 static function setFailedLoginAttempts($userID, $value = false, $setByForce = false)
 {
     $trustedUser = eZUser::isTrusted();
     // If user is trusted we should stop processing
     if ($trustedUser and !$setByForce) {
         return true;
     }
     $maxNumberOfFailedLogin = eZUser::maxNumberOfFailedLogin();
     if ($maxNumberOfFailedLogin == '0' and !$setByForce) {
         return true;
     }
     $userID = (int) $userID;
     $userObject = eZUser::fetch($userID);
     if (!$userObject) {
         return true;
     }
     $isEnabled = $userObject->isEnabled();
     // If current user is disabled we should not continue
     if (!$isEnabled and !$setByForce) {
         return true;
     }
     $db = eZDB::instance();
     $db->begin();
     $userVisitArray = $db->arrayQuery("SELECT 1 FROM ezuservisit WHERE user_id={$userID}");
     if (isset($userVisitArray[0])) {
         if ($value === false) {
             $failedLoginAttempts = $userObject->failedLoginAttempts();
             $failedLoginAttempts += 1;
         } else {
             $failedLoginAttempts = (int) $value;
         }
         $db->query("UPDATE ezuservisit SET failed_login_attempts={$failedLoginAttempts} WHERE user_id={$userID}");
     } else {
         if ($value === false) {
             $failedLoginAttempts = 1;
         } else {
             $failedLoginAttempts = (int) $value;
         }
         $db->query("INSERT INTO ezuservisit ( failed_login_attempts, user_id ) VALUES ( {$failedLoginAttempts}, {$userID} )");
     }
     $db->commit();
     eZContentCacheManager::clearContentCacheIfNeeded($userID);
     eZContentCacheManager::generateObjectViewCache($userID);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:44,代码来源:ezuser.php


示例9: storeObjectAttribute

 function storeObjectAttribute($attribute)
 {
     $ini = eZINI::instance();
     // Delete compiled template
     $siteINI = eZINI::instance();
     if ($siteINI->hasVariable('FileSettings', 'CacheDir')) {
         $cacheDir = $siteINI->variable('FileSettings', 'CacheDir');
         if ($cacheDir[0] == "/") {
             $cacheDir = eZDir::path(array($cacheDir));
         } else {
             if ($siteINI->hasVariable('FileSettings', 'VarDir')) {
                 $varDir = $siteINI->variable('FileSettings', 'VarDir');
                 $cacheDir = eZDir::path(array($varDir, $cacheDir));
             }
         }
     } else {
         if ($siteINI->hasVariable('FileSettings', 'VarDir')) {
             $varDir = $siteINI->variable('FileSettings', 'VarDir');
             $cacheDir = $ini->variable('FileSettings', 'CacheDir');
             $cacheDir = eZDir::path(array($varDir, $cacheDir));
         } else {
             $cacheDir = eZSys::cacheDirectory();
         }
     }
     $compiledTemplateDir = $cacheDir . "/template/compiled";
     eZDir::unlinkWildcard($compiledTemplateDir . "/", "*pagelayout*.*");
     // Expire template block cache
     eZContentCacheManager::clearTemplateBlockCacheIfNeeded(false);
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:29,代码来源:ezpackagetype.php


示例10: array

        // Sort objectDepthList by depth to apply updatechildren in the right order
        if (!array_multisort($objectDepthList[0], SORT_ASC, $objectDepthList[1], SORT_ASC)) {
            eZDebug::writeError('Error in array_multisort', 'ezmbpaex_updatechildren.php');
        } else {
            // Generate array of paex objects to update
            $paexObjectArray = array();
            foreach ($objectDepthList[1] as $contentobjectId) {
                if (isset($pendingList[$contentobjectId])) {
                    // Generate update children data for every pending object in pendingIDList
                    $paexObjectArray = $pendingList[$contentobjectId]->generateUpdateChildren($paexObjectArray);
                } else {
                    eZDebug::writeError('Found contentobject_id [' . $contentobjectId . '] not present in the pendingIDList', 'ezmbpaex_updatechildren.php');
                }
            }
            // Reset pending object updatechildren attribute in pendingIDList objects and add to the array of paex objects to update
            foreach ($pendingList as $pendingObject) {
                $pendingObject->setAttribute('updatechildren', 0);
                $paexObjectArray[$pendingObject->attribute('contentobject_id')] = $pendingObject;
            }
            // Store updated paex objects in the DB
            $db = eZDB::instance();
            $db->begin();
            foreach ($paexObjectArray as $paexObject) {
                $paexObject->store();
                eZContentCacheManager::clearContentCacheIfNeeded($paexObject->attribute('contentobject_id'));
            }
            $db->commit();
        }
    }
    $cli->output("eZPaEx: Update children process end");
}
开发者ID:netbliss,项目名称:ezmbpaex,代码行数:31,代码来源:ezmbpaex_updatechildren.php


示例11: clearViewCacheForSubtree

 /**
  * Clears the view cache for a subtree
  *
  * @param eZContentObjectTreeNode $node
  * @param bool $clearForRootNode
  * @return bool
  */
 static function clearViewCacheForSubtree(eZContentObjectTreeNode $node, $clearForRootNode = true)
 {
     // Max nodes to fetch at a time
     static $limit = 200;
     if ($clearForRootNode) {
         $objectID = $node->attribute('contentobject_id');
         eZContentCacheManager::clearContentCacheIfNeeded($objectID);
     }
     $offset = 0;
     $params = array('AsObject' => false, 'Depth' => false, 'Limitation' => array());
     // Empty array means no permission checking
     $subtreeCount = $node->subTreeCount($params);
     while ($offset < $subtreeCount) {
         $params['Offset'] = $offset;
         $params['Limit'] = $limit;
         $subtreeChunk = $node->subTree($params);
         $nNodesInChunk = count($subtreeChunk);
         $offset += $nNodesInChunk;
         if ($nNodesInChunk == 0) {
             break;
         }
         $objectIDList = array();
         foreach ($subtreeChunk as $curNode) {
             $objectIDList[] = $curNode['id'];
         }
         unset($subtreeChunk);
         eZContentCacheManager::clearContentCacheIfNeeded(array_unique($objectIDList));
     }
     return true;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:37,代码来源:ezcontentobjecttreenode.php


示例12: generateObjectViewCache

 static function generateObjectViewCache($objectID)
 {
     // Generate the view cache
     $ini = eZINI::instance();
     $object = eZContentObject::fetch($objectID);
     $user = eZUser::currentUser();
     eZDebug::accumulatorStart('generate_cache', '', 'Generating view cache');
     if ($ini->variable('ContentSettings', 'PreViewCache') == 'enabled') {
         $preCacheSiteaccessArray = $ini->variable('ContentSettings', 'PreCacheSiteaccessArray');
         $currentSiteAccess = $GLOBALS['eZCurrentAccess'];
         // This is the default view parameters for content/view
         $viewParameters = array('offset' => false, 'year' => false, 'month' => false, 'day' => false, 'namefilter' => false);
         if (is_array($preCacheSiteaccessArray) && count($preCacheSiteaccessArray) > 0) {
             foreach ($preCacheSiteaccessArray as $changeToSiteAccess) {
                 $newSiteAccess = $currentSiteAccess;
                 $newSiteAccess['name'] = $changeToSiteAccess;
                 unset($newSiteAccess['uri_part']);
                 //eZSiteAccess::load() will take care of setting correct one
                 eZSiteAccess::load($newSiteAccess);
                 $tpl = eZTemplate::factory();
                 // Get the sitedesign and cached view preferences for this siteaccess
                 $siteini = eZINI::instance('site.ini');
                 $cachedViewPreferences = $siteini->variable('ContentSettings', 'CachedViewPreferences');
                 $language = false;
                 // Needs to be specified if you want to generate the cache for a specific language
                 $viewMode = 'full';
                 $assignedNodes = $object->assignedNodes();
                 foreach ($assignedNodes as $node) {
                     // We want to generate the cache for the specified user
                     $previewCacheUsers = $ini->variable('ContentSettings', 'PreviewCacheUsers');
                     foreach ($previewCacheUsers as $previewCacheUserID) {
                         // If the text is 'anon' we need to fetch the Anonymous user ID.
                         if ($previewCacheUserID === 'anonymous') {
                             $previewCacheUserID = $siteini->variable("UserSettings", "AnonymousUserID");
                             $previewCacheUser = eZUser::fetch($previewCacheUserID);
                         } else {
                             if ($previewCacheUserID === 'current') {
                                 $previewCacheUser = $user;
                             } else {
                                 $previewCacheUser = eZUser::fetch($previewCacheUserID);
                             }
                         }
                         if (!$previewCacheUser) {
                             continue;
                         }
                         // Before we generate the view cache we must change the currently logged in user to $previewCacheUser
                         // If not the templates might read in wrong personalized data (preferences etc.)
                         eZUser::setCurrentlyLoggedInUser($previewCacheUser, $previewCacheUser->attribute('contentobject_id'), eZUser::NO_SESSION_REGENERATE);
                         // Cache the current node
                         $cacheFileArray = eZNodeviewfunctions::generateViewCacheFile($previewCacheUser, $node->attribute('node_id'), false, false, $language, $viewMode, $viewParameters, $cachedViewPreferences);
                         $tmpRes = eZNodeviewfunctions::generateNodeView($tpl, $node, $node->attribute('object'), $language, $viewMode, false, $cacheFileArray['cache_dir'], $cacheFileArray['cache_path'], true, $viewParameters);
                         // Cache the parent node
                         $parentNode = $node->attribute('parent');
                         $objectID = $parentNode->attribute('contentobject_id');
                         // if parent objectID is null or is 0 we should not create cache.
                         if ($objectID) {
                             $cacheFileArray = eZNodeviewfunctions::generateViewCacheFile($previewCacheUser, $parentNode->attribute('node_id'), 0, false, $language, $viewMode, $viewParameters, $cachedViewPreferences);
                             $tmpRes = eZNodeviewfunctions::generateNodeView($tpl, $parentNode, $parentNode->attribute('object'), $language, $viewMode, 0, $cacheFileArray['cache_dir'], $cacheFileArray['cache_path'], true, $viewParameters);
                         }
                     }
                 }
             }
             // Restore the old user as the current one
             eZUser::setCurrentlyLoggedInUser($user, $user->attribute('contentobject_id'), eZUser::NO_SESSION_REGENERATE);
             // restore siteaccess
             eZSiteAccess::load($currentSiteAccess);
         }
     }
     if ($ini->variable('ContentSettings', 'StaticCache') == 'enabled') {
         $nodes = array();
         $ini = eZINI::instance();
         $useURLAlias =& $GLOBALS['eZContentObjectTreeNodeUseURLAlias'];
         $pathPrefix = $ini->variable('SiteAccessSettings', 'PathPrefix');
         // get staticCacheHandler instance
         $optionArray = array('iniFile' => 'site.ini', 'iniSection' => 'ContentSettings', 'iniVariable' => 'StaticCacheHandler');
         $options = new ezpExtensionOptions($optionArray);
         $staticCacheHandler = eZExtension::getHandlerClass($options);
         if (!isset($useURLAlias)) {
             $useURLAlias = $ini->variable('URLTranslator', 'Translation') == 'enabled';
         }
         eZContentCacheManager::nodeListForObject($object, true, self::CLEAR_DEFAULT, $nodes, $handledObjectList);
         // If no nodes returns it means that ClearCacheMethod = self::CLEAR_NO_CACHE
         if (count($nodes)) {
             foreach ($nodes as $nodeID) {
                 if ($useURLAlias) {
                     $oNode = eZContentObjectTreeNode::fetch($nodeID, false, true);
                     if (!isset($oNode)) {
                         continue;
                     }
                     $urlAlias = $oNode->urlAlias();
                     if ($pathPrefix != '') {
                         $tempAlias = substr($pathPrefix, strlen($pathPrefix) - 1) == '/' ? $urlAlias . '/' : $urlAlias;
                         if (strncmp($tempAlias, $pathPrefix, strlen($tempAlias)) == 0) {
                             $urlAlias = substr($tempAlias, strlen($pathPrefix));
                         }
                     }
                 } else {
                     $urlAlias = 'content/view/full/' . $nodeID;
                 }
                 $staticCacheHandler->cacheURL('/' . $urlAlias, $nodeID);
//.........这里部分代码省略.........
开发者ID:nlescure,项目名称:ezpublish,代码行数:101,代码来源:ezcontentcachemanager.php


示例13:

                if ($existingNotification) {
                    $tpl->setVariable('success_message', ezpI18n::tr('ezcomments/comment/add', 'You have already subscribed to comment updates on this content.'));
                } else {
                    $tpl->setVariable('success_message', ezpI18n::tr('ezcomments/comment/add', 'You will receive comment updates on the content.'));
                }
            } else {
                $tpl->setVariable('success_message', ezpI18n::tr('ezcomments/comment/add', 'A confirmation email has been sent to your email address. You will receive comment updates after confirmation.'));
            }
        }
        //remember cookies
        $cookieManager = ezcomCookieManager::instance();
        if ($http->postVariable('CommentRememberme', false) !== false || !$user->isAnonymous()) {
            $cookieManager->storeCookie($comment);
        } else {
            $cookieManager->clearCookie();
        }
        eZContentCacheManager::clearContentCacheIfNeeded($contentObjectId);
        if (!$changeNotification) {
            $commentINI = eZINI::instance('ezcomments.ini');
            if ($commentINI->variable('GlobalSettings', 'RedirectAfterCommenting') === 'true') {
                $module->redirectTo($redirectURI);
            }
        } else {
            $tpl->setVariable('redirect_uri', $redirectURI);
        }
    }
} else {
    $tpl->setVariable('error_message', ezpI18n::tr('ezcomments/comment/add', 'You should not access this view directly.'));
}
$Result['content'] = $tpl->fetch('design:comment/add.tpl');
return $Result;
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:add.php


示例14: swapNodes

    function swapNodes( $params )
    {
        $nodeInfo1 = $params['src_node'];
        $nodeInfo2 = $params['dst_node'];

        //init vars
        $node1 = $this->nodeIdByName( $nodeInfo1 );
        $node2 = $this->nodeIdByName( $nodeInfo2 );

        $nodeID = $node1;
        $node = eZContentObjectTreeNode::fetch( $nodeID );

        if( !is_object( $node ) )
        {
            $this->reportError( "Can't fetch node '$nodeID'", 'eZSiteInstaller::swapNodes' );
            return false;
        }

        if( !$node->canSwap() )
        {
            $this->reportError( "Cannot swap node '$nodeID' (no edit permission)", 'eZSiteInstaller::swapNodes' );
            return false;
        }

        $nodeParentNodeID = $node->attribute( 'parent_node_id' );

        $object = $node->object();
        if( !is_object( $object ) )
        {
            $this->reportError( "Cannot fetch object for node '$nodeID'", 'eZSiteInstaller::swapNodes' );
            return false;
        }

        $objectID = $object->attribute( 'id' );
        $objectVersion = $object->attribute( 'current_version' );
        $class = $object->contentClass();
        $classID = $class->attribute( 'id' );

        $selectedNodeID = $node2;

        $selectedNode = eZContentObjectTreeNode::fetch( $selectedNodeID );

        if( !is_object( $selectedNode ) )
        {
            $this->reportError( "Cannot fetch node '$selectedNodeID'", 'eZSiteInstaller::swapNodes' );
            return false;
        }

        if( !$selectedNode->canSwap() )
        {
            $this->reportError( "Cannot use node $selectedNodeID as the exchanging node for $nodeID, the current user does not have edit permission for it",
                                'eZSiteInstaller::swapNodes' );
            return false;
        }

        // clear cache.
        eZContentCacheManager::clearContentCacheIfNeeded( $objectID );

        $selectedObject = $selectedNode->object();
        $selectedObjectID = $selectedObject->attribute( 'id' );
        $selectedObjectVersion = $selectedObject->attribute( 'current_version' );
        $selectedNodeParentNodeID = $selectedNode->attribute( 'parent_node_id' );


        /* In order to swap node1 and node2 a user should have the following permissions:
         * 1. move_from: move node1
         * 2. move_from: move node2
         * 3. move_to: move an object of the same class as node2 under parent of node1
         * 4. move_to: move an object of the same class as node1 under parent of node2
         *
         * The First two has already been checked. Let's check the rest.
         */
        $nodeParent            = $node->attribute( 'parent' );
        $selectedNodeParent    = $selectedNode->attribute( 'parent' );
        $objectClassID         = $object->attribute( 'contentclass_id' );
        $selectedObjectClassID = $selectedObject->attribute( 'contentclass_id' );

        if( !$nodeParent || !$selectedNodeParent )
        {
            $this->reportError( "No $nodeParent or no !$selectedNodeParent received.",
                                'eZSiteInstaller::swapNodes' );
            return false;
        }

        if( !$nodeParent->canMoveTo( $selectedObjectClassID ) )
        {
            $this->reportError( "Cannot move an object of class $selectedObjectClassID to node $nodeParentNodeID (no create permission)",
                                'eZSiteInstaller::swapNodes' );
            return false;
        }

        if( !$selectedNodeParent->canMoveTo( $objectClassID ) )
        {
            $this->reportError( "Cannot move an object of class $objectClassID to node $selectedNodeParentNodeID (no create permission)",
                                'eZSiteInstaller::swapNodes' );
            return false;
        }

        // exchange contentobject ids and versions.
        $node->setAttribute( 'contentobject_id', $selectedObjectID );
//.........这里部分代码省略.........
开发者ID:nottavi,项目名称:ezpublish,代码行数:101,代码来源:ezsiteinstaller.php


示例15: rate

 /**
  * Create a ezsrRatingDataObject and store it.
  * Note: No access checks or input validation is done other then on rating
  *
  * @param int $contentobjectId
  * @param int $contentobjectAttributeId
  * @param int $rate (above 0 and  bellow or equal 5)
  * @param bool $onlyStoreIfUserNotAlreadyRated
  * @return null|ezsrRatingDataObject
  */
 static function rate($contentobjectId, $contentobjectAttributeId, $rate)
 {
     $rating = null;
     if (is_numeric($contentobjectId) && is_numeric($contentobjectAttributeId) && is_numeric($rate) && $rate <= 5 && $rate > 0) {
         $row = array('contentobject_attribute_id' => $contentobjectAttributeId, 'contentobject_id' => $contentobjectId, 'rating' => $rate);
         $rating = self::create($row);
         if (!$rating->userHasRated()) {
             $rating->store();
             $avgRating = $rating->getAverageRating();
             $avgRating->updateFromRatingData();
             $avgRating->store();
             // clear the cache for all nodes associated with this object
             eZContentCacheManager::clearContentCacheIfNeeded($contentobjectId, true, false);
         }
     }
     return $rating;
 }
开发者ID:heliopsis,项目名称:ezstarrating,代码行数:27,代码来源:ezsrratingdataobject.php


示例16: forceSiteColor

 /**
  * Forza l'impostazione del colore di base di un site
  * 
  * Ritorna true se il colore è stato modificato
  * 
  * @param int $currentColor
  * @return boolean
  */
 public static function forceSiteColor($currentColor)
 {
     //
     // lettura variabili per individuare file scss
     $designINIinstance = eZINI::instance('design.ini', 'settings', null, FALSE);
     $_stylesheetBaseFile = $designINIinstance->variable('StylesheetSettings', 'StylesheetBaseFile');
     $_stylesheetDestFile = $designINIinstance->variable('StylesheetSettings', 'StylesheetDestinationFile');
     $_stylesheetCluster = $designINIinstance->variable('StylesheetSettings', 'StylesheetCluster');
     // Cicla sui file di origine
     for ($i = 0; $i < count($_stylesheetBaseFile); $i++) {
         foreach ($_stylesheetCluster as $itemCluster) {
             // File da sostituire.
             $curFile = $itemCluster . $_stylesheetBaseFile[$i];
             $curDestinationFile = $itemCluster . $_stylesheetDestFile[$i];
             //print_r('File :<br><b>');
             //print_r($curFile);
             //print_r('<br>in:<br><b>');
             //print_r($curDestinationFile);
             //die();
             // recupera i valori del eZPersistentObject sinet_site_colors
             $colorList = Sinetsitecolors_PstObject::fetchHandlerList();
             $fh = fopen($curFile, 'r');
             $newRow = '';
             // Legge ogni singola riga del file origine
             $arrayOriginalColor = explode("-", $currentColor);
             while (!feof($fh)) {
                 $tmpRow = fgets($fh);
                 $indiceColore = 0;
                 foreach ($colorList as $objColor) {
                     // per ogni riga del pesisten object sostituisce il name_tag con il colore letto
                     $curname_tag = $objColor['name_tag'];
                     if (count($arrayOriginalColor) > $indiceColore) {
                         $tmpRow = PatBaseColorFunctions::replaceCssInLine($tmpRow, $arrayOriginalColor[$indiceColore], $curname_tag);
                     }
                     $indiceColore++;
                 }
                 $newRow .= $tmpRow;
             }
             // set del colore nel persistent object
             $indiceColore = 0;
             foreach ($colorList as $objColor) {
                 $curname_tag = $objColor['name_tag'];
                 $curId = $objColor['id'];
                 if (count($arrayOriginalColor) > $indiceColore) {
                     $simpleObj = Sinetsitecolors_PstObject::fetchById($curId);
                     $simpleObj->setAttribute('color', $arrayOriginalColor[$indiceColore]);
                     $simpleObj->store();
                 }
                 $indiceColore++;
             }
             // Scrive il file di destinazione
             $fw = fopen($curDestinationFile, 'w');
             if (!$fw) {
                 echo '</b><font color=red>Errore Open W</font></pre>';
             } else {
                 $bytes = fwrite($fw, $newRow);
                 fclose($fw);
             }
             fclose($fh);
             // echo('</b><font color=red>OK</font></pre>');
         }
     }
     // Prova la pulizia della cache dei template
     eZContentCacheManager::clearAllContentCache();
     eZContentCacheManager::clearContentCache(2);
     //die();
     return true;
 }
开发者ID:informaticatrentina,项目名称:pat_base,代码行数:76,代码来源:patbasecolorfunctions.php


示例17: array

        if (preg_match('/(^[^A-Za-z])|\\W/', $sectionIdentifier)) {
            $errorMessage = ezpI18n::tr('design/admin/section/edit', 'Identifier should consist of letters, numbers or \'_\' with letter prefix.');
        } else {
            $conditions = array('identifier' => $sectionIdentifier, 'id' => array('!=', $SectionID));
            $existingSection = eZSection::fetchFilteredList($conditions);
            if (count($existingSection) > 0) {
                $errorMessage = ezpI18n::tr('design/admin/section/edit', 'The identifier has been used in another section.');
            }
        }
    }
    $section->setAttribute('identifier', $sectionIdentifier);
    $section->setAttribute('navigation_part_identifier', $http->postVariable('NavigationPartIdentifier'));
    if ($http->hasPostVariable('Locale')) {
        $section->setAttribute('locale', $http->postVariable('Locale'));
    }
    if ($errorMessage === '') {
        $section->store();
        eZContentCacheManager::clearContentCacheIfNeededBySectionID($section->attribute('id'));
        $Module->redirectTo($Module->functionURI('list'));
        return;
    } else {
        $tpl->setVariable('error_message', $errorMessage);
    }
}
if ($http->hasPostVariable('CancelButton')) {
    $Module->redirectTo($Module->functionURI('list'));
}
$tpl->setVariable("section", $section);
$Result = array();
$Result['content'] = $tpl->fetch("design:section/edit.tpl");
$Result['path'] = array(array('url' => 'section/list', 'text' => ezpI18n::tr('kernel/section', 'Sections')), array('url' => false, 'text' => $section instanceof eZSection ? $section->attribute('name') : $section['name']));
开发者ID:runelangseid,项目名称:ezpublish,代码行数:31,代码来源:edit.php


示例18: update


//.........这里部分代码省略.........
                 // Move objects waiting in queue to the "valid ones"
                 foreach ($movingFromQueue as $itemToMove) {
                     $objectID = $itemToMove['object_id'];
                     $db->query("UPDATE ezm_pool\n                             SET ts_visible={$time}, priority={$priority}\n                             WHERE block_id='{$blockID}'\n                               AND object_id={$objectID}");
                     $priority++;
                 }
                 $countValid += count($movingFromQueue);
                 // Compare this number to the given and archive the oldest (order by ts_visible)
                 $numberOfValidItems = $ini->variable($block['block_type'], 'NumberOfValidItems');
                 if (!$numberOfValidItems) {
                     $numberOfValidItems = 20;
                     eZDebug::writeWarning('Number of valid items for ' . $block['block_type'] . ' is not set; using the default value (' . $numberOfValidItems . ')', __METHOD__);
                 }
                 $countToRemove = $countValid - $numberOfValidItems;
                 if ($countToRemove > 0) {
                     $overflowID = $block['overflow_id'];
                     $items = $db->arrayQuery("SELECT node_id, object_id, rotation_until\n                                           FROM ezm_pool\n                                           WHERE block_id='{$blockID}'\n                                             AND ts_visible>0\n                                             AND ts_hidden=0\n                                           ORDER BY priority ASC", array('limit' => $countToRemove));
                     if ($items) {
                         $itemArray = array();
                         $priority = 0;
                         foreach ($items as $item) {
                             $objectID = $item['object_id'];
                             if ($block['rotation_type'] != self::ROTATION_NONE && ($item['rotation_until'] > $time || $item['rotation_until'] == 0)) {
                                 if ($block['rotation_type'] == self::ROTATION_SIMPLE) {
                                     // Simple rotation
                                     $newPublicationTS = -$time;
                                     $priority++;
                                 } else {
                                     // Random rotation/Shuffle
                                     $newPublicationTS = 0;
                                     $priority = mt_rand();
                                 }
                                 // Move item back to queue
                                 $db->query("UPDATE ezm_pool\n                                         SET ts_visible=0,\n                                             ts_publication=-{$time},\n                                             priority={$priority}\n                                         WHERE block_id='{$blockID}'\n                                           AND object_id={$objectID}");
                             } else {
                                 $itemArray[] = $objectID;
                             }
                         }
                         if ($itemArray) {
                             if ($overflowID) {
                                 // Put $itemArray items into pool of different block
                                 $priority = 0;
                                 foreach ($items as $item) {
                                     $itemObjectID = $item['object_id'];
                                     $itemNodeID = $item['node_id'];
                                     // Check if the object_id is not already in the new block
                                     $duplicityCheck = $db->arrayQuery("SELECT object_id\n                                                                    FROM ezm_pool\n                                                                    WHERE block_id='{$overflowID}'\n                                                                      AND object_id={$itemObjectID}", array('limit' => 1));
                                     if ($duplicityCheck) {
                                         eZDebug::writeNotice("Object {$itemObjectID} is already available in the block {$overflowID}.", __METHOD__);
                                     } else {
                                         $db->query("INSERT INTO ezm_pool(block_id,object_id,node_id,ts_publication,priority)\n                                                 VALUES ('{$overflowID}',{$itemObjectID},{$itemNodeID},{$time},{$priority})");
                                         $priority++;
                                     }
                                 }
                                 $db->query("UPDATE ezm_pool\n                                         SET ts_hidden={$time},\n                                             moved_to='{$overflowID}',\n  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP eZContentClass类代码示例发布时间:2022-05-23
下一篇:
PHP eZContentBrowse类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap