eZ Publish  [4.0]
ezworkflowgroup.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZWorkflowGroup class
00004 //
00005 // Created on: <16-Apr-2002 11:08:14 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 /*!
00032  \class eZWorkflowGroup ezworkflowgroup.php
00033  \brief Handles grouping of workflows
00034 
00035 */
00036 
00037 //include_once( "kernel/classes/ezpersistentobject.php" );
00038 
00039 class eZWorkflowGroup extends eZPersistentObject
00040 {
00041     function eZWorkflowGroup( $row )
00042     {
00043         $this->eZPersistentObject( $row );
00044     }
00045 
00046     static function definition()
00047     {
00048         return array( "fields" => array( "id" => array( 'name' => 'ID',
00049                                                         'datatype' => 'integer',
00050                                                         'default' => 0,
00051                                                         'required' => true ),
00052                                          "name" => array( 'name' => "Name",
00053                                                           'datatype' => 'string',
00054                                                           'default' => '',
00055                                                           'required' => true,
00056                                                           'max_length' => 255 ),
00057                                          "creator_id" => array( 'name' => "CreatorID",
00058                                                                 'datatype' => 'integer',
00059                                                                 'default' => 0,
00060                                                                 'required' => true,
00061                                                                 'foreign_class' => 'eZUser',
00062                                                                  'foreign_attribute' => 'contentobject_id',
00063                                                                  'multiplicity' => '1..*' ),
00064                                          "modifier_id" => array( 'name' => "ModifierID",
00065                                                                  'datatype' => 'integer',
00066                                                                  'default' => 0,
00067                                                                  'required' => true,
00068                                                                  'foreign_class' => 'eZUser',
00069                                                                  'foreign_attribute' => 'contentobject_id',
00070                                                                  'multiplicity' => '1..*' ),
00071                                          "created" => array( 'name' => "Created",
00072                                                              'datatype' => 'integer',
00073                                                              'default' => 0,
00074                                                              'required' => true ),
00075                                          "modified" => array( 'name' => "Modified",
00076                                                               'datatype' => 'integer',
00077                                                               'default' => 0,
00078                                                               'required' => true ) ),
00079                       "keys" => array( "id" ),
00080                       'function_attributes' => array( 'creator' => 'creator',
00081                                                       'modifier' => 'modifier' ),
00082                       "increment_key" => "id",
00083                       "class_name" => "eZWorkflowGroup",
00084                       "sort" => array( "name" => "asc" ),
00085                       "name" => "ezworkflow_group" );
00086     }
00087 
00088     static function create( $user_id )
00089     {
00090         $date_time = time();
00091         $row = array(
00092             "id" => null,
00093             "name" => "",
00094             "creator_id" => $user_id,
00095             "modifier_id" => $user_id,
00096             "created" => $date_time,
00097             "modified" => $date_time );
00098         return new eZWorkflowGroup( $row );
00099     }
00100 
00101     static function fetch( $id, $asObject = true )
00102     {
00103         return eZPersistentObject::fetchObject( eZWorkflowGroup::definition(),
00104                                                 null,
00105                                                 array( "id" => $id ),
00106                                                 $asObject );
00107     }
00108 
00109     static function fetchList( $asObject = true )
00110     {
00111         return eZPersistentObject::fetchObjectList( eZWorkflowGroup::definition(),
00112                                                     null, null, null, null,
00113                                                     $asObject );
00114     }
00115 
00116     /*!
00117      \note Transaction unsafe. If you call several transaction unsafe methods you must enclose
00118      the calls within a db transaction; thus within db->begin and db->commit.
00119      */
00120     static function removeSelected ( $id )
00121     {
00122         eZPersistentObject::removeObject( eZWorkflowGroup::definition(),
00123                                           array( "id" => $id ) );
00124     }
00125 
00126     function creator()
00127     {
00128         if ( isset( $this->CreatorID ) and $this->CreatorID )
00129         {
00130             //include_once( "kernel/classes/datatypes/ezuser/ezuser.php" );
00131             return eZUser::fetch( $this->CreatorID );
00132         }
00133         return null;
00134     }
00135 
00136     function modifier()
00137     {
00138         if ( isset( $this->ModifierID ) and $this->ModifierID )
00139         {
00140             //include_once( "kernel/classes/datatypes/ezuser/ezuser.php" );
00141             return eZUser::fetch( $this->ModifierID );
00142         }
00143         return null;
00144     }
00145 
00146     /// \privatesection
00147     public $ID;
00148     public $Name;
00149     public $CreatorID;
00150     public $ModifierID;
00151     public $Created;
00152     public $Modified;
00153 }
00154 
00155 ?>