当前位置: 首页>>代码示例>>PHP>>正文


PHP eZContentObjectTreeNode::fetchByPath方法代码示例

本文整理汇总了PHP中eZContentObjectTreeNode::fetchByPath方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectTreeNode::fetchByPath方法的具体用法?PHP eZContentObjectTreeNode::fetchByPath怎么用?PHP eZContentObjectTreeNode::fetchByPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZContentObjectTreeNode的用法示例。


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

示例1: foreach

        $nodeIDList[] = $nodeID;
        $node = eZContentObjectTreeNode::fetch( $nodeID );
        $nodeList[] = $node;
    }
}

// Fetch subtree limitations
$subtreeLimitation = eZPolicyLimitation::fetchByIdentifier( $policyID, 'Subtree' );
if ( $subtreeLimitation != null )
{
    $subtreeLimitationID = $subtreeLimitation->attribute('id');
    $subtreeLimitationValues = eZPolicyLimitationValue::fetchList( $subtreeLimitationID );
    foreach ( $subtreeLimitationValues as $subtreeLimitationValue )
    {
        $subtreePath = $subtreeLimitationValue->attribute( 'value' );
        $subtreeObject = eZContentObjectTreeNode::fetchByPath( $subtreePath );
        if ( $subtreeObject )
        {
            $subtreeID = $subtreeObject->attribute( 'node_id' );
            if ( !isset( $subtreeIDList ) )
                $subtreeIDList = array();
            $subtreeIDList[] = $subtreeID;
            $subtree = eZContentObjectTreeNode::fetch( $subtreeID );
            $subtreeList[] = $subtree;
        }
    }
}

$http->setSessionVariable( 'DisableRoleCache', 1 );

if ( $http->hasPostVariable( 'DiscardChange' ) )
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:31,代码来源:policyedit.php

示例2: createUser

 /**
  * Helper method that creates a new user.
  * Currently only creates in users/guest_accounts.
  * First and last name will be a splitup of username
  *
  * @param string $username
  * @param string $password If not provided, uses the username as password
  * @param string $email If not provided, uses '<username><at>test.ez.no'
  *
  * @return eZContentObject
  */
 protected static function createUser($username, $password = false, $email = false)
 {
     $firstname = substr($username, 0, floor(strlen($username) / 2));
     $lastname = substr($username, ceil(strlen($username) / 2));
     if ($email === false) {
         $email = "{$username}@test.ez.no";
     }
     if ($password === false) {
         $password = $username;
     }
     $user = new ezpObject('user', eZContentObjectTreeNode::fetchByPath('users/guest_accounts'));
     $user->first_name = $firstname;
     $user->last_name = $lastname;
     $user->user_account = $account = sprintf('%s|%s|%s|%d', $username, $email, eZUser::createHash($username, $password, eZUser::site(), eZUser::PASSWORD_HASH_MD5_USER), eZUser::PASSWORD_HASH_MD5_USER);
     $user->publish();
     $user->refresh();
     return $user->object;
 }
开发者ID:netbliss,项目名称:ezmbpaex,代码行数:29,代码来源:ezpaex_test.php

示例3: allValuesAsArrayWithNames

 function allValuesAsArrayWithNames()
 {
     $returnValue = null;
     $valueList = $this->attribute('values_as_array');
     $names = array();
     $policy = $this->attribute('policy');
     if (!$policy) {
         return $returnValue;
     }
     $currentModule = $policy->attribute('module_name');
     $mod = eZModule::exists($currentModule);
     if (!is_object($mod)) {
         eZDebug::writeError('Failed to fetch instance for module ' . $currentModule);
         return $returnValue;
     }
     $functions = $mod->attribute('available_functions');
     $functionNames = array_keys($functions);
     $currentFunction = $policy->attribute('function_name');
     $limitationValueArray = array();
     $limitation = $functions[$currentFunction][$this->attribute('identifier')];
     if ($limitation && isset($limitation['class']) && count($limitation['values'] == 0)) {
         $obj = new $limitation['class'](array());
         $limitationValueList = call_user_func_array(array($obj, $limitation['function']), $limitation['parameter']);
         foreach ($limitationValueList as $limitationValue) {
             $limitationValuePair = array();
             $limitationValuePair['Name'] = $limitationValue['name'];
             $limitationValuePair['value'] = $limitationValue['id'];
             $limitationValueArray[] = $limitationValuePair;
         }
     } else {
         if ($limitation['name'] === 'Node') {
             foreach ($valueList as $value) {
                 $node = eZContentObjectTreeNode::fetch($value, false, false);
                 if ($node == null) {
                     continue;
                 }
                 $limitationValuePair = array();
                 $limitationValuePair['Name'] = $node['name'];
                 $limitationValuePair['value'] = $value;
                 $limitationValuePair['node_data'] = $node;
                 $limitationValueArray[] = $limitationValuePair;
             }
         } else {
             if ($limitation['name'] === 'Subtree') {
                 foreach ($valueList as $value) {
                     $subtreeObject = eZContentObjectTreeNode::fetchByPath($value, false);
                     if ($subtreeObject != null) {
                         $limitationValuePair = array();
                         $limitationValuePair['Name'] = $subtreeObject['name'];
                         $limitationValuePair['value'] = $value;
                         $limitationValuePair['node_data'] = $subtreeObject;
                         $limitationValueArray[] = $limitationValuePair;
                     }
                 }
             } else {
                 $limitationValueArray = $limitation['values'];
             }
         }
     }
     $limitationValuesWithNames = array();
     foreach (array_keys($valueList) as $key) {
         $value = $valueList[$key];
         if (isset($limitationValueArray)) {
             reset($limitationValueArray);
             foreach (array_keys($limitationValueArray) as $ckey) {
                 if ($value == $limitationValueArray[$ckey]['value']) {
                     $limitationValuesWithNames[] = $limitationValueArray[$ckey];
                 }
             }
         }
     }
     return $limitationValuesWithNames;
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:73,代码来源:ezpolicylimitation.php

示例4: getNodeFromPath

    /**
     * @param string $nodePath
     * @param eZContentObjectTreeNode[] $publisherFolderNodes
     * @return eZContentObjectTreeNode
     */
    static protected function getNodeFromPath ( $nodePath, $publisherFolderNodes )
    {
        // Remove view parameters
        $nodePath = preg_replace( '#/\([^\)]+\)/.*$#', '', $nodePath );
        $node = false;

        foreach ( $publisherFolderNodes as $publisherFolderNode )
        {
            $nodeFullPath = '/' . $publisherFolderNode->attribute('url_alias') . '/' . $nodePath;
            $node = eZContentObjectTreeNode::fetchByURLPath( $nodeFullPath );

            if (!$node)
            {
                $node = eZContentObjectTreeNode::fetchByPath($nodeFullPath);

                if (!$node)
                {
                    $cleanableHref  = $nodeFullPath;
                    $aliasTranslate = eZURLAliasML::translate($cleanableHref);

                    while ( $aliasTranslate !== true && $aliasTranslate !== false )
                    {
                        $cleanableHref  = $aliasTranslate;
                        $aliasTranslate = eZURLAliasML::translate($cleanableHref);
                    }

                    if ( $aliasTranslate === true )
                    {
                        $lastSlashPosition = strrpos($cleanableHref, '/');

                        if( $lastSlashPosition !== false )
                            $node = eZContentObjectTreeNode::fetch(substr($cleanableHref, $lastSlashPosition+1));
                    }
                }

                if (!$node)
                {
                    $tabNodePath    = explode('/', substr($nodeFullPath, 1));
                    $remoteId       = end($tabNodePath);
                    $nodeRemote     = eZContentObjectTreeNode::fetchByRemoteID($remoteId);

                    if($nodeRemote && $publisherFolderNode)
                    {
                        $rootNodeID     = $publisherFolderNode->attribute('node_id');
                        $tabNodeRemote  = $nodeRemote->pathArray();
                        $nodeId         = $nodeRemote->attribute('node_id');

                        if(in_array($rootNodeID, $tabNodeRemote) && $rootNodeID != $nodeId)
                            $node = $nodeRemote;
                        /*******************************************************************************
                         * TODO : Delete after PF Refactor
                         *******************************************************************************/
                        else
                        {
                            $publisherFolderPathArray = $publisherFolderNode->pathArray();
                            foreach ( $nodeRemote->object()->assignedNodes() as $location )
                            {
                                if ( in_array( $publisherFolderPathArray[2], $location->pathArray() ) )
                                {
                                    $node = $location;
                                    break;
                                }
                            }
                        }
                        /*******************************************************************************
                         * TODO : END : Delete after PF Refactor
                         *******************************************************************************/
                    }
                }
            }
            
            if ($node instanceof eZContentObjectTreeNode)
                break;
        }


        // if we still do not have a node, we try to look in the old locations
        if ( !($node instanceof eZContentObjectTreeNode) )
        {
            $pfrLocation = null;

            if ( preg_match('#node_(?P<node_id>\d+)/?$#', $nodePath, $m) )
            {
                $nodeId = $m['node_id'];
                $pfrLocation = PfrLocation::fetchByNodeId( $nodeId );
            }
            else
            {
                $remoteId = basename( rtrim($nodePath, '/') );
                $pfrLocation = PfrLocation::fetchByRemoteId( $remoteId );
            }

            if ( $pfrLocation instanceof PfrLocation )
            {
                $node = $pfrLocation->node( $publisherFolderNodes );
//.........这里部分代码省略.........
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:applicationFactory.php


注:本文中的eZContentObjectTreeNode::fetchByPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。