| [ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZWorkflowEvent class 4 // 5 // Created on: <16-Apr-2002 11:08:14 amos> 6 // 7 // SOFTWARE NAME: eZ publish 8 // SOFTWARE RELEASE: 3.9.0 9 // BUILD VERSION: 17785 10 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 11 // SOFTWARE LICENSE: GNU General Public License v2.0 12 // NOTICE: > 13 // This program is free software; you can redistribute it and/or 14 // modify it under the terms of version 2.0 of the GNU General 15 // Public License as published by the Free Software Foundation. 16 // 17 // This program is distributed in the hope that it will be useful, 18 // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 // GNU General Public License for more details. 21 // 22 // You should have received a copy of version 2.0 of the GNU General 23 // Public License along with this program; if not, write to the Free 24 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 25 // MA 02110-1301, USA. 26 // 27 // 28 29 //!! eZKernel 30 //! The class eZWorkflowEvent does 31 /*! 32 33 */ 34 35 include_once ( "lib/ezdb/classes/ezdb.php" ); 36 include_once ( "kernel/classes/ezpersistentobject.php" ); 37 include_once ( "kernel/classes/ezworkflowtype.php" ); 38 39 class eZWorkflowEvent extends eZPersistentObject 40 { 41 function eZWorkflowEvent( $row ) 42 { 43 $this->eZPersistentObject( $row ); 44 $this->Content = null; 45 } 46 47 function definition() 48 { 49 return array( "fields" => array( "id" => array( 'name' => 'ID', 50 'datatype' => 'integer', 51 'default' => 0, 52 'required' => true ), 53 "version" => array( 'name' => "Version", 54 'datatype' => 'integer', 55 'default' => 0, 56 'required' => true ), 57 "workflow_id" => array( 'name' => "WorkflowID", 58 'datatype' => 'integer', 59 'default' => 0, 60 'required' => true, 61 'foreign_class' => 'eZWorkflow', 62 'foreign_attribute' => 'id', 63 'multiplicity' => '1..*' ), 64 "workflow_type_string" => array( 'name' => "TypeString", 65 'datatype' => 'string', 66 'default' => '', 67 'required' => true ), 68 "description" => array( 'name' => "Description", 69 'datatype' => 'string', 70 'default' => '', 71 'required' => true ), 72 "data_int1" => array( 'name' => "DataInt1", 73 'datatype' => 'integer', 74 'default' => 0, 75 'required' => true ), 76 "data_int2" => array( 'name' => "DataInt2", 77 'datatype' => 'integer', 78 'default' => 0, 79 'required' => true ), 80 "data_int3" => array( 'name' => "DataInt3", 81 'datatype' => 'integer', 82 'default' => 0, 83 'required' => true ), 84 "data_int4" => array( 'name' => "DataInt4", 85 'datatype' => 'integer', 86 'default' => 0, 87 'required' => true ), 88 "data_text1" => array( 'name' => "DataText1", 89 'datatype' => 'text', 90 'default' => '', 91 'required' => true ), 92 "data_text2" => array( 'name' => "DataText2", 93 'datatype' => 'text', 94 'default' => '', 95 'required' => true ), 96 "data_text3" => array( 'name' => "DataText3", 97 'datatype' => 'text', 98 'default' => '', 99 'required' => true ), 100 "data_text4" => array( 'name' => "DataText4", 101 'datatype' => 'text', 102 'default' => '', 103 'required' => true ), 104 "placement" => array( 'name' => "Placement", 105 'datatype' => 'integer', 106 'default' => 0, 107 'required' => true ) ), 108 "keys" => array( "id", "version" ), 109 "function_attributes" => array( 'content' => 'content', 110 'workflow_type' => 'eventType' ), 111 "increment_key" => "id", 112 "sort" => array( "placement" => "asc" ), 113 "class_name" => "eZWorkflowEvent", 114 "name" => "ezworkflow_event" ); 115 } 116 117 function create( $workflow_id, $type_string ) 118 { 119 $row = array( 120 "id" => null, 121 "version" => 1, 122 "workflow_id" => $workflow_id, 123 "workflow_type_string" => $type_string, 124 "description" => "", 125 "placement" => eZPersistentObject::newObjectOrder( eZWorkflowEvent::definition(), 126 "placement", 127 array( "version" => 1, 128 "workflow_id" => $workflow_id ) ) ); 129 return new eZWorkflowEvent( $row ); 130 } 131 132 function fetch( $id, $asObject = true, $version = 0, $field_filters = null ) 133 { 134 return eZPersistentObject::fetchObject( eZWorkflowEvent::definition(), 135 $field_filters, 136 array( "id" => $id, 137 "version" => $version ), 138 $asObject ); 139 } 140 141 function &fetchList( $asObject = true ) 142 { 143 $objectList = eZPersistentObject::fetchObjectList( eZWorkflowEvent::definition(), 144 null, null, null, null, 145 $asObject ); 146 return $objectList; 147 } 148 149 function fetchFilteredList( $cond, $asObject = true ) 150 { 151 return eZPersistentObject::fetchObjectList( eZWorkflowEvent::definition(), 152 null, $cond, null, null, 153 $asObject ); 154 } 155 156 /*! 157 Moves the object down if $down is true, otherwise up. 158 If object is at either top or bottom it is wrapped around. 159 */ 160 function move( $down, $params = null ) 161 { 162 if ( is_array( $params ) ) 163 { 164 $pos = $params["placement"]; 165 $wid = $params["workflow_id"]; 166 $version = $params["version"]; 167 } 168 else 169 { 170 $pos = $this->Placement; 171 $wid = $this->WorkflowID; 172 $version = $this->Version; 173 } 174 eZPersistentObject::reorderObject( eZWorkflowEvent::definition(), 175 array( "placement" => $pos ), 176 array( "workflow_id" => $wid, 177 "version" => $version ), 178 $down ); 179 } 180 181 function attributes() 182 { 183 $eventType =& $this->eventType(); 184 return array_merge( eZPersistentObject::attributes(), $eventType->typeFunctionalAttributes() ); 185 } 186 187 function hasAttribute( $attr ) 188 { 189 $eventType =& $this->eventType(); 190 return eZPersistentObject::hasAttribute( $attr ) or 191 in_array( $attr, $eventType->typeFunctionalAttributes() ); 192 } 193 194 function &attribute( $attr ) 195 { 196 $eventType =& $this->eventType(); 197 if ( is_object( $eventType ) and in_array( $attr, $eventType->typeFunctionalAttributes( ) ) ) 198 { 199 $attributeDecoder =& $eventType->attributeDecoder( $this, $attr ); 200 return $attributeDecoder; 201 } 202 else 203 return eZPersistentObject::attribute( $attr ); 204 } 205 206 function &eventType() 207 { 208 if ( ! isset ( $this->EventType ) ) 209 { 210 $this->EventType =& eZWorkflowType::createType( $this->TypeString ); 211 } 212 return $this->EventType; 213 } 214 215 /*! 216 Returns the content for this event. 217 */ 218 function &content() 219 { 220 if ( $this->Content === null ) 221 { 222 $eventType =& $this->eventType(); 223 $this->Content =& $eventType->workflowEventContent( $this ); 224 } 225 226 return $this->Content; 227 } 228 229 /*! 230 Sets the content for the current event 231 */ 232 function setContent( $content ) 233 { 234 $this->Content =& $content; 235 } 236 237 238 /*! 239 Executes the custom HTTP action 240 */ 241 function customHTTPAction( &$http, $action ) 242 { 243 $eventType =& $this->eventType(); 244 $eventType->customWorkflowEventHTTPAction( $http, $action, $this ); 245 } 246 247 /*! 248 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 249 the calls within a db transaction; thus within db->begin and db->commit. 250 */ 251 function store() 252 { 253 $db =& eZDB::instance(); 254 $db->begin(); 255 $stored = eZPersistentObject::store(); 256 257 $eventType =& $this->eventType(); 258 $eventType->storeEventData( $this, $this->attribute( 'version' ) ); 259 $db->commit(); 260 261 return $stored; 262 } 263 264 /// \privatesection 265 var $ID; 266 var $Version; 267 var $WorkflowID; 268 var $TypeString; 269 var $Description; 270 var $Placement; 271 var $DataInt1; 272 var $DataInt2; 273 var $DataInt3; 274 var $DataInt4; 275 var $DataText1; 276 var $DataText2; 277 var $DataText3; 278 var $DataText4; 279 var $Content; 280 } 281 282 ?>
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 |