|
eZ Publish
[trunk]
|
00001 <?php 00002 /** 00003 * File containing the eZContentObjectAttribute class. 00004 * 00005 * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved. 00006 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 00007 * @version //autogentag// 00008 * @package kernel 00009 */ 00010 00011 /*! 00012 \class eZContentObjectAttribute ezcontentobjectattribute.php 00013 \ingroup eZKernel 00014 \brief Encapsulates the data for an object attribute 00015 00016 \sa eZContentObject eZContentClass eZContentClassAttribute 00017 */ 00018 00019 class eZContentObjectAttribute extends eZPersistentObject 00020 { 00021 function eZContentObjectAttribute( $row ) 00022 { 00023 $this->Content = null; 00024 $this->DisplayInfo = null; 00025 $this->HTTPValue = null; 00026 $this->ValidationError = null; 00027 $this->ValidationLog = null; 00028 $this->ContentClassAttributeIdentifier = null; 00029 $this->ContentClassAttributeID = null; 00030 $this->InputParameters = false; 00031 $this->HasValidationError = false; 00032 $this->DataTypeCustom = null; 00033 $this->eZPersistentObject( $row ); 00034 } 00035 00036 static function definition() 00037 { 00038 static $definition = array( "fields" => array( "id" => array( 'name' => 'ID', 00039 'datatype' => 'integer', 00040 'default' => 0, 00041 'required' => true ), 00042 "contentobject_id" => array( 'name' => "ContentObjectID", 00043 'datatype' => 'integer', 00044 'default' => 0, 00045 'required' => true, 00046 'foreign_class' => 'eZContentObject', 00047 'foreign_attribute' => 'id', 00048 'multiplicity' => '1..*' ), 00049 "version" => array( 'name' => "Version", 00050 'datatype' => 'integer', 00051 'default' => 0, 00052 'required' => true ), 00053 "language_code" => array( 'name' => "LanguageCode", 00054 'datatype' => 'string', 00055 'default' => '', 00056 'required' => true ), 00057 'language_id' => array( 'name' => "LanguageID", 00058 'datatype' => 'integer', 00059 'default' => '0', 00060 'required' => true, 00061 'foreign_class' => 'eZContentLanguage', 00062 'foreign_attribute' => 'id', 00063 'multiplicity' => '1..*' ), 00064 "contentclassattribute_id" => array( 'name' => "ContentClassAttributeID", 00065 'datatype' => 'integer', 00066 'default' => 0, 00067 'required' => true, 00068 'foreign_class' => 'eZContentClassAttribute', 00069 'foreign_attribute' => 'id', 00070 'multiplicity' => '1..*' ), 00071 "attribute_original_id" => array( 'name' => "AttributeOriginalID", 00072 'datatype' => 'integer', 00073 'default' => 0, 00074 'required' => true, 00075 'foreign_class' => 'eZContentObjectAttribute', 00076 'foreign_attribute' => 'id', 00077 'multiplicity' => '1..*' ), 00078 "sort_key_int" => array( 'name' => "SortKeyInt", 00079 'datatype' => 'integer', 00080 'default' => '0', 00081 'required' => true ), 00082 "sort_key_string" => array( 'name' => "SortKeyString", 00083 'datatype' => 'string', 00084 'max_length' => 255, 00085 'default' => '', 00086 'required' => true ), 00087 "data_type_string" => array( 'name' => "DataTypeString", 00088 'datatype' => 'string', 00089 'default' => '', 00090 'required' => true ), 00091 "data_text" => array( 'name' => "DataText", 00092 'datatype' => 'text', 00093 'default' => '', 00094 'required' => true ), 00095 "data_int" => array( 'name' => "DataInt", 00096 'datatype' => 'integer', 00097 'default' => null, 00098 'required' => false ), 00099 "data_float" => array( 'name' => "DataFloat", 00100 'datatype' => 'float', 00101 'default' => 0, 00102 'required' => true ) ), 00103 "keys" => array( "id", "contentobject_id", "version", "language_code" ), 00104 "function_attributes" => array( "contentclass_attribute" => "contentClassAttribute", 00105 "contentclass_attribute_identifier" => "contentClassAttributeIdentifier", 00106 "contentclass_attribute_name" => "contentClassAttributeName", 00107 "can_translate" => "contentClassAttributeCanTranslate", 00108 "is_information_collector" => "contentClassAttributeIsInformationCollector", 00109 "is_required" => "contentClassAttributeIsRequired", 00110 "content" => "content", 00111 'has_http_value' => 'hasHTTPValue', 00112 'value' => 'value', 00113 'has_content' => 'hasContent', 00114 "class_content" => "classContent", 00115 "object" => "object", 00116 'object_version' => 'objectVersion', 00117 'view_template' => 'viewTemplateName', 00118 'edit_template' => 'editTemplateName', 00119 'result_template' => 'resultTemplate', 00120 "has_validation_error" => "hasValidationError", 00121 "validation_error" => "validationError", 00122 "validation_log" => "validationLog", 00123 "language" => "language", 00124 "is_a" => "isA", 00125 'display_info' => 'displayInfo', 00126 'class_display_info' => 'classDisplayInfo' ), 00127 "increment_key" => "id", 00128 "class_name" => "eZContentObjectAttribute", 00129 "sort" => array( "id" => "asc" ), 00130 "name" => "ezcontentobject_attribute" ); 00131 return $definition; 00132 } 00133 00134 static function fetch( $id, $version, $asObject = true, $field_filters = null ) 00135 { 00136 return eZPersistentObject::fetchObject( eZContentObjectAttribute::definition(), 00137 $field_filters, 00138 array( "id" => $id, 00139 "version" => $version ), 00140 $asObject ); 00141 } 00142 00143 static function fetchListByClassID( $id, $version = false, $limit = null, $asObject = true, $asCount = false ) 00144 { 00145 $conditions = array(); 00146 if ( is_array( $id ) ) 00147 $conditions['contentclassattribute_id'] = array( $id ); 00148 else 00149 $conditions['contentclassattribute_id'] = $id; 00150 if ( $version !== false ) 00151 $conditions["version"] = $version; 00152 $fieldFilters = null; 00153 $customFields = null; 00154 if ( $asCount ) 00155 { 00156 $limit = null; 00157 $asObject = false; 00158 $fieldFilters = array(); 00159 $customFields = array( array( 'operation' => 'count( id )', 00160 'name' => 'count' ) ); 00161 } 00162 $objectList = eZPersistentObject::fetchObjectList( eZContentObjectAttribute::definition(), 00163 $fieldFilters, 00164 $conditions, 00165 ( $asCount ? false : null ), 00166 $limit, 00167 $asObject, 00168 null, 00169 $customFields ); 00170 if ( $asCount ) 00171 { 00172 return $objectList[0]['count']; 00173 } 00174 else 00175 { 00176 return $objectList; 00177 } 00178 } 00179 00180 static function fetchByClassAttributeID( $classAttributeID, $objectID, $version, $languageID, $asObject = true ) 00181 { 00182 return eZPersistentObject::fetchObject( eZContentObjectAttribute::definition(), 00183 null, 00184 array( 'contentclassattribute_id' => $classAttributeID, 00185 'contentobject_id' => $objectID, 00186 'version' => $version, 00187 'language_id' => $languageID ), 00188 $asObject ); 00189 } 00190 00191 /*! 00192 Fetches all contentobject attributes which relates to the contentclass attribute \a $contentClassAttributeID. 00193 \return An array with contentobject attributes. 00194 \param $contentClassAttributeID The ID of the contentclass attribute 00195 \param $asObject If \c true objects will be returned, otherwise associative arrays are returned. 00196 \param $version The version the of contentobject attributes to fetch or all version if \c false. 00197 \param $contentObjectID The ID the of contentobject to fetch or all objects if \c false. 00198 */ 00199 static function fetchSameClassAttributeIDList( $contentClassAttributeID, $asObject = true, $version = false, $contentObjectID = false ) 00200 { 00201 $conditions = array( "contentclassattribute_id" => $contentClassAttributeID ); 00202 if ( $version !== false ) 00203 $conditions['version'] = $version; 00204 if ( $contentObjectID !== false ) 00205 $conditions['contentobject_id'] = $contentObjectID; 00206 return eZPersistentObject::fetchObjectList( eZContentObjectAttribute::definition(), 00207 null, 00208 $conditions, 00209 null, 00210 null, 00211 $asObject); 00212 } 00213 00214 /*! 00215 \return the attributes with alternative translations for the current attribute version and class attribute id 00216 */ 00217 function fetchAttributeTranslations( $asObject = true ) 00218 { 00219 return eZPersistentObject::fetchObjectList( eZContentObjectAttribute::definition(), 00220 null, 00221 array( "contentclassattribute_id" => $this->ContentClassAttributeID, 00222 "contentobject_id" => $this->ContentObjectID, 00223 "version" => $this->Version ), 00224 null, 00225 null, 00226 $asObject); 00227 } 00228 00229 static function create( $contentclassAttributeID, $contentobjectID, $version = 1, $languageCode = false ) 00230 { 00231 if ( $languageCode == false ) 00232 { 00233 $languageCode = eZContentObject::defaultLanguage(); 00234 } 00235 00236 $languageID = eZContentLanguage::idByLocale( $languageCode ); 00237 00238 $row = array( 00239 "id" => null, 00240 "contentobject_id" => $contentobjectID, 00241 "version" => $version, 00242 "language_code" => $languageCode, 00243 'language_id' => $languageID, 00244 "contentclassattribute_id" => $contentclassAttributeID, 00245 'data_text' => '', 00246 'data_int' => null, 00247 'data_float' => 0.0 ); 00248 return new eZContentObjectAttribute( $row ); 00249 } 00250 00251 /*! 00252 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 00253 the calls within a db transaction; thus within db->begin and db->commit. 00254 */ 00255 function store( $fieldFilters = null ) 00256 { 00257 // Unset the cache 00258 global $eZContentObjectContentObjectCache; 00259 unset( $eZContentObjectContentObjectCache[$this->ContentObjectID] ); 00260 global $eZContentObjectDataMapCache; 00261 unset( $eZContentObjectDataMapCache[$this->ContentObjectID] ); 00262 00263 $classAttribute = $this->contentClassAttribute(); 00264 00265 $dataType = $classAttribute->dataType(); 00266 if ( $dataType ) 00267 { 00268 $this->setAttribute( 'data_type_string', $classAttribute->attribute( 'data_type_string' ) ); 00269 $this->updateSortKey( false ); 00270 00271 $db = eZDB::instance(); 00272 $db->begin(); 00273 00274 // store the content data for this attribute 00275 $dataType->storeObjectAttribute( $this ); 00276 00277 eZPersistentObject::store( $fieldFilters ); 00278 $dataType->postStore( $this ); 00279 $db->commit(); 00280 } 00281 } 00282 00283 /*! 00284 Similar to store() but does not call eZDataType::storeObjectAttribute(). 00285 00286 If you have some datatype code that needs to store attribute data you should 00287 call this instead of store(), this function will avoid infinite recursion. 00288 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 00289 the calls within a db transaction; thus within db->begin and db->commit. 00290 */ 00291 function storeData() 00292 { 00293 // Unset the cache 00294 global $eZContentObjectContentObjectCache; 00295 unset( $eZContentObjectContentObjectCache[$this->ContentObjectID] ); 00296 global $eZContentObjectDataMapCache; 00297 unset( $eZContentObjectDataMapCache[$this->ContentObjectID] ); 00298 00299 $classAttribute = $this->contentClassAttribute(); 00300 $dataType = $classAttribute->dataType(); 00301 $this->setAttribute( 'data_type_string', $classAttribute->attribute( 'data_type_string' ) ); 00302 $this->updateSortKey( false ); 00303 00304 eZPersistentObject::store(); 00305 } 00306 00307 /*! 00308 Copies the sort key value from the attribute according to the datatype rules. 00309 \note The attribute is not stored 00310 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 00311 the calls within a db transaction; thus within db->begin and db->commit. 00312 */ 00313 function updateSortKey( $storeData = true ) 00314 { 00315 $classAttribute = $this->contentClassAttribute(); 00316 $dataType = $classAttribute->dataType(); 00317 00318 $return = false; 00319 00320 if ( $dataType ) 00321 { 00322 $return = true; 00323 00324 $sortKey = $dataType->sortKey( $this ); 00325 $this->setAttribute( 'sort_key_string', "" ); 00326 $this->setAttribute( 'sort_key_int', 0 ); 00327 if ( $dataType->sortKeyType() == 'string' ) 00328 { 00329 $this->setAttribute( 'sort_key_string', $sortKey ); 00330 $this->setAttribute( 'sort_key_int', 0 ); 00331 00332 } 00333 else if ( $dataType->sortKeyType() == 'int' ) 00334 { 00335 $this->setAttribute( 'sort_key_int', $sortKey ); 00336 } 00337 00338 if ( $storeData ) 00339 { 00340 $dataType->storeObjectAttribute( $this ); 00341 $return = eZPersistentObject::store(); 00342 } 00343 } 00344 00345 return $return; 00346 } 00347 00348 /*! 00349 Store one row into content attribute table 00350 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 00351 the calls within a db transaction; thus within db->begin and db->commit. 00352 */ 00353 function storeNewRow() 00354 { 00355 return eZPersistentObject::store(); 00356 } 00357 00358 /*! 00359 * Fetch a node by identifier (unique data_text ) 00360 00361 \param identifier 00362 00363 \return object attribute 00364 */ 00365 static function fetchByIdentifier( $identifier, $asObject = true ) 00366 { 00367 return eZPersistentObject::fetchObject( eZContentObjectAttribute::definition(), 00368 null, 00369 array( 'sort_key_string' => $identifier, 'data_type_string' => 'ezstring' ), 00370 $asObject ); 00371 } 00372 00373 function language( $languageCode = false, $asObject = true ) 00374 { 00375 if ( !$languageCode ) 00376 { 00377 $object = $this->object(); 00378 if ( !$object ) 00379 { 00380 return null; 00381 } 00382 $languageCode = $object->initialLanguageCode(); 00383 } 00384 return eZPersistentObject::fetchObject( eZContentObjectAttribute::definition(), 00385 null, 00386 array( "contentclassattribute_id" => $this->ContentClassAttributeID, 00387 "contentobject_id" => $this->ContentObjectID, 00388 "version" => $this->Version, 00389 "language_code" => $languageCode ), 00390 $asObject ); 00391 } 00392 00393 function object() 00394 { 00395 if( isset( $this->ContentObjectID ) and $this->ContentObjectID ) 00396 { 00397 return eZContentObject::fetch( $this->ContentObjectID ); 00398 } 00399 return null; 00400 } 00401 00402 function objectVersion() 00403 { 00404 return eZContentObjectVersion::fetchVersion( $this->Version, $this->ContentObjectID ); 00405 } 00406 00407 /*! 00408 Returns the attribute for the current data attribute instance 00409 */ 00410 function contentClassAttribute() 00411 { 00412 eZDebug::accumulatorStart( 'instantiate_class_attribute', 'class_abstraction', 'Instantiating content class attribute' ); 00413 $classAttribute = eZContentClassAttribute::fetch( $this->ContentClassAttributeID ); 00414 eZDebug::accumulatorStop( 'instantiate_class_attribute' ); 00415 return $classAttribute; 00416 } 00417 00418 /*! 00419 Sets the cached content class attribute identifier 00420 */ 00421 function setContentClassAttributeIdentifier( $identifier ) 00422 { 00423 $this->ContentClassAttributeIdentifier = $identifier; 00424 } 00425 00426 /*! 00427 Sets the cached content class attribute can_translate 00428 */ 00429 function setContentClassAttributeCanTranslate( $canTranslate ) 00430 { 00431 $this->ContentClassAttributeCanTranslate = $canTranslate; 00432 } 00433 00434 /*! 00435 Sets the cached content class attribute name 00436 */ 00437 function setContentClassAttributeName( $name ) 00438 { 00439 $this->ContentClassAttributeName = $name; 00440 } 00441 00442 /*! 00443 \returns the cached value of the IsRequired value 00444 */ 00445 function contentClassAttributeIsRequired() 00446 { 00447 if ( $this->ContentClassAttributeIsRequired === null ) 00448 { 00449 eZDebug::accumulatorStart( 'class_a_is_req', 'Sytem overhead', 'Fetch class attribute is_required' ); 00450 00451 $classAttribute = eZContentClassAttribute::fetch( $this->ContentClassAttributeID ); 00452 $this->ContentClassAttributeIsRequired = $classAttribute->attribute( 'is_required' ); 00453 eZDebug::accumulatorStop( 'class_a_is_req' ); 00454 } 00455 00456 return $this->ContentClassAttributeIsRequired; 00457 } 00458 00459 /*! 00460 \returns the cached value of the is_informationcollector value 00461 */ 00462 function contentClassAttributeIsInformationCollector() 00463 { 00464 if ( $this->ContentClassAttributeIsInformationCollector === null ) 00465 { 00466 eZDebug::accumulatorStart( 'class_a_is_ic', 'Sytem overhead', 'Fetch class attribute name' ); 00467 00468 $classAttribute = eZContentClassAttribute::fetch( $this->ContentClassAttributeID ); 00469 $this->ContentClassAttributeIsInformationCollector = $classAttribute->attribute( 'is_information_collector' ); 00470 eZDebug::accumulatorStop( 'class_a_is_ic' ); 00471 } 00472 00473 return $this->ContentClassAttributeIsInformationCollector; 00474 } 00475 00476 /*! 00477 \returns the cached value of the class attribute name 00478 */ 00479 function contentClassAttributeName() 00480 { 00481 if ( $this->ContentClassAttributeName === null ) 00482 { 00483 eZDebug::accumulatorStart( 'class_a_name', 'Sytem overhead', 'Fetch class attribute name' ); 00484 00485 $classAttribute = eZContentClassAttribute::fetch( $this->ContentClassAttributeID ); 00486 $this->ContentClassAttributeName = $classAttribute->attribute( 'name' ); 00487 eZDebug::accumulatorStop( 'class_a_name' ); 00488 } 00489 00490 return $this->ContentClassAttributeName; 00491 } 00492 00493 /*! 00494 \returns the cached value if the attribute can be translated or not 00495 */ 00496 function contentClassAttributeCanTranslate() 00497 { 00498 if ( $this->ContentClassAttributeCanTranslate === null ) 00499 { 00500 eZDebug::accumulatorStart( 'class_a_can_translate', 'Sytem overhead', 'Fetch class attribute can translate value' ); 00501 00502 $classAttribute = eZContentClassAttribute::fetch( $this->ContentClassAttributeID ); 00503 00504 $dataType = $classAttribute->dataType(); 00505 00506 if ( $dataType && 00507 $dataType->Attributes["properties"]["translation_allowed"] && 00508 $classAttribute->attribute( 'can_translate' ) ) 00509 $this->ContentClassAttributeCanTranslate = 1; 00510 else 00511 $this->ContentClassAttributeCanTranslate = 0; 00512 eZDebug::accumulatorStop( 'class_a_can_translate' ); 00513 } 00514 00515 return $this->ContentClassAttributeCanTranslate; 00516 } 00517 00518 /*! 00519 \return the idenfifier for the content class attribute 00520 */ 00521 function contentClassAttributeIdentifier() 00522 { 00523 if ( $this->ContentClassAttributeIdentifier === null ) 00524 { 00525 $this->ContentClassAttributeIdentifier = eZContentClassAttribute::classAttributeIdentifierByID( $this->ContentClassAttributeID ); 00526 } 00527 00528 return $this->ContentClassAttributeIdentifier; 00529 } 00530 00531 /*! 00532 Validates the data contents, returns true on success false if the data 00533 does not validate. 00534 */ 00535 function validateInput( $http, $base, 00536 &$inputParameters, $validationParameters = array() ) 00537 { 00538 $dataType = $this->dataType(); 00539 if ( $dataType ) 00540 { 00541 $this->setInputParameters( $inputParameters ); 00542 $this->setValidationParameters( $validationParameters ); 00543 $this->IsValid = $dataType->validateObjectAttributeHTTPInput( $http, $base, $this ); 00544 $this->unsetValidationParameters(); 00545 $this->unsetInputParameters(); 00546 } 00547 return $this->IsValid; 00548 } 00549 00550 /*! 00551 Validates the data contents, returns true on success false if the data 00552 does not validate. 00553 */ 00554 function validateAddToBasket( $data, &$errors ) 00555 { 00556 $dataType = $this->dataType(); 00557 if ( $dataType ) 00558 { 00559 $this->AddToBasketIsValid = $dataType->validateAddToBasket( $this, $data, $errors ); 00560 } 00561 return $this->AddToBasketIsValid; 00562 } 00563 00564 /*! 00565 Sets the current input parameters to \a $parameters. 00566 The input parameters are set by validateInput() and made avaiable to 00567 datatypes trough the function inputParameters(). 00568 \note The input parameters will only be available for the duration of validateInput(). 00569 \sa inputParameters 00570 */ 00571 function setInputParameters( $parameters ) 00572 { 00573 $this->InputParameters = $parameters; 00574 } 00575 00576 /*! 00577 Unsets the input parameters previously set by setInputParameters(). 00578 \sa inputParameters 00579 */ 00580 function unsetInputParameters() 00581 { 00582 unset( $this->InputParameters ); 00583 $this->InputParameters = false; 00584 } 00585 00586 /*! 00587 \return the current input parameters or \c false if no parameters has been set. 00588 \sa setInputParameters, unsetInputParameters 00589 */ 00590 function inputParameters() 00591 { 00592 return $this->InputParameters; 00593 } 00594 00595 /*! 00596 Sets the current validation parameters to \a $parameters. 00597 The validation parameters are set by validateInput() and made avaiable to 00598 datatypes trough the function validationParameters(). 00599 \note The validation parameters will only be available for the duration of validateInput(). 00600 \sa validationParameters 00601 */ 00602 function setValidationParameters( $parameters ) 00603 { 00604 $this->ValidationParameters = $parameters; 00605 } 00606 00607 /*! 00608 Unsets the validation parameters previously set by setValidationParameters(). 00609 \sa validationParameters 00610 */ 00611 function unsetValidationParameters() 00612 { 00613 unset( $this->ValidationParameters ); 00614 $this->ValidationParameters = false; 00615 } 00616 00617 /*! 00618 \return the current validation parameters or \c false if no parameters has been set. 00619 \sa setValidationParameters, unsetValidationParameters 00620 */ 00621 function validationParameters() 00622 { 00623 return $this->ValidationParameters; 00624 } 00625 00626 /*! 00627 \return \c true if 'is_required' validation should be done otherwise \c false; 00628 */ 00629 function validateIsRequired() 00630 { 00631 $classAttribute = $this->contentClassAttribute(); 00632 $validationParameters = $this->validationParameters(); 00633 if ( !( isset( $validationParameters['skip-isRequired'] ) && $validationParameters['skip-isRequired'] === true ) && $classAttribute->attribute( "is_required" ) ) 00634 return true; 00635 00636 return false; 00637 } 00638 00639 /*! 00640 Tries to fixup the input text to be acceptable. 00641 �*/ 00642 function fixupInput( $http, $base ) 00643 { 00644 $dataType = $this->dataType(); 00645 if ( $dataType ) 00646 $dataType->fixupObjectAttributeHTTPInput( $http, $base, $this ); 00647 } 00648 00649 /*! 00650 Fetches the data from http post vars and sets them correctly. 00651 */ 00652 function fetchInput( $http, $base ) 00653 { 00654 $dataType = $this->dataType(); 00655 if ( $dataType ) 00656 return $dataType->fetchObjectAttributeHTTPInput( $http, $base, $this ); 00657 00658 return false; 00659 } 00660 00661 /*! 00662 Validates the information collection data. 00663 �*/ 00664 function validateInformation( $http, $base, 00665 &$inputParameters, $validationParameters = array() ) 00666 { 00667 $dataType = $this->dataType(); 00668 if ( $dataType ) 00669 { 00670 $this->setInputParameters( $inputParameters ); 00671 $this->setValidationParameters( $validationParameters ); 00672 $this->IsValid = $dataType->validateCollectionAttributeHTTPInput( $http, $base, $this ); 00673 $this->unsetValidationParameters(); 00674 $this->unsetInputParameters(); 00675 } 00676 return $this->IsValid; 00677 } 00678 00679 /*! 00680 Collects the information entered by the user from http post vars 00681 */ 00682 function collectInformation( $collection, &$collectionAttribute, $http, $base ) 00683 { 00684 $dataType = $this->dataType(); 00685 if ( $dataType ) 00686 { 00687 $collectionAttribute->setAttribute( 'contentclass_attribute_id', $this->attribute( 'contentclassattribute_id' ) ); 00688 $collectionAttribute->setAttribute( 'contentobject_attribute_id', $this->attribute( 'id' ) ); 00689 $collectionAttribute->setAttribute( 'contentobject_id', $this->attribute( 'contentobject_id' ) ); 00690 return $dataType->fetchCollectionAttributeHTTPInput( $collection, $collectionAttribute, $http, $base, $this ); 00691 } 00692 00693 return false; 00694 } 00695 00696 /*! 00697 Executes the custom HTTP action 00698 */ 00699 function customHTTPAction( $http, $action, $parameters = array() ) 00700 { 00701 $dataType = $this->dataType(); 00702 if ( $dataType ) 00703 $dataType->customObjectAttributeHTTPAction( $http, $action, $this, $parameters ); 00704 } 00705 00706 /*! 00707 Sends custom actions to datatype for custom handling. 00708 */ 00709 function handleCustomHTTPActions( $http, $attributeDataBaseName, 00710 $customActionAttributeArray, $customActionParameters ) 00711 { 00712 $dataType = $this->dataType(); 00713 if ( $dataType ) 00714 { 00715 $customActionParameters['contentobject_attribute'] = $this; 00716 $dataType->handleCustomObjectHTTPActions( $http, $attributeDataBaseName, 00717 $customActionAttributeArray, $customActionParameters ); 00718 } 00719 } 00720 00721 /*! 00722 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 00723 the calls within a db transaction; thus within db->begin and db->commit. 00724 */ 00725 function onPublish( $object, $nodes ) 00726 { 00727 $dataType = $this->dataType(); 00728 if ( $dataType ) 00729 $dataType->onPublish( $this, $object, $nodes ); 00730 } 00731 00732 /*! 00733 Inserts the HTTP file \a $httpFile to the content object attribute \a $objectAttribute 00734 by calling eZDataType::insertHTTPFile on the current datatype. 00735 00736 The parameters are passed directly to the datatype with the exception of 00737 \a $object, \a $objectVersion and \a $objectLanguage. 00738 If \c false is passed to any of these parameters they will be fetched from the 00739 current attribute, if these are available it is adviced to pass them since it will save time. 00740 */ 00741 function insertHTTPFile( $object, $objectVersion, $objectLanguage, 00742 $httpFile, $mimeData, 00743 &$result ) 00744 { 00745 if ( !$object ) 00746 $object = $this->object(); 00747 if ( $objectVersion === false ) 00748 $objectVersion = $object->attribute( 'current_version' ); 00749 if ( $objectLanguage === false ) 00750 $objectLanguage = $object->attribute( 'default_language' ); 00751 $dataType = $this->dataType(); 00752 return $dataType->insertHTTPFile( $object, $objectVersion, $objectLanguage, 00753 $this, $httpFile, $mimeData, 00754 $result ); 00755 } 00756 00757 /*! 00758 Inserts the file named \a $filePath to the content object attribute \a $objectAttribute. 00759 by calling eZDataType::insertRegularFile on the current datatype. 00760 00761 The parameters are passed directly to the datatype with the exception of 00762 \a $object, \a $objectVersion and \a $objectLanguage. 00763 If \c false is passed to any of these parameters they will be fetched from the 00764 current attribute, if these are available it is adviced to pass them since it will save time. 00765 */ 00766 function insertRegularFile( $object, $objectVersion, $objectLanguage, 00767 $filePath, 00768 &$result ) 00769 { 00770 if ( !$object ) 00771 $object = $this->object(); 00772 if ( $objectVersion === false ) 00773 $objectVersion = $object->attribute( 'current_version' ); 00774 if ( $objectLanguage === false ) 00775 $objectLanguage = $object->attribute( 'default_language' ); 00776 $dataType = $this->dataType(); 00777 return $dataType->insertRegularFile( $object, $objectVersion, $objectLanguage, 00778 $this, $filePath, 00779 $result ); 00780 } 00781 00782 /*! 00783 Inserts the string \a $string to the content object attribute \a $objectAttribute. 00784 by calling eZDataType::insertSimpleString on the current datatype. 00785 00786 The parameters are passed directly to the datatype with the exception of 00787 \a $object, \a $objectVersion and \a $objectLanguage. 00788 If \c false is passed to any of these parameters they will be fetched from the 00789 current attribute, if these are available it is adviced to pass them since it will save time. 00790 */ 00791 function insertSimpleString( $object, $objectVersion, $objectLanguage, 00792 $string, 00793 &$result ) 00794 { 00795 if ( !$object ) 00796 $object = $this->object(); 00797 if ( $objectVersion === false ) 00798 $objectVersion = $object->attribute( 'current_version' ); 00799 if ( $objectLanguage === false ) 00800 $objectLanguage = $object->attribute( 'default_language' ); 00801 $dataType = $this->dataType(); 00802 return $dataType->insertSimpleString( $object, $objectVersion, $objectLanguage, 00803 $this, $string, 00804 $result ); 00805 } 00806 00807 /*! 00808 Calls hasStoredFileInformation() on the current datatype and returns the result. 00809 */ 00810 function hasStoredFileInformation( $object, $objectVersion, $objectLanguage ) 00811 { 00812 if ( !$object ) 00813 $object = $this->object(); 00814 if ( $objectVersion === false ) 00815 $objectVersion = $object->attribute( 'current_version' ); 00816 if ( $objectLanguage === false ) 00817 $objectLanguage = $object->attribute( 'default_language' ); 00818 $dataType = $this->dataType(); 00819 return $dataType->hasStoredFileInformation( $object, $objectVersion, $objectLanguage, 00820 $this ); 00821 } 00822 00823 /*! 00824 Calls storedFileInformation() on the current datatype and returns the result. 00825 */ 00826 function storedFileInformation( $object, $objectVersion, $objectLanguage ) 00827 { 00828 if ( !$object ) 00829 $object = $this->object(); 00830 if ( $objectVersion === false ) 00831 $objectVersion = $object->attribute( 'current_version' ); 00832 if ( $objectLanguage === false ) 00833 $objectLanguage = $object->attribute( 'default_language' ); 00834 $dataType = $this->dataType(); 00835 return $dataType->storedFileInformation( $object, $objectVersion, $objectLanguage, 00836 $this ); 00837 } 00838 00839 /*! 00840 Calls handleDownload() on the current datatype and returns the result. 00841 */ 00842 function handleDownload( $object, $objectVersion, $objectLanguage ) 00843 { 00844 if ( !$object ) 00845 $object = $this->object(); 00846 if ( $objectVersion === false ) 00847 $objectVersion = $object->attribute( 'current_version' ); 00848 if ( $objectLanguage === false ) 00849 $objectLanguage = $object->attribute( 'default_language' ); 00850 $dataType = $this->dataType(); 00851 return $dataType->handleDownload( $object, $objectVersion, $objectLanguage, 00852 $this ); 00853 } 00854 00855 /** 00856 * Initializes the attribute by using the datatype 00857 * 00858 * @param int $currentVersion Current version number 00859 * @param eZContentObjectAttribute $originalContentObjectAttribute 00860 * Optional eZContentObjectAttribute the content will be initialized 00861 * from 00862 * @return void 00863 */ 00864 function initialize( $currentVersion = null, $originalContentObjectAttribute = null ) 00865 { 00866 if ( $originalContentObjectAttribute === null ) 00867 $originalContentObjectAttribute = $this; 00868 $classAttribute = $this->contentClassAttribute(); 00869 $dataType = $classAttribute->dataType(); 00870 if ( $dataType ) 00871 $dataType->initializeObjectAttribute( $this, $currentVersion, $originalContentObjectAttribute ); 00872 } 00873 00874 /*! 00875 Initialized the attribute by using the datatype after the actual attribute is stored. 00876 */ 00877 function postInitialize( $currentVersion = null, $originalContentObjectAttribute = null ) 00878 { 00879 if ( $originalContentObjectAttribute === null ) 00880 $originalContentObjectAttribute = $this; 00881 $classAttribute = $this->contentClassAttribute(); 00882 $dataType = $classAttribute->dataType(); 00883 if ( $dataType ) 00884 $dataType->postInitializeObjectAttribute( $this, $currentVersion, $originalContentObjectAttribute ); 00885 } 00886 00887 /*! 00888 Remove the attribute by using the datatype. 00889 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 00890 the calls within a db transaction; thus within db->begin and db->commit. 00891 */ 00892 function removeThis( $id, $currentVersion = null ) 00893 { 00894 $dataType = $this->dataType(); 00895 if ( !$dataType ) 00896 return false; 00897 $dataType->deleteStoredObjectAttribute( $this, $currentVersion ); 00898 if( $currentVersion == null ) 00899 { 00900 eZPersistentObject::removeObject( eZContentObjectAttribute::definition(), 00901 array( "id" => $id ) ); 00902 } 00903 else 00904 { 00905 eZPersistentObject::removeObject( eZContentObjectAttribute::definition(), 00906 array( "id" => $id, 00907 "version" => $currentVersion ) ); 00908 } 00909 } 00910 00911 /** 00912 * Clones the attribute to a new version 00913 * 00914 * @param int $newVersionNumber Target version number 00915 * @param int $currentVersionNumnber Source version number 00916 * @param int $contentObjectID 00917 * @param string $newLanguageCode 00918 * 00919 * @note The cloned attribute isn't stored automatically 00920 * 00921 * @return eZContentObjectAttribute The cloned attribute 00922 * 00923 * @todo Deprecate this in favor of a real __clone 00924 */ 00925 function cloneContentObjectAttribute( $newVersionNumber, $currentVersionNumber, $contentObjectID = false, $newLanguageCode = false ) 00926 { 00927 $tmp = clone $this; 00928 $tmp->setAttribute( "version", $newVersionNumber ); 00929 if ( $contentObjectID != false ) 00930 { 00931 // if copying the whole object 00932 if ( $contentObjectID != $tmp->attribute( 'contentobject_id' ) ) 00933 { 00934 $exAttr = eZPersistentObject::fetchObject( eZContentObjectAttribute::definition(), 00935 null, 00936 array( 'contentobject_id' => $contentObjectID, 00937 'contentclassattribute_id' => $tmp->attribute( 'contentclassattribute_id' ), 00938 'language_code' => $tmp->attribute( 'language_code' ) ), 00939 true ); 00940 00941 // if the new object already contains the same attribute with another version 00942 if ( is_object( $exAttr ) ) 00943 // we take attribute id from it 00944 $id = $exAttr->attribute( 'id' ); 00945 else 00946 // otherwise new attribute id will be generated 00947 $id = null; 00948 00949 $tmp->setAttribute( 'id', $id ); 00950 } 00951 $tmp->setAttribute( 'contentobject_id', $contentObjectID ); 00952 } 00953 else 00954 { 00955 // if not copying, we will remove the information on which language has to be always shown 00956 $tmp->setAttribute( 'language_id', $tmp->attribute( 'language_id' ) & ~1 ); 00957 } 00958 00959 if ( $newLanguageCode != false && $tmp->attribute( 'language_code' ) != $newLanguageCode ) 00960 { 00961 $exAttr = eZPersistentObject::fetchObject( eZContentObjectAttribute::definition(), 00962 null, 00963 array( 'contentobject_id' => $contentObjectID? $contentObjectID: $tmp->attribute( 'contentobject_id' ), 00964 'contentclassattribute_id' => $tmp->attribute( 'contentclassattribute_id' ), 00965 'language_code' => $newLanguageCode ), 00966 true ); 00967 // if the new object already contains the same attribute with another version 00968 if ( is_object( $exAttr ) ) 00969 { 00970 $id = $exAttr->attribute( 'id' ); 00971 } 00972 else 00973 { 00974 $id = null; 00975 } 00976 $tmp->setAttribute( 'id', $id ); 00977 $tmp->setAttribute( 'language_code', $newLanguageCode ); 00978 $tmp->setAttribute( 'language_id', eZContentLanguage::idByLocale( $newLanguageCode ) ); 00979 } 00980 00981 $db = eZDB::instance(); 00982 $db->begin(); 00983 $tmp->sync(); 00984 $tmp->initialize( $currentVersionNumber, $this ); 00985 $tmp->sync(); 00986 $tmp->postInitialize( $currentVersionNumber, $this ); 00987 $db->commit(); 00988 00989 return $tmp; 00990 } 00991 00992 /*! 00993 Clones the attribute to the translation \a $languageCode. 00994 \note The cloned attribute is not stored. 00995 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 00996 the calls within a db transaction; thus within db->begin and db->commit. 00997 \note Deprecated. 00998 */ 00999 function translateTo( $languageCode, $updateLanguageMask = true ) 01000 { 01001 $languageID = eZContentLanguage::idByLocale( $languageCode ); 01002 01003 $tmp = clone $this; 01004 $tmp->setAttribute( 'id', null ); 01005 $tmp->setAttribute( 'language_code', $languageCode ); 01006 $tmp->setAttribute( 'language_id', $languageID ); 01007 01008 $db = eZDB::instance(); 01009 $db->begin(); 01010 $tmp->sync(); 01011 $currentVersionNumber = $this->attribute( 'version' ); 01012 $tmp->initialize( $currentVersionNumber, $this ); 01013 $tmp->sync(); 01014 $tmp->postInitialize( $currentVersionNumber, $this ); 01015 if ( $updateLanguageMask ) 01016 { 01017 $version = $tmp->objectVersion(); 01018 $version->updateLanguageMask( (int) $version->languageMask() | (int) $languageID, false ); 01019 } 01020 $db->commit(); 01021 01022 // Clear in-memory content cache 01023 $tmpnull = null; 01024 $tmp->setContent( $tmpnull ); 01025 01026 return $tmp; 01027 } 01028 01029 /*! 01030 Returns the data type class for the current attribute. 01031 */ 01032 function dataType() 01033 { 01034 $dataType = null; 01035 if( $this->DataTypeString !== null ) 01036 $dataType = eZDataType::create( $this->DataTypeString ); 01037 01038 return $dataType; 01039 } 01040 01041 /*! 01042 Fetches the title of the data instance which is to form the title of the object. 01043 */ 01044 function title() 01045 { 01046 $dataType = $this->dataType(); 01047 if ( $dataType ) 01048 return $dataType->title( $this ); 01049 01050 return ''; 01051 } 01052 01053 /*! 01054 \return the content for the contentclass attribute which defines this contentobject attribute. 01055 */ 01056 function classContent() 01057 { 01058 $attribute = $this->contentClassAttribute(); 01059 return $attribute->content(); 01060 } 01061 01062 /*! 01063 Sets the content of variable for the content of the relevant value(s) submitted in HTTP form. 01064 */ 01065 function setHTTPValue( $value ) 01066 { 01067 $this->HTTPValue = $value; 01068 } 01069 01070 /*! 01071 Returns the content of the relevant value(s) submitted in HTTP form. 01072 */ 01073 function value() 01074 { 01075 if ( $this->HTTPValue !== null ) 01076 return $this->HTTPValue; 01077 else 01078 return $this->content(); 01079 } 01080 01081 /*! 01082 \return \c true if the attribute has relavant value(s) submitted in HTTP form. 01083 */ 01084 function hasHTTPValue() 01085 { 01086 if ( $this->HTTPValue !== null ) 01087 { 01088 return true; 01089 } 01090 return false; 01091 } 01092 01093 /*! 01094 Returns the content for this attribute. 01095 */ 01096 function content() 01097 { 01098 if ( $this->Content === null ) 01099 { 01100 $dataType = $this->dataType(); 01101 if ( $dataType ) 01102 $this->Content = $dataType->objectAttributeContent( $this ); 01103 } 01104 return $this->Content; 01105 } 01106 01107 /*! 01108 \return \c true if the attribute is considered to have any content at all (ie. non-empty). 01109 01110 It will call the hasObjectAttributeContent() for the current datatype to figure this out. 01111 */ 01112 function hasContent() 01113 { 01114 $dataType = $this->dataType(); 01115 if ( $dataType ) 01116 { 01117 return $dataType->hasObjectAttributeContent( $this ); 01118 } 01119 return false; 01120 } 01121 01122 /*! 01123 Returns the metadata. This is the pure content of the attribute used for 01124 indexing data for search engines. 01125 */ 01126 function metaData() 01127 { 01128 $dataType = $this->dataType(); 01129 if ( $dataType ) 01130 return $dataType->metaData( $this ); 01131 else 01132 return false; 01133 } 01134 /*! 01135 Returns the string representation of attribute. This is the pure content of the attribute in string 01136 representation used for simplified import/export. 01137 */ 01138 function toString() 01139 { 01140 $dataType = $this->dataType(); 01141 if ( $dataType ) 01142 return $dataType->toString( $this ); 01143 else 01144 return false; 01145 } 01146 /*! 01147 imports string to attribute content 01148 used for simplified import/export. 01149 */ 01150 function fromString( $string ) 01151 { 01152 $dataType = $this->dataType(); 01153 if ( $dataType ) 01154 return $dataType->fromString( $this, $string ); 01155 else 01156 return false; 01157 } 01158 01159 01160 /*! 01161 \static 01162 Goes trough all attributes and fetches metadata for the ones that is searchable. 01163 \return an array with metadata information. 01164 */ 01165 static function metaDataArray( &$attributes ) 01166 { 01167 $metaDataArray = array(); 01168 if ( !is_array( $attributes ) ) 01169 return false; 01170 foreach( $attributes as $attribute ) 01171 { 01172 $classAttribute = $attribute->contentClassAttribute(); 01173 if ( $classAttribute->attribute( 'is_searchable' ) ) 01174 { 01175 $attributeMetaData = $attribute->metaData(); 01176 if ( $attributeMetaData !== false ) 01177 { 01178 if ( !is_array( $attributeMetaData ) ) 01179 { 01180 $attributeMetaData = array( array( 'id' => '', 01181 'text' => $attributeMetaData ) ); 01182 } 01183 $metaDataArray = array_merge( $metaDataArray, $attributeMetaData ); 01184 } 01185 } 01186 } 01187 return $metaDataArray; 01188 } 01189 01190 01191 /*! 01192 Sets the content for the current attribute 01193 */ 01194 function setContent( $content ) 01195 { 01196 $this->Content = $content; 01197 } 01198 01199 /*! 01200 \return Information on how to display the current attribute. 01201 See eZDataType::objectDisplayInformation() for more information on what is returned. 01202 */ 01203 function displayInfo() 01204 { 01205 if ( !$this->DisplayInfo ) 01206 { 01207 $dataType = $this->dataType(); 01208 if ( $dataType ) 01209 $this->DisplayInfo = $dataType->objectDisplayInformation( $this, false ); 01210 } 01211 return $this->DisplayInfo; 01212 } 01213 01214 /*! 01215 \return Information on how to display the class attribute. 01216 See eZDataType::classDisplayInformation() for more information on what is returned. 01217 \note This is a copy of eZContentClassAttribute::displayInfo() 01218 */ 01219 function classDisplayInfo() 01220 { 01221 $classAttribute = $this->contentClassAttribute(); 01222 if ( !$classAttribute->DisplayInfo ) 01223 { 01224 $dataType = $this->dataType(); 01225 if ( $dataType ) 01226 { 01227 $classAttribute->DisplayInfo = $dataType->classDisplayInformation( $classAttribute, false ); 01228 } 01229 } 01230 return $classAttribute->DisplayInfo; 01231 } 01232 01233 /*! 01234 Returns the content action(s) for this attribute 01235 */ 01236 function contentActionList() 01237 { 01238 $dataType = $this->dataType(); 01239 if ( $dataType ) 01240 { 01241 return $dataType->contentActionList( $this->contentClassAttribute() ); 01242 } 01243 return false; 01244 } 01245 01246 function setValidationError() 01247 { 01248 $numargs = func_num_args(); 01249 if ( $numargs < 1 ) 01250 { 01251 trigger_error( 'Function must take at least one parameter', E_USER_WARNING ); 01252 return; 01253 } 01254 $argList = func_get_args(); 01255 $text = eZContentObjectAttribute::generateValidationErrorText( $numargs, $argList ); 01256 $this->ValidationError = $text; 01257 $this->HasValidationError = true; 01258 } 01259 01260 function setHasValidationError( $hasError = true ) 01261 { 01262 $this->HasValidationError = $hasError; 01263 } 01264 01265 function hasValidationError() 01266 { 01267 return $this->HasValidationError; 01268 } 01269 01270 static function generateValidationErrorText( $numargs, $argList ) 01271 { 01272 $text = $argList[0]; 01273 for ( $i = 1; $i < $numargs; ++$i ) 01274 { 01275 $arg = $argList[$i]; 01276 $text = str_replace( "%$i", $arg, $text ); 01277 } 01278 return $text; 01279 } 01280 01281 function setValidationLog( $text ) 01282 { 01283 if ( is_string( $text ) ) 01284 { 01285 $logMessage = array(); 01286 $logMessage[] = $text; 01287 $this->ValidationLog = $logMessage; 01288 } 01289 elseif ( is_array( $text ) ) 01290 { 01291 $this->ValidationLog = $text; 01292 } 01293 else 01294 { 01295 $this->ValidationLog = null; 01296 } 01297 } 01298 01299 function validationError() 01300 { 01301 return $this->ValidationError; 01302 } 01303 01304 function validationLog() 01305 { 01306 return $this->ValidationLog; 01307 } 01308 01309 function serialize( $package ) 01310 { 01311 $result = false; 01312 $dataType = $this->dataType(); 01313 if ( $dataType ) 01314 $result = $dataType->serializeContentObjectAttribute( $package, $this ); 01315 01316 return $result; 01317 } 01318 01319 function unserialize( $package, $attributeDOMNode ) 01320 { 01321 $dataType = $this->dataType(); 01322 if ( $dataType ) 01323 $dataType->unserializeContentObjectAttribute( $package, $this, $attributeDOMNode ); 01324 } 01325 01326 function postUnserialize( $package ) 01327 { 01328 $dataType = $this->dataType(); 01329 if ( $dataType ) 01330 { 01331 $result = $dataType->postUnserializeContentObjectAttribute( $package, $this ); 01332 if ( $result ) 01333 { 01334 $this->store(); 01335 } 01336 } 01337 } 01338 01339 function isA() 01340 { 01341 $dataType = $this->dataType(); 01342 if ( $dataType ) 01343 { 01344 return $dataType->isA(); 01345 } 01346 return false; 01347 } 01348 01349 /*! 01350 \return the template name to use for viewing the attribute or 01351 if the attribute is an information collector the information 01352 template name is returned. 01353 \note The returned template name does not include the .tpl extension. 01354 \sa editTemplate, informationTemplate 01355 */ 01356 function viewTemplateName() 01357 { 01358 /* This will not work, datatypes should be able to override this .e.g Online Editor 01359 // Don't need to do lookup since we already know the datatype string, which is the result 01360 return $this->DataTypeString; 01361 */ 01362 01363 $classAttribute = $this->contentClassAttribute(); 01364 if ( $classAttribute->attribute( 'is_information_collector' ) ) 01365 { 01366 return $this->informationTemplate(); 01367 } 01368 return $this->viewTemplate(); 01369 } 01370 01371 /*! 01372 \return the template name to use for editing the attribute. 01373 */ 01374 function editTemplateName() 01375 { 01376 return $this->editTemplate(); 01377 } 01378 01379 /*! 01380 \return the template name to use for viewing the attribute. 01381 \note The returned template name does not include the .tpl extension. 01382 \sa editTemplate, informationTemplate 01383 */ 01384 function viewTemplate() 01385 { 01386 /* This will not work, datatypes should be able to override this .e.g Online Editor 01387 return $this->DataTypeString; 01388 // We really don't need to do a lookup via the datatype since we already have the string 01389 */ 01390 $dataType = $this->dataType(); 01391 if ( $dataType ) 01392 { 01393 return $dataType->viewTemplate( $this ); 01394 } 01395 return false; 01396 } 01397 01398 /*! 01399 \return the template name to use for editing the attribute. 01400 \note The returned template name does not include the .tpl extension. 01401 \sa viewTemplate, informationTemplate 01402 */ 01403 function editTemplate() 01404 { 01405 $dataType = $this->dataType(); 01406 if ( $dataType ) 01407 { 01408 return $dataType->editTemplate( $this ); 01409 } 01410 return false; 01411 } 01412 01413 /*! 01414 \return the template name to use for information collection for the attribute. 01415 \note The returned template name does not include the .tpl extension. 01416 \sa viewTemplate, editTemplate 01417 */ 01418 function informationTemplate() 01419 { 01420 /* This will not work, datatypes should be able to override this .e.g Online Editor 01421 return $this->DataTypeString; 01422 */ 01423 $dataType = $this->dataType(); 01424 if ( $dataType ) 01425 { 01426 return $dataType->informationTemplate( $this ); 01427 } 01428 return false; 01429 } 01430 01431 /*! 01432 \return the template name to use for information collection result view for the attribute. 01433 \note The returned template name does not include the .tpl extension. 01434 \sa viewTemplate, editTemplate, informationTemplate 01435 */ 01436 function resultTemplate() 01437 { 01438 /* This will not work, datatypes should be able to override this .e.g Online Editor 01439 return $this->DataTypeString; 01440 */ 01441 $dataType = $this->dataType(); 01442 if ( $dataType ) 01443 { 01444 return $dataType->resultTemplate( $this ); 01445 } 01446 return false; 01447 } 01448 01449 /// Contains the value(s) submitted in HTTP form 01450 public $HTTPValue; 01451 01452 /// Contains the content for this attribute 01453 public $Content; 01454 01455 /// Contains information on how to display the current attribute in various viewmodes 01456 public $DisplayInfo; 01457 01458 /// Stores the is valid 01459 public $IsValid; 01460 01461 public $ContentClassAttributeID; 01462 01463 /// Contains the last validation error 01464 public $ValidationError; 01465 01466 /// Contains the last validation error 01467 public $ValidationLog; 01468 01469 /// 01470 public $ContentClassAttributeIdentifier; 01471 public $ContentClassAttributeCanTranslate; 01472 public $ContentClassAttributeName; 01473 public $ContentClassAttributeIsInformationCollector; 01474 public $ContentClassAttributeIsRequired; 01475 } 01476 01477 ?>