Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezcollaborationitemmessagelink.php
Go to the documentation of this file.
1 <?php
17 class eZCollaborationItemMessageLink extends eZPersistentObject
18 {
19 static function definition()
20 {
21 return array( 'fields' => array( 'id' => array( 'name' => 'ID',
22 'datatype' => 'integer',
23 'default' => 0,
24 'required' => true ),
25 'collaboration_id' => array( 'name' => 'CollaborationID',
26 'datatype' => 'integer',
27 'default' => 0,
28 'required' => true,
29 'foreign_class' => 'eZCollaborationItem',
30 'foreign_attribute' => 'id',
31 'multiplicity' => '1..*' ),
32 'message_id' => array( 'name' => 'MessageID',
33 'datatype' => 'integer',
34 'default' => 0,
35 'required' => true,
36 'foreign_class' => 'eZCollaborationSimpleMessage',
37 'foreign_attribute' => 'id',
38 'multiplicity' => '1..*' ),
39 'message_type' => array( 'name' => 'MessageType',
40 'datatype' => 'integer',
41 'default' => 0,
42 'required' => true ),
43 'participant_id' => array( 'name' => 'ParticipantID',
44 'datatype' => 'integer',
45 'default' => 0,
46 'required' => true,
47 'foreign_class' => 'eZUser',
48 'foreign_attribute' => 'contentobject_id',
49 'multiplicity' => '1..*' ),
50 'created' => array( 'name' => 'Created',
51 'datatype' => 'integer',
52 'default' => 0,
53 'required' => true ),
54 'modified' => array( 'name' => 'Modified',
55 'datatype' => 'integer',
56 'default' => 0,
57 'required' => true ) ),
58 'keys' => array( 'id' ),
59 'function_attributes' => array( 'collaboration_item' => 'collaborationItem',
60 'participant' => 'participant',
61 'simple_message' => 'simpleMessage' ),
62 'increment_key' => 'id',
63 'class_name' => 'eZCollaborationItemMessageLink',
64 'name' => 'ezcollab_item_message_link' );
65 }
66
67 static function create( $collaborationID, $messageID, $messageType, $participantID )
68 {
69 $dateTime = time();
70 $row = array(
71 'collaboration_id' => $collaborationID,
72 'message_id' => $messageID,
73 'message_type' => $messageType,
74 'participant_id' => $participantID,
75 'created' => $dateTime,
76 'modified' => $dateTime );
77 return new eZCollaborationItemMessageLink( $row );
78 }
79
84 static function addMessage( $collaborationItem, $message, $messageType, $participantID = false )
85 {
86 $messageID = $message->attribute( 'id' );
87
88 if ( !$messageID )
89 {
90 eZDebug::writeError( 'No message ID, cannot create link', __METHOD__ );
91 $retValue = null;
92 return $retValue;
93 }
94 if ( $participantID === false )
95 {
96 $user = eZUser::currentUser();
97 $participantID = $user->attribute( 'contentobject_id' );
98 }
99 $collaborationID = $collaborationItem->attribute( 'id' );
100 $timestamp = time();
101 $collaborationItem->setAttribute( 'modified', $timestamp );
102
103 $db = eZDB::instance();
104 $db->begin();
105 $collaborationItem->sync();
106 $link = eZCollaborationItemMessageLink::create( $collaborationID, $messageID, $messageType, $participantID );
107 $link->store();
108 $db->commit();
109
110 return $link;
111 }
112
113 static function fetch( $id, $asObject = true )
114 {
115 return eZPersistentObject::fetchObject( eZCollaborationItemMessageLink::definition(),
116 null,
117 array( "id" => $id ),
118 null, null,
119 $asObject );
120 }
121
122 static function fetchItemCount( $parameters )
123 {
124 $parameters = array_merge( array( 'item_id' => false,
125 'conditions' => null ),
126 $parameters );
127 $itemID = $parameters['item_id'];
128 $conditions = $parameters['conditions'];
129 if ( $conditions === null )
130 $conditions = array();
131 $conditions['collaboration_id'] = $itemID;
132
133 $objectList = eZPersistentObject::fetchObjectList( eZCollaborationItemMessageLink::definition(),
134 array(),
135 $conditions,
136 false,
137 null,
138 false,
139 false,
140 array( array( 'operation' => 'count( id )',
141 'name' => 'count' ) ) );
142 return $objectList[0]['count'];
143 }
144
145 static function fetchItemList( $parameters )
146 {
147 $parameters = array_merge( array( 'as_object' => true,
148 'item_id' => false,
149 'offset' => false,
150 'limit' => false,
151 'sort_by' => false ),
152 $parameters );
153 $itemID = $parameters['item_id'];
154 $asObject = $parameters['as_object'];
155 $offset = $parameters['offset'];
156 $limit = $parameters['limit'];
157 $limitArray = null;
158 if ( $offset and $limit )
159 {
160 $limitArray = array( 'offset' => $offset,
161 'limit' => $limit );
162 }
163
164 return eZPersistentObject::fetchObjectList( eZCollaborationItemMessageLink::definition(),
165 null,
166 array( "collaboration_id" => $itemID ),
167 null, $limitArray,
168 $asObject );
169 }
170
171
172 function collaborationItem()
173 {
174 if ( isset( $this->CollaborationID ) and $this->CollaborationID )
175 {
176 return eZCollaborationItem::fetch( $this->CollaborationID );
177 }
178
179 return null;
180 }
181
182 function participant()
183 {
184 return eZCollaborationItemParticipantLink::fetch( $this->CollaborationID, $this->ParticipantID );
185 }
186
187 function simpleMessage()
188 {
189 if ( isset( $this->MessageID ) and $this->MessageID )
190 {
191 return eZCollaborationSimpleMessage::fetch( $this->MessageID );
192 }
193
194 return null;
195 }
196
198 public $CollaborationID;
199 public $MessageID;
200 public $ParticipantID;
201 public $Created;
202 public $Modified;
203 }
204
205 ?>
eZCollaborationItemMessageLink
The class eZCollaborationItemMessageLink does.
Definition: ezcollaborationitemmessagelink.php:18
eZCollaborationItemMessageLink\fetchItemCount
static fetchItemCount( $parameters)
Definition: ezcollaborationitemmessagelink.php:122
eZCollaborationItemMessageLink\collaborationItem
collaborationItem()
Definition: ezcollaborationitemmessagelink.php:172
eZCollaborationItemMessageLink\$Modified
$Modified
Definition: ezcollaborationitemmessagelink.php:202
eZCollaborationItemMessageLink\$MessageID
$MessageID
Definition: ezcollaborationitemmessagelink.php:199
eZCollaborationItemMessageLink\definition
static definition()
Definition: ezcollaborationitemmessagelink.php:19
eZCollaborationItemMessageLink\fetch
static fetch( $id, $asObject=true)
Definition: ezcollaborationitemmessagelink.php:113
eZCollaborationItemMessageLink\$CollaborationID
$CollaborationID
Definition: ezcollaborationitemmessagelink.php:198
eZCollaborationItemMessageLink\$Created
$Created
Definition: ezcollaborationitemmessagelink.php:201
eZCollaborationItemMessageLink\create
static create( $collaborationID, $messageID, $messageType, $participantID)
Definition: ezcollaborationitemmessagelink.php:67
eZCollaborationItemMessageLink\participant
participant()
Definition: ezcollaborationitemmessagelink.php:182
eZCollaborationItemMessageLink\simpleMessage
simpleMessage()
Definition: ezcollaborationitemmessagelink.php:187
eZCollaborationItemMessageLink\addMessage
static addMessage( $collaborationItem, $message, $messageType, $participantID=false)
Definition: ezcollaborationitemmessagelink.php:84
eZCollaborationItemMessageLink\$ParticipantID
$ParticipantID
Definition: ezcollaborationitemmessagelink.php:200
eZCollaborationItemMessageLink\fetchItemList
static fetchItemList( $parameters)
Definition: ezcollaborationitemmessagelink.php:145
eZCollaborationItemParticipantLink\fetch
static fetch( $collaborationID, $participantID, $asObject=true)
Definition: ezcollaborationitemparticipantlink.php:118
eZCollaborationItem\fetch
static fetch( $id, $creatorID=false, $asObject=true)
Definition: ezcollaborationitem.php:135
eZCollaborationSimpleMessage\fetch
static fetch( $id, $asObject=true)
Definition: ezcollaborationsimplemessage.php:102
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\fetchObject
static fetchObject( $def, $field_filters, $conds, $asObject=true, $grouping=null, $custom_fields=null)
Definition: ezpersistentobject.php:213
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
eZUser\currentUser
static currentUser()
Definition: ezuser.php:1716
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.