| [ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZContentClassGroup class 4 // 5 // 6 // SOFTWARE NAME: eZ publish 7 // SOFTWARE RELEASE: 3.9.0 8 // BUILD VERSION: 17785 9 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 10 // SOFTWARE LICENSE: GNU General Public License v2.0 11 // NOTICE: > 12 // This program is free software; you can redistribute it and/or 13 // modify it under the terms of version 2.0 of the GNU General 14 // Public License as published by the Free Software Foundation. 15 // 16 // This program is distributed in the hope that it will be useful, 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 // GNU General Public License for more details. 20 // 21 // You should have received a copy of version 2.0 of the GNU General 22 // Public License along with this program; if not, write to the Free 23 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 24 // MA 02110-1301, USA. 25 // 26 // 27 28 //!! eZKernel 29 //! The class eZContentClassGroup 30 /*! 31 32 */ 33 34 include_once ( "lib/ezdb/classes/ezdb.php" ); 35 include_once ( "kernel/classes/ezpersistentobject.php" ); 36 37 class eZContentClassGroup extends eZPersistentObject 38 { 39 function eZContentClassGroup( $row ) 40 { 41 $this->eZPersistentObject( $row ); 42 } 43 44 function definition() 45 { 46 return array( "fields" => array( "id" => array( 'name' => 'ID', 47 'datatype' => 'integer', 48 'default' => 0, 49 'required' => true ), 50 "name" => array( 'name' => "Name", 51 'datatype' => 'string', 52 'default' => '', 53 'required' => true ), 54 "creator_id" => array( 'name' => "CreatorID", 55 'datatype' => 'integer', 56 'default' => 0, 57 'required' => true, 58 'foreign_class' => 'eZUser', 59 'foreign_attribute' => 'contentobject_id', 60 'multiplicity' => '1..*' ), 61 "modifier_id" => array( 'name' => "ModifierID", 62 'datatype' => 'integer', 63 'default' => 0, 64 'required' => true, 65 'foreign_class' => 'eZUser', 66 'foreign_attribute' => 'contentobject_id', 67 'multiplicity' => '1..*' ), 68 "created" => array( 'name' => "Created", 69 'datatype' => 'integer', 70 'default' => 0, 71 'required' => true ), 72 "modified" => array( 'name' => "Modified", 73 'datatype' => 'integer', 74 'default' => 0, 75 'required' => true ) ), 76 "keys" => array( "id" ), 77 'function_attributes' => array( 'modifier' => 'modifier', 78 'creator' => 'creator' ), 79 "increment_key" => "id", 80 "class_name" => "eZContentClassGroup", 81 "sort" => array( "id" => "asc" ), 82 "name" => "ezcontentclassgroup" ); 83 } 84 85 function create( $userID = false ) 86 { 87 $dateTime = time(); 88 if ( !$userID ) 89 $userID = eZUser::currentUserID(); 90 $row = array( 91 "id" => null, 92 "name" => "", 93 "creator_id" => $userID, 94 "modifier_id" => $userID, 95 "created" => $dateTime, 96 "modified" => $dateTime ); 97 return new eZContentClassGroup( $row ); 98 } 99 100 function &modifier() 101 { 102 if ( isset( $this->ModifierID ) and $this->ModifierID ) 103 { 104 include_once ( "kernel/classes/datatypes/ezuser/ezuser.php" ); 105 $user = eZUser::fetch( $this->ModifierID ); 106 } 107 else 108 $user = null; 109 return $user; 110 } 111 112 function &creator() 113 { 114 if ( isset( $this->CreatorID ) and $this->CreatorID ) 115 { 116 include_once ( "kernel/classes/datatypes/ezuser/ezuser.php" ); 117 $user = eZUser::fetch( $this->CreatorID ); 118 } 119 else 120 $user = null; 121 return $user; 122 } 123 124 /*! 125 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 126 the calls within a db transaction; thus within db->begin and db->commit. 127 */ 128 function removeSelected( $id ) 129 { 130 eZPersistentObject::removeObject( eZContentClassGroup::definition(), 131 array( "id" => $id ) ); 132 } 133 134 /*! 135 Fetch Class group by name, and return first result. 136 137 \param name 138 \param asObject 139 */ 140 function fetchByName( $name, $asObject = true ) 141 { 142 $conds = array( 'name' => $name ); 143 return eZPersistentObject::fetchObject( eZContentClassGroup::definition(), 144 null, 145 $conds, 146 $asObject ); 147 } 148 149 function fetch( $id, $user_id = false, $asObject = true ) 150 { 151 $conds = array( "id" => $id ); 152 if ( $user_id !== false and is_numeric( $user_id ) ) 153 $conds["creator_id"] = $user_id; 154 return eZPersistentObject::fetchObject( eZContentClassGroup::definition(), 155 null, 156 $conds, 157 $asObject ); 158 } 159 160 function fetchList( $user_id = false, $asObject = true ) 161 { 162 $conds = array(); 163 if ( $user_id !== false and is_numeric( $user_id ) ) 164 $conds["creator_id"] = $user_id; 165 return eZPersistentObject::fetchObjectList( eZContentClassGroup::definition(), 166 null, $conds, null, null, 167 $asObject ); 168 } 169 170 /*! 171 Appends the class \a $class to this group. 172 \param $class Can either be an eZContentClass object or a class ID. 173 \return the class group link object. 174 \note tranaction unsafe. 175 */ 176 function &appendClass( &$class, $version = false ) 177 { 178 if ( get_class( $class ) == 'ezcontentclass' ) 179 { 180 $classID = $class->attribute( 'id' ); 181 $version = $class->attribute( 'version' ); 182 } 183 else 184 $classID = $class; 185 $classGroupLink = eZContentClassClassGroup::create( $classID, $version, 186 $this->attribute( 'id' ), 187 $this->attribute( 'name' ) ); 188 $classGroupLink->store(); 189 return $classGroupLink; 190 } 191 192 var $ID; 193 var $Name; 194 var $CreatorID; 195 var $ModifierID; 196 var $Created; 197 var $Modified; 198 } 199 200 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |