當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。