本文整理汇总了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;
}
示例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');
示例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);
}
示例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;
}
示例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);
示例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 );
}
示例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);
}
示例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;
}
示例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()
)
);
示例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( '' );