[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/classes/ -> ezcontentobjectedithandler.php (source)

   1  <?php
   2  //
   3  // Definition of eZContentObjectEditHandler class
   4  //
   5  // Created on: <20-Dec-2005 14:19:36 hovik>
   6  //
   7  // SOFTWARE NAME: eZ publish
   8  // SOFTWARE RELEASE: 3.9.0
   9  // BUILD VERSION: 17785
  10  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  11  // SOFTWARE LICENSE: GNU General Public License v2.0
  12  // NOTICE: >
  13  //   This program is free software; you can redistribute it and/or
  14  //   modify it under the terms of version 2.0  of the GNU General
  15  //   Public License as published by the Free Software Foundation.
  16  //
  17  //   This program is distributed in the hope that it will be useful,
  18  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20  //   GNU General Public License for more details.
  21  //
  22  //   You should have received a copy of version 2.0 of the GNU General
  23  //   Public License along with this program; if not, write to the Free
  24  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25  //   MA 02110-1301, USA.
  26  //
  27  //
  28  
  29  /*! \file ezcontentobjectedithandler.php
  30  */
  31  
  32  /*!
  33    \class eZContentObjectEditHandler ezcontentobjectedithandler.php
  34    \brief The class eZContentObjectEditHandler provides a framework for handling
  35    content/edit view specific things in extensions.
  36  
  37  */
  38  
  39  class eZContentObjectEditHandler
  40  {
  41      /*!
  42       Constructor
  43      */
  44      function eZContentObjectEditHandler()
  45      {
  46      }
  47  
  48      /*!
  49       \abstract
  50  
  51       Override this function in the extension to handle edit input parameters.
  52      */
  53      function fetchInput( &$http, &$module, &$class, &$object, &$version, &$contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage )
  54      {
  55      }
  56  
  57      /*!
  58       \abstract
  59  
  60       Return list of HTTP postparameters which should trigger store action.
  61      */
  62      function storeActionList()
  63      {
  64      }
  65  
  66      /*!
  67       \abstract
  68  
  69       Do content object publish operations.
  70      */
  71      function publish( $contentObjectID, $contentObjectVersion )
  72      {
  73      }
  74  
  75      /*!
  76       \static
  77       Initialize all extension input handler.
  78      */
  79      function initialize()
  80      {
  81          $contentINI = eZINI::instance( 'content.ini' );
  82          foreach( $contentINI->variable( 'EditSettings', 'ExtensionDirectories' ) as $extensionDirectory )
  83          {
  84              $fileName = eZExtension::baseDirectory() . '/' . $extensionDirectory . '/content/' . $extensionDirectory . 'handler.php';
  85              if ( file_exists( $fileName ) )
  86              {
  87                  include_once( $fileName );
  88                  $className = $extensionDirectory . 'Handler';
  89                  $storeActionList = call_user_func_array( array( $className, 'storeActionList' ), array() );
  90                  foreach( $storeActionList as $storeAction )
  91                  {
  92                      eZContentObjectEditHandler::addStoreAction( $storeAction );
  93                  }
  94              }
  95              else
  96              {
  97                  eZDebug::writeError( 'Cound not find content object edit handler ( defined in content.ini ) : ' . $fileName );
  98              }
  99          }
 100      }
 101  
 102      /*!
 103       \static
 104       Calls all extension object edit input handler, and executes this the fetchInput function
 105      */
 106      function executeInputHandlers( &$module, &$class, &$object, &$version, &$contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage )
 107      {
 108          $http =& eZHTTPTool::instance();
 109          $contentINI = eZINI::instance( 'content.ini' );
 110          foreach( $contentINI->variable( 'EditSettings', 'ExtensionDirectories' ) as $extensionDirectory )
 111          {
 112              $fileName = eZExtension::baseDirectory() . '/' . $extensionDirectory . '/content/' . $extensionDirectory . 'handler.php';
 113              if ( file_exists( $fileName ) )
 114              {
 115                  include_once( $fileName );
 116                  $className = $extensionDirectory . 'Handler';
 117                  $inputHandler = new $className();
 118                  call_user_func_array( array( $inputHandler, 'fetchInput' ),
 119                                        array( &$http, &$module, &$class, &$object, &$version, &$contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage ) );
 120              }
 121          }
 122      }
 123  
 124      /*!
 125       \static
 126       Calls all publish functions.
 127      */
 128      function executePublish( $contentObjectID, $contentObjectVersion )
 129      {
 130          $contentINI = eZINI::instance( 'content.ini' );
 131          foreach( $contentINI->variable( 'EditSettings', 'ExtensionDirectories' ) as $extensionDirectory )
 132          {
 133              $fileName = eZExtension::baseDirectory() . '/' . $extensionDirectory . '/content/' . $extensionDirectory . 'handler.php';
 134              if ( file_exists( $fileName ) )
 135              {
 136                  include_once( $fileName );
 137                  $className = $extensionDirectory . 'Handler';
 138                  $inputHandler = new $className();
 139                  call_user_func_array( array( $inputHandler, 'publish' ),
 140                                        array( $contentObjectID, $contentObjectVersion ) );
 141              }
 142          }
 143      }
 144  
 145      /*!
 146       \static
 147       Set custom HTTP post parameters which should trigger store acrtions.
 148  
 149       \param HTTP post parameter name
 150      */
 151      function addStoreAction( $name )
 152      {
 153          if ( !isset( $GLOBALS['eZContentObjectEditHandler_StoreAction'] ) )
 154          {
 155              $GLOBALS['eZContentObjectEditHandler_StoreAction'] = array();
 156          }
 157          $GLOBALS['eZContentObjectEditHandler_StoreAction'][] = $name;
 158      }
 159  
 160      /*!
 161       \static
 162       Check if any HTTP input trigger store action
 163      */
 164      function isStoreAction()
 165      {
 166          if ( !isset( $GLOBALS['eZContentObjectEditHandler_StoreAction'] ) )
 167              return 0;
 168          return count( array_intersect( array_keys( $_POST ), $GLOBALS['eZContentObjectEditHandler_StoreAction'] ) ) > 0;
 169      }
 170  }
 171  
 172  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7