00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class eZContentObjectEditHandler
00042 {
00043
00044
00045
00046 function eZContentObjectEditHandler()
00047 {
00048 }
00049
00050
00051
00052
00053
00054
00055 function fetchInput( &$http, &$module, &$class, &$object, &$version, &$contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage )
00056 {
00057 }
00058
00059
00060
00061
00062
00063
00064 function storeActionList()
00065 {
00066 }
00067
00068
00069
00070
00071
00072
00073 function publish( $contentObjectID, $contentObjectVersion )
00074 {
00075 }
00076
00077
00078
00079
00080
00081 function initialize()
00082 {
00083 $contentINI = eZINI::instance( 'content.ini' );
00084 foreach( array_unique( $contentINI->variable( 'EditSettings', 'ExtensionDirectories' ) ) as $extensionDirectory )
00085 {
00086 $fileName = eZExtension::baseDirectory() . '/' . $extensionDirectory . '/content/' . $extensionDirectory . 'handler.php';
00087 if ( file_exists( $fileName ) )
00088 {
00089 include_once( $fileName );
00090 $className = $extensionDirectory . 'Handler';
00091 $storeActionList = call_user_func_array( array( $className, 'storeActionList' ), array() );
00092 foreach( $storeActionList as $storeAction )
00093 {
00094 eZContentObjectEditHandler::addStoreAction( $storeAction );
00095 }
00096 }
00097 else
00098 {
00099 eZDebug::writeError( 'Cound not find content object edit handler ( defined in content.ini ) : ' . $fileName );
00100 }
00101 }
00102 }
00103
00104
00105
00106
00107
00108 function executeInputHandlers( &$module, &$class, &$object, &$version, &$contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage )
00109 {
00110 $http =& eZHTTPTool::instance();
00111 $contentINI = eZINI::instance( 'content.ini' );
00112 foreach( array_unique( $contentINI->variable( 'EditSettings', 'ExtensionDirectories' ) ) as $extensionDirectory )
00113 {
00114 $fileName = eZExtension::baseDirectory() . '/' . $extensionDirectory . '/content/' . $extensionDirectory . 'handler.php';
00115 if ( file_exists( $fileName ) )
00116 {
00117 include_once( $fileName );
00118 $className = $extensionDirectory . 'Handler';
00119 $inputHandler = new $className();
00120 call_user_func_array( array( $inputHandler, 'fetchInput' ),
00121 array( &$http, &$module, &$class, &$object, &$version, &$contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage ) );
00122 }
00123 }
00124 }
00125
00126
00127
00128
00129
00130 function executePublish( $contentObjectID, $contentObjectVersion )
00131 {
00132 $contentINI = eZINI::instance( 'content.ini' );
00133 foreach( array_unique( $contentINI->variable( 'EditSettings', 'ExtensionDirectories' ) ) as $extensionDirectory )
00134 {
00135 $fileName = eZExtension::baseDirectory() . '/' . $extensionDirectory . '/content/' . $extensionDirectory . 'handler.php';
00136 if ( file_exists( $fileName ) )
00137 {
00138 include_once( $fileName );
00139 $className = $extensionDirectory . 'Handler';
00140 $inputHandler = new $className();
00141 call_user_func_array( array( $inputHandler, 'publish' ),
00142 array( $contentObjectID, $contentObjectVersion ) );
00143 }
00144 }
00145 }
00146
00147
00148
00149
00150
00151
00152
00153 function addStoreAction( $name )
00154 {
00155 if ( !isset( $GLOBALS['eZContentObjectEditHandler_StoreAction'] ) )
00156 {
00157 $GLOBALS['eZContentObjectEditHandler_StoreAction'] = array();
00158 }
00159 $GLOBALS['eZContentObjectEditHandler_StoreAction'][] = $name;
00160 }
00161
00162
00163
00164
00165
00166 function isStoreAction()
00167 {
00168 if ( !isset( $GLOBALS['eZContentObjectEditHandler_StoreAction'] ) )
00169 return 0;
00170 return count( array_intersect( array_keys( $_POST ), $GLOBALS['eZContentObjectEditHandler_StoreAction'] ) ) > 0;
00171 }
00172 }
00173
00174 ?>