| [ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZStepSitePackages class 4 // 5 // Created on: <16-Apr-2004 10:53:35 amos> 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 include_once ( 'kernel/setup/steps/ezstep_installer.php'); 30 include_once ( "kernel/common/i18n.php" ); 31 32 /*! 33 \class eZStepSitePackages ezstep_site_packages.php 34 \brief The class eZStepSitePackages does 35 36 */ 37 38 class eZStepSitePackages extends eZStepInstaller 39 { 40 /*! 41 Constructor 42 */ 43 function eZStepSitePackages( &$tpl, &$http, &$ini, &$persistenceList ) 44 { 45 $this->eZStepInstaller( $tpl, $http, $ini, $persistenceList, 46 'site_packages', 'Site packages' ); 47 } 48 49 /*! 50 \reimp 51 */ 52 function processPostData() 53 { 54 if ( $this->Http->hasPostVariable( 'eZSetup_site_packages' ) ) 55 { 56 $sitePackages = $this->Http->postVariable( 'eZSetup_site_packages' ); 57 $this->PersistenceList['site_packages'] = $sitePackages; 58 59 if ( $this->Http->hasPostVariable( 'AdditionalPackages' ) ) 60 { 61 $this->PersistenceList['additional_packages'] = $this->Http->postVariable( 'AdditionalPackages' ); 62 } 63 else 64 { 65 $this->PersistenceList['additional_packages'] = array(); 66 } 67 } 68 else 69 { 70 $this->ErrorMsg = ezi18n( 'design/standard/setup/init', 71 'No packages choosen.' ); 72 return false; 73 } 74 return true; 75 } 76 77 /*! 78 \reimp 79 */ 80 function init() 81 { 82 if ( $this->hasKickstartData() ) 83 { 84 $data = $this->kickstartData(); 85 86 $siteTypes = $this->chosenSiteTypes(); 87 $siteType = $siteTypes[0]['identifier']; 88 89 $typeFunctionality = eZSetupFunctionality( $siteType ); 90 $requiredPackageList = $typeFunctionality['required']; 91 $requiredPackages = array(); 92 foreach ( $requiredPackageList as $requiredPackage ) 93 { 94 $requiredPackages[] = strtolower( $requiredPackage ); 95 } 96 $this->PersistenceList['site_packages'] = $requiredPackages; 97 98 $additionalPackages = $data['Packages']; 99 foreach ( $additionalPackages as $key => $additionalPackage ) 100 { 101 $additionalPackages[$key] = strtolower( $additionalPackage ); 102 } 103 $this->PersistenceList['additional_packages'] = $additionalPackages; 104 105 if ( ( count( $requiredPackages ) + count( $additionalPackages ) ) > 0 ) 106 { 107 return $this->kickstartContinueNextStep(); 108 } 109 } 110 111 $this->ErrorMsg = false; 112 return false; // Always show site package selection 113 } 114 115 /*! 116 \reimp 117 */ 118 function &display() 119 { 120 $siteTypes = $this->chosenSiteTypes(); 121 $siteType = $siteTypes[0]['identifier']; 122 123 $typeFunctionality = eZSetupFunctionality( $siteType ); 124 $requiredPackageList = $typeFunctionality['required']; 125 $requiredPackages = array(); 126 foreach ( $requiredPackageList as $requiredPackage ) 127 { 128 $requiredPackages[] = strtolower( $requiredPackage ); 129 } 130 131 include_once ( 'kernel/classes/ezpackage.php' ); 132 $packageArray = eZPackage::fetchPackages( array( 'repository_id' => 'addons' ) ); 133 134 $requiredPackageInfoArray = array(); 135 $packageInfoArray = array(); 136 foreach ( $packageArray as $package ) 137 { 138 if ( in_array( strtolower( $package->attribute( 'name' ) ), $requiredPackages ) ) 139 { 140 $requiredPackageInfoArray[] = array( 'identifier' => $package->attribute( 'name' ), 141 'name' => $package->attribute( 'summary' ), 142 'description' => $package->attribute( 'description' ) ); 143 } 144 else 145 { 146 $packageInfoArray[] = array( 'identifier' => $package->attribute( 'name' ), 147 'name' => $package->attribute( 'summary' ), 148 'description' => $package->attribute( 'description' ) ); 149 } 150 } 151 152 $recommended = array(); 153 if ( isset( $typeFunctionality['recommended'] ) ) 154 $recommended = $typeFunctionality['recommended']; 155 156 if ( isset( $this->PersistenceList['additional_packages'] ) ) 157 $recommended = array_unique( array_merge( $recommended, 158 $this->PersistenceList['additional_packages'] ) ); 159 160 $this->Tpl->setVariable( 'site_types', $siteTypes ); 161 $this->Tpl->setVariable( 'recommended_package_array', $recommended ); 162 $this->Tpl->setVariable( 'error', $this->ErrorMsg ); 163 $this->Tpl->setVariable( 'required_package_array', $requiredPackageInfoArray ); 164 $this->Tpl->setVariable( 'package_array', $packageInfoArray ); 165 166 // Return template and data to be shown 167 $result = array(); 168 // Display template 169 $result['content'] = $this->Tpl->fetch( 'design:setup/init/site_packages.tpl' ); 170 $result['path'] = array( array( 'text' => ezi18n( 'design/standard/setup/init', 171 'Site functionality' ), 172 'url' => false ) ); 173 return $result; 174 175 } 176 177 var $Error = 0; 178 } 179 180 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |