|
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 ezenum.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 eZEnumValue ezenumvalue.php 00040 \ingroup eZDatatype 00041 \brief The class eZEnumValue does 00042 00043 */ 00044 00045 class eZEnumValue extends eZPersistentObject 00046 { 00047 /*! 00048 Constructor 00049 */ 00050 function eZEnumValue( $row ) 00051 { 00052 $this->eZPersistentObject( $row ); 00053 } 00054 00055 static function definition() 00056 { 00057 return array( "fields" => array( "id" => array( 'name' => 'ID', 00058 'datatype' => 'integer', 00059 'default' => 0, 00060 'required' => true ), 00061 "contentclass_attribute_id" => array( 'name' => "ContentClassAttributeID", 00062 'datatype' => 'integer', 00063 'default' => 0, 00064 'required' => true, 00065 'foreign_class' => 'eZContentObjectAttribute', 00066 'foreign_attribute' => 'id', 00067 'multiplicity' => '1..*' ), 00068 "contentclass_attribute_version" => array( 'name' => "ContentClassAttributeVersion", 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 "placement" => array( 'name' => "Placement", 00081 'datatype' => 'integer', 00082 'default' => 0, 00083 'required' => true ) ), 00084 "keys" => array( "id", "contentclass_attribute_id", "contentclass_attribute_version" ), 00085 "increment_key" => "id", 00086 "sort" => array( "id" => "asc" ), 00087 "class_name" => "eZEnumValue", 00088 "name" => "ezenumvalue" ); 00089 } 00090 00091 function __clone() 00092 { 00093 unset( $this->ID ); 00094 } 00095 00096 static function create( $contentClassAttributeID, $contentClassAttributeVersion, $element ) 00097 { 00098 $row = array( "id" => null, 00099 "contentclass_attribute_id" => $contentClassAttributeID, 00100 "contentclass_attribute_version" => $contentClassAttributeVersion, 00101 "enumvalue" => "", 00102 "enumelement" => $element, 00103 "placement" => eZPersistentObject::newObjectOrder( eZEnumValue::definition(), 00104 "placement", 00105 array( "contentclass_attribute_id" => $contentClassAttributeID, 00106 "contentclass_attribute_version" => $contentClassAttributeVersion ) ) ); 00107 return new eZEnumValue( $row ); 00108 } 00109 00110 static function createCopy( $id, $contentClassAttributeID, $contentClassAttributeVersion, $element, $value, $placement ) 00111 { 00112 $row = array( "id" => $id, 00113 "contentclass_attribute_id" => $contentClassAttributeID, 00114 "contentclass_attribute_version" => $contentClassAttributeVersion, 00115 "enumvalue" => $value, 00116 "enumelement" => $element, 00117 "placement" => $placement ); 00118 return new eZEnumValue( $row ); 00119 } 00120 00121 static function removeAllElements( $contentClassAttributeID, $version ) 00122 { 00123 eZPersistentObject::removeObject( eZEnumValue::definition(), 00124 array( "contentclass_attribute_id" => $contentClassAttributeID, 00125 "contentclass_attribute_version" => $version) ); 00126 } 00127 00128 static function removeByID( $id , $version ) 00129 { 00130 eZPersistentObject::removeObject( eZEnumValue::definition(), 00131 array( "id" => $id, 00132 "contentclass_attribute_version" => $version) ); 00133 } 00134 00135 static function fetch( $id, $version, $asObject = true ) 00136 { 00137 return eZPersistentObject::fetchObject( eZEnumValue::definition(), 00138 null, 00139 array( "id" => $id, 00140 "contentclass_attribute_version" => $version), 00141 $asObject ); 00142 } 00143 00144 static function fetchAllElements( $classAttributeID, $version, $asObject = true ) 00145 { 00146 if ( is_null( $classAttributeID ) ) 00147 { 00148 return array(); 00149 } 00150 00151 return eZPersistentObject::fetchObjectList( eZEnumValue::definition(), 00152 null, 00153 array( "contentclass_attribute_id" => $classAttributeID, 00154 "contentclass_attribute_version" => $version ), 00155 null, 00156 null, 00157 $asObject ); 00158 } 00159 00160 public $ID; 00161 public $ContentClassAttributeID; 00162 public $ContentClassAttributeVersion; 00163 public $EnumElement; 00164 public $EnumValue; 00165 public $Placement; 00166 } 00167 00168 ?>