|
eZ Publish
[4.0]
|
00001 <?php 00002 // 00003 // Definition of eZEnum class 00004 // 00005 // Created on: <24-ßÂ-2002 16:07:05 wy> 00006 // 00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00008 // SOFTWARE NAME: eZ Publish 00009 // SOFTWARE RELEASE: 4.0.x 00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS 00011 // SOFTWARE LICENSE: GNU General Public License v2.0 00012 // NOTICE: > 00013 // This program is free software; you can redistribute it and/or 00014 // modify it under the terms of version 2.0 of the GNU General 00015 // Public License as published by the Free Software Foundation. 00016 // 00017 // This program is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU General Public License for more details. 00021 // 00022 // You should have received a copy of version 2.0 of the GNU General 00023 // Public License along with this program; if not, write to the Free 00024 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00025 // MA 02110-1301, USA. 00026 // 00027 // 00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00029 // 00030 00031 /*! \file ezenumobjectvalue.php 00032 */ 00033 00034 //include_once( "lib/ezdb/classes/ezdb.php" ); 00035 //include_once( "kernel/classes/ezpersistentobject.php" ); 00036 //include_once( "kernel/classes/ezcontentclassattribute.php" ); 00037 00038 /*! 00039 \class eZEnumObjectValue ezenumobjectvalue.php 00040 \brief The class eZEnumObjectValue stores chosen enum values of an object attribute 00041 00042 */ 00043 00044 class eZEnumObjectValue extends eZPersistentObject 00045 { 00046 /*! 00047 Constructor 00048 */ 00049 function eZEnumObjectValue( $row ) 00050 { 00051 $this->eZPersistentObject( $row ); 00052 } 00053 00054 static function definition() 00055 { 00056 return array( "fields" => array( "contentobject_attribute_id" => array( 'name' => "ContentObjectAttributeID", 00057 'datatype' => 'integer', 00058 'default' => 0, 00059 'required' => true, 00060 'foreign_class' => 'eZContentObjectAttribute', 00061 'foreign_attribute' => 'id', 00062 'multiplicity' => '1..*' ), 00063 "contentobject_attribute_version" => array( 'name' => "ContentObjectAttributeVersion", 00064 'datatype' => 'integer', 00065 'default' => 0, 00066 'required' => true, 00067 'short_name' => 'contentobject_attr_version' ), 00068 "enumid" => array( 'name' => "EnumID", 00069 'datatype' => 'integer', 00070 'default' => 0, 00071 'required' => true ), 00072 "enumelement" => array( 'name' => "EnumElement", 00073 'datatype' => 'string', 00074 'default' => '', 00075 'required' => true ), 00076 "enumvalue" => array( 'name' => "EnumValue", 00077 'datatype' => 'string', 00078 'default' => '', 00079 'required' => true ) ), 00080 "keys" => array( "contentobject_attribute_id", "contentobject_attribute_version", "enumid" ), 00081 "sort" => array( "contentobject_attribute_id" => "asc" ), 00082 "class_name" => "eZEnumObjectValue", 00083 "name" => "ezenumobjectvalue" ); 00084 } 00085 00086 static function create( $contentObjectAttributeID, $contentObjectAttributeVersion, $enumID, $enumElement, $enumValue ) 00087 { 00088 $row = array( "contentobject_attribute_id" => $contentObjectAttributeID, 00089 "contentobject_attribute_version" => $contentObjectAttributeVersion, 00090 "enumid" => $enumID, 00091 "enumelement" => $enumElement, 00092 "enumvalue" => $enumValue ); 00093 return new eZEnumObjectValue( $row ); 00094 } 00095 00096 static function removeAllElements( $contentObjectAttributeID, $contentObjectAttributeVersion ) 00097 { 00098 if( $contentObjectAttributeVersion == null ) 00099 { 00100 eZPersistentObject::removeObject( eZEnumObjectValue::definition(), 00101 array( "contentobject_attribute_id" => $contentObjectAttributeID ) ); 00102 } 00103 else 00104 { 00105 eZPersistentObject::removeObject( eZEnumObjectValue::definition(), 00106 array( "contentobject_attribute_id" => $contentObjectAttributeID, 00107 "contentobject_attribute_version" => $contentObjectAttributeVersion ) ); 00108 } 00109 } 00110 00111 function removeByOAID( $contentObjectAttributeID, $contentObjectAttributeVersion, $enumid ) 00112 { 00113 eZPersistentObject::removeObject( eZEnumObjectValue::definition(), 00114 array( "enumid" => $enumid, 00115 "contentobject_attribute_id" => $contentObjectAttributeID, 00116 "contentobject_attribute_version" => $contentObjectAttributeVersion ) ); 00117 } 00118 00119 static function fetch( $contentObjectAttributeID, $contentObjectAttributeVersion, $enumid, $asObject = true ) 00120 { 00121 return eZPersistentObject::fetchObject( eZEnumObjectValue::definition(), 00122 null, 00123 array( "contentobject_attribute_id" => $contentObjectAttributeID, 00124 "contentobject_attribute_version" => $contentObjectAttributeVersion, 00125 "enumid" => $enumid ), 00126 $asObject ); 00127 } 00128 00129 static function fetchAllElements( $contentObjectAttributeID, $contentObjectAttributeVersion, $asObject = true ) 00130 { 00131 return eZPersistentObject::fetchObjectList( eZEnumObjectValue::definition(), 00132 null, 00133 array( "contentobject_attribute_id" => $contentObjectAttributeID, 00134 "contentobject_attribute_version" => $contentObjectAttributeVersion ), 00135 null, 00136 null, 00137 $asObject ); 00138 } 00139 00140 public $ContentObjectAttributeID; 00141 public $ContentObjectAttributeVersion; 00142 public $EnumID; 00143 public $EnumElement; 00144 public $EnumValue; 00145 } 00146 00147 ?>