eZ Publish  [4.0]
ezcollaborationsimplemessage.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZCollaborationSimpleMessage class
00004 //
00005 // Created on: <24-Jan-2003 15:38:57 amos>
00006 //
00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00008 // SOFTWARE NAME: eZ Publish
00009 // SOFTWARE RELEASE: 4.0.x
00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00011 // SOFTWARE LICENSE: GNU General Public License v2.0
00012 // NOTICE: >
00013 //   This program is free software; you can redistribute it and/or
00014 //   modify it under the terms of version 2.0  of the GNU General
00015 //   Public License as published by the Free Software Foundation.
00016 //
00017 //   This program is distributed in the hope that it will be useful,
00018 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //   GNU General Public License for more details.
00021 //
00022 //   You should have received a copy of version 2.0 of the GNU General
00023 //   Public License along with this program; if not, write to the Free
00024 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 //   MA 02110-1301, USA.
00026 //
00027 //
00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00029 //
00030 
00031 /*! \file ezcollaborationsimplemessage.php
00032 */
00033 
00034 /*!
00035   \class eZCollaborationSimpleMessage ezcollaborationsimplemessage.php
00036   \brief The class eZCollaborationSimpleMessage does
00037 
00038 */
00039 
00040 //include_once( 'kernel/classes/ezpersistentobject.php' );
00041 
00042 class eZCollaborationSimpleMessage extends eZPersistentObject
00043 {
00044     /*!
00045      Constructor
00046     */
00047     function eZCollaborationSimpleMessage( $row )
00048     {
00049         $this->eZPersistentObject( $row );
00050     }
00051 
00052     static function definition()
00053     {
00054         return array( 'fields' => array( 'id' => array( 'name' => 'ID',
00055                                                         'datatype' => 'integer',
00056                                                         'default' => 0,
00057                                                         'required' => true ),
00058                                          'message_type' => array( 'name' => 'MessageType',
00059                                                                   'datatype' => 'string',
00060                                                                   'default' => '',
00061                                                                   'required' => true ),
00062                                          'data_text1' => array( 'name' => 'DataText1',
00063                                                                 'datatype' => 'text',
00064                                                                 'default' => '',
00065                                                                 'required' => true ),
00066                                          'data_text2' => array( 'name' => 'DataText2',
00067                                                                 'datatype' => 'text',
00068                                                                 'default' => '',
00069                                                                 'required' => true ),
00070                                          'data_text3' => array( 'name' => 'DataText3',
00071                                                                 'datatype' => 'text',
00072                                                                 'default' => '',
00073                                                                 'required' => true ),
00074                                          'data_int1' => array( 'name' => 'DataInt1',
00075                                                                'datatype' => 'integer',
00076                                                                'default' => 0,
00077                                                                'required' => true ),
00078                                          'data_int2' => array( 'name' => 'DataInt2',
00079                                                                'datatype' => 'integer',
00080                                                                'default' => 0,
00081                                                                'required' => true ),
00082                                          'data_int3' => array( 'name' => 'DataInt3',
00083                                                                'datatype' => 'integer',
00084                                                                'default' => 0,
00085                                                                'required' => true ),
00086                                          'data_float1' => array( 'name' => 'DataFloat1',
00087                                                                  'datatype' => 'float',
00088                                                                  'default' => 0,
00089                                                                  'required' => true ),
00090                                          'data_float2' => array( 'name' => 'DataFloat2',
00091                                                                  'datatype' => 'float',
00092                                                                  'default' => 0,
00093                                                                  'required' => true ),
00094                                          'data_float3' => array( 'name' => 'DataFloat3',
00095                                                                  'datatype' => 'float',
00096                                                                  'default' => 0,
00097                                                                  'required' => true ),
00098                                          'creator_id' => array( 'name' => 'CreatorID',
00099                                                                 'datatype' => 'integer',
00100                                                                 'default' => 0,
00101                                                                 'required' => true,
00102                                                                 'foreign_class' => 'eZUser',
00103                                                                 'foreign_attribute' => 'contentobject_id',
00104                                                                 'multiplicity' => '1..*' ),
00105                                          'created' => array( 'name' => 'Created',
00106                                                              'datatype' => 'integer',
00107                                                              'default' => 0,
00108                                                              'required' => true ),
00109                                          'modified' => array( 'name' => 'Modified',
00110                                                               'datatype' => 'integer',
00111                                                               'default' => 0,
00112                                                               'required' => true ) ),
00113                       'keys' => array( 'id' ),
00114                       'function_attributes' => array( 'participant' => 'participant' ),
00115                       'increment_key' => 'id',
00116                       'class_name' => 'eZCollaborationSimpleMessage',
00117                       'name' => 'ezcollab_simple_message' );
00118     }
00119 
00120     static function create( $type, $text = false, $creatorID = false )
00121     {
00122         $date_time = time();
00123         if ( $creatorID === false )
00124         {
00125             //include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' );
00126             $user = eZUser::currentUser();
00127             $creatorID = $user->attribute( 'contentobject_id' );
00128         }
00129         return new eZCollaborationSimpleMessage( array( 'message_type' => $type,
00130                                                         'data_text1' => $text,
00131                                                         'creator_id' => $creatorID,
00132                                                         'created' => $date_time,
00133                                                         'modified' => $date_time ) );
00134     }
00135 
00136     static function fetch( $id, $asObject = true )
00137     {
00138         return eZPersistentObject::fetchObject( eZCollaborationSimpleMessage::definition(),
00139                                                 null,
00140                                                 array( "id" => $id ),
00141                                                 $asObject );
00142     }
00143 
00144     function participant()
00145     {
00146         // TODO: Get participant trough participant link from item
00147         return null;
00148     }
00149 
00150     /// \privatesection
00151     public $ID;
00152     public $ParticipantID;
00153     public $Created;
00154     public $Modified;
00155     public $DataText1;
00156     public $DataText2;
00157     public $DataText3;
00158     public $DataInt1;
00159     public $DataInt2;
00160     public $DataInt3;
00161     public $DataFloat1;
00162     public $DataFloat2;
00163     public $DataFloat3;
00164 }
00165 
00166 ?>