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


PHP eZContentObjectTreeNode::definition方法代码示例

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


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

示例1: definition

 /** definition of ezsrRatingObjectTreeNode, extends eZContentObjectTreeNode definition
  * 
  *  @return array
  */
 static function definition()
 {
     static $def = null;
     if ($def === null) {
         $def = parent::definition();
         $def['class_name'] = 'ezsrRatingObjectTreeNode';
         $def['fields']['rating'] = array('name' => 'Rating', 'datatype' => 'integer', 'default' => 0, 'required' => false);
         $def['fields']['rating_count'] = array('name' => 'RatingCount', 'datatype' => 'integer', 'default' => 0, 'required' => false);
     }
     return $def;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:15,代码来源:ezsrratingobjecttreenode.php

示例2: array

    if ($dbUser !== false) {
        $params['user'] = $dbUser;
        $params['password'] = '';
    }
    if ($dbPassword !== false) {
        $params['password'] = $dbPassword;
    }
    if ($dbName !== false) {
        $params['database'] = $dbName;
    }
    $db = eZDB::instance($dbImpl, $params, true);
    eZDB::setInstance($db);
}
$db->setIsSQLOutputEnabled($showSQL);
// Get top nodes
$topNodeArray = eZPersistentObject::fetchObjectList(eZContentObjectTreeNode::definition(), null, array('parent_node_id' => 1, 'depth' => 1));
$subTreeCount = 0;
foreach ($topNodeArray as $node) {
    $subTreeCount += $node->subTreeCount(array('Limitation' => array()));
}
$cli->output("Number of objects to update: {$subTreeCount}");
$i = 0;
$dotMax = 70;
$dotCount = 0;
$limit = 50;
foreach ($topNodeArray as $node) {
    $offset = 0;
    $subTree = $node->subTree(array('Offset' => $offset, 'Limit' => $limit, 'Limitation' => array()));
    while ($subTree != null) {
        foreach ($subTree as $innerNode) {
            $object = $innerNode->attribute('object');
开发者ID:nfrp,项目名称:ezpublish,代码行数:31,代码来源:updatecontentobjectname.php

示例3: fetchByContentObjectID

 static function fetchByContentObjectID($contentObjectID, $asObject = true, $contentObjectVersion = false)
 {
     $conds = array('contentobject_id' => $contentObjectID);
     if ($contentObjectVersion !== false) {
         $conds['contentobject_version'] = $contentObjectVersion;
     }
     return eZPersistentObject::fetchObjectList(eZContentObjectTreeNode::definition(), null, $conds, null, null, $asObject);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:8,代码来源:ezcontentobjecttreenode.php

示例4: objectCount

 /**
  * Get total number of objects
  *
  * @return int Total object count
  */
 protected function objectCount()
 {
     $topNodeArray = eZPersistentObject::fetchObjectList(eZContentObjectTreeNode::definition(), null, array('parent_node_id' => 1, 'depth' => 1));
     $subTreeCount = 0;
     foreach (array_keys($topNodeArray) as $key) {
         $subTreeCount += $topNodeArray[$key]->subTreeCount(array('Limitation' => array(), 'MainNodeOnly' => true));
     }
     return $subTreeCount;
 }
开发者ID:legende91,项目名称:ez,代码行数:14,代码来源:updatesearchindexsolr.php

示例5: count

        $treeNode->store();
    }
    $totalCount += $nonUniqueRemoteIDData['cnt'] - 1;
    $cli->output('');
    $cli->output('');
}
if ($db->databaseName() == 'oracle') {
    $nonUniqueRemoteIDDataList = $db->arrayQuery("SELECT node_id FROM ezcontentobject_tree WHERE remote_id IS NULL");
} else {
    $nonUniqueRemoteIDDataList = $db->arrayQuery("SELECT node_id FROM ezcontentobject_tree WHERE remote_id = ''");
}
$nonUniqueRemoteIDDataListCount = count($nonUniqueRemoteIDDataList);
$cli->output('');
$cli->output("Found {$nonUniqueRemoteIDDataListCount} tree nodes with empty remote IDs.");
$cli->output('');
if ($nonUniqueRemoteIDDataListCount) {
    $cli->output('Fixing', false);
    foreach ($nonUniqueRemoteIDDataList as $nonUniqueRemoteIDData) {
        // fetch nodes with eZPersistentObject to avoid object cache
        $treeNodes = eZPersistentObject::fetchObjectList(eZContentObjectTreeNode::definition(), null, array('node_id' => $nonUniqueRemoteIDData['node_id']), array('modified_subnode' => 'asc'));
        foreach ($treeNodes as $i => $treeNode) {
            $treeNode->setAttribute('remote_id', eZRemoteIdUtility::generate('node'));
            $treeNode->store();
        }
        ++$totalCount;
        $cli->output('.', false);
    }
}
$cli->output('');
$cli->output("Number of tree nodes that received a new remote ID : {$totalCount}");
$script->shutdown(0);
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:31,代码来源:fixnoderemoteid.php

示例6: execute


//.........这里部分代码省略.........
        }

        $object = eZContentObject::fetch( $objectID );
        if ( !$object )
        {
            $this->writeMessage( "\tObject not found.", 'error' );
            return false;
        }

        $parentNode =  eZContentObjectTreeNode::fetch( $parentNodeID );
        if ( !$parentNode )
        {
            $this->writeMessage( "\tparent node not found.", 'error' );
            return false;
        }
        $node = $object->attribute( 'main_node' );

        $nodeAssignmentList = eZNodeAssignment::fetchForObject( $objectID, $object->attribute( 'current_version' ), 0, false );
        $assignedNodes = $object->assignedNodes();

        $parentNodeIDArray = array();
        $setMainNode = false;
        $hasMainNode = false;
        foreach ( $assignedNodes as $assignedNode )
        {
            if ( $assignedNode->attribute( 'is_main' ) )
                $hasMainNode = true;
            $append = false;
            foreach ( $nodeAssignmentList as $nodeAssignment )
            {
                if ( $nodeAssignment['parent_node'] == $assignedNode->attribute( 'parent_node_id' ) )
                {
                    $append = true;
                    break;
                }
            }
            if ( $append )
            {
                $parentNodeIDArray[] = $assignedNode->attribute( 'parent_node_id' );
            }
        }
        if ( !$hasMainNode )
            $setMainNode = true;

        $mainNodeID = $parentNode->attribute( 'main_node_id' );
        $objectName = $object->attribute( 'name' );

        $db = eZDB::instance();
        $db->begin();
        $locationAdded = false;
        $destNode = null;
        if ( !in_array( $parentNodeID, $parentNodeIDArray ) )
        {
            $parentNodeObject = $parentNode->attribute( 'object' );

            $insertedNode = $object->addLocation( $parentNodeID, true );

            // Now set is as published and fix main_node_id
            $insertedNode->setAttribute( 'contentobject_is_published', 1 );
            $insertedNode->setAttribute( 'main_node_id', $node->attribute( 'main_node_id' ) );
            $insertedNode->setAttribute( 'contentobject_version', $node->attribute( 'contentobject_version' ) );
            // Make sure the url alias is set updated.
            $insertedNode->updateSubTreePath();
            $insertedNode->sync();

            $locationAdded = true;
        }
        if ( $locationAdded )
        {
            $ini = eZINI::instance();
            $userClassID = $ini->variable( "UserSettings", "UserClassID" );
            if ( $object->attribute( 'contentclass_id' ) == $userClassID )
            {
                eZUser::cleanupCache();
            }
            $this->writeMessage( "\tAdded location of " . $object->attribute( 'name' ) . "  to Node $parentNodeID", 'notice' );

            $destNode = $insertedNode;
        }
        else
        {
            $this->writeMessage( "\tLocation of " . $object->attribute( 'name' ) . "  to Node $parentNodeID already exists.", 'notice' );

            $destNode = eZContentObjectTreeNode::fetchObject( eZContentObjectTreeNode::definition(), null, array( 'parent_node_id' => $parentNodeID, 'contentobject_id' => $objectID ) );
        }
        $db->commit();

        if( $destNode && $priority )
        {
            $destNode->setAttribute( 'priority', $priority );
            $destNode->store();
        }

        if( $destNode && $setReferenceID )
        {
            $this->addReference( array( $setReferenceID => $destNode->attribute( 'node_id' ) ) );
        }

        eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:ezaddlocation.php

示例7: checkObject

 /**
  * \static
  * Check whether the given object should cause access mode change.
  * It it should, this method does not return.
  */
 static function checkObject($module, $view, $object)
 {
     if (!eZSSLZone::enabled()) {
         return;
     }
     /* If the given module/view is not in the list of 'keep mode' views,
      * i.e. it cannot choose access mode itself,
      * then do nothing.
      */
     if (!eZSSLZone::isKeepModeView($module, $view)) {
         return;
     }
     $pathStringList = eZPersistentObject::fetchObjectList(eZContentObjectTreeNode::definition(), array('path_string'), array('contentobject_id' => $object->attribute('id')), null, null, false);
     if (is_array($pathStringList) && count($pathStringList)) {
         /* The object has some assigned nodes.
          * If at least one of those nodes belongs to an SSL zone,
          * we switch to SSL.
          */
         // "flatten" the array
         array_walk($pathStringList, create_function('&$a', '$a = $a[\'path_string\'];'));
     } else {
         /* The object has no assigned nodes.
          * Let's work with its parent nodes.
          * If at least one of the parent nodes belongs to an SSL zone,
          * we switch to SSL.
          */
         $pathStringList = array();
         $nodes = $object->parentNodes($object->attribute('current'));
         if (!is_array($nodes)) {
             eZDebug::writeError('Object ' . $object->attribute('is') . 'does not have neither assigned nor parent nodes.');
         } else {
             foreach ($nodes as $node) {
                 $pathStringList[] = $node->attribute('path_string');
             }
         }
     }
     $inSSL = false;
     // does the object belong to an SSL zone?
     foreach ($pathStringList as $pathString) {
         if (eZSSLZone::checkNodePath($module, $view, $pathString, false)) {
             $inSSL = true;
             break;
         }
     }
     eZSSLZone::switchIfNeeded($inSSL);
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:51,代码来源:ezsslzone.php

示例8: objectCount

 /**
  * Get total number of objects
  *
  * @return int Total object count
  */
 protected function objectCount()
 {
     $topNodeArray = eZPersistentObject::fetchObjectList(eZContentObjectTreeNode::definition(), null, array('parent_node_id' => 1, 'depth' => 1));
     $subTreeCount = 0;
     $nodeTreeParams = array('Limitation' => array(), 'MainNodeOnly' => true);
     if (count($this->classIdentifiers) > 0) {
         $nodeTreeParams['ClassFilterType'] = 'include';
         $nodeTreeParams['ClassFilterArray'] = $this->classIdentifiers;
     }
     //print_r($nodeTreeParams);
     foreach (array_keys($topNodeArray) as $key) {
         $subTreeCount += $topNodeArray[$key]->subTreeCount($nodeTreeParams);
     }
     return $subTreeCount;
 }
开发者ID:kminds,项目名称:ezfind,代码行数:20,代码来源:updatesearchindexsolr.php

示例9: array

        $params['user'] = $dbUser;
        $params['password'] = '';
    }
    if ( $dbPassword !== false )
        $params['password'] = $dbPassword;
    if ( $dbName !== false )
        $params['database'] = $dbName;
    $db = eZDB::instance( $dbImpl, $params, true );
    eZDB::setInstance( $db );
}

$db->setIsSQLOutputEnabled( $showSQL );

// Get top nodes
$topNodeArray = eZPersistentObject::fetchObjectList( 
    eZContentObjectTreeNode::definition(),
    null,
    array( 
        'parent_node_id' => 1,
        'depth' => 1 
    ) 
);

$subTreeCount = 0;
foreach ( $topNodeArray as $node )
{
    $subTreeCount += $node->subTreeCount( 
        array( 
            'Limitation' => array() 
        ) 
    );
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:updatecontentobjectname.php

示例10: count

}

$nonUniqueRemoteIDDataListCount = count( $nonUniqueRemoteIDDataList );

$cli->output( '' );
$cli->output( "Found $nonUniqueRemoteIDDataListCount tree nodes with empty remote IDs." );
$cli->output( '' );

if ( $nonUniqueRemoteIDDataListCount )
{
    $cli->output( 'Fixing', false );

    foreach ( $nonUniqueRemoteIDDataList as $nonUniqueRemoteIDData )
    {
        // fetch nodes with eZPersistentObject to avoid object cache
        $treeNodes = eZPersistentObject::fetchObjectList( eZContentObjectTreeNode::definition(),
                                                        null,
                                                        array( 'node_id' => $nonUniqueRemoteIDData['node_id'] ),
                                                        array( 'modified_subnode' => 'asc' ) );
        foreach ( $treeNodes as $i => $treeNode )
        {
            $treeNode->setAttribute( 'remote_id', eZRemoteIdUtility::generate( 'node' ) );
            $treeNode->store();
        }

        ++$totalCount;
        $cli->output( '.', false );
    }
}

$cli->output( '' );
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:fixnoderemoteid.php


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