eZ Publish  [trunk]
ezdiffcontent.php
Go to the documentation of this file.
00001 <?php
00002 /**
00003  * File containing the eZDiffContent class.
00004  *
00005  * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
00006  * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
00007  * @version //autogentag//
00008  * @package lib
00009  */
00010 
00011 /*!
00012   \class eZDiffContent ezdiffcontent.php
00013   \ingroup eZDiff
00014   \brief eZDiff provides an interface for accessing changes in an eZContentObject
00015 
00016   eZDiffContent holds container structures for viewing and accessing detected differences
00017   in an eZContentObject. This is an abstract class.
00018 */
00019 
00020 class eZDiffContent
00021 {
00022     /*!
00023       \public
00024       Return the set of changes.
00025     */
00026     function getChanges()
00027     {
00028         return $this->Changeset;
00029     }
00030 
00031     /*!
00032       \public
00033       Returns the old stored content
00034     */
00035     function getOldContent()
00036     {
00037         return $this->OldContent;
00038     }
00039 
00040     /*!
00041       \public
00042       Returns the new stored content
00043     */
00044     function getNewContent()
00045     {
00046         return $this->NewContent;
00047     }
00048 
00049     /*!
00050       \public
00051       Sets the old stored content
00052     */
00053     function setOldContent( $data )
00054     {
00055         $this->OldContent = $data;
00056     }
00057 
00058     /*!
00059       \public
00060       Sets the new stored content
00061     */
00062     function setNewContent( $data )
00063     {
00064         $this->NewContent = $data;
00065     }
00066 
00067     /*!
00068       \public
00069       Set the changeset array
00070     */
00071     function setChanges( $data )
00072     {
00073         $this->Changeset = $data;
00074     }
00075 
00076 
00077     function attributes()
00078     {
00079         return array( 'changes',
00080                       'old_content',
00081                       'new_content' );
00082     }
00083 
00084     function hasAttribute( $name )
00085     {
00086         return in_array( $name, $this->attributes() );
00087     }
00088 
00089     function attribute( $attrName )
00090     {
00091         switch ( $attrName )
00092         {
00093             case 'changes':
00094             {
00095                 return $this->getChanges();
00096             }break;
00097 
00098             case 'old_content':
00099             {
00100                 return $this->getOldContent();
00101             }break;
00102 
00103             case 'new_content':
00104             {
00105                 return $this->getNewContent();
00106             }break;
00107 
00108             default:
00109             {
00110                 eZDebug::writeError( "Attribute '$attrName' does not exist", 'eZDiffContent' );
00111                 return null;
00112             }break;
00113         }
00114     }
00115 
00116     /// \privatesection
00117     /// The set of detected changes
00118     public $Changeset;
00119 
00120     /// Old Object
00121     public $OldContent;
00122 
00123     /// New Object
00124     public $NewContent;
00125 }
00126 ?>