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


PHP eZContentObjectAttribute::fetchSameClassAttributeIDList方法代码示例

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


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

示例1: store

 /**
  * Store the modification made to an eZContentClass.
  *
  * @param eZContentClass Content class to be stored.
  * @param array[eZContentClassAttribute] Attributes of the new content class.
  * @param array Unordered view parameters
  */
 public function store(eZContentClass $class, array $attributes, array &$unorderedParameters)
 {
     $oldClassAttributes = $class->fetchAttributes($class->attribute('id'), true, eZContentClass::VERSION_STATUS_DEFINED);
     // Delete object attributes which have been removed.
     foreach ($oldClassAttributes as $oldClassAttribute) {
         $attributeExists = false;
         $oldClassAttributeID = $oldClassAttribute->attribute('id');
         foreach ($class->fetchAttributes() as $newClassAttribute) {
             if ($oldClassAttributeID == $newClassAttribute->attribute('id')) {
                 $attributeExists = true;
                 break;
             }
         }
         if (!$attributeExists) {
             foreach (eZContentObjectAttribute::fetchSameClassAttributeIDList($oldClassAttributeID) as $objectAttribute) {
                 $objectAttribute->removeThis($objectAttribute->attribute('id'));
             }
         }
     }
     $class->storeDefined($attributes);
     // Add object attributes which have been added.
     foreach ($attributes as $newClassAttribute) {
         $attributeExists = false;
         $newClassAttributeID = $newClassAttribute->attribute('id');
         foreach ($oldClassAttributes as $oldClassAttribute) {
             if ($newClassAttributeID == $oldClassAttribute->attribute('id')) {
                 $attributeExists = true;
                 break;
             }
         }
         if (!$attributeExists) {
             $newClassAttribute->initializeObjectAttributes($objects);
         }
     }
 }
开发者ID:legende91,项目名称:ez,代码行数:42,代码来源:ezcontentclassedithandler.php

示例2: removeClassAttribute

 public static function removeClassAttribute($class_identifier, $attribute_identifier)
 {
     if (isset($class_identifier)) {
         $class = eZContentClass::fetchByIdentifier($class_identifier);
     }
     if (!is_object($class)) {
         return;
     }
     $classAttributeIdentifier = $attribute_identifier;
     // get attributes of 'temporary' version as well
     $classAttributeList = eZContentClassAttribute::fetchFilteredList(array('contentclass_id' => $class->ID, 'identifier' => $classAttributeIdentifier), true);
     $validation = array();
     foreach ($classAttributeList as $classAttribute) {
         $dataType = $classAttribute->dataType();
         if ($dataType->isClassAttributeRemovable($classAttribute)) {
             $objectAttributes = eZContentObjectAttribute::fetchSameClassAttributeIDList($classAttribute->attribute('id'));
             foreach ($objectAttributes as $objectAttribute) {
                 $objectAttributeID = $objectAttribute->attribute('id');
                 $objectAttribute->removeThis($objectAttributeID);
             }
             $classAttribute->removeThis();
         } else {
             $removeInfo = $dataType->classAttributeRemovableInformation($classAttribute);
         }
     }
 }
开发者ID:rantoniazzi,项目名称:xrowmetadata,代码行数:26,代码来源:xrowsiteupdater.php

示例3: updateClass

function updateClass($classId, $scheduledScript)
{
    $cli = eZCLI::instance();
    /*
    // If the class is not stored yet, store it now
    $class = eZContentClass::fetch( $classId, true, eZContentClass::VERSION_STATUS_TEMPORARY );
    if ( $class )
    {
        $cli->output( "Storing class" );
        $class->storeDefined( $class->fetchAttributes() );
    }
    */
    // Fetch the stored class
    $class = eZContentClass::fetch($classId, true, eZContentClass::VERSION_STATUS_MODIFIED);
    if (!$class) {
        $cli->error('No class in a modified version status with ID: ' . $classId);
        return;
    }
    // Fetch attributes and definitions
    $attributes = $class->fetchAttributes($classId, true, eZContentClass::VERSION_STATUS_MODIFIED);
    $oldClassAttributes = $class->fetchAttributes($classId, true, eZContentClass::VERSION_STATUS_DEFINED);
    // Delete object attributes which have been removed.
    foreach ($oldClassAttributes as $oldClassAttribute) {
        $attributeExist = false;
        $oldClassAttributeID = $oldClassAttribute->attribute('id');
        foreach ($attributes as $newClassAttribute) {
            if ($oldClassAttributeID == $newClassAttribute->attribute('id')) {
                $attributeExist = true;
            }
        }
        if (!$attributeExist) {
            foreach (eZContentObjectAttribute::fetchSameClassAttributeIDList($oldClassAttributeID) as $objectAttribute) {
                $objectAttribute->removeThis($objectAttribute->attribute('id'));
            }
        }
    }
    $class->storeVersioned($attributes, eZContentClass::VERSION_STATUS_DEFINED);
    // Add object attributes which have been added.
    foreach ($attributes as $newClassAttribute) {
        $attributeExist = false;
        foreach ($oldClassAttributes as $oldClassAttribute) {
            if ($oldClassAttribute->attribute('id') == $newClassAttribute->attribute('id')) {
                $attributeExist = true;
                break;
            }
        }
        if (!$attributeExist) {
            $objects = null;
            $newClassAttribute->initializeObjectAttributes($objects);
        }
    }
    if ($scheduledScript !== false) {
        $scheduledScript->updateProgress(100);
    }
}
开发者ID:legende91,项目名称:ez,代码行数:55,代码来源:syncobjectattributes.php

示例4: fetchImageAttributesByClassAttributes

 /**
  * Fetch content object 'image' attributes by content class attributes
  *
  * @param array $contentClassImageAttributes Array of content class attributes
  * @return array Array of content object attributes, empty array if not
  * @static
  */
 static function fetchImageAttributesByClassAttributes($contentClassImageAttributes = array(), $firstVersion = false)
 {
     // Default datatypes to create image alias variations
     $imageDataTypeStrings = eZINI::instance('bcimagealias.ini')->variable('BCImageAliasSettings', 'ImageDataTypeStringList');
     $contentObjectImageAttributes = array();
     foreach ($contentClassImageAttributes as $contentClassAttribute) {
         $contentObjectAttributes = eZContentObjectAttribute::fetchSameClassAttributeIDList($contentClassAttribute->attribute('id'), true, $firstVersion ? 1 : false);
         foreach ($contentObjectAttributes as $contentObjectAttribute) {
             if (in_array($contentObjectAttribute->attribute('data_type_string'), $imageDataTypeStrings) && $contentObjectAttribute->attribute('has_content')) {
                 $contentObjectImageAttributes[] = $contentObjectAttribute;
             }
         }
     }
     return $contentObjectImageAttributes;
 }
开发者ID:philandteds,项目名称:bcimagealias,代码行数:22,代码来源:bcimagealias.php

示例5: foreach

$i = 0;
foreach ($oldOptions as $enumValueID => $name) {
    $optionNode = $doc->createElement("option");
    $optionNode->setAttribute('id', $i);
    $optionNode->setAttribute('name', $name);
    $oldToNewIDMap[$enumValueID] = $i;
    $i++;
    $options->appendChild($optionNode);
}
$xml = $doc->saveXML();
$db = eZDB::instance();
$db->begin();
$classAttribute->setAttribute('data_text5', $xml);
$classAttribute->setAttribute('data_type_string', 'ezselection');
$classAttribute->store();
$attributes = eZContentObjectAttribute::fetchSameClassAttributeIDList($classAttribute->attribute('id'));
$count = count($attributes);
$cli->output('number of object attributes to convert: ' . $count);
$script->setIterationData('.', '~');
$script->resetIteration($count);
for ($i = 0; $i < $count; $i++) {
    $objectAttributeID = $attributes[$i]->attribute('id');
    $objectAttributeVersion = $attributes[$i]->attribute('version');
    $selectOptions = array();
    $enumContent = $attributes[$i]->attribute('content');
    $enumObjectValues = $enumContent->attribute('enumobject_list');
    foreach ($enumObjectValues as $enumObjectValue) {
        $value = $enumObjectValue->attribute('enumvalue');
        $element = $enumObjectValue->attribute('enumelement');
        $enumValueID = $enumObjectValue->attribute('enumid');
        if (!array_key_exists($enumValueID, $oldToNewIDMap)) {
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:31,代码来源:convertezenumtoezselection.php

示例6: removeClassAttribute

    function removeClassAttribute( $params )
    {
        $contentClassID = $params['class_id'];
        $classAttributeIdentifier = $params['attribute_identifier'];

        // get attributes of 'temporary' version as well
        $classAttributeList = eZContentClassAttribute::fetchFilteredList( array( 'contentclass_id' => $contentClassID,
                                                                                  'identifier' => $classAttributeIdentifier ),
                                                                           true );

        $validation = array();
        foreach( $classAttributeList as $classAttribute )
        {
            $dataType = $classAttribute->dataType();
            if( $dataType->isClassAttributeRemovable( $classAttribute ) )
            {
                $objectAttributes = eZContentObjectAttribute::fetchSameClassAttributeIDList( $classAttribute->attribute( 'id' ) );
                foreach( $objectAttributes as $objectAttribute )
                {
                    $objectAttributeID = $objectAttribute->attribute( 'id' );
                    $objectAttribute->removeThis( $objectAttributeID );
                }

                $classAttribute->removeThis();
            }
            else
            {
                $removeInfo = $dataType->classAttributeRemovableInformation( $classAttribute );
                if( $removeInfo === false )
                    $removeInfo = "Unknow reason";

                $validation[] = array( 'id' => $classAttribute->attribute( 'id' ),
                                       'identifier' => $classAttribute->attribute( 'identifier' ),
                                       'reason' => $removeInfo );
            }
        }

        if( count( $validation ) > 0 )
        {
            $this->reportError( $validation, 'eZSiteInstaller::removeClassAttribute: Unable to remove eZClassAttribute(s)' );
        }

    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:43,代码来源:ezsiteinstaller.php

示例7: unset

 $priceClassAttribute->setAttribute(eZMultiPriceType::DEFAULT_CURRENCY_CODE_FIELD, $defaultCurrencyCode);
 $priceClassAttribute->store();
 unset($GLOBALS['eZContentClassAttributeCache'][$priceClassAttributeID]);
 // update objects
 $offset = 0;
 $limit = 1000;
 $cli->output('Converting', false);
 while ($offset < $objectListCount) {
     $objectList = eZContentObject::fetchSameClassList($class->attribute('id'), true, $offset, $limit);
     $offset += count($objectList);
     foreach ($objectList as $object) {
         $contentObjectID = $object->attribute('id');
         $objectVersions =& $object->versions();
         foreach ($objectVersions as $objectVersion) {
             $version = $objectVersion->attribute('version');
             $objectAttributeList = eZContentObjectAttribute::fetchSameClassAttributeIDList($priceClassAttributeID, true, $version, $contentObjectID);
             foreach ($objectAttributeList as $objectAttribute) {
                 $priceValue = $objectAttribute->attribute('data_float');
                 $multiprice = eZMultiPriceData::create($objectAttribute->attribute('id'), $version, $defaultCurrencyCode, $priceValue, eZMultiPriceData::VALUE_TYPE_CUSTOM);
                 $multiprice->store();
                 $objectAttribute->setAttribute('data_type_string', 'ezmultiprice');
                 $objectAttribute->setAttribute('data_float', 0);
                 $objectAttribute->setAttribute('sort_key_int', 0);
                 $objectAttribute->store();
             }
         }
         $cli->output('.', false);
         ++$convertedObjectsCount;
     }
 }
 $cli->output(' ');
开发者ID:netbliss,项目名称:ezpublish,代码行数:31,代码来源:convertprice2multiprice.php

示例8: changeContentObjectAttributeDataTypeString

 /**
  * @param eZContentClassAttribute $localeAttribute
  * @param string $newDataTypeString
  */
 protected function changeContentObjectAttributeDataTypeString($localeAttribute, $newDataTypeString)
 {
     /** @var eZContentObjectAttribute[] $contentAttributes */
     $contentAttributes = eZContentObjectAttribute::fetchSameClassAttributeIDList($localeAttribute->attribute('id'), true);
     foreach ($contentAttributes as $attribute) {
         $attribute->setAttribute('data_type_string', $newDataTypeString);
         $attribute->store();
     }
 }
开发者ID:OpencontentCoop,项目名称:ocsearchtools,代码行数:13,代码来源:occlasstools.php

示例9: updateClass

function updateClass($classId, $scheduledScript)
{
    $cli = eZCLI::instance();
    /*
    // If the class is not stored yet, store it now
    $class = eZContentClass::fetch( $classId, true, eZContentClass::VERSION_STATUS_TEMPORARY );
    if ( $class )
    {
        $cli->output( "Storing class" );
        $class->storeDefined( $class->fetchAttributes() );
    }
    */
    // Fetch the stored class
    $class = eZContentClass::fetch($classId, true, eZContentClass::VERSION_STATUS_MODIFIED);
    if (!$class) {
        $cli->error('No class in a modified version status with ID: ' . $classId);
        return;
    }
    // Fetch attributes and definitions
    $attributes = $class->fetchAttributes($classId, true, eZContentClass::VERSION_STATUS_MODIFIED);
    $oldClassAttributes = $class->fetchAttributes($classId, true, eZContentClass::VERSION_STATUS_DEFINED);
    // Delete object attributes which have been removed.
    foreach ($oldClassAttributes as $oldClassAttribute) {
        $attributeExist = false;
        $oldClassAttributeID = $oldClassAttribute->attribute('id');
        foreach ($attributes as $newClassAttribute) {
            if ($oldClassAttributeID == $newClassAttribute->attribute('id')) {
                $attributeExist = true;
            }
        }
        if (!$attributeExist) {
            $ezscriptmonitorINI = eZINI::instance('ezscriptmonitor.ini');
            $objectLimit = $ezscriptmonitorINI->variable('GeneralSettings', 'ObjectLimit');
            $limit = array('offset' => 0, 'length' => $objectLimit);
            do {
                $objectAttributes = eZContentObjectAttribute::fetchSameClassAttributeIDList($oldClassAttributeID, false, false, false, $limit);
                $objectAttributeCount = count($objectAttributes);
                $conditions = array("contentclassattribute_id" => $oldClassAttributeID);
                $totalObjectAttributeCount = eZContentObjectAttribute::count(eZContentObjectAttribute::definition(), array("contentclassattribute_id" => $oldClassAttributeID));
                if (is_array($objectAttributes) && $objectAttributeCount > 0) {
                    $db = eZDB::instance();
                    $db->begin();
                    foreach ($objectAttributes as $objectAttribute) {
                        $objectAttribute = new eZContentObjectAttribute($objectAttribute);
                        $objectAttribute->removeThis($objectAttribute->attribute('id'));
                    }
                    $db->commit();
                    $limit['offset'] += $objectAttributeCount;
                    $percentage = round(100 * $limit['offset'] / $totalObjectAttributeCount, 2);
                    // for ezscriptmonitor 100 means the script is all the way done
                    if ($percentage < 100 && $scheduledScript !== false) {
                        $scheduledScript->updateProgress($percentage);
                    }
                    $cli->output("Removing attributes - Progress: " . $percentage . " %");
                }
            } while ($objectAttributeCount == $objectLimit);
        }
    }
    $class->storeVersioned($attributes, eZContentClass::VERSION_STATUS_DEFINED);
    // Add object attributes which have been added.
    foreach ($attributes as $newClassAttribute) {
        $attributeExist = false;
        foreach ($oldClassAttributes as $oldClassAttribute) {
            if ($oldClassAttribute->attribute('id') == $newClassAttribute->attribute('id')) {
                $attributeExist = true;
                break;
            }
        }
        if (!$attributeExist) {
            $objects = null;
            $cli->output("Adding attribute : " . $newClassAttribute->attribute('name'));
            $newClassAttribute->initializeObjectAttributes($objects);
        }
    }
    if ($scheduledScript !== false) {
        $scheduledScript->updateProgress(100);
    }
}
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:78,代码来源:syncobjectattributes.php


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