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


PHP eZContentObject::definition方法代码示例

本文整理汇总了PHP中eZContentObject::definition方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject::definition方法的具体用法?PHP eZContentObject::definition怎么用?PHP eZContentObject::definition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZContentObject的用法示例。


在下文中一共展示了eZContentObject::definition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: definition

    /**
     * Makes the following function attributes field attribtues, for testing purposes :
     *  - class_name
     *  - class_identifier
     *  - main_node_id
     *  - main_parent_node_id
     *
     * @return the overridden definition array
     */
    public static function definition()
    {
        $definitionOverride = array( 'fields' => array( 'class_name' =>
                                                            array( 'name' =>     "LocalClassName",
                                                                   'datatype' => 'mixed' ),
                                                        'class_identifier' =>
                                                            array( 'name' =>     "LocalClassIdentifier",
                                                                   'datatype' => 'mixed' ),
                                                        'main_node_id' =>
                                                            array( 'name' =>     "MainNodeId",
                                                                   'datatype' => 'mixed' ),
                                                        'main_parent_node_id' =>
                                                            array( 'name' =>     "MainParentNodeId",
                                                                   'datatype' => 'mixed' )
                                                      )
                                   );

        $definition = array_merge_recursive( parent::definition(), $definitionOverride );
        $definition['class_name'] = __CLASS__;

        unset( $definition['function_attributes']['class_name'] );
        unset( $definition['function_attributes']['class_identifier'] );
        unset( $definition['function_attributes']['main_node_id'] );
        unset( $definition['function_attributes']['main_parent_node_id'] );

        return $definition;
    }
开发者ID:ataxel,项目名称:tp,代码行数:36,代码来源:ezcontentobject_tester.php

示例2: fetchObjectListCount

 function fetchObjectListCount($sectionID, $status = false)
 {
     if ($status == 'archived') {
         $status = eZContentObject::STATUS_ARCHIVED;
     } else {
         $status = eZContentObject::STATUS_PUBLISHED;
     }
     $rows = eZPersistentObject::fetchObjectList(eZContentObject::definition(), array(), array('section_id' => $sectionID, 'status' => $status), false, null, false, false, array(array('operation' => 'count( id )', 'name' => 'count')));
     return array('result' => $rows[0]['count']);
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:10,代码来源:ezsectionfunctioncollection.php

示例3: testFetchByNodeIDAsRow

 /**
  * Unit test for {@link eZContentObject::fetchByNodeID()}
  */
 public function testFetchByNodeIDAsRow()
 {
     $fetchedObject = eZContentObject::fetchByNodeID(2, false);
     $def = eZContentObject::definition();
     self::assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $fetchedObject, "eZContentObject::fetchByNodeID() with \$asObject=false must return an array");
     foreach ($def['fields'] as $key => $fieldDef) {
         self::assertArrayHasKey($key, $fetchedObject, "eZContentObject::fetchByNodeID() with \$asObject=false must return an array with '{$key}' key");
     }
     $this->assertEquals('eZ Publish', $fetchedObject['name']);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:13,代码来源:ezcontentobject_test.php

示例4: importRSSItem

function importRSSItem($item, $rssImport, $cli, $channel)
{
    $rssImportID = $rssImport->attribute('id');
    $rssOwnerID = $rssImport->attribute('object_owner_id');
    // Get owner user id
    $parentContentObjectTreeNode = eZContentObjectTreeNode::fetch($rssImport->attribute('destination_node_id'));
    // Get parent treenode object
    if ($parentContentObjectTreeNode == null) {
        $cli->output('RSSImport ' . $rssImport->attribute('name') . ': Destination tree node seems to be unavailable');
        return 0;
    }
    $parentContentObject = $parentContentObjectTreeNode->attribute('object');
    // Get parent content object
    $titleElement = $item->getElementsByTagName('title')->item(0);
    $title = is_object($titleElement) ? $titleElement->textContent : '';
    // Test for link or guid as unique identifier
    $link = $item->getElementsByTagName('link')->item(0);
    $guid = $item->getElementsByTagName('guid')->item(0);
    $rssId = '';
    if ($link->textContent) {
        $rssId = $link->textContent;
    } elseif ($guid->textContent) {
        $rssId = $guid->textContent;
    } else {
        $cli->output('RSSImport ' . $rssImport->attribute('name') . ': Item has no unique identifier. RSS guid or link missing.');
        return 0;
    }
    $md5Sum = md5($rssId);
    // Try to fetch RSSImport object with md5 sum matching link.
    $existingObject = eZPersistentObject::fetchObject(eZContentObject::definition(), null, array('remote_id' => 'RSSImport_' . $rssImportID . '_' . $md5Sum));
    // if object exists, continue to next import item
    if ($existingObject != null) {
        $cli->output('RSSImport ' . $rssImport->attribute('name') . ': Object ( ' . $existingObject->attribute('id') . ' ) with ID: "' . $rssId . '" already exists');
        unset($existingObject);
        // delete object to preserve memory
        return 0;
    }
    // Fetch class, and create ezcontentobject from it.
    $contentClass = eZContentClass::fetch($rssImport->attribute('class_id'));
    // Instantiate the object with user $rssOwnerID and use section id from parent. And store it.
    $contentObject = $contentClass->instantiate($rssOwnerID, $parentContentObject->attribute('section_id'));
    $db = eZDB::instance();
    $db->begin();
    $contentObject->store();
    $contentObjectID = $contentObject->attribute('id');
    // Create node assignment
    $nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $contentObjectID, 'contentobject_version' => $contentObject->attribute('current_version'), 'is_main' => 1, 'parent_node' => $parentContentObjectTreeNode->attribute('node_id')));
    $nodeAssignment->store();
    $version = $contentObject->version(1);
    $version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
    $version->store();
    // Get object attributes, and set their values and store them.
    $dataMap = $contentObject->dataMap();
    $importDescription = $rssImport->importDescription();
    // Set content object attribute values.
    $classAttributeList = $contentClass->fetchAttributes();
    foreach ($classAttributeList as $classAttribute) {
        $classAttributeID = $classAttribute->attribute('id');
        if (isset($importDescription['class_attributes'][$classAttributeID])) {
            if ($importDescription['class_attributes'][$classAttributeID] == '-1') {
                continue;
            }
            $importDescriptionArray = explode(' - ', $importDescription['class_attributes'][$classAttributeID]);
            if (count($importDescriptionArray) < 1) {
                $cli->output('RSSImport ' . $rssImport->attribute('name') . ': Invalid import definition. Please redit.');
                break;
            }
            $elementType = $importDescriptionArray[0];
            array_shift($importDescriptionArray);
            switch ($elementType) {
                case 'item':
                    setObjectAttributeValue($dataMap[$classAttribute->attribute('identifier')], recursiveFindRSSElementValue($importDescriptionArray, $item));
                    break;
                case 'channel':
                    setObjectAttributeValue($dataMap[$classAttribute->attribute('identifier')], recursiveFindRSSElementValue($importDescriptionArray, $channel));
                    break;
            }
        }
    }
    $contentObject->setAttribute('remote_id', 'RSSImport_' . $rssImportID . '_' . $md5Sum);
    $contentObject->store();
    $db->commit();
    // Publish new object. The user id is sent to make sure any workflow
    // requiring the user id has access to it.
    $operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $contentObject->attribute('id'), 'version' => 1, 'user_id' => $rssOwnerID));
    if (!isset($operationResult['status']) || $operationResult['status'] != eZModuleOperationInfo::STATUS_CONTINUE) {
        if (isset($operationResult['result']) && isset($operationResult['result']['content'])) {
            $failReason = $operationResult['result']['content'];
        } else {
            $failReason = "unknown error";
        }
        $cli->error("Publishing failed: {$failReason}");
        unset($failReason);
    }
    $db->begin();
    unset($contentObject);
    unset($version);
    $contentObject = eZContentObject::fetch($contentObjectID);
    $version = $contentObject->attribute('current');
    // Set object Attributes like modified and published timestamps
//.........这里部分代码省略.........
开发者ID:nfrp,项目名称:ezpublish,代码行数:101,代码来源:rssimport.php

示例5: array

                $objectList = eZPersistentObject::fetchObjectList(eZContentObject::definition(), null, array('id' => $deleteID), null, null, true);
                foreach ($objectList as $object) {
                    $object->purge();
                }
            }
        } else {
            return $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
        }
    }
} else {
    if ($http->hasPostVariable('EmptyButton')) {
        $access = $user->hasAccessTo('content', 'cleantrash');
        if ($access['accessWord'] == 'yes' || $access['accessWord'] == 'limited') {
            while (true) {
                // Fetch 100 objects at a time, to limit transaction size
                $objectList = eZPersistentObject::fetchObjectList(eZContentObject::definition(), null, array('status' => eZContentObject::STATUS_ARCHIVED), null, 100, true);
                if (count($objectList) < 1) {
                    break;
                }
                foreach ($objectList as $object) {
                    $object->purge();
                }
            }
        } else {
            return $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
        }
    }
}
$tpl = eZTemplate::factory();
$tpl->setVariable('view_parameters', $viewParameters);
$Result = array();
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:trash.php

示例6: fetchSameClassListCount

 /**
  * Returns the number of content objects with the content class id $contentClassID
  *
  * @param int $contentClassID
  * @return int
  */
 static function fetchSameClassListCount( $contentClassID )
 {
     $result = eZPersistentObject::fetchObjectList( eZContentObject::definition(),
                                                    array(),
                                                    array( "contentclass_id" => $contentClassID ),
                                                    false, null,
                                                    false, false,
                                                    array( array( 'operation' => 'count( * )',
                                                                  'name' => 'count' ) ) );
     return $result[0]['count'];
 }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:17,代码来源:ezcontentobject.php

示例7: testFetchListCountOnObjectIDAndArchivedStatus

 /**
  * Test for eZContentObject::fetchListCount(), using content object ID + archived status
  */
 public function testFetchListCountOnObjectIDAndArchivedStatus()
 {
     $this->article->setAttribute('status', eZContentObject::STATUS_ARCHIVED);
     $this->article->store();
     $eZContentObjectDefinition = eZContentObject::definition();
     $count = eZContentObject::fetchListCount(array($eZContentObjectDefinition['name'] . ".id" => $this->article->id, 'status' => eZContentObject::STATUS_ARCHIVED));
     $this->assertEquals(1, $count);
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:11,代码来源:ezcontentobject_test2.php

示例8: count

}

$nonUniqueRemoteIDDataListCount = count( $nonUniqueRemoteIDDataList );

$cli->output( '' );
$cli->output( "Found $nonUniqueRemoteIDDataListCount content objects with empty remote IDs." );
$cli->output( '' );

if ( $nonUniqueRemoteIDDataListCount )
{
    $cli->output( 'Fixing', false );

    foreach ( $nonUniqueRemoteIDDataList as $nonUniqueRemoteIDData )
    {
        // fetch objects with eZPersistentObject to avoid object cache
        $contentObjects = eZPersistentObject::fetchObjectList( eZContentObject::definition(),
                                                               null,
                                                               array( 'id' => $nonUniqueRemoteIDData['id'] ),
                                                               array( 'status' => 'desc', 'published' => 'asc' ) );
        foreach ( $contentObjects as $i => $contentObject )
        {
            $contentObject->setAttribute( 'remote_id', eZRemoteIdUtility::generate( 'object' ) );
            $contentObject->store();
        }

        ++$totalCount;
        $cli->output( '.', false );
    }
}

$cli->output( '' );
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:fixobjectremoteid.php

示例9: array

    }
    $db = eZDB::instance($dbImpl, $params, true);
    eZDB::setInstance($db);
}
$db->setIsSQLOutputEnabled($showSQL);
$searchEngine = eZSearch::getEngine();
if (!$searchEngine instanceof ezpSearchEngine) {
    $cli->error("The configured search engine does not implement the ezpSearchEngine interface or can't be found.");
    $script->shutdown(1);
}
if ($cleanupSearch) {
    $cli->output("{eZSearchEngine: Cleaning up search data", false);
    $searchEngine->cleanup();
    $cli->output("}");
}
$def = eZContentObject::definition();
$conds = array('status' => eZContentObject::STATUS_PUBLISHED);
$count = eZPersistentObject::count($def, $conds, 'id');
$cli->output("Number of objects to index: {$count}");
$length = 50;
$limit = array('offset' => 0, 'length' => $length);
$script->resetIteration($count);
$needRemoveWithUpdate = $searchEngine->needRemoveWithUpdate();
do {
    // clear in-memory object cache
    eZContentObject::clearCache();
    $objects = eZPersistentObject::fetchObjectList($def, null, $conds, null, $limit);
    foreach ($objects as $object) {
        if ($needRemoveWithUpdate || !$cleanupSearch) {
            $searchEngine->removeObjectById($object->attribute("id"), false);
        }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:31,代码来源:updatesearchindex.php

示例10: canBeRemoved

 function canBeRemoved($sectionID = false)
 {
     if ($sectionID === false) {
         $sectionID = $this->attribute('id');
     }
     $objects = eZPersistentObject::fetchObjectList(eZContentObject::definition(), null, array('section_id' => $sectionID));
     $limitations = eZPolicyLimitation::findByType('Section', $sectionID, true, false);
     $userRoles = eZRole::fetchRolesByLimitation('section', $sectionID);
     if (count($objects) > 0 or count($limitations) > 0 or count($userRoles) > 0) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:14,代码来源:ezsection.php

示例11: isUser

 /**
  * Check if the object that contains the ezpaex attribute is an user
  *
  * @return bool if the contentobject is a user or not
  */
 function isUser()
 {
     $ezpo = eZPersistentObject::fetchObject(eZContentObject::definition(), null, array('id' => $this->attribute('contentobject_id')), true);
     return eZUser::isUserObject($ezpo);
 }
开发者ID:netbliss,项目名称:ezmbpaex,代码行数:10,代码来源:ezpaex.php

示例12: count

        $contentObject->store();
    }
    $totalCount += $nonUniqueRemoteIDData['cnt'] - 1;
    $cli->output('');
    $cli->output('');
}
if ($db->databaseName() == 'oracle') {
    $nonUniqueRemoteIDDataList = $db->arrayQuery("SELECT id FROM ezcontentobject WHERE remote_id IS NULL");
} else {
    $nonUniqueRemoteIDDataList = $db->arrayQuery("SELECT id FROM ezcontentobject WHERE remote_id = ''");
}
$nonUniqueRemoteIDDataListCount = count($nonUniqueRemoteIDDataList);
$cli->output('');
$cli->output("Found {$nonUniqueRemoteIDDataListCount} content objects with empty remote IDs.");
$cli->output('');
if ($nonUniqueRemoteIDDataListCount) {
    $cli->output('Fixing', false);
    foreach ($nonUniqueRemoteIDDataList as $nonUniqueRemoteIDData) {
        // fetch objects with eZPersistentObject to avoid object cache
        $contentObjects = eZPersistentObject::fetchObjectList(eZContentObject::definition(), null, array('id' => $nonUniqueRemoteIDData['id']), array('status' => 'desc', 'published' => 'asc'));
        foreach ($contentObjects as $i => $contentObject) {
            $contentObject->setAttribute('remote_id', eZRemoteIdUtility::generate('object'));
            $contentObject->store();
        }
        ++$totalCount;
        $cli->output('.', false);
    }
}
$cli->output('');
$cli->output("Number of content objects that received a new remote ID : {$totalCount}");
$script->shutdown(0);
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:fixobjectremoteid.php

示例13: attribute

 function attribute($attr)
 {
     switch ($attr) {
         case 'sections':
             $sections = eZSection::fetchList(false);
             foreach ($sections as $key => $section) {
                 $sections[$key]['Name'] = $section['name'];
                 $sections[$key]['value'] = $section['id'];
             }
             return $sections;
             break;
         case 'languages':
             return eZContentLanguage::fetchList();
             break;
         case 'usergroups':
             $groups = eZPersistentObject::fetchObjectList(eZContentObject::definition(), array('id', 'name'), array('contentclass_id' => 3, 'status' => eZContentObject::STATUS_PUBLISHED), null, null, false);
             foreach ($groups as $key => $group) {
                 $groups[$key]['Name'] = $group['name'];
                 $groups[$key]['value'] = $group['id'];
             }
             return $groups;
             break;
         case 'contentclass_list':
             $classes = eZContentClass::fetchList(eZContentClass::VERSION_STATUS_DEFINED, true, false, array('name' => 'asc'));
             $classList = array();
             for ($i = 0; $i < count($classes); $i++) {
                 $classList[$i]['Name'] = $classes[$i]->attribute('name');
                 $classList[$i]['value'] = $classes[$i]->attribute('id');
             }
             return $classList;
             break;
         case 'workflow_list':
             $workflows = eZWorkflow::fetchList();
             $workflowList = array();
             for ($i = 0; $i < count($workflows); $i++) {
                 $workflowList[$i]['Name'] = $workflows[$i]->attribute('name');
                 $workflowList[$i]['value'] = $workflows[$i]->attribute('id');
             }
             return $workflowList;
             break;
     }
     return eZWorkflowEventType::attribute($attr);
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:43,代码来源:ezmultiplexertype.php

示例14: array

$script->startup();
$options = $script->getOptions('[class:]', '', array('class' => 'Identificatore della classe'));
$script->initialize();
$script->setUseDebugAccumulators(true);
$cli = eZCLI::instance();
try {
    if (isset($options['class'])) {
        $classIdentifier = $options['class'];
    } else {
        throw new Exception("Specificare la classe");
    }
    $class = eZContentClass::fetchByIdentifier($classIdentifier);
    if (!$class instanceof eZContentClass) {
        throw new Exception("Classe {$classIdentifier} non trovata");
    }
    $objects = eZPersistentObject::fetchObjectList(eZContentObject::definition(), array('id'), array('contentclass_id' => $class->attribute('id')), null, null, false);
    $ids = array();
    foreach ($objects as $object) {
        $ids[] = $object['id'];
    }
    $pendingAction = 'rename';
    if (count($ids) > 0) {
        $count = count($ids);
        $output = new ezcConsoleOutput();
        $progressBarOptions = array('emptyChar' => ' ', 'barChar' => '=');
        $progressBarOptions['minVerbosity'] = 10;
        $progressBar = new ezcConsoleProgressbar($output, intval($count), $progressBarOptions);
        $progressBar->start();
        foreach ($ids as $id) {
            $progressBar->advance();
            eZDB::instance()->query("INSERT INTO ezpending_actions( action, param ) VALUES ( '{$pendingAction}', '{$id}' )");
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:31,代码来源:rename_by_class.php

示例15: sleep

    $cli->output("Invalid parent tag.");
    $script->shutdown(1);
}
$cli->warning("This script will NOT republish objects, but rather update the CURRENT");
$cli->warning("version of published objects. If you do not wish to do that, you have");
$cli->warning("15 seconds to cancel the script! (press Ctrl-C)\n");
sleep(15);
$sourceClassAttributeIdentifier = $sourceClassAttribute->attribute('identifier');
$destClassAttributeIdentifier = $destClassAttribute->attribute('identifier');
$isDestClassAttributeTranslatable = (bool) $destClassAttribute->attribute('can_translate');
$adminUser = eZUser::fetchByName('admin');
$adminUser->loginCurrent();
$db = eZDB::instance();
$offset = 0;
$limit = 50;
$objectCount = eZPersistentObject::count(eZContentObject::definition(), array('contentclass_id' => $sourceClassAttribute->attribute('contentclass_id'), 'status' => eZContentObject::STATUS_PUBLISHED));
while ($offset < $objectCount) {
    $objects = eZContentObject::fetchFilteredList(array('contentclass_id' => $sourceClassAttribute->attribute('contentclass_id'), 'status' => eZContentObject::STATUS_PUBLISHED), $offset, $limit);
    foreach ($objects as $object) {
        foreach ($object->availableLanguages() as $languageCode) {
            $object->fetchDataMap(false, $languageCode);
        }
        if (isset($object->DataMap[$object->attribute('current_version')])) {
            $db->begin();
            $languageDataMap = $object->DataMap[$object->attribute('current_version')];
            $initialLanguageCode = $object->initialLanguageCode();
            // first convert the initial (main) language
            $objectAttributes = $languageDataMap[$initialLanguageCode];
            if (isset($objectAttributes[$sourceClassAttributeIdentifier]) && isset($objectAttributes[$destClassAttributeIdentifier])) {
                $sourceObjectAttribute = $objectAttributes[$sourceClassAttributeIdentifier];
                $destObjectAttribute = $objectAttributes[$destClassAttributeIdentifier];
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:31,代码来源:convertezkeyword.php


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