[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/common/ -> ezpackageoperator.php (source)

   1  <?php
   2  //
   3  // Definition of eZPackageoperator class
   4  //
   5  // Created on: <16-Oct-2003 10:51:28 wy>
   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 ezpackageoperator.php
  30  */
  31  
  32  /*!
  33    \class eZPackageOperator ezpackageoperator.php
  34    \brief The class eZPackageOperator does
  35  
  36  */
  37  
  38  class eZPackageOperator
  39  {
  40      /*!
  41       Constructor
  42      */
  43      function eZPackageOperator( $name = 'ezpackage' )
  44      {
  45          $this->Operators = array( $name );
  46      }
  47  
  48      /*!
  49       Returns the operators in this class.
  50      */
  51      function &operatorList()
  52      {
  53          return $this->Operators;
  54      }
  55  
  56      /*!
  57       See eZTemplateOperator::namedParameterList()
  58      */
  59      function namedParameterList()
  60      {
  61          return array( 'class' => array( 'type' => 'string',
  62                                          'required' => true,
  63                                          'default' => false ),
  64                        'data' => array( 'type' => 'string',
  65                                         'required' => false,
  66                                         'default' => false ) );
  67      }
  68  
  69      /*!
  70       \reimp
  71      */
  72      function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters )
  73      {
  74          $package =& $operatorValue;
  75          $class = $namedParameters['class'];
  76          switch ( $class )
  77          {
  78              case 'thumbnail':
  79              {
  80                  if ( get_class( $operatorValue ) == 'ezpackage' )
  81                  {
  82                      if ( !is_array( $fileList = $operatorValue->fileList( 'default' ) ) )
  83                          $fileList = array();
  84                      foreach ( array_keys( $fileList ) as $key )
  85                      {
  86                          $file =& $fileList[$key];
  87                          $fileType = $file["type"];
  88                          if ( $fileType == 'thumbnail' )
  89                          {
  90                              $operatorValue = $operatorValue->fileItemPath( $file, 'default' );
  91                              return;
  92                          }
  93                      }
  94                      $operatorValue = false;
  95                  }
  96              } break;
  97  
  98              case 'filepath':
  99              {
 100                  if ( get_class( $operatorValue ) == 'ezpackage' )
 101                  {
 102                      $variableName = $namedParameters['data'];
 103                      $fileList = $operatorValue->fileList( 'default' );
 104                      foreach ( array_keys( $fileList ) as $key )
 105                      {
 106                          $file =& $fileList[$key];
 107                          $fileIdentifier = $file["variable-name"];
 108                          if ( $fileIdentifier == $variableName )
 109                          {
 110                              $operatorValue = $operatorValue->fileItemPath( $file, 'default' );
 111                              return;
 112                          }
 113                      }
 114                      $tpl->error( $operatorName,
 115                                   "No filepath found for variable $variableName in package " . $package->attribute( 'name' ) );
 116                      $operatorValue = false;
 117                  }
 118              } break;
 119  
 120              case 'fileitempath':
 121              {
 122                  if ( get_class( $operatorValue ) == 'ezpackage' )
 123                  {
 124                      $fileItem = $namedParameters['data'];
 125                      $operatorValue = $operatorValue->fileItemPath( $fileItem, 'default' );
 126                  }
 127              } break;
 128  
 129              case 'documentpath':
 130              {
 131                  if ( get_class( $package ) == 'ezpackage' )
 132                  {
 133                      $documentName = $namedParameters['data'];
 134                      $documentList = $package->attribute( 'documents' );
 135                      foreach ( array_keys( $documentList ) as $key )
 136                      {
 137                          $document =& $documentList[$key];
 138                          $name = $document["name"];
 139                          if ( $name == $documentName )
 140                          {
 141                              $documentFilePath = $package->path() . '/' . eZPackage::documentDirectory() . '/' . $document['name'];
 142                              $operatorValue = $documentFilePath;
 143                              return;
 144                          }
 145                      }
 146                      $tpl->error( $operatorName,
 147                                   "No documentpath found for document $documentName in package " . $package->attribute( 'name' ) );
 148                      $operatorValue = false;
 149                  }
 150              } break;
 151  
 152              case 'dirpath':
 153              {
 154                  $dirPath = $operatorValue->currentRepositoryPath() . "/" . $operatorValue->attribute( 'name' );
 155                  $operatorValue = $dirPath;
 156              } break;
 157  
 158              default:
 159                  $tpl->error( $operatorName, "Unknown package operator name: '$class'" );
 160              break;
 161          }
 162      }
 163      /// \privatesection
 164      var $Operators;
 165  };
 166  
 167  ?>


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