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


PHP eZContentObjectAttribute::setContentClassAttributeIdentifier方法代码示例

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


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

示例1: fillNodeListAttributes

    /**
     * Fetches the attributes for an array of objects or nodes
     *
     * @param eZContentObject[]|eZContentObjectTreeNode[] $objList
     * @param bool $asObject
     */
    static function fillNodeListAttributes( $objList, $asObject = true )
    {
        $db = eZDB::instance();

        if ( count( $objList ) > 0 )
        {
            $objectArray = array();
            $tmpLanguageObjectList = array();
            $whereSQL = '';
            $count = count( $objList );
            $i = 0;
            foreach ( $objList as $obj )
            {
                if ( $obj instanceOf eZContentObject )
                    $object = $obj;
                else
                    $object = $obj->attribute( 'object' );

                $language = $object->currentLanguage();
                $tmpLanguageObjectList[$object->attribute( 'id' )] = $language;
                $objectArray = array( 'id' => $object->attribute( 'id' ),
                                      'language' => $language,
                                      'version' => $object->attribute( 'current_version' ) );

                $whereSQL .= "( ezcontentobject_attribute.version = '" . $object->attribute( 'current_version' ) . "' AND
                    ezcontentobject_attribute.contentobject_id = '" . $object->attribute( 'id' ) . "' AND
                    ezcontentobject_attribute.language_code = '" . $language . "' ) ";

                $i++;
                if ( $i < $count )
                    $whereSQL .= ' OR ';
            }

            $query = "SELECT ezcontentobject_attribute.*, ezcontentclass_attribute.identifier as identifier FROM
                    ezcontentobject_attribute, ezcontentclass_attribute
                  WHERE
                    ezcontentclass_attribute.version = '0' AND
                    ezcontentclass_attribute.id = ezcontentobject_attribute.contentclassattribute_id AND
                    ( $whereSQL )
                  ORDER BY
                    ezcontentobject_attribute.contentobject_id, ezcontentclass_attribute.placement ASC";

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

            $tmpAttributeObjectList = array();
            $returnAttributeArray = array();
            foreach ( $attributeArray as $attribute )
            {
                $attr = new eZContentObjectAttribute( $attribute );
                $attr->setContentClassAttributeIdentifier( $attribute['identifier'] );

                $tmpAttributeObjectList[$attr->attribute( 'contentobject_id' )][] = $attr;
            }

            foreach ( $objList as $obj )
            {
                if ( $obj instanceOf eZContentObject )
                {
                    $obj->setContentObjectAttributes( $tmpAttributeObjectList[$obj->attribute( 'id' )],
                                         $obj->attribute( 'current_version' ),
                                         $tmpLanguageObjectList[$obj->attribute( 'id' )] );
                }
                else
                {
                    $object = $obj->attribute( 'object' );
                    $object->setContentObjectAttributes( $tmpAttributeObjectList[$object->attribute( 'id' )],
                                                         $object->attribute( 'current_version' ),
                                                         $tmpLanguageObjectList[$object->attribute( 'id' )] );
                    $obj->setContentObject( $object );
                }
            }
        }
    }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:79,代码来源: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


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