本文整理汇总了PHP中eZContentObjectTreeNode类的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectTreeNode类的具体用法?PHP eZContentObjectTreeNode怎么用?PHP eZContentObjectTreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZContentObjectTreeNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getNodeUrl
/**
* @param eZContentObjectTreeNode $node
* @return string
*/
public function getNodeUrl(&$node = null)
{
$token = $this->getToken();
$dataMap = $node->dataMap();
$mediaContentAttribute = $dataMap['media_content'];
$mediaContentAttributeContent = $mediaContentAttribute->content();
$linkObjectID = $mediaContentAttributeContent['relation_list'][0]['contentobject_id'];
$linkObject = eZContentObject::fetch( $linkObjectID );
$linkDatamap = $linkObject->dataMap();
$url = $linkDatamap['url']->content();
$queryStringPosition = strpos($url, '?');
$queryString = substr($url, $queryStringPosition + 1);
$url = substr($url, 0, $queryStringPosition);
$queryStringParts = array();
parse_str($queryString, $queryStringParts);
$queryStringParts[self::SESSION_ID_FIELD] = $token;
$queryString = http_build_query($queryStringParts);
$url .= '?' . $queryString;
return $url;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:30,代码来源:externallinkhandlermedienspiegel.php
示例2: getTimeTableFromNode
public static function getTimeTableFromNode(eZContentObjectTreeNode $node)
{
$dataMap = $node->attribute('data_map');
if (isset($dataMap['timetable']) && $dataMap['timetable'] instanceof eZContentObjectAttribute && $dataMap['timetable']->attribute('has_content')) {
$timeTableContent = $dataMap['timetable']->attribute('content')->attribute('matrix');
$timeTable = array();
foreach ($timeTableContent['columns']['sequential'] as $column) {
foreach ($column['rows'] as $row) {
$parts = explode('-', $row);
if (count($parts) == 2) {
$fromParts = explode(':', $parts[0]);
if (count($fromParts) != 2) {
$fromParts = explode('.', $parts[0]);
}
$toParts = explode(':', $parts[1]);
if (count($toParts) != 2) {
$toParts = explode('.', $parts[1]);
}
if (count($fromParts) == 2 && count($toParts) == 2) {
if (!isset($timeTable[$column['identifier']])) {
$timeTable[$column['identifier']] = array();
}
$timeTable[$column['identifier']][] = array('from_time' => array('hour' => trim($fromParts[0]), 'minute' => trim($fromParts[1])), 'to_time' => array('hour' => trim($toParts[0]), 'minute' => trim($toParts[1])));
}
}
}
}
return $timeTable;
}
return array();
}
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:31,代码来源:occalendartimetable.php
示例3: fetchByNode
static function fetchByNode(eZContentObjectTreeNode $node)
{
$attributes = $node->attribute('data_map');
foreach ($attributes as $attribute) {
if ($attribute->DataTypeString == 'xrowmetadata' and $attribute->hasContent()) {
return $attribute->content();
}
}
return false;
}
开发者ID:rantoniazzi,项目名称:xrowmetadata,代码行数:10,代码来源:xrowmetadatatools.php
示例4: getNodeUrl
/**
* @param eZContentObjectTreeNode $node
* @return string
*/
public function getNodeUrl(&$node = null)
{
$dataMap = $node->dataMap();
$mediaContentAttribute = $dataMap['media_content'];
$mediaContentAttributeContent = $mediaContentAttribute->content();
$linkObjectID = $mediaContentAttributeContent['relation_list'][0]['contentobject_id'];
$linkObject = eZContentObject::fetch( $linkObjectID );
$linkDatamap = $linkObject->dataMap();
$url = $linkDatamap['url']->content();
$delimiter = ( strpos($url, '?') === false ) ? '?' : '&';
$url .= $delimiter.'ID=mmed45652&PASSWORD=medicus&NEWS=n';
return $url;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:18,代码来源:externallinkhandlerovid.php
示例5: getNextItems
/**
* Returns block item XHTML
*
* @param mixed $args
* @return array
*/
public static function getNextItems($args)
{
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
$result = array();
$galleryID = $http->postVariable('gallery_id');
$offset = $http->postVariable('offset');
$limit = $http->postVariable('limit');
$galleryNode = eZContentObjectTreeNode::fetch($galleryID);
if ($galleryNode instanceof eZContentObjectTreeNode) {
$params = array('Depth' => 1, 'Offset' => $offset, 'Limit' => $limit);
$pictureNodes = $galleryNode->subtree($params);
foreach ($pictureNodes as $validNode) {
$tpl->setVariable('node', $validNode);
$tpl->setVariable('view', 'block_item');
$tpl->setVariable('image_class', 'blockgallery1');
$content = $tpl->fetch('design:node/view/view.tpl');
$result[] = $content;
if ($counter === $limit) {
break;
}
}
}
return $result;
}
开发者ID:nfrp,项目名称:eZ-Publish-Training-examples,代码行数:31,代码来源:trainingservercallfunctions.php
示例6: getRelatedPublishers
/**
* This method returns list of related publisher folders if custom parameter ShowPublisherLogos is != null
* @return null|PublisherFolder[]
*/
protected function getRelatedPublishers()
{
$publisherFolders = null;
if ($this->getCustomParameter('ShowPublisherLogos') == null)
{
return $publisherFolders;
}
if ($this->node instanceof eZContentObjectTreeNode)
{
$dataMap = $this->node->dataMap();
$taxonomies = $dataMap["serialized_taxonomies"]->content();
$publisherPaths = $taxonomies["publisher_folder"];
foreach ($publisherPaths as $publisherPath)
{
$publisherFolders[] = $this->applicationLocalized()->getPublisherFolderFromPath( $publisherPath );
}
}
else
{
$publisherFolders = $this->applicationLocalized()->publisherFolders;
}
return $publisherFolders;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:29,代码来源:applicationDefault.php
示例7: fetchIndexTargets
private static function fetchIndexTargets($indexTarget, $classIdentifiers, $contentObjectAttribute)
{
if (!is_array($classIdentifiers)) {
return array();
}
if ($indexTarget == 'parent_line') {
$path = $contentObjectAttribute->object()->mainNode()->fetchPath();
if (!empty($classIdentifiers)) {
$targets = array();
foreach ($path as $pathNode) {
if (in_array($pathNode->classIdentifier(), $classIdentifiers)) {
$targets[] = $pathNode;
}
}
return $targets;
}
return $path;
} else {
if ($indexTarget == 'parent') {
$parentNode = $contentObjectAttribute->object()->mainNode()->fetchParent();
if (empty($classIdentifiers) || in_array($parentNode->classIdentifier(), $classIdentifiers)) {
return array($parentNode);
}
} else {
if ($indexTarget == 'children' || $indexTarget == 'subtree') {
$children = eZContentObjectTreeNode::subTreeByNodeID(array('ClassFilterType' => !empty($classIdentifiers) ? 'include' : false, 'ClassFilterArray' => !empty($classIdentifiers) ? $classIdentifiers : false, 'Depth' => $indexTarget == 'children' ? 1 : false), $contentObjectAttribute->object()->mainNode()->attribute('node_id'));
if (is_array($children)) {
return $children;
}
}
}
}
return array();
}
开发者ID:netgen,项目名称:ngindexer,代码行数:34,代码来源:ezfsolrdocumentfieldngindexer.php
示例8: modify
function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
{
$parentNodeID = $namedParameters['parent_node_id'];
switch ($operatorName) {
case 'ezkeywordlist':
include_once 'lib/ezdb/classes/ezdb.php';
$db = eZDB::instance();
if ($parentNodeID) {
$node = eZContentObjectTreeNode::fetch($parentNodeID);
if ($node) {
$pathString = "AND ezcontentobject_tree.path_string like '" . $node->attribute('path_string') . "%'";
}
$parentNodeIDSQL = "AND ezcontentobject_tree.node_id != " . (int) $parentNodeID;
}
$showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(true, false);
$limitation = false;
$limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
$sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
$versionNameJoins = " AND ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id AND\n ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version AND ";
$languageFilter = " AND " . eZContentLanguage::languagesSQLFilter('ezcontentobject');
$versionNameJoins .= eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject');
$quotedClassIdentifiers = array();
foreach ((array) $namedParameters['class_identifier'] as $classIdentifier) {
$quotedClassIdentifiers[] = "'" . $db->escapeString($classIdentifier) . "'";
}
$rs = $db->arrayQuery("SELECT DISTINCT ezkeyword.keyword\n FROM ezkeyword_attribute_link,\n ezkeyword,\n ezcontentobject,\n ezcontentobject_name,\n ezcontentobject_attribute,\n ezcontentobject_tree,\n ezcontentclass\n {$sqlPermissionChecking['from']}\n WHERE ezkeyword.id = ezkeyword_attribute_link.keyword_id\n AND ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id\n AND ezcontentobject_tree.contentobject_id = ezcontentobject_attribute.contentobject_id\n AND ezkeyword.class_id = ezcontentclass.id\n AND " . $db->generateSQLINStatement($quotedClassIdentifiers, 'ezcontentclass.identifier') . "\n {$pathString}\n {$parentNodeIDSQL} " . ($namedParameters['depth'] > 0 ? "AND ezcontentobject_tree.depth=" . (int) $namedParameters['depth'] : '') . "\n {$showInvisibleNodesCond}\n {$sqlPermissionChecking['where']}\n {$languageFilter}\n {$versionNameJoins}\n ORDER BY ezkeyword.keyword ASC");
$operatorValue = $rs;
break;
}
}
开发者ID:BGCX067,项目名称:ezpublish-thetechtalent-svn-to-git,代码行数:30,代码来源:ezkeywordlist.php
示例9: getMetaTitle
public static function getMetaTitle( $pathArray )
{
$metaINI = eZINI::instance( 'ezmetadata.ini' );
$allowedClasses = $metaINI->variable( 'TitleSettings', 'ParentClasses' );
$maxDepth = $metaINI->variable( 'TitleSettings', 'MaxDepth' );
$separator = ' '.$metaINI->variable( 'TitleSettings', 'PathSeparator' ).' ';
$contentINI = eZINI::instance( 'content.ini' );
$rootNodeID = $contentINI->variable( 'NodeSettings', 'RootNode' );
$titleArray = array();
$depth = -1;
$currentItem = array_pop( $pathArray );
foreach ( $pathArray as $item )
{
if ( $item['node_id'] == $rootNodeID ) $depth = 0;
if ( $depth < 0 ) continue;
$itemNode = eZContentObjectTreeNode::fetch( $item['node_id'] );
$itemClass = $itemNode->attribute( 'class_identifier' );
if ( in_array( $itemClass, $allowedClasses ) )
{
$titleArray[] = self::getMetaTitleItem( $itemNode );
$depth++;
if ( $depth >= $maxDepth ) break;
}
}
$itemNode = eZContentObjectTreeNode::fetch( $currentItem['node_id'] );
if ( $itemNode ) $titleArray[] = self::getMetaTitleItem( $itemNode );
$titleArray = array_reverse( $titleArray );
return implode( $separator, $titleArray );
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:35,代码来源:metaoperators.php
示例10: fetch
public function fetch($parameters, $publishedAfter, $publishedBeforeOrAt)
{
if (isset($parameters['Source'])) {
$nodeID = $parameters['Source'];
$node = eZContentObjectTreeNode::fetch($nodeID, false, false);
// not as an object
if ($node && $node['modified_subnode'] <= $publishedAfter) {
return array();
}
} else {
$nodeID = 0;
}
$subTreeParameters = array();
$subTreeParameters['AsObject'] = false;
$subTreeParameters['SortBy'] = array('published', false);
// first the latest
$subTreeParameters['AttributeFilter'] = array('and', array('published', '>', $publishedAfter), array('published', '<=', $publishedBeforeOrAt), array('visibility', '=', true));
if (isset($parameters['Class'])) {
$subTreeParameters['ClassFilterType'] = 'include';
$subTreeParameters['ClassFilterArray'] = explode(';', $parameters['Class']);
}
if (isset($parameters['Limit'])) {
$subTreeParameters['Limit'] = (int) $parameters['Limit'];
}
$result = eZContentObjectTreeNode::subTreeByNodeID($subTreeParameters, $nodeID);
if ($result === null) {
return array();
}
$fetchResult = array();
foreach ($result as $item) {
$fetchResult[] = array('object_id' => $item['id'], 'node_id' => $item['node_id'], 'ts_publication' => $item['published']);
}
return $fetchResult;
}
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:34,代码来源:ezflowlatestobjects.php
示例11: getNodeUrl
/**
* @param eZContentObjectTreeNode $node
* @return string
*/
public function getNodeUrl(&$node = null)
{
$url = '';
if ( $node )
{
$dataMap = $node->dataMap();
$mediaContentAttribute = $dataMap['media_content'];
$mediaContentAttributeContent = $mediaContentAttribute->content();
$linkObjectID = $mediaContentAttributeContent['relation_list'][0]['contentobject_id'];
$linkObject = eZContentObject::fetch( $linkObjectID );
$linkDatamap = $linkObject->dataMap();
$url = $linkDatamap['url']->content();
}
return $url;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:20,代码来源:externallinkhandlerurl.php
示例12: testDisplayVariableWithObject
/**
* Tests that the output process works with objects.
*
* There should be no crash from casting errors.
* @group templateOperators
* @group attributeOperator
*/
public function testDisplayVariableWithObject()
{
$db = eZDB::instance();
// STEP 1: Add test folder
$folder = new ezpObject( "folder", 2 );
$folder->name = __METHOD__;
$folder->publish();
$nodeId = $folder->mainNode->node_id;
$node = eZContentObjectTreeNode::fetch( $nodeId );
$attrOp = new eZTemplateAttributeOperator();
$outputTxt = '';
$formatterMock = $this->getMock( 'ezpAttributeOperatorFormatterInterface' );
$formatterMock->expects( $this->any() )
->method( 'line' )
->will( $this->returnValue( __METHOD__ ) );
try
{
$attrOp->displayVariable( $node, $formatterMock, true, 2, 0, $outputTxt );
}
catch ( PHPUnit_Framework_Error $e )
{
self::fail( "eZTemplateAttributeOperator raises an error when working with objects." );
}
self::assertNotNull( $outputTxt, "Output text is empty." );
// this is an approxmiate test. The output shoudl contain the name of the object it has been generated correctly.
self::assertContains( __METHOD__, $outputTxt, "There is something wrong with the output of the attribute operator. Object name not found." );
}
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:39,代码来源:eztemplateattributeoperator_test.php
示例13: 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
示例14: fetch
public function fetch($parameters, $publishedAfter, $publishedBeforeOrAt)
{
if (isset($parameters['Source'])) {
$nodeID = $parameters['Source'];
$node = eZContentObjectTreeNode::fetch($nodeID, false, false);
// not as an object
if ($node && $node['modified_subnode'] <= $publishedAfter) {
return array();
}
} else {
$nodeID = 0;
}
$subTreeParameters = array();
$subTreeParameters['AsObject'] = false;
$subTreeParameters['SortBy'] = array('published', true);
// first the oldest
$subTreeParameters['AttributeFilter'] = array('and', array('published', '>', $publishedAfter), array('published', '<=', $publishedBeforeOrAt));
if (isset($parameters['Classes'])) {
$subTreeParameters['ClassFilterType'] = 'include';
$subTreeParameters['ClassFilterArray'] = explode(',', $parameters['Classes']);
}
// Do not fetch hidden nodes even when ShowHiddenNodes=true
$subTreeParameters['AttributeFilter'] = array('and', array('visibility', '=', true));
$nodes = eZContentObjectTreeNode::subTreeByNodeID($subTreeParameters, $nodeID);
if ($nodes === null) {
return array();
}
$fetchResult = array();
foreach ($nodes as $node) {
$fetchResult[] = array('object_id' => $node['contentobject_id'], 'node_id' => $node['node_id'], 'ts_publication' => $node['published']);
}
return $fetchResult;
}
开发者ID:BGCX067,项目名称:ezpublish-thetechtalent-svn-to-git,代码行数:33,代码来源:ezflowmcfetch.php
示例15: testIssue23528
/**
* eZContentObjectTreeNode::createAttributeFilterSQLStrings() returns
* invalid 'in'/'not in' SQL statements
*
* @link http://issues.ez.no/23528
* @dataProvider providerForTestIssue23528
*/
public function testIssue23528($name, $expected)
{
$params = array(1, '3', 'foo', '1foo', 'foo_1');
$attributeFilterParams = array(array($name, 'in', $params));
$attributeFilter = eZContentObjectTreeNode::createAttributeFilterSQLStrings($attributeFilterParams);
$this->assertEquals($expected, $attributeFilter['where']);
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:14,代码来源:ezcontentobjecttreenode_test2.php
示例16: testUnauthorizedContentByNode
/**
* @group issue18073
* @link http://issues.ez.no/18073
*/
public function testUnauthorizedContentByNode()
{
$this->setExpectedException('ezpContentAccessDeniedException');
// Let's take content node #5 / object #4 (users) as unauthorized content for anonymous user
$unauthorizedNodeID = 5;
$content = ezpContent::fromNode(eZContentObjectTreeNode::fetch($unauthorizedNodeID));
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:11,代码来源:ezpcontent_regression.php
示例17: execute
public function execute($process, $event)
{
$params = $process->attribute('parameter_list');
$object_id = $params['object_id'];
$object = eZContentObject::fetch($object_id);
if (!is_object($object)) {
eZDebug::writeError("Unable to fetch object: '{$object_id}'", __METHOD__);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
// current parent node(s)
$parentNodeIds = $object->attribute('parent_nodes');
$checkedObjs = array();
foreach ($parentNodeIds as $parentNodeId) {
//eZDebug::writeDebug( "Checking parent node: " . $parentNodeId, __METHOD__ );
$parentNode = eZContentObjectTreeNode::fetch($parentNodeId);
$parentObj = $parentNode->attribute('object');
if (!in_array($parentObj->attribute('id'), $checkedObjs)) {
//eZDebug::writeDebug( "Checking all nodes of parent obj: " . $parentObj->attribute( 'id' ), __METHOD__ );
foreach ($parentObj->attribute('assigned_nodes') as $node) {
if (!in_array($node->attribute('node_id'), $parentNodeIds)) {
//eZDebug::writeDebug( "Found a node which is not parent of current obj: " . $node->attribute( 'node_id' ), __METHOD__ );
// the current obj has no node which is children of the given node of one of its parent objects
$operationResult = eZOperationHandler::execute('content', 'addlocation', array('node_id' => $object->attribute('main_node_id'), 'object_id' => $object->attribute('id'), 'select_node_id_array' => array($node->attribute('node_id'))), null, true);
if ($operationResult == null || $operationResult['status'] != true) {
eZDebug::writeError("Unable to add new location to object: " . $object->attribute('id'), __METHOD__);
}
} else {
//eZDebug::writeDebug( "Found a node which is already parent of current obj: " . $node->attribute( 'node_id' ), __METHOD__ );
}
}
}
$checkedObjs[] = $parentObj->attribute('id');
}
return eZWorkflowType::STATUS_ACCEPTED;
}
开发者ID:gggeek,项目名称:ezworkflowcollection,代码行数:35,代码来源:copynodetoallparentlocationstype.php
示例18: validNodes
/**
* Return valid items for block with given $blockID
*
* @static
* @param string $blockID
* @param bool $asObject
* @return array(eZContentObjectTreeNode)
*/
static function validNodes($blockID, $asObject = true)
{
if (isset($GLOBALS['eZFlowPool']) === false) {
$GLOBALS['eZFlowPool'] = array();
}
if (isset($GLOBALS['eZFlowPool'][$blockID])) {
return $GLOBALS['eZFlowPool'][$blockID];
}
$visibilitySQL = "";
if (eZINI::instance('site.ini')->variable('SiteAccessSettings', 'ShowHiddenNodes') !== 'true') {
$visibilitySQL = "AND ezcontentobject_tree.is_invisible = 0 ";
}
$db = eZDB::instance();
$validNodes = $db->arrayQuery("SELECT ezm_pool.node_id\n FROM ezm_pool, ezcontentobject_tree, ezcontentobject\n WHERE ezm_pool.block_id='{$blockID}'\n AND ezm_pool.ts_visible>0\n AND ezm_pool.ts_hidden=0\n AND ezcontentobject_tree.node_id = ezm_pool.node_id\n AND ezcontentobject.id = ezm_pool.object_id\n AND " . eZContentLanguage::languagesSQLFilter('ezcontentobject') . "\n {$visibilitySQL}\n ORDER BY ezm_pool.priority DESC");
if ($asObject && !empty($validNodes)) {
$validNodesObjects = array();
foreach ($validNodes as $node) {
$validNodeObject = eZContentObjectTreeNode::fetch($node['node_id']);
if ($validNodeObject instanceof eZContentObjectTreeNode && $validNodeObject->canRead()) {
$validNodesObjects[] = $validNodeObject;
}
}
$GLOBALS['eZFlowPool'][$blockID] = $validNodesObjects;
return $validNodesObjects;
} else {
return $validNodes;
}
}
开发者ID:kuborgh,项目名称:ezflow-ls-extension,代码行数:36,代码来源:ezflowpool.php
示例19: createUser
/**
* Creates a user with provided auth data
*
* @param array $authResult
*
* @return bool|eZUser
*/
public static function createUser($authResult)
{
$ngConnectINI = eZINI::instance('ngconnect.ini');
$siteINI = eZINI::instance('site.ini');
$defaultUserPlacement = $ngConnectINI->variable('LoginMethod_' . $authResult['login_method'], 'DefaultUserPlacement');
$placementNode = eZContentObjectTreeNode::fetch($defaultUserPlacement);
if (!$placementNode instanceof eZContentObjectTreeNode) {
$defaultUserPlacement = $siteINI->variable('UserSettings', 'DefaultUserPlacement');
$placementNode = eZContentObjectTreeNode::fetch($defaultUserPlacement);
if (!$placementNode instanceof eZContentObjectTreeNode) {
return false;
}
}
$contentClass = eZContentClass::fetch($siteINI->variable('UserSettings', 'UserClassID'));
$userCreatorID = $siteINI->variable('UserSettings', 'UserCreatorID');
$defaultSectionID = $siteINI->variable('UserSettings', 'DefaultSectionID');
$db = eZDB::instance();
$db->begin();
$contentObject = $contentClass->instantiate($userCreatorID, $defaultSectionID);
$contentObject->store();
$nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $contentObject->attribute('id'), 'contentobject_version' => 1, 'parent_node' => $placementNode->attribute('node_id'), 'is_main' => 1));
$nodeAssignment->store();
$currentTimeStamp = eZDateTime::currentTimeStamp();
/** @var eZContentObjectVersion $version */
$version = $contentObject->currentVersion();
$version->setAttribute('modified', $currentTimeStamp);
$version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
$version->store();
$dataMap = $version->dataMap();
self::fillUserObject($version->dataMap(), $authResult);
if (!isset($dataMap['user_account'])) {
$db->rollback();
return false;
}
$userLogin = 'ngconnect_' . $authResult['login_method'] . '_' . $authResult['id'];
$userPassword = (string) rand() . 'ngconnect_' . $authResult['login_method'] . '_' . $authResult['id'] . (string) rand();
$userExists = false;
if (eZUser::requireUniqueEmail()) {
$userExists = eZUser::fetchByEmail($authResult['email']) instanceof eZUser;
}
if (empty($authResult['email']) || $userExists) {
$email = md5('ngconnect_' . $authResult['login_method'] . '_' . $authResult['id']) . '@localhost.local';
} else {
$email = $authResult['email'];
}
$user = new eZUser(array('contentobject_id' => $contentObject->attribute('id'), 'email' => $email, 'login' => $userLogin, 'password_hash' => md5("{$userLogin}\n{$userPassword}"), 'password_hash_type' => 1));
$user->store();
$userSetting = new eZUserSetting(array('is_enabled' => true, 'max_login' => 0, 'user_id' => $contentObject->attribute('id')));
$userSetting->store();
$dataMap['user_account']->setContent($user);
$dataMap['user_account']->store();
$operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $contentObject->attribute('id'), 'version' => $version->attribute('version')));
if (array_key_exists('status', $operationResult) && $operationResult['status'] == eZModuleOperationInfo::STATUS_CONTINUE) {
$db->commit();
return $user;
}
$db->rollback();
return false;
}
开发者ID:netgen,项目名称:ngconnect,代码行数:66,代码来源:ngconnectfunctions.php
示例20: mainNode
protected function mainNode()
{
if ( is_null($this->_mainNode) )
{
$this->_mainNode = eZContentObjectTreeNode::fetch( $this->mainNodeId );
}
return $this->_mainNode;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:8,代码来源:pfrlocation.php
注:本文中的eZContentObjectTreeNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论