[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/classes/notification/ -> eznotificationevent.php (source)

   1  <?php
   2  //
   3  // Definition of eZNotificationEvent class
   4  //
   5  // Created on: <09-May-2003 16:03:28 sp>
   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  /*! \file eznotificationevent.php
  30  */
  31  
  32  /*!
  33    \class eZNotificationEvent eznotificationevent.php
  34    \brief The class eZNotificationEvent does
  35  
  36  */
  37  include_once ( 'kernel/classes/notification/eznotificationeventtype.php' );
  38  include_once ( 'kernel/classes/ezpersistentobject.php' );
  39  
  40  define( 'EZ_NOTIFICATIONEVENT_STATUS_CREATED', 0 );
  41  define( 'EZ_NOTIFICATIONEVENT_STATUS_HANDLED', 1 );
  42  
  43  class eZNotificationEvent extends eZPersistentObject
  44  {
  45      /*!
  46       Constructor
  47      */
  48      function eZNotificationEvent( $row = array() )
  49      {
  50          $this->eZPersistentObject( $row );
  51          $this->TypeString = $this->attribute( 'event_type_string' );
  52      }
  53  
  54      function definition()
  55      {
  56          return array( "fields" => array( "id" => array( 'name' => 'ID',
  57                                                          'datatype' => 'integer',
  58                                                          'default' => 0,
  59                                                          'required' => true ),
  60                                           "status" => array( 'name' => 'Status',
  61                                                              'datatype' => 'integer',
  62                                                              'default' => 0,
  63                                                              'required' => true ),
  64                                           "event_type_string" => array( 'name' => "EventTypeString",
  65                                                                         'datatype' => 'string',
  66                                                                         'default' => '',
  67                                                                         'required' => true ),
  68                                           "data_int1" => array( 'name' => "DataInt1",
  69                                                                 'datatype' => 'integer',
  70                                                                 'default' => 0,
  71                                                                 'required' => true ),
  72                                           "data_int2" => array( 'name' => "DataInt2",
  73                                                                 'datatype' => 'integer',
  74                                                                 'default' => 0,
  75                                                                 'required' => true ),
  76                                           "data_int3" => array( 'name' => "DataInt3",
  77                                                                 'datatype' => 'integer',
  78                                                                 'default' => 0,
  79                                                                 'required' => true ),
  80                                           "data_int4" => array( 'name' => "DataInt4",
  81                                                                 'datatype' => 'integer',
  82                                                                 'default' => 0,
  83                                                                 'required' => true ),
  84                                           "data_text1" => array( 'name' => "DataText1",
  85                                                                  'datatype' => 'text',
  86                                                                  'default' => '',
  87                                                                  'required' => true ),
  88                                           "data_text2" => array( 'name' => "DataText2",
  89                                                                  'datatype' => 'text',
  90                                                                  'default' => '',
  91                                                                  'required' => true ),
  92                                           "data_text3" => array( 'name' => "DataText3",
  93                                                                  'datatype' => 'text',
  94                                                                  'default' => '',
  95                                                                  'required' => true ),
  96                                           "data_text4" => array( 'name' => "DataText4",
  97                                                                  'datatype' => 'text',
  98                                                                  'default' => '',
  99                                                                  'required' => true ) ),
 100                        "keys" => array( "id" ),
 101                        "function_attributes" => array( 'content' => 'content' ),
 102                        "increment_key" => "id",
 103                        "sort" => array( "id" => "asc" ),
 104                        "class_name" => "eZNotificationEvent",
 105                        "name" => "eznotificationevent" );
 106      }
 107  
 108      function create( $type, $params = array() )
 109      {
 110          $row = array(
 111              "id" => null,
 112              'event_type_string' => $type,
 113              'data_int1' => 0,
 114              'data_int2' => 0,
 115              'data_int3' => 0,
 116              'data_int4' => 0,
 117              'data_text1' => '',
 118              'data_text2' => '',
 119              'data_text3' => '',
 120              'data_text4' => '' );
 121          $event = new eZNotificationEvent( $row );
 122          eZDebugSetting::writeDebug( 'kernel-notification', $event, "event" );
 123          $event->initializeEventType( $params );
 124          return $event;
 125      }
 126  
 127      function initializeEventType( $params = array() )
 128      {
 129          $eventType =& $this->eventType();
 130          $eventType->initializeEvent( $this, $params );
 131          eZDebugSetting::writeDebug( 'kernel-notification', $this, 'event after initialization' );
 132      }
 133  
 134      function &eventType()
 135      {
 136          if ( ! isset (  $this->EventType ) )
 137          {
 138              $this->EventType =& eZNotificationEventType::create( $this->TypeString );
 139          }
 140          return $this->EventType;
 141      }
 142  
 143  
 144      /*!
 145       Returns the content for this event.
 146      */
 147      function &content()
 148      {
 149          if ( $this->Content === null )
 150          {
 151              $eventType =& $this->eventType();
 152              $this->Content = $eventType->eventContent( $this );
 153          }
 154          return $this->Content;
 155      }
 156  
 157      /*!
 158       Sets the content for the current event
 159      */
 160      function setContent( $content )
 161      {
 162          $this->Content =& $content;
 163      }
 164  
 165      function fetchList()
 166      {
 167          return eZPersistentObject::fetchObjectList( eZNotificationEvent::definition(),
 168                                                      null,  null, null,null,
 169                                                      true );
 170      }
 171  
 172      function fetch( $eventID )
 173      {
 174          return eZPersistentObject::fetchObject( eZNotificationEvent::definition(),
 175                                                  null,
 176                                                  array( 'id' => $eventID ) );
 177      }
 178  
 179      function fetchUnhandledList()
 180      {
 181          return eZPersistentObject::fetchObjectList( eZNotificationEvent::definition(),
 182                                                      null, array( 'status' => EZ_NOTIFICATIONEVENT_STATUS_CREATED ), null,null,
 183                                                      true );
 184      }
 185  
 186      /*!
 187       \static
 188       Removes all notification events.
 189      */
 190      function cleanup()
 191      {
 192          $db =& eZDB::instance();
 193          $db->query( "DELETE FROM eznotificationevent" );
 194      }
 195  
 196      var $Content = null;
 197  }
 198  
 199  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7