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


PHP eZContentObjectAttribute::dataType方法代码示例

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


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

示例1: fixReverseRelations

    /**
     * Fixes reverse relations
     *
     * @see eZObjectRelationListType::fixRelatedObjectItem()
     *
     * @param int $objectID
     * @param string|bool $mode See eZObjectRelationListType::fixRelatedObjectItem() for valid modes
     */
    static function fixReverseRelations( $objectID, $mode = false )
    {
        $db = eZDB::instance();
        $objectID = (int) $objectID;

        // Finds all the attributes that store relations to the given object.
        $result = $db->arrayQuery( "SELECT attr.*
                                    FROM ezcontentobject_link link,
                                         ezcontentobject_attribute attr
                                    WHERE link.from_contentobject_id=attr.contentobject_id AND
                                          link.from_contentobject_version=attr.version AND
                                          link.contentclassattribute_id=attr.contentclassattribute_id AND
                                          link.to_contentobject_id=$objectID" );
        if ( count( $result ) > 0 )
        {
            $objectIDList = array();
            foreach( $result as $row )
            {
                $attr = new eZContentObjectAttribute( $row );
                $dataType = $attr->dataType();
                $dataType->fixRelatedObjectItem( $attr, $objectID, $mode );
                $objectIDList[] = $attr->attribute( 'contentobject_id' );
            }
            if ( eZINI::instance()->variable( 'ContentSettings', 'ViewCaching' ) === 'enabled' )
                eZContentCacheManager::clearObjectViewCacheArray( $objectIDList );
        }
    }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:35,代码来源:ezcontentobject.php

示例2: fetchAttributes

    static function fetchAttributes( $version, $contentObjectID, $language = false, $asObject = true )
    {
        $db = eZDB::instance();
        $language = $db->escapeString( $language );
        $contentObjectID = (int) $contentObjectID;
        $version =(int) $version;
        $query = "SELECT ezcontentobject_attribute.*, ezcontentclass_attribute.identifier as classattribute_identifier,
                        ezcontentclass_attribute.can_translate, ezcontentclass_attribute.serialized_name_list as attribute_serialized_name_list
                  FROM  ezcontentobject_attribute, ezcontentclass_attribute, ezcontentobject_version
                  WHERE
                    ezcontentclass_attribute.version = '0' AND
                    ezcontentclass_attribute.id = ezcontentobject_attribute.contentclassattribute_id AND
                    ezcontentobject_attribute.version = '$version' AND
                    ezcontentobject_attribute.contentobject_id = '$contentObjectID' AND
                    ezcontentobject_version.contentobject_id = '$contentObjectID' AND
                    ezcontentobject_version.version = '$version' AND ".
                    ( ( $language )? "ezcontentobject_attribute.language_code = '$language'": eZContentLanguage::sqlFilter( 'ezcontentobject_attribute', 'ezcontentobject_version' ) ).
                  " ORDER by
                    ezcontentclass_attribute.placement ASC";

        $attributeArray = $db->arrayQuery( $query );

        $returnAttributeArray = array();
        foreach ( $attributeArray as $attribute )
        {
            $attr = new eZContentObjectAttribute( $attribute );

            $attr->setContentClassAttributeIdentifier( $attribute['classattribute_identifier'] );

            $dataType = $attr->dataType();

            if ( is_object( $dataType ) &&
                 $dataType->Attributes["properties"]["translation_allowed"] &&
                 $attribute['can_translate'] )
                $attr->setContentClassAttributeCanTranslate( 1 );
            else
                $attr->setContentClassAttributeCanTranslate( 0 );

            $attr->setContentClassAttributeName( eZContentClassAttribute::nameFromSerializedString( $attribute['attribute_serialized_name_list'] ) );

            $returnAttributeArray[] = $attr;
        }
        return $returnAttributeArray;
    }
开发者ID:ataxel,项目名称:tp,代码行数:44,代码来源:ezcontentobjectversion.php

示例3: removeReverseRelations

    function removeReverseRelations( $objectID )
    {
        $db = eZDB::instance();
        $objectID = (int) $objectID;
        // Get list of objects referring to this one.
        $relatingObjects = $this->reverseRelatedObjectList( false, 0, false, array( 'AllRelations' => true ) );

        // Finds all the attributes that store relations to the given object.

        $result = $db->arrayQuery( "SELECT attr.*
                                    FROM ezcontentobject_link link,
                                         ezcontentobject_attribute attr
                                    WHERE link.from_contentobject_id=attr.contentobject_id AND
                                          link.from_contentobject_version=attr.version AND
                                          link.contentclassattribute_id=attr.contentclassattribute_id AND
                                          link.to_contentobject_id=$objectID" );

        // Remove references from XML.
        if ( count( $result ) > 0 )
        {
            foreach( $result as $row )
            {
                $attr = new eZContentObjectAttribute( $row );
                $dataType = $attr->dataType();
                $dataType->removeRelatedObjectItem( $attr, $objectID );
                eZContentCacheManager::clearObjectViewCache( $attr->attribute( 'contentobject_id' ), true );
                $attr->storeData();
            }
        }

        // Remove references in ezcontentobject_link.
        foreach ( $relatingObjects as $fromObject )
        {
            $fromObject->removeContentObjectRelation( $this->attribute( 'id' ), false, false );
        }
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:36,代码来源:ezcontentobject.php

示例4: convertAttributeToString

 /**
  * Generic method wrapping datatype's toString() method if implemented
  * Checks if toString() is implemented in the field's datatype
  * If not, data_text will be used by default
  * @param eZContentObjectAttribute $attribute
  * @return string
  */
 public static function convertAttributeToString(eZContentObjectAttribute $attribute)
 {
     $datatype = $attribute->attribute('data_type_string');
     $toStringImplemented = null;
     $ret = null;
     // First check if datatype is already known as implementing fromString() or not
     // (Better performance as the check is made through Reflection API)
     if (in_array($datatype, self::$datatypesToStringImpl)) {
         $toStringImplemented = true;
     } else {
         if (in_array($datatype, self::$datatypesToStringNotImpl)) {
             $toStringImplemented = false;
         } else {
             $reflector = new ReflectionObject($attribute->dataType());
             $callerClass = $reflector->getMethod('toString')->class;
             if ($callerClass == 'eZDataType') {
                 self::$datatypesToStringNotImpl[] = $datatype;
                 $toStringImplemented = false;
             } else {
                 self::$datatypesToStringImpl[] = $datatype;
                 $toStringImplemented = true;
             }
         }
     }
     // Now insert data through the appropriate way
     if ($toStringImplemented) {
         $ret = $attribute->toString();
     } else {
         $ret = $attribute->attribute('data_text');
     }
     return $ret;
 }
开发者ID:lolautruche,项目名称:sqliimport,代码行数:39,代码来源:sqlicontentfield.php


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