function removeAttributes($removeAttributes = false, $version = false) { if (is_array($removeAttributes)) { $db = eZDB::instance(); $db->begin(); foreach ($removeAttributes as $attribute) { $attribute->removeThis(); } $db->commit(); } else { $contentClassID = $this->ID; if ($version === false) { $version = $this->Version; } $classAttributes = $this->fetchAttributes(); $db = eZDB::instance(); $db->begin(); foreach ($classAttributes as $classAttribute) { $dataType = $classAttribute->dataType(); $dataType->deleteStoredClassAttribute($classAttribute, $version); } eZPersistentObject::removeObject(eZContentClassAttribute::definition(), array('contentclass_id' => $contentClassID, 'version' => $version)); $db->commit(); } }
function move( $down, $params = null ) { if ( is_array( $params ) ) { $pos = $params['placement']; $cid = $params['contentclass_id']; $version = $params['version']; } else { $pos = $this->Position; $cid = $this->ContentClassID; $version = $this->Version; } eZPersistentObject::reorderObject( eZContentClassAttribute::definition(), array( 'placement' => $pos ), array( 'contentclass_id' => $cid, 'version' => $version ), $down ); }
/** * Returns count of eZContentClassAttribute objects (represented as subtree limitation count) * * @return integer */ function getSubTreeLimitationsCount() { if ($this->attribute('main_tag_id') == 0) { return eZPersistentObject::count(eZContentClassAttribute::definition(), array('data_type_string' => 'eztags', eZTagsType::SUBTREE_LIMIT_FIELD => $this->attribute('id'), 'version' => eZContentClass::VERSION_STATUS_DEFINED)); } else { return 0; } }
$attribute->setAttribute('category', $categoryArray[$attributeID]); } } } } // Fixup input if ($requireFixup) { foreach ($attributes as $attribute) { $dataType = $attribute->dataType(); $status = $dataType->fixupClassAttributeHTTPInput($http, 'ContentClass', $attribute); } } $cur_datatype = 'ezstring'; // Apply HTTP POST variables if ($contentClassHasInput) { eZHTTPPersistence::fetch('ContentAttribute', eZContentClassAttribute::definition(), $attributes, $http, true, 'id'); if ($http->hasPostVariable('ContentAttribute_name')) { $attributeNames = $http->postVariable('ContentAttribute_name'); foreach ($attributes as $attribute) { $key = $attribute->attribute('id'); if (isset($attributeNames[$key])) { $attribute->setName($attributeNames[$key], $EditLanguage); } } } if ($http->hasPostVariable('ContentAttribute_description')) { $attributeNames = $http->postVariable('ContentAttribute_description'); foreach ($attributes as $attribute) { $key = $attribute->attribute('id'); if (isset($attributeNames[$key])) { $attribute->setDescription($attributeNames[$key], $EditLanguage);
function removeAttributes($removeAttributes = false, $version = false) { if (is_array($removeAttributes)) { $db = eZDB::instance(); $db->begin(); foreach ($removeAttributes as $attribute) { $attribute->removeThis(); } $db->commit(); } else { $contentClassID = $this->ID; if ($version === false) { $version = $this->Version; } $classAttributes = $this->fetchAttributes(); $db = eZDB::instance(); $db->begin(); foreach ($classAttributes as $classAttribute) { $dataType = $classAttribute->dataType(); if ($dataType === null) { eZDebug::writeError("Skipping removal of class attribute for non-existent datatype " . $classAttribute->DataTypeString, __METHOD__); continue; } $dataType->deleteStoredClassAttribute($classAttribute, $version); } eZPersistentObject::removeObject(eZContentClassAttribute::definition(), array('contentclass_id' => $contentClassID, 'version' => $version)); $db->commit(); } }