Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezcontentobjectedithandler.php
Go to the documentation of this file.
1 <?php
18 class eZContentObjectEditHandler
19 {
23 function fetchInput( $http, &$module, &$class, $object, &$version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage )
24 {
25 }
26
30 static function storeActionList()
31 {
32 return array();
33 }
34
38 function publish( $contentObjectID, $contentObjectVersion )
39 {
40 }
41
48 function validateInput( $http, &$module, &$class, $object, &$version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage, $validationParameters )
49 {
50 $result = array( 'is_valid' => true, 'warnings' => array() );
51
52 return $result;
53 }
54
59 static function initialize()
60 {
61 $contentINI = eZINI::instance( 'content.ini' );
62 foreach( array_unique( $contentINI->variable( 'EditSettings', 'ExtensionDirectories' ) ) as $extensionDirectory )
63 {
64 $fileName = eZExtension::baseDirectory() . '/' . $extensionDirectory . '/content/' . $extensionDirectory . 'handler.php';
65 if ( file_exists( $fileName ) )
66 {
67 include_once( $fileName );
68 $className = $extensionDirectory . 'Handler';
69 $storeActionList = call_user_func_array( array( $className, 'storeActionList' ), array() );
70 foreach( $storeActionList as $storeAction )
71 {
72 eZContentObjectEditHandler::addStoreAction( $storeAction );
73 }
74 }
75 else
76 {
77 eZDebug::writeError( 'Cound not find content object edit handler ( defined in content.ini ) : ' . $fileName );
78 }
79 }
80 }
81
86 static function executeHandlerFunction( $functionName, $params )
87 {
88 $result = array();
89 $contentINI = eZINI::instance( 'content.ini' );
90 foreach( array_unique( $contentINI->variable( 'EditSettings', 'ExtensionDirectories' ) ) as $extensionDirectory )
91 {
92 $fileName = eZExtension::baseDirectory() . '/' . $extensionDirectory . '/content/' . $extensionDirectory . 'handler.php';
93 if ( file_exists( $fileName ) )
94 {
95 include_once( $fileName );
96 $className = $extensionDirectory . 'Handler';
97 $inputHandler = new $className();
98 $functionResult = call_user_func_array( array( $inputHandler, $functionName ), $params );
99 $result[] = array( 'handler' => $className,
100 'function' => array( 'name' => $functionName, 'value' => $functionResult ) );
101 }
102 }
103
104 return $result;
105 }
106
111 static function executeInputHandlers( &$module, &$class, $object, &$version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage )
112 {
113 $http = eZHTTPTool::instance();
114 $functionName = 'fetchInput';
115 $params = array( $http,
116 &$module,
117 &$class,
118 $object,
119 &$version,
120 $contentObjectAttributes,
121 $editVersion,
122 $editLanguage,
123 $fromLanguage );
124
125 self::executeHandlerFunction( $functionName, $params );
126 }
127
132 static function executePublish( $contentObjectID, $contentObjectVersion )
133 {
134 $functionName = 'publish';
135 $params = array( $contentObjectID, $contentObjectVersion );
136
137 self::executeHandlerFunction( $functionName, $params );
138 }
139
144 static function validateInputHandlers( &$module, &$class, $object, &$version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage, $validationParameters )
145 {
146 $result = array( 'validated' => true, 'warnings' => array() );
147 $validated =& $result['validated'];
148 $warnings =& $result['warnings'];
149
150 $http = eZHTTPTool::instance();
151
152 $functionName = 'validateInput';
153 $params = array( $http,
154 &$module,
155 &$class,
156 $object,
157 &$version,
158 $contentObjectAttributes,
159 $editVersion,
160 $editLanguage,
161 $fromLanguage,
162 $validationParameters );
163
164 $validationResults = self::executeHandlerFunction( $functionName, $params );
165
166 foreach( $validationResults as $validationResult )
167 {
168 $value = $validationResult['function']['value'];
169
170 if ( $value['is_valid'] == false )
171 {
172 if ( $value['warnings'] )
173 $warnings = array_merge( $warnings, $value['warnings'] );
174
175 $validated = false;
176 }
177 }
178
179 return $result;
180 }
181
188 static function addStoreAction( $name )
189 {
190 if ( !isset( $GLOBALS['eZContentObjectEditHandler_StoreAction'] ) )
191 {
192 $GLOBALS['eZContentObjectEditHandler_StoreAction'] = array();
193 }
194 $GLOBALS['eZContentObjectEditHandler_StoreAction'][] = $name;
195 }
196
201 static function isStoreAction()
202 {
203 if ( !isset( $GLOBALS['eZContentObjectEditHandler_StoreAction'] ) )
204 return 0;
205 return count( array_intersect( array_keys( $_POST ), $GLOBALS['eZContentObjectEditHandler_StoreAction'] ) ) > 0;
206 }
207 }
208
209 ?>
eZContentObjectEditHandler
The class eZContentObjectEditHandler provides a framework for handling content/edit view specific thi...
Definition: ezcontentobjectedithandler.php:19
eZContentObjectEditHandler\isStoreAction
static isStoreAction()
Definition: ezcontentobjectedithandler.php:201
eZContentObjectEditHandler\initialize
static initialize()
Definition: ezcontentobjectedithandler.php:59
eZContentObjectEditHandler\executePublish
static executePublish( $contentObjectID, $contentObjectVersion)
Definition: ezcontentobjectedithandler.php:132
eZContentObjectEditHandler\fetchInput
fetchInput( $http, &$module, &$class, $object, &$version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage)
Definition: ezcontentobjectedithandler.php:23
eZContentObjectEditHandler\addStoreAction
static addStoreAction( $name)
Definition: ezcontentobjectedithandler.php:188
eZContentObjectEditHandler\publish
publish( $contentObjectID, $contentObjectVersion)
Definition: ezcontentobjectedithandler.php:38
eZContentObjectEditHandler\storeActionList
static storeActionList()
Definition: ezcontentobjectedithandler.php:30
eZContentObjectEditHandler\executeInputHandlers
static executeInputHandlers(&$module, &$class, $object, &$version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage)
Definition: ezcontentobjectedithandler.php:111
eZContentObjectEditHandler\validateInput
validateInput( $http, &$module, &$class, $object, &$version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage, $validationParameters)
Definition: ezcontentobjectedithandler.php:48
eZContentObjectEditHandler\executeHandlerFunction
static executeHandlerFunction( $functionName, $params)
Definition: ezcontentobjectedithandler.php:86
eZContentObjectEditHandler\validateInputHandlers
static validateInputHandlers(&$module, &$class, $object, &$version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage, $validationParameters)
Definition: ezcontentobjectedithandler.php:144
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZExtension\baseDirectory
static baseDirectory(eZINI|null $siteINI=null)
Definition: ezextension.php:39
eZHTTPTool\instance
static instance()
Definition: ezhttptool.php:189
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.