00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Install_Block_Locale extends Mage_Install_Block_Abstract
00035 {
00036
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setTemplate('install/locale.phtml');
00041 }
00042
00043
00044
00045
00046
00047
00048 public function getLocale()
00049 {
00050 $locale = $this->getData('locale');
00051 if (is_null($locale)) {
00052 $locale = Mage::app()->getLocale()->getLocale();
00053 $this->setData('locale', $locale);
00054 }
00055 return $locale;
00056 }
00057
00058
00059
00060
00061
00062
00063 public function getPostUrl()
00064 {
00065 return $this->getCurrentStep()->getNextUrl();
00066
00067 }
00068
00069
00070
00071
00072
00073
00074 public function getChangeUrl()
00075 {
00076 return $this->getUrl('*/*/localeChange');
00077 }
00078
00079
00080
00081
00082
00083
00084 public function getLocaleSelect()
00085 {
00086 $html = $this->getLayout()->createBlock('core/html_select')
00087 ->setName('config[locale]')
00088 ->setId('locale')
00089 ->setTitle(Mage::helper('install')->__('Locale'))
00090 ->setClass('required-entry')
00091 ->setValue($this->getLocale()->__toString())
00092 ->setOptions(Mage::app()->getLocale()->getTranslatedOptionLocales())
00093 ->getHtml();
00094 return $html;
00095 }
00096
00097
00098
00099
00100
00101
00102 public function getTimezoneSelect()
00103 {
00104 $html = $this->getLayout()->createBlock('core/html_select')
00105 ->setName('config[timezone]')
00106 ->setId('timezone')
00107 ->setTitle(Mage::helper('install')->__('Time Zone'))
00108 ->setClass('required-entry')
00109 ->setValue($this->getTimezone())
00110 ->setOptions(Mage::app()->getLocale()->getOptionTimezones())
00111 ->getHtml();
00112 return $html;
00113 }
00114
00115
00116
00117
00118
00119
00120 public function getTimezone()
00121 {
00122 $timezone = Mage::getSingleton('install/session')->getTimezone()
00123 ? Mage::getSingleton('install/session')->getTimezone()
00124 : Mage::app()->getLocale()->getTimezone();
00125 if ($timezone == Mage_Core_Model_Locale::DEFAULT_TIMEZONE) {
00126 $timezone = 'America/Los_Angeles';
00127 }
00128 return $timezone;
00129 }
00130
00131
00132
00133
00134
00135
00136 public function getCurrencySelect()
00137 {
00138 $html = $this->getLayout()->createBlock('core/html_select')
00139 ->setName('config[currency]')
00140 ->setId('currency')
00141 ->setTitle(Mage::helper('install')->__('Default Currency'))
00142 ->setClass('required-entry')
00143 ->setValue($this->getCurrency())
00144 ->setOptions(Mage::app()->getLocale()->getOptionCurrencies())
00145 ->getHtml();
00146 return $html;
00147 }
00148
00149
00150
00151
00152
00153
00154 public function getCurrency()
00155 {
00156 return Mage::getSingleton('install/session')->getCurrency()
00157 ? Mage::getSingleton('install/session')->getCurrency()
00158 : Mage::app()->getLocale()->getCurrency();
00159 }
00160
00161 public function getFormData()
00162 {
00163 $data = $this->getData('form_data');
00164 if (is_null($data)) {
00165 $data = new Varien_Object();
00166 $this->setData('form_data', $data);
00167 }
00168 return $data;
00169 }
00170
00171 }