本文整理汇总了PHP中eZContentObject::createWithNodeAssignment方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject::createWithNodeAssignment方法的具体用法?PHP eZContentObject::createWithNodeAssignment怎么用?PHP eZContentObject::createWithNodeAssignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObject
的用法示例。
在下文中一共展示了eZContentObject::createWithNodeAssignment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$Result['content'] = $tpl->fetch('design:content/create_languages.tpl');
return $Result;
}
}
if ($hasClassInformation && $http->hasPostVariable('NodeID') || $module->isCurrentAction('NewObjectAddNodeAssignment')) {
if ($module->isCurrentAction('NewObjectAddNodeAssignment')) {
$selectedNodeIDArray = eZContentBrowse::result('NewObjectAddNodeAssignment');
if (count($selectedNodeIDArray) == 0) {
return $module->redirectToView('view', array('full', 2));
}
$node = eZContentObjectTreeNode::fetch($selectedNodeIDArray[0]);
} else {
$node = eZContentObjectTreeNode::fetch($http->postVariable('NodeID'));
}
if (is_object($node)) {
$contentObject = eZContentObject::createWithNodeAssignment($node, $contentClassID, $languageCode, $http->postVariable('AssignmentRemoteID', false));
if ($contentObject) {
if ($http->hasPostVariable('RedirectURIAfterPublish')) {
$http->setSessionVariable('RedirectURIAfterPublish', $http->postVariable('RedirectURIAfterPublish'));
}
if ($http->hasPostVariable('RedirectIfDiscarded')) {
$http->setSessionVariable('RedirectIfDiscarded', $http->postVariable('RedirectIfDiscarded'));
}
$module->redirectTo($module->functionURI('edit') . '/' . $contentObject->attribute('id') . '/' . $contentObject->attribute('current_version'));
return;
} else {
// If ACCESS DENIED save current post variables for using after login
$http->setSessionVariable('$_POST_BeforeLogin', $http->attribute('post'));
return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
} else {
示例2: createFolder
/**
* Creates a new folder under the given $target path.
*
* @param eZContentObject $parentNode
* @param string $target Eg. 'Folder1'
* @return bool
*/
protected function createFolder($parentNode, $target)
{
// Grab settings from the ini file:
$webdavINI = eZINI::instance(self::WEBDAV_INI_FILE);
$folderClassID = $webdavINI->variable('FolderSettings', 'FolderClass');
$languageCode = eZContentObject::defaultLanguage();
$contentObject = eZContentObject::createWithNodeAssignment($parentNode, $folderClassID, $languageCode);
if ($contentObject) {
$db = eZDB::instance();
$db->begin();
$version = $contentObject->version(1);
$version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
$version->store();
$contentObjectID = $contentObject->attribute('id');
$contentObjectAttributes = $version->contentObjectAttributes();
// @todo @as avoid using [0] (could be another index in some classes)
$contentObjectAttributes[0]->setAttribute('data_text', basename($target));
$contentObjectAttributes[0]->store();
$db->commit();
$operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $contentObjectID, 'version' => 1));
return true;
// @as self::OK_CREATED;
} else {
return false;
// @as self::FAILED_FORBIDDEN;
}
}
示例3: createNewRelatedObject
function createNewRelatedObject($http, $action, $objectAttribute, $parameters)
{
$hasClassInformation = false;
$contentClassID = false;
$contentClassIdentifier = false;
$languageCode = false;
$class = false;
$languageCode = $objectAttribute->attribute('language_code');
$originalContentObjectID = $objectAttribute->attribute('contentobject_id');
$originalContentObjectVersion = $objectAttribute->attribute('version');
$contentObject = false;
$addVersion = false;
if ($this->Num != 0) {
$contentObject = eZContentObject::fetch($this->Num);
}
if ($this->Num == 0 or !(get_class($contentObject) == 'eZContentObject')) {
$addVersion = true;
$ini = eZINI::instance('ezsurvey.ini');
$configList = eZSurveyRelatedConfig::fetchList();
if (count($configList) > 0) {
$config = $configList[0];
$contentClassID = $config->attribute('contentclass_id');
$contentClass = eZContentClass::fetch($contentClassID);
$nodeID = $config->attribute('node_id');
$attributeParentNode = eZContentObjectTreeNode::fetch($nodeID);
if (get_class($contentClass) == 'eZContentClass' and get_class($attributeParentNode) == 'eZContentObjectTreeNode') {
$languageID = eZContentLanguage::idByLocale($languageCode);
$contentObject = eZContentObject::fetch($objectAttribute->attribute('contentobject_id'));
$node = eZContentObjectTreeNode::fetch($nodeID, $languageCode);
if (get_class($node) == "eZContentObjectTreeNode") {
$contentObject = eZContentObject::createWithNodeAssignment($node, $contentClassID, $languageCode, false);
} else {
eZDebug::writeWarning('node is not a valid eZContentObjectTreeNode', 'eZSurveyRelatedObject::createNewRelatedObject');
}
} else {
eZDebug::writeWarning('Config is not valid', 'eZSurveyRelatedObject::createNewRelatedObject');
}
}
}
if ($contentObject) {
$redirectHref = 'content/edit/' . $originalContentObjectID . '/' . $originalContentObjectVersion;
$http->setSessionVariable('LastAccessesURI_Backup_' . $originalContentObjectID . '_' . $this->ID, array('content' => $http->sessionVariable('LastAccessesURI')));
$http->setSessionVariable('RedirectURIAfterPublish_Backup_' . $originalContentObjectID . '_' . $this->ID, array('content' => $http->sessionVariable('RedirectURIAfterPublish')));
$http->setSessionVariable('RedirectIfDiscarded_Backup_' . $originalContentObjectID . '_' . $this->ID, array('content' => $http->sessionVariable('RedirectIfDiscarded')));
$http->setSessionVariable('LastAccessesURI', $redirectHref);
$http->setSessionVariable('RedirectURIAfterPublish', $redirectHref);
$http->setSessionVariable('RedirectIfDiscarded', $redirectHref);
$this->Num = $contentObject->attribute('id');
$this->store();
$parameters = array($contentObject->attribute('id'));
if ($addVersion === true) {
$parameters[] = $contentObject->attribute('current_version');
}
$module = $GLOBALS['module'];
$module->redirectToView('edit', $parameters);
}
return true;
}
示例4: createFolder
function createFolder( $parentNode, $target )
{
// Grab settings from the ini file:
$webdavINI = eZINI::instance( eZWebDAVContentServer::WEBDAV_INI_FILE );
$folderClassID = $webdavINI->variable( 'FolderSettings', 'FolderClass' );
$languageCode = eZContentObject::defaultLanguage();
$contentObject = eZContentObject::createWithNodeAssignment( $parentNode, $folderClassID, $languageCode );
if ( $contentObject )
{
$db = eZDB::instance();
$db->begin();
$version = $contentObject->version( 1 );
$version->setAttribute( 'status', eZContentObjectVersion::STATUS_DRAFT );
$version->store();
$contentObjectID = $contentObject->attribute( 'id' );
$contentObjectAttributes = $version->contentObjectAttributes();
$contentObjectAttributes[0]->setAttribute( 'data_text', basename( $target ) );
$contentObjectAttributes[0]->store();
$db->commit();
$operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID,
'version' => 1 ) );
return eZWebDAVServer::OK_CREATED;
}
else
{
$this->appendLogEntry( "Not allowed", 'CS:createFolder' );
return eZWebDAVServer::FAILED_FORBIDDEN;
}
}
示例5: explode
$contentClassIdentifier = $Params['Class'];
$class = eZContentClass::fetchByIdentifier($contentClassIdentifier);
if (!$class instanceof eZContentClass) {
return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$queryString = '';
if ($_SERVER['QUERY_STRING']) {
$queryStringParts = explode('/', $_SERVER['QUERY_STRING']);
$queryString = '?' . array_pop($queryStringParts);
}
if ($http->hasGetVariable('parent')) {
$parent = $http->getVariable('parent', false);
$node = eZContentObjectTreeNode::fetch(intval($parent));
if ($node instanceof eZContentObjectTreeNode && $class->attribute('id') && $node->canCreate()) {
$languageCode = eZINI::instance()->variable('RegionalSettings', 'Locale');
$object = eZContentObject::createWithNodeAssignment($node, $class->attribute('id'), $languageCode, false);
if ($object) {
$module->redirectTo('content/edit/' . $object->attribute('id') . '/' . $object->attribute('current_version') . $queryString);
return;
} else {
return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
} else {
return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
} elseif ($http->hasGetVariable('from')) {
$from = $http->getVariable('from', false);
$object = eZContentObject::fetch(intval($from));
try {
$languageCode = eZINI::instance()->variable('RegionalSettings', 'Locale');
$copy = OCOperatorsCollectionsTools::copyObject($object);