Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezworkflowevent.php
Go to the documentation of this file.
1 <?php
13
17 class eZWorkflowEvent extends eZPersistentObject
18 {
19 public $EventType;
20 public function __construct( $row )
21 {
22 parent::__construct( $row );
23 $this->Content = null;
24 }
25
30 public function eZWorkflowEvent( $row )
31 {
32 self::__construct( $row );
33 }
34
35 static function definition()
36 {
37 return array( "fields" => array( "id" => array( 'name' => 'ID',
38 'datatype' => 'integer',
39 'default' => 0,
40 'required' => true ),
41 "version" => array( 'name' => "Version",
42 'datatype' => 'integer',
43 'default' => 0,
44 'required' => true ),
45 "workflow_id" => array( 'name' => "WorkflowID",
46 'datatype' => 'integer',
47 'default' => 0,
48 'required' => true,
49 'foreign_class' => 'eZWorkflow',
50 'foreign_attribute' => 'id',
51 'multiplicity' => '1..*' ),
52 "workflow_type_string" => array( 'name' => "TypeString",
53 'datatype' => 'string',
54 'default' => '',
55 'required' => true,
56 'max_length' => 50 ),
57 "description" => array( 'name' => "Description",
58 'datatype' => 'string',
59 'default' => '',
60 'required' => true,
61 'max_length' => 50 ),
62 "data_int1" => array( 'name' => "DataInt1",
63 'datatype' => 'integer',
64 'default' => 0,
65 'required' => true ),
66 "data_int2" => array( 'name' => "DataInt2",
67 'datatype' => 'integer',
68 'default' => 0,
69 'required' => true ),
70 "data_int3" => array( 'name' => "DataInt3",
71 'datatype' => 'integer',
72 'default' => 0,
73 'required' => true ),
74 "data_int4" => array( 'name' => "DataInt4",
75 'datatype' => 'integer',
76 'default' => 0,
77 'required' => true ),
78 "data_text1" => array( 'name' => "DataText1",
79 'datatype' => 'text',
80 'default' => '',
81 'required' => true,
82 'max_length' => 50 ),
83 "data_text2" => array( 'name' => "DataText2",
84 'datatype' => 'text',
85 'default' => '',
86 'required' => true,
87 'max_length' => 50 ),
88 "data_text3" => array( 'name' => "DataText3",
89 'datatype' => 'text',
90 'default' => '',
91 'required' => true,
92 'max_length' => 50 ),
93 "data_text4" => array( 'name' => "DataText4",
94 'datatype' => 'text',
95 'default' => '',
96 'required' => true,
97 'max_length' => 50 ),
98 "data_text5" => array( 'name' => "DataText5",
99 'datatype' => 'text',
100 'default' => '',
101 'required' => true ),
102 "placement" => array( 'name' => "Placement",
103 'datatype' => 'integer',
104 'default' => 0,
105 'required' => true ) ),
106 "keys" => array( "id", "version" ),
107 "function_attributes" => array( 'content' => 'content',
108 'workflow_type' => 'eventType' ),
109 "increment_key" => "id",
110 "sort" => array( "placement" => "asc" ),
111 "class_name" => "eZWorkflowEvent",
112 "name" => "ezworkflow_event" );
113 }
114
123 static function create( $workflowID, $typeString )
124 {
125 $row = array(
126 "id" => null,
127 "version" => 1,
128 "workflow_id" => $workflowID,
129 "workflow_type_string" => $typeString,
130 "description" => "",
131 "placement" => eZPersistentObject::newObjectOrder( eZWorkflowEvent::definition(),
132 "placement",
133 array( "version" => 1,
134 "workflow_id" => $workflowID ) ) );
135 return new eZWorkflowEvent( $row );
136 }
137
138 static function fetch( $id, $asObject = true, $version = 0, $field_filters = null )
139 {
140 return eZPersistentObject::fetchObject( eZWorkflowEvent::definition(),
141 $field_filters,
142 array( "id" => $id,
143 "version" => $version ),
144 $asObject );
145 }
146
147 static function fetchList( $asObject = true )
148 {
149 return eZPersistentObject::fetchObjectList( eZWorkflowEvent::definition(),
150 null, null, null, null,
151 $asObject );
152 }
153
154 static function fetchFilteredList( $cond, $asObject = true )
155 {
156 return eZPersistentObject::fetchObjectList( eZWorkflowEvent::definition(),
157 null, $cond, null, null,
158 $asObject );
159 }
160
165 function move( $down, $params = null )
166 {
167 if ( is_array( $params ) )
168 {
169 $pos = $params["placement"];
170 $wid = $params["workflow_id"];
171 $version = $params["version"];
172 }
173 else
174 {
175 $pos = $this->Placement;
176 $wid = $this->WorkflowID;
177 $version = $this->Version;
178 }
179 eZPersistentObject::reorderObject( eZWorkflowEvent::definition(),
180 array( "placement" => $pos ),
181 array( "workflow_id" => $wid,
182 "version" => $version ),
183 $down );
184 }
185
186 function attributes()
187 {
188 return array_merge( parent::attributes(), $this->eventType()->typeFunctionalAttributes() );
189 }
190
191 function hasAttribute( $attr )
192 {
193 $eventType = $this->eventType();
194 return parent::hasAttribute( $attr ) or
195 in_array( $attr, $eventType->typeFunctionalAttributes() );
196 }
197
198 function attribute( $attr, $noFunction = false )
199 {
200 $eventType = $this->eventType();
201 if ( is_object( $eventType ) and in_array( $attr, $eventType->typeFunctionalAttributes( ) ) )
202 {
203 return $eventType->attributeDecoder( $this, $attr );
204 }
205
206 return parent::attribute( $attr );
207 }
208
209 function eventType()
210 {
211 if ( ! isset( $this->EventType ) )
212 {
213 $this->EventType = eZWorkflowType::createType( $this->TypeString );
214 }
215 return $this->EventType;
216 }
217
221 function content()
222 {
223 if ( $this->Content === null )
224 {
225 $eventType = $this->eventType();
226 $this->Content = $eventType->workflowEventContent( $this );
227 }
228
229 return $this->Content;
230 }
231
235 function setContent( $content )
236 {
237 $this->Content = $content;
238 }
239
240
244 function customHTTPAction( $http, $action )
245 {
246 $eventType = $this->eventType();
247 $eventType->customWorkflowEventHTTPAction( $http, $action, $this );
248 }
249
254 function store( $fieldFilters = null )
255 {
256 $db = eZDB::instance();
257 $db->begin();
258 $stored = parent::store( $fieldFilters );
259
260 $eventType = $this->eventType();
261 if ( $eventType instanceof eZWorkflowEventType )
262 {
263 $eventType->storeEventData( $this, $this->attribute( 'version' ) );
264 }
265 else // Can't find eventype. Most likely deactivated while workflow has not been cleaneds up
266 {
267 eZDebug::writeError( "Couldn't load eventype '{$this->attribute( 'workflow_type_string' )}' for workflow. Is it activated ?", __METHOD__ );
268 }
269 $db->commit();
270
271 return $stored;
272 }
273
278 function storeDefined( $fieldFilters = null )
279 {
280 $db = eZDB::instance();
281 $db->begin();
282 $stored = parent::store( $fieldFilters );
283
284 $eventType = $this->eventType();
285 if ( $eventType instanceof eZWorkflowEventType )
286 {
287 $eventType->storeDefinedEventData( $this );
288 }
289 else // Can't find eventype. Most likely deactivated while workflow has not been cleaned up
290 {
291 eZDebug::writeError( "Couldn't load eventype '{$this->attribute( 'workflow_type_string' )}' for workflow. Is it activated ?", __METHOD__ );
292 }
293
294 $db->commit();
295
296 return $stored;
297 }
298
300 public $ID;
301 public $Version;
302 public $WorkflowID;
303 public $TypeString;
304 public $Description;
305 public $Placement;
306 public $DataInt1;
307 public $DataInt2;
308 public $DataInt3;
309 public $DataInt4;
310 public $DataText1;
311 public $DataText2;
312 public $DataText3;
313 public $DataText4;
314 public $Content;
315 }
316
317 ?>
eZDB\instance
static instance( $databaseImplementation=false, $databaseParameters=false, $forceNewInstance=false)
Definition: ezdb.php:117
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZPersistentObject
Definition: ezpersistentobject.php:33
eZPersistentObject\newObjectOrder
static newObjectOrder( $def, $orderField, $conditions)
Definition: ezpersistentobject.php:1034
eZPersistentObject\fetchObject
static fetchObject( $def, $field_filters, $conds, $asObject=true, $grouping=null, $custom_fields=null)
Definition: ezpersistentobject.php:213
eZPersistentObject\reorderObject
static reorderObject( $def, $orderField, $conditions, $down=true)
Definition: ezpersistentobject.php:1069
eZPersistentObject\fetchObjectList
static fetchObjectList( $def, $field_filters=null, $conds=null, $sorts=null, $limit=null, $asObject=true, $grouping=false, $custom_fields=null, $custom_tables=null, $custom_conds=null)
Definition: ezpersistentobject.php:806
eZWorkflowEventType
Definition: ezworkfloweventtype.php:18
eZWorkflowEvent
Definition: ezworkflowevent.php:18
eZWorkflowEvent\$DataText1
$DataText1
Definition: ezworkflowevent.php:310
eZWorkflowEvent\$EventType
$EventType
Definition: ezworkflowevent.php:19
eZWorkflowEvent\$TypeString
$TypeString
Definition: ezworkflowevent.php:303
eZWorkflowEvent\content
content()
Definition: ezworkflowevent.php:221
eZWorkflowEvent\__construct
__construct( $row)
Definition: ezworkflowevent.php:20
eZWorkflowEvent\definition
static definition()
Definition: ezworkflowevent.php:35
eZWorkflowEvent\setContent
setContent( $content)
Definition: ezworkflowevent.php:235
eZWorkflowEvent\customHTTPAction
customHTTPAction( $http, $action)
Definition: ezworkflowevent.php:244
eZWorkflowEvent\$DataInt4
$DataInt4
Definition: ezworkflowevent.php:309
eZWorkflowEvent\$Placement
$Placement
Definition: ezworkflowevent.php:305
eZWorkflowEvent\fetchFilteredList
static fetchFilteredList( $cond, $asObject=true)
Definition: ezworkflowevent.php:154
eZWorkflowEvent\move
move( $down, $params=null)
Definition: ezworkflowevent.php:165
eZWorkflowEvent\attribute
attribute( $attr, $noFunction=false)
Definition: ezworkflowevent.php:198
eZWorkflowEvent\attributes
attributes()
Definition: ezworkflowevent.php:186
eZWorkflowEvent\$Version
$Version
Definition: ezworkflowevent.php:301
eZWorkflowEvent\$DataInt2
$DataInt2
Definition: ezworkflowevent.php:307
eZWorkflowEvent\$Description
$Description
Definition: ezworkflowevent.php:304
eZWorkflowEvent\eZWorkflowEvent
eZWorkflowEvent( $row)
Definition: ezworkflowevent.php:30
eZWorkflowEvent\$WorkflowID
$WorkflowID
Definition: ezworkflowevent.php:302
eZWorkflowEvent\store
store( $fieldFilters=null)
Definition: ezworkflowevent.php:254
eZWorkflowEvent\hasAttribute
hasAttribute( $attr)
Definition: ezworkflowevent.php:191
eZWorkflowEvent\$DataInt3
$DataInt3
Definition: ezworkflowevent.php:308
eZWorkflowEvent\eventType
eventType()
Definition: ezworkflowevent.php:209
eZWorkflowEvent\$DataText2
$DataText2
Definition: ezworkflowevent.php:311
eZWorkflowEvent\$DataText4
$DataText4
Definition: ezworkflowevent.php:313
eZWorkflowEvent\storeDefined
storeDefined( $fieldFilters=null)
Definition: ezworkflowevent.php:278
eZWorkflowEvent\fetchList
static fetchList( $asObject=true)
Definition: ezworkflowevent.php:147
eZWorkflowEvent\$DataInt1
$DataInt1
Definition: ezworkflowevent.php:306
eZWorkflowEvent\$Content
$Content
Definition: ezworkflowevent.php:314
eZWorkflowEvent\create
static create( $workflowID, $typeString)
Definition: ezworkflowevent.php:123
eZWorkflowEvent\$ID
$ID
Definition: ezworkflowevent.php:300
eZWorkflowEvent\fetch
static fetch( $id, $asObject=true, $version=0, $field_filters=null)
Definition: ezworkflowevent.php:138
eZWorkflowEvent\$DataText3
$DataText3
Definition: ezworkflowevent.php:312
eZWorkflowType\createType
static createType( $typeString)
Definition: ezworkflowtype.php:81
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.