eZ Publish  [4.0]
ezworkflowgrouplink.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZContentClass class
00004 //
00005 //
00006 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00007 // SOFTWARE NAME: eZ Publish
00008 // SOFTWARE RELEASE: 4.0.x
00009 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00010 // SOFTWARE LICENSE: GNU General Public License v2.0
00011 // NOTICE: >
00012 //   This program is free software; you can redistribute it and/or
00013 //   modify it under the terms of version 2.0  of the GNU General
00014 //   Public License as published by the Free Software Foundation.
00015 //
00016 //   This program is distributed in the hope that it will be useful,
00017 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 //   GNU General Public License for more details.
00020 //
00021 //   You should have received a copy of version 2.0 of the GNU General
00022 //   Public License along with this program; if not, write to the Free
00023 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00024 //   MA 02110-1301, USA.
00025 //
00026 //
00027 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00028 //
00029 
00030 //!! eZKernel
00031 //! The class eZWorkflowGroupLink
00032 /*!
00033 
00034 */
00035 
00036 //include_once( "lib/ezdb/classes/ezdb.php" );
00037 //include_once( "kernel/classes/ezpersistentobject.php" );
00038 //include_once( "kernel/classes/ezworkflowgroup.php" );
00039 
00040 class eZWorkflowGroupLink extends eZPersistentObject
00041 {
00042     function eZWorkflowGroupLink( $row )
00043     {
00044         $this->eZPersistentObject( $row );
00045     }
00046 
00047     static function definition()
00048     {
00049         return array( "fields" => array( "workflow_id" => array( 'name' => "WorkflowID",
00050                                                                  'datatype' => 'integer',
00051                                                                  'default' => 0,
00052                                                                  'required' => true,
00053                                                                  'foreign_class' => 'eZWorkflow',
00054                                                                  'foreign_attribute' => 'id',
00055                                                                  'multiplicity' => '1..*' ),
00056                                          "workflow_version" => array( 'name' => "WorkflowVersion",
00057                                                                       'datatype' => 'integer',
00058                                                                       'default' => 0,
00059                                                                       'required' => true ),
00060                                          "group_id" => array( 'name' => "GroupID",
00061                                                               'datatype' => 'integer',
00062                                                               'default' => 0,
00063                                                               'required' => true,
00064                                                               'foreign_class' => 'eZWorkflowGroup',
00065                                                               'foreign_attribute' => 'id',
00066                                                               'multiplicity' => '1..*' ),
00067                                          "group_name" => array( 'name' => "GroupName",
00068                                                                 'datatype' => 'string',
00069                                                                 'default' => '',
00070                                                                 'required' => true ) ),
00071                       "keys" => array( "workflow_id", "workflow_version", "group_id" ),
00072                       "class_name" => "eZWorkflowGroupLink",
00073                       "sort" => array( "workflow_id" => "asc" ),
00074                       "name" => "ezworkflow_group_link" );
00075     }
00076 
00077     static function create( $workflow_id, $workflow_version, $group_id, $group_name )
00078     {
00079         $row = array("workflow_id" => $workflow_id,
00080                      "workflow_version" => $workflow_version,
00081                      "group_id" => $group_id,
00082                      "group_name" => $group_name);
00083         return new eZWorkflowGroupLink( $row );
00084     }
00085 
00086     /*!
00087      \note Transaction unsafe. If you call several transaction unsafe methods you must enclose
00088      the calls within a db transaction; thus within db->begin and db->commit.
00089      */
00090     static function removeByID( $workflow_id, $workflow_version, $group_id )
00091     {
00092         eZPersistentObject::removeObject( eZWorkflowGroupLink::definition(),
00093                                           array("workflow_id" => $workflow_id,
00094                                                 "workflow_version" =>$workflow_version,
00095                                                 "group_id" => $group_id ) );
00096     }
00097 
00098     /*!
00099      \note Transaction unsafe. If you call several transaction unsafe methods you must enclose
00100      the calls within a db transaction; thus within db->begin and db->commit.
00101      */
00102     static function removeGroupMembers( $group_id )
00103     {
00104         eZPersistentObject::removeObject( eZWorkflowGroupLink::definition(),
00105                                           array( "group_id" => $group_id ) );
00106     }
00107 
00108     /*!
00109      \note Transaction unsafe. If you call several transaction unsafe methods you must enclose
00110      the calls within a db transaction; thus within db->begin and db->commit.
00111      */
00112     static function removeWorkflowMembers( $workflow_id, $workflow_version )
00113     {
00114         eZPersistentObject::removeObject( eZWorkflowGroupLink::definition(),
00115                                           array( "workflow_id" =>$workflow_id,
00116                                                  "workflow_version" =>$workflow_version ) );
00117     }
00118 
00119     static function fetch( $workflow_id, $workflow_version, $group_id, $asObject = true )
00120     {
00121         return eZPersistentObject::fetchObject( eZWorkflowGroupLink::definition(),
00122                                                 null,
00123                                                 array("workflow_id" => $workflow_id,
00124                                                       "workflow_version" =>$workflow_version,
00125                                                       "group_id" => $group_id ),
00126                                                 $asObject );
00127     }
00128 
00129     static function fetchWorkflowList( $workflow_version, $group_id, $asObject = true )
00130     {
00131         return eZPersistentObject::fetchObjectList( eZWorkflowGroupLink::definition(),
00132                                                     null,
00133                                                     array( "workflow_version" =>$workflow_version,
00134                                                            "group_id" => $group_id ),
00135                                                     null,
00136                                                     null,
00137                                                     $asObject);
00138     }
00139 
00140     static function fetchGroupList( $workflow_id, $workflow_version, $asObject = true )
00141     {
00142         return eZPersistentObject::fetchObjectList( eZWorkflowGroupLink::definition(),
00143                                                     null,
00144                                                     array( "workflow_id" => $workflow_id,
00145                                                            "workflow_version" =>$workflow_version ),
00146                                                     null,
00147                                                     null,
00148                                                     $asObject);
00149     }
00150 
00151     /// \privatesection
00152     public $WorkflowID;
00153     public $WorkflowVersion;
00154     public $GroupID;
00155     public $GroupName;
00156 }
00157 
00158 ?>