eZ Publish  [4.0]
ezdiffcontent.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZDiffContent class
00004 //
00005 // Created on: <24-Jul-2007 13:45:21 hovik>
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 ezdiffcontent.php
00032   eZDiffContent class
00033 */
00034 
00035 /*!
00036   \class eZDiffContent ezdiffcontent.php
00037   \ingroup eZDiff
00038   \brief eZDiff provides an interface for accessing changes in an eZContentObject
00039 
00040   eZDiffContent holds container structures for viewing and accessing detected differences
00041   in an eZContentObject. This is an abstract class.
00042 */
00043 
00044 class eZDiffContent
00045 {
00046     /*!
00047       \public
00048       Return the set of changes.
00049     */
00050     function getChanges()
00051     {
00052         return $this->Changeset;
00053     }
00054 
00055     /*!
00056       \public
00057       Returns the old stored content
00058     */
00059     function getOldContent()
00060     {
00061         return $this->OldContent;
00062     }
00063 
00064     /*!
00065       \public
00066       Returns the new stored content
00067     */
00068     function getNewContent()
00069     {
00070         return $this->NewContent;
00071     }
00072 
00073     /*!
00074       \public
00075       Sets the old stored content
00076     */
00077     function setOldContent( $data )
00078     {
00079         $this->OldContent = $data;
00080     }
00081 
00082     /*!
00083       \public
00084       Sets the new stored content
00085     */
00086     function setNewContent( $data )
00087     {
00088         $this->NewContent = $data;
00089     }
00090 
00091     /*!
00092       \public
00093       Set the changeset array
00094     */
00095     function setChanges( $data )
00096     {
00097         $this->Changeset = $data;
00098     }
00099 
00100 
00101     function attributes()
00102     {
00103         return array( 'changes',
00104                       'old_content',
00105                       'new_content' );
00106     }
00107 
00108     function hasAttribute( $name )
00109     {
00110         return in_array( $name, $this->attributes() );
00111     }
00112 
00113     function attribute( $attrName )
00114     {
00115         switch ( $attrName )
00116         {
00117             case 'changes':
00118             {
00119                 return $this->getChanges();
00120             }break;
00121 
00122             case 'old_content':
00123             {
00124                 return $this->getOldContent();
00125             }break;
00126 
00127             case 'new_content':
00128             {
00129                 return $this->getNewContent();
00130             }break;
00131 
00132             default:
00133             {
00134                 eZDebug::writeError( "Attribute '$attrName' does not exist", 'eZDiffContent' );
00135                 return null;
00136             }break;
00137         }
00138     }
00139 
00140     /// \privatesection
00141     /// The set of detected changes
00142     public $Changeset;
00143 
00144     /// Old Object
00145     public $OldContent;
00146 
00147     /// New Object
00148     public $NewContent;
00149 }
00150 ?>