[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Created on: <08-Nov-2005 13:06:15 dl> 4 // 5 // SOFTWARE NAME: eZ publish 6 // SOFTWARE RELEASE: 3.9.0 7 // BUILD VERSION: 17785 8 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 9 // SOFTWARE LICENSE: GNU General Public License v2.0 10 // NOTICE: > 11 // This program is free software; you can redistribute it and/or 12 // modify it under the terms of version 2.0 of the GNU General 13 // Public License as published by the Free Software Foundation. 14 // 15 // This program is distributed in the hope that it will be useful, 16 // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 // GNU General Public License for more details. 19 // 20 // You should have received a copy of version 2.0 of the GNU General 21 // Public License along with this program; if not, write to the Free 22 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 23 // MA 02110-1301, USA. 24 // 25 // 26 27 /*! \file currencylist.php 28 */ 29 30 include_once ( 'kernel/common/template.php' ); 31 include_once ( 'kernel/classes/ezpreferences.php' ); 32 include_once ( 'kernel/shop/classes/ezcurrencydata.php' ); 33 include_once ( 'kernel/shop/classes/ezshopfunctions.php' ); 34 35 $module =& $Params['Module']; 36 $offset =& $Params['Offset']; 37 38 $error = false; 39 40 if ( $module->hasActionParameter( 'Offset' ) ) 41 { 42 $offset = $module->actionParameter( 'Offset' ); 43 } 44 45 if ( $module->isCurrentAction( 'NewCurrency' ) ) 46 { 47 $module->redirectTo( $module->functionURI( 'editcurrency' ) ); 48 } 49 else if ( $module->isCurrentAction( 'RemoveCurrency' ) ) 50 { 51 $currencyList = $module->hasActionParameter( 'DeleteCurrencyList' ) ? $module->actionParameter( 'DeleteCurrencyList' ) : array(); 52 53 eZShopFunctions::removeCurrency( $currencyList ); 54 55 include_once ( 'kernel/classes/ezcontentcachemanager.php' ); 56 eZContentCacheManager::clearAllContentCache(); 57 } 58 else if ( $module->isCurrentAction( 'ApplyChanges' ) ) 59 { 60 $updateDataList = $module->hasActionParameter( 'CurrencyList' ) ? $module->actionParameter( 'CurrencyList' ) : array(); 61 62 $currencyList = eZCurrencyData::fetchList(); 63 $db =& eZDB::instance(); 64 $db->begin(); 65 foreach ( $currencyList as $currency ) 66 { 67 $currencyCode = $currency->attribute( 'code' ); 68 if ( isset( $updateDataList[$currencyCode] ) ) 69 { 70 $updateData = $updateDataList[$currencyCode]; 71 72 if ( isset( $updateData['status'] ) ) 73 $currency->setStatus( $updateData['status'] ); 74 75 if ( is_numeric( $updateData['custom_rate_value'] ) ) 76 $currency->setAttribute( 'custom_rate_value', $updateData['custom_rate_value'] ); 77 else if ( $updateData['custom_rate_value'] == '' ) 78 $currency->setAttribute( 'custom_rate_value', 0 ); 79 80 if ( is_numeric( $updateData['rate_factor'] ) ) 81 $currency->setAttribute( 'rate_factor', $updateData['rate_factor'] ); 82 else if ( $updateData['rate_factor'] == '' ) 83 $currency->setAttribute( 'rate_factor', 0 ); 84 85 $currency->sync(); 86 } 87 } 88 $db->commit(); 89 90 $error = array( 'code' => 0, 91 'description' => ezi18n( 'kernel/shop', 'Changes were stored successfully.' ) ); 92 } 93 else if ( $module->isCurrentAction( 'UpdateAutoprices' ) ) 94 { 95 $error = eZShopFunctions::updateAutoprices(); 96 97 include_once ( 'kernel/classes/ezcontentcachemanager.php' ); 98 eZContentCacheManager::clearAllContentCache(); 99 } 100 else if ( $module->isCurrentAction( 'UpdateAutoRates' ) ) 101 { 102 $error = eZShopFunctions::updateAutoRates(); 103 } 104 105 if ( $error !== false ) 106 { 107 if ( $error['code'] != 0 ) 108 $error['style'] = 'message-error'; 109 else 110 $error['style'] = 'message-feedback'; 111 } 112 113 switch ( eZPreferences::value( 'currencies_list_limit' ) ) 114 { 115 case '2': { $limit = 25; } break; 116 case '3': { $limit = 50; } break; 117 default: { $limit = 10; } break; 118 } 119 120 // fetch currencies 121 $currencyList = eZCurrencyData::fetchList( null, true, $offset, $limit ); 122 $currencyCount = eZCurrencyData::fetchListCount(); 123 124 $viewParameters = array( 'offset' => $offset ); 125 126 $tpl =& templateInit(); 127 128 $tpl->setVariable( 'currency_list', $currencyList ); 129 $tpl->setVariable( 'currency_list_count', $currencyCount ); 130 $tpl->setVariable( 'limit', $limit ); 131 $tpl->setVariable( 'view_parameters', $viewParameters ); 132 $tpl->setVariable( 'show_error_message', $error !== false ); 133 $tpl->setVariable( 'error', $error ); 134 135 $Result = array(); 136 $Result['path'] = array( array( 'text' => ezi18n( 'kernel/shop', 'Available currency list' ), 137 'url' => false ) ); 138 $Result['content'] =& $tpl->fetch( "design:shop/currencylist.tpl" ); 139 140 141 142 ?>
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 |