Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

eznotificationevent.php
Go to the documentation of this file.
1 <?php
16 class eZNotificationEvent extends eZPersistentObject
17 {
18 public $TypeString;
19 public $EventType;
20 const STATUS_CREATED = 0;
21 const STATUS_HANDLED = 1;
22
23 public function __construct( $row = array() )
24 {
25 parent::__construct( $row );
26 $this->TypeString = $this->attribute( 'event_type_string' );
27 }
28
29 static function definition()
30 {
31 return array( "fields" => array( "id" => array( 'name' => 'ID',
32 'datatype' => 'integer',
33 'default' => 0,
34 'required' => true ),
35 "status" => array( 'name' => 'Status',
36 'datatype' => 'integer',
37 'default' => 0,
38 'required' => true ),
39 "event_type_string" => array( 'name' => "EventTypeString",
40 'datatype' => 'string',
41 'default' => '',
42 'required' => true ),
43 "data_int1" => array( 'name' => "DataInt1",
44 'datatype' => 'integer',
45 'default' => 0,
46 'required' => true ),
47 "data_int2" => array( 'name' => "DataInt2",
48 'datatype' => 'integer',
49 'default' => 0,
50 'required' => true ),
51 "data_int3" => array( 'name' => "DataInt3",
52 'datatype' => 'integer',
53 'default' => 0,
54 'required' => true ),
55 "data_int4" => array( 'name' => "DataInt4",
56 'datatype' => 'integer',
57 'default' => 0,
58 'required' => true ),
59 "data_text1" => array( 'name' => "DataText1",
60 'datatype' => 'text',
61 'default' => '',
62 'required' => true ),
63 "data_text2" => array( 'name' => "DataText2",
64 'datatype' => 'text',
65 'default' => '',
66 'required' => true ),
67 "data_text3" => array( 'name' => "DataText3",
68 'datatype' => 'text',
69 'default' => '',
70 'required' => true ),
71 "data_text4" => array( 'name' => "DataText4",
72 'datatype' => 'text',
73 'default' => '',
74 'required' => true ) ),
75 "keys" => array( "id" ),
76 "function_attributes" => array( 'content' => 'content' ),
77 "increment_key" => "id",
78 "sort" => array( "id" => "asc" ),
79 "class_name" => "eZNotificationEvent",
80 "name" => "eznotificationevent" );
81 }
82
83 static function create( $type, $params = array() )
84 {
85 $row = array(
86 "id" => null,
87 'event_type_string' => $type,
88 'data_int1' => 0,
89 'data_int2' => 0,
90 'data_int3' => 0,
91 'data_int4' => 0,
92 'data_text1' => '',
93 'data_text2' => '',
94 'data_text3' => '',
95 'data_text4' => '' );
96 $event = new eZNotificationEvent( $row );
97 eZDebugSetting::writeDebug( 'kernel-notification', $event, "event" );
98 $event->initializeEventType( $params );
99 return $event;
100 }
101
102 function initializeEventType( $params = array() )
103 {
104 $eventType = $this->eventType();
105 $eventType->initializeEvent( $this, $params );
106 eZDebugSetting::writeDebug( 'kernel-notification', $this, 'event after initialization' );
107 }
108
109 function eventType()
110 {
111 if ( ! isset ( $this->EventType ) )
112 {
113 $this->EventType = eZNotificationEventType::create( $this->TypeString );
114 }
115 return $this->EventType;
116 }
117
118
122 function content()
123 {
124 if ( $this->Content === null )
125 {
126 $eventType = $this->eventType();
127 $this->Content = $eventType->eventContent( $this );
128 }
129 return $this->Content;
130 }
131
135 function setContent( $content )
136 {
137 $this->Content = $content;
138 }
139
152 static function fetchList( $limit = null )
153 {
154 return eZPersistentObject::fetchObjectList( eZNotificationEvent::definition(),
155 null, null, null, $limit,
156 true );
157 }
158
159 static function fetch( $eventID )
160 {
161 return eZPersistentObject::fetchObject( eZNotificationEvent::definition(),
162 null,
163 array( 'id' => $eventID ) );
164 }
165
178 static function fetchUnhandledList( $limit = null )
179 {
180 return eZPersistentObject::fetchObjectList( eZNotificationEvent::definition(),
181 null, array( 'status' => self::STATUS_CREATED ), null, $limit,
182 true );
183 }
184
189 static function cleanup()
190 {
191 $db = eZDB::instance();
192 $db->query( "DELETE FROM eznotificationevent" );
193 }
194
195 public $Content = null;
196 }
197
198 ?>
eZDB\instance
static instance( $databaseImplementation=false, $databaseParameters=false, $forceNewInstance=false)
Definition: ezdb.php:117
eZDebugSetting\writeDebug
static writeDebug( $conditionName, $string, $label="")
Definition: ezdebugsetting.php:127
eZNotificationEventType\create
static create( $notificationEventTypeString)
Definition: eznotificationeventtype.php:43
eZNotificationEvent
The class eZNotificationEvent does.
Definition: eznotificationevent.php:17
eZNotificationEvent\$EventType
$EventType
Definition: eznotificationevent.php:19
eZNotificationEvent\$Content
$Content
Definition: eznotificationevent.php:195
eZNotificationEvent\definition
static definition()
Definition: eznotificationevent.php:29
eZNotificationEvent\STATUS_CREATED
const STATUS_CREATED
Definition: eznotificationevent.php:20
eZNotificationEvent\cleanup
static cleanup()
Definition: eznotificationevent.php:189
eZNotificationEvent\fetch
static fetch( $eventID)
Definition: eznotificationevent.php:159
eZNotificationEvent\create
static create( $type, $params=array())
Definition: eznotificationevent.php:83
eZNotificationEvent\STATUS_HANDLED
const STATUS_HANDLED
Definition: eznotificationevent.php:21
eZNotificationEvent\eventType
eventType()
Definition: eznotificationevent.php:109
eZNotificationEvent\$TypeString
$TypeString
Definition: eznotificationevent.php:18
eZNotificationEvent\fetchList
static fetchList( $limit=null)
Definition: eznotificationevent.php:152
eZNotificationEvent\__construct
__construct( $row=array())
Definition: eznotificationevent.php:23
eZNotificationEvent\fetchUnhandledList
static fetchUnhandledList( $limit=null)
Definition: eznotificationevent.php:178
eZNotificationEvent\content
content()
Definition: eznotificationevent.php:122
eZNotificationEvent\setContent
setContent( $content)
Definition: eznotificationevent.php:135
eZNotificationEvent\initializeEventType
initializeEventType( $params=array())
Definition: eznotificationevent.php:102
eZPersistentObject
Definition: ezpersistentobject.php:33
eZPersistentObject\fetchObject
static fetchObject( $def, $field_filters, $conds, $asObject=true, $grouping=null, $custom_fields=null)
Definition: ezpersistentobject.php:213
eZPersistentObject\attribute
attribute( $attr, $noFunction=false)
Definition: ezpersistentobject.php:1329
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
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.