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


PHP eZContentObject::dataMap方法代码示例

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


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

示例1: __get

    /**
     * Returns the value of the property $name.
     *
     * @throws ezcBasePropertyNotFoundException if the property does not exist.
     * @param string $name
     * @ignore
     */
    public function __get( $name )
    {
        switch ( $name )
        {
            case 'dataMap':
            {
                if ( isset( $this->object ) )
                    return $this->object->dataMap();
                else
                    return array();
            } break;
            default:
            {
                if ( isset( $this->dataMap[$name] ) )
                {
                    return $this->dataMap[$name]->content();
                }

                if ( !$this->object instanceof eZContentObject )
                    throw new ezcBaseInvalidParentClassException( 'eZContentObject', $this->object );

                if ( $this->object->hasAttribute( $name ) )
                    return $this->object->attribute( $name );

                throw new ezcBasePropertyNotFoundException( '->object->attribute( ' . $name . ' )' );
            }
        }
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:35,代码来源:object.php

示例2: updateObjectSource

    /**
     * @param eZContentObject $object
     * @return bool
     */
    public static function updateObjectSource($object)
    {
        /* @var $sourceAttribute eZContentObjectAttribute */
        $dataMap            = $object->dataMap();
        $sourceAttribute    = $dataMap['source'];
        $previousValue      = $sourceAttribute->attribute('data_text');
        $newValue           = self::getSourceString($object);

        if($newValue && ($previousValue != $newValue))
        {
            /* @var $version eZContentObjectVersion */
            $version = $object->currentVersion();
            $version->setAttribute( 'modified', time() );
            $version->store();

            $sourceAttribute->setAttribute('data_text', self::getSourceString($object));
            $sourceAttribute->store();

            eZOperationHandler::execute('content', 'publish', array(    'object_id' => $object->attribute('id'),
                                                                        'version'   => $object->attribute('current_version') ) );
        }

        return true;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:28,代码来源:mmnewssource.php

示例3: getSitemapImageItems

 /**
  * Retourne les éléments de sitemap image pour un content object $object donné
  * @param eZContentObject $object
  * @return array(xrowSitemapItemImage)
  */
 private static function getSitemapImageItems(eZContentObject $object)
 {
     $images = array();
     // D'abord depuis la datamap
     $images = array_merge($images, self::getSitemapImageItemFromDataMap($object->dataMap()));
     // Puis avec les related objects
     $aParamsRelated = array('object_id' => $object->attribute('id'), 'all_relations' => true);
     $aImageObjectIDs = array();
     $relatedObjects = eZFunctionHandler::execute('content', 'related_objects', $aParamsRelated);
     $imagesRelated = array();
     foreach ($relatedObjects as $relatedObject) {
         switch ($relatedObject->attribute('class_identifier')) {
             case 'image':
                 $imagesRelated = array_merge($imagesRelated, self::getSitemapImageItemFromDataMap($relatedObject->dataMap()));
                 break;
         }
     }
     // Puis les children (gallery)
     $imagesChildren = array();
     $aParamsChildren = array('class_filter_type' => 'include', 'class_filter_array' => array('image'), 'parent_node_id' => $object->attribute('main_node_id'));
     $aChildren = eZFunctionHandler::execute('content', 'list', $aParamsChildren);
     foreach ($aChildren as $child) {
         $imagesChildren = array_merge($imagesChildren, self::getSitemapImageItemFromDataMap($child->object()->dataMap()));
     }
     return array_merge($images, $imagesRelated, $imagesChildren);
 }
开发者ID:obenyoussef,项目名称:metalfrance,代码行数:31,代码来源:mffunctioncollection.php

示例4: checkMediaFromArticle

    /**
     * Check state of all medias related to the article
     * @param eZContentObject $articleContentObject
     * @return bool
     */
    private static function checkMediaFromArticle( $articleContentObject )
    {
        /* @type $mediaClassIdentifiers array */
        $siteIni               = eZINI::instance( 'site.ini' );
        $mediaClassIdentifiers = $siteIni->variable( 'EventManager', 'MediaClassIdentifiers' );

        //Retrieve all media related to the article
        /* @type $articleDataMap eZContentObjectAttribute[] */
        $articleDataMap = $articleContentObject->dataMap();

        if( !isset( $articleDataMap['media_content'] ) )
            return true;

        $mediaContent = $articleDataMap['media_content']->content();

        if( empty( $mediaContent['relation_list'] ) )
            return true;

        foreach( $mediaContent['relation_list'] as $mediaData )
        {
            if( !in_array( $mediaData['contentclass_identifier'], $mediaClassIdentifiers ) )
                continue;

            if(!self::mediaIsCompleted($mediaData['contentobject_id']))
                return false;
        }

        // retrieve all medias in core content related to the article
        $relatedCoreContentList = RelatedCoreContent::getMediasFromArticle($articleContentObject->attribute("id"), $articleContentObject->currentLanguage());
        /** @var RelatedCoreContent $relatedCoreContent */
        foreach($relatedCoreContentList as $relatedCoreContent)
        {
            if(!self::mediaIsCompleted($relatedCoreContent->attribute("media_object_id")))
                return false;
        }

        return true;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:43,代码来源:mmeventmanager.php

示例5: setObjectAttributes

 /**
  * Set content object attributes
  *
  * @private
  * @param eZContentObject $object
  * @param array( attributeIdentifier => attributeStringValue ) $attributesValues
  * @return void
  */
 private function setObjectAttributes(eZContentObject $object, array $attributesValues)
 {
     $attributes = $object->dataMap();
     foreach ($attributesValues as $identifier => $value) {
         if (isset($attributes[$identifier])) {
             $attribute = $attributes[$identifier];
             switch ($attribute->attribute('data_type_string')) {
                 case 'ezimage':
                     $arr = explode('|', trim($value));
                     $source = str_replace(' ', '%20', $arr[0]);
                     if (file_exists($source)) {
                         // Handle local files
                         $content = $attribute->attribute('content');
                         $content->initializeFromFile($source, isset($arr[1]) ? $arr[1] : null);
                         $content->store($attribute);
                     } else {
                         // Handle remote files
                         $filename = 'var/cache/' . md5(microtime()) . substr($source, strrpos($source, '.'));
                         if (!empty($source)) {
                             if (in_array('curl', get_loaded_extensions())) {
                                 $ch = curl_init();
                                 $out = fopen($filename, 'w');
                                 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                                 curl_setopt($ch, CURLOPT_URL, $source);
                                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                                 curl_setopt($ch, CURLOPT_FILE, $out);
                                 curl_exec($ch);
                                 curl_close($ch);
                                 fclose($out);
                             } else {
                                 copy($source, $filename);
                             }
                         }
                         if (file_exists($filename)) {
                             $content = $attribute->attribute('content');
                             $content->initializeFromFile($filename, isset($arr[1]) ? $arr[1] : null);
                             $content->store($attribute);
                             unlink($filename);
                         }
                     }
                     break;
                 case 'ezxmltext':
                     $parser = new eZOEInputParser();
                     $value = '<div>' . trim($value) . '</div>';
                     $document = $parser->process($value);
                     $urlIDArray = $parser->getUrlIDArray();
                     if (count($urlIDArray) > 0) {
                         eZOEXMLInput::updateUrlObjectLinks($attribute, $urlIDArray);
                     }
                     $object->appendInputRelationList($parser->getLinkedObjectIDArray(), eZContentObject::RELATION_LINK);
                     $object->appendInputRelationList($parser->getEmbeddedObjectIDArray(), eZContentObject::RELATION_EMBED);
                     $value = $document ? eZXMLTextType::domString($document) : null;
                     $attribute->fromString($value);
                     break;
                 default:
                     if (is_callable(array($attribute, 'fromString'))) {
                         $attribute->fromString($value);
                     } else {
                         $attribute->setAttribute('data_text', $value);
                     }
             }
             $attribute->store();
         }
     }
 }
开发者ID:nxc,项目名称:nxc_powercontent,代码行数:73,代码来源:powercontent.php


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