00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 include_once( 'kernel/classes/ezpersistentobject.php' );
00037
00038 class eZInformationCollectionAttribute extends eZPersistentObject
00039 {
00040 function eZInformationCollectionAttribute( $row )
00041 {
00042 $this->Content = null;
00043 $this->eZPersistentObject( $row );
00044 }
00045
00046
00047
00048
00049 function definition()
00050 {
00051 return array( 'fields' => array( 'id' => array( 'name' => 'ID',
00052 'datatype' => 'integer',
00053 'default' => 0,
00054 'required' => true ),
00055 'informationcollection_id' => array( 'name' => 'InformationCollectionID',
00056 'datatype' => 'integer',
00057 'default' => 0,
00058 'required' => true,
00059 'foreign_class' => 'eZInformationCollection',
00060 'foreign_attribute' => 'id',
00061 'multiplicity' => '1..*' ),
00062 'contentclass_attribute_id' => array( 'name' => 'ContentClassAttributeID',
00063 'datatype' => 'integer',
00064 'default' => 0,
00065 'required' => true,
00066 'foreign_class' => 'eZContentClassAttribute',
00067 'foreign_attribute' => 'id',
00068 'multiplicity' => '1..*' ),
00069 'contentobject_attribute_id' => array( 'name' => 'ContentObjectAttributeID',
00070 'datatype' => 'integer',
00071 'default' => 0,
00072 'required' => true,
00073 'foreign_class' => 'eZContentObjectAttribute',
00074 'foreign_attribute' => 'id',
00075 'multiplicity' => '1..*' ),
00076 'contentobject_id' => array( 'name' => 'ContentObjectID',
00077 'datatype' => 'integer',
00078 'default' => 0,
00079 'required' => true,
00080 'foreign_class' => 'eZContentObject',
00081 'foreign_attribute' => 'id',
00082 'multiplicity' => '1..*' ),
00083 'data_text' => array( 'name' => 'DataText',
00084 'datatype' => 'text',
00085 'default' => '',
00086 'required' => true ),
00087 'data_int' => array( 'name' => 'DataInt',
00088 'datatype' => 'integer',
00089 'default' => 0,
00090 'required' => true ),
00091 'data_float' => array( 'name' => 'DataFloat',
00092 'datatype' => 'float',
00093 'default' => 0,
00094 'required' => true ) ),
00095 'keys' => array( 'id' ),
00096 'function_attributes' => array( 'contentclass_attribute_name' => 'contentClassAttributeName',
00097 'contentclass_attribute' => 'contentClassAttribute',
00098 'contentobject_attribute' => 'contentObjectAttribute',
00099 'contentobject' => 'contentObject',
00100 'result_template' => 'resultTemplateName',
00101 'has_content' => 'hasContent',
00102 'content' => 'content',
00103 'class_content' => 'classContent' ),
00104 'increment_key' => 'id',
00105 'class_name' => 'eZInformationCollectionAttribute',
00106 'name' => 'ezinfocollection_attribute' );
00107 }
00108
00109
00110
00111
00112 function &classContent()
00113 {
00114 $classAttribute =& $this->contentClassAttribute();
00115 if ( is_object( $classAttribute ) )
00116 $content =& $classAttribute->content();
00117 else
00118 $content = null;
00119 return $content;
00120 }
00121
00122
00123
00124
00125 function &content()
00126 {
00127 if ( $this->Content === null )
00128 {
00129 $dataType = $this->dataType();
00130 if ( is_object( $dataType ) )
00131 {
00132 $this->Content =& $dataType->objectAttributeContent( $this );
00133 }
00134 }
00135 return $this->Content;
00136 }
00137
00138
00139
00140
00141
00142
00143 function &hasContent()
00144 {
00145 $hasContent = false;
00146 $dataType = $this->dataType();
00147 if ( is_object( $dataType ) )
00148 {
00149 $hasContent = $dataType->hasObjectAttributeContent( $this );
00150 }
00151 return $hasContent;
00152 }
00153
00154
00155
00156
00157
00158
00159 function &resultTemplateName()
00160 {
00161 $dataType = $this->dataType();
00162 if ( $dataType )
00163 $retValue =& $dataType->resultTemplate( $this );
00164 else
00165 $retValue = null;
00166 return $retValue;
00167 }
00168
00169
00170
00171 function &contentObject()
00172 {
00173 $contentObject =& eZContentObject::fetch( $this->attribute( 'contentobject_id' ) );
00174 return $contentObject;
00175 }
00176
00177
00178
00179 function &contentObjectAttribute()
00180 {
00181 $contentObject =& $this->contentObject();
00182 $contentObjectAttribute = eZContentObjectAttribute::fetch( $this->attribute( 'contentobject_attribute_id' ), $contentObject->attribute( 'current_version' ) );
00183 return $contentObjectAttribute;
00184 }
00185
00186
00187
00188 function &contentClassAttribute()
00189 {
00190 $contentClassAttribute =& eZContentClassAttribute::fetch( $this->attribute( 'contentclass_attribute_id' ) );
00191 return $contentClassAttribute;
00192 }
00193
00194
00195
00196 function dataType()
00197 {
00198 $contentClassAttribute =& $this->contentClassAttribute();
00199 if ( $contentClassAttribute )
00200 return $contentClassAttribute->dataType();
00201 return null;
00202 }
00203
00204
00205
00206 function &contentClassAttributeName()
00207 {
00208 $db =& eZDB::instance();
00209 $nameArray = $db->arrayQuery( "SELECT serialized_name_list FROM ezcontentclass_attribute WHERE id='$this->ContentClassAttributeID'" );
00210
00211 return eZContentClassAttributeNameList::nameFromSerializedString( $nameArray[0]['serialized_name_list'] );
00212 }
00213
00214
00215
00216
00217 function create( $informationCollectionID )
00218 {
00219 $row = array( 'informationcollection_id' => $informationCollectionID );
00220 return new eZInformationCollectionAttribute( $row );
00221 }
00222
00223
00224
00225
00226
00227 function fetchByObjectAttributeID( $id, $contentobjectAttributeID, $asObject = true )
00228 {
00229 return eZPersistentObject::fetchObject( eZInformationCollectionAttribute::definition(),
00230 null,
00231 array( 'informationcollection_id' => $id,
00232 'contentobject_attribute_id' => $contentobjectAttributeID ),
00233 $asObject );
00234 }
00235
00236
00237
00238
00239
00240
00241
00242 function cleanup()
00243 {
00244 $db =& eZDB::instance();
00245 $db->query( "DELETE FROM ezinfocollection_attribute" );
00246 }
00247
00248
00249 var $Content;
00250 }
00251
00252 ?>