[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/setup/steps/ -> ezstep_site_templates.php (source)

   1  <?php
   2  //
   3  // Definition of eZStepSiteTemplates class
   4  //
   5  // Created on: <12-Aug-2003 15:14:42 kk>
   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 ezstep_site_templates.php
  30  */
  31  include_once ( 'kernel/setup/steps/ezstep_installer.php');
  32  include_once ( "kernel/common/i18n.php" );
  33  
  34  /*!
  35    \class eZStepSiteTemplates ezstep_site_templates.php
  36    \brief The class eZStepSiteTemplates does
  37  
  38  */
  39  
  40  class eZStepSiteTemplates extends eZStepInstaller
  41  {
  42      /*!
  43       Constructor
  44      */
  45      function eZStepSiteTemplates( &$tpl, &$http, &$ini, &$persistenceList )
  46      {
  47          $this->eZStepInstaller( $tpl, $http, $ini, $persistenceList,
  48                                  'site_templates', 'Site templates' );
  49      }
  50  
  51      /*!
  52       \reimp
  53       */
  54      function processPostData()
  55      {
  56          // set template and template thumbnail
  57          $config =& eZINI::instance( 'setup.ini' );
  58          $thumbnailBase = $config->variable( 'SiteTemplates', 'ThumbnailBase' );
  59          $thumbnailExtension = $config->variable( 'SiteTemplates', 'ThumbnailExtension' );
  60  
  61          if ( $this->Http->hasPostVariable( 'eZSetup_site_templates' ) )
  62          {
  63              $siteTemplates = $this->Http->postVariable( 'eZSetup_site_templates' );
  64              $this->PersistenceList['site_templates']['count'] = count( $siteTemplates );
  65  
  66              $siteTemplatesCount = 0;
  67              foreach ( $siteTemplates as $key => $template )
  68              {
  69                  if ( !isset( $template['checked'] ) or
  70                       $template['checked'] != $template['identifier'] )
  71                      continue;
  72                  $this->PersistenceList['site_templates_' . $siteTemplatesCount]['identifier'] = $template['identifier'];
  73                  $this->PersistenceList['site_templates_' . $siteTemplatesCount]['name'] = $template['name'];
  74                  $this->PersistenceList['site_templates_' . $siteTemplatesCount]['image_file_name'] = $template['image'];
  75                  ++$siteTemplatesCount;
  76              }
  77              if ( $siteTemplatesCount == 0)
  78              {
  79                  $this->ErrorMsg = ezi18n( 'design/standard/setup/init',
  80                                            'No templates choosen.' );
  81                  return false;
  82              }
  83              $this->PersistenceList['site_templates']['count'] = $siteTemplatesCount;
  84          }
  85          else
  86          {
  87              $this->ErrorMsg = ezi18n( 'design/standard/setup/init',
  88                                        'No templates choosen.' );
  89              return false;
  90          }
  91          return true;
  92      }
  93  
  94      /*!
  95       \reimp
  96       */
  97      function init()
  98      {
  99          return false; // Always show site template selection
 100      }
 101  
 102      /*!
 103       \reimp
 104      */
 105      function &display()
 106      {
 107          // Get site templates from setup.ini
 108          $config =& eZINI::instance( 'setup.ini' );
 109          $thumbnailBase = $config->variable( 'SiteTemplates', 'ThumbnailBase' );
 110          $thumbnailExtension = $config->variable( 'SiteTemplates', 'ThumbnailExtension' );
 111  
 112          $site_templates = array();
 113  
 114          include_once ( 'kernel/classes/ezpackage.php' );
 115  
 116          $packages = eZPackage::fetchPackages( array( 'path' => 'kernel/setup/packages' ) );
 117          for ( $key = 0; $key < count( $packages ); ++$key )
 118          {
 119              $package =& $packages[$key];
 120              $site_templates[$key]['name'] = $package->attribute( 'summary' );
 121              $site_templates[$key]['identifier'] = $package->attribute( 'name' );
 122              $thumbnails = $package->thumbnailList( 'default' );
 123              if ( count( $thumbnails ) > 0 )
 124                  $site_templates[$key]['image_file_name'] = $package->fileItemPath( $thumbnails[0], 'default', 'kernel/setup/packages' );
 125              else
 126                  $site_templates[$key]['image_file_name'] = false;
 127          }
 128  
 129          $this->Tpl->setVariable( 'site_templates', $site_templates );
 130          $this->Tpl->setVariable( 'error', $this->Error );
 131  
 132          // Return template and data to be shown
 133          $result = array();
 134          // Display template
 135          $result['content'] = $this->Tpl->fetch( 'design:setup/init/site_templates.tpl' );
 136          $result['path'] = array( array( 'text' => ezi18n( 'design/standard/setup/init',
 137                                                            'Site template selection' ),
 138                                          'url' => false ) );
 139          return $result;
 140  
 141      }
 142  
 143      var $Error = 0;
 144  }
 145  
 146  ?>


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