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


PHP eZContentObject::createWithNodeAssignment方法代码示例

本文整理汇总了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 {
开发者ID:heliopsis,项目名称:ezpublish-legacy,代码行数:31,代码来源:action.php

示例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;
     }
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:34,代码来源:ezwebdavcontentbackend.php

示例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;
 }
开发者ID:heliopsis,项目名称:ezsurvey,代码行数:58,代码来源:ezsurveyrelatedobject.php

示例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;
        }
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:33,代码来源:ezwebdavcontentserver.php

示例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);
开发者ID:OpencontentCoop,项目名称:ocoperatorscollection,代码行数:31,代码来源:new.php


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