*/ /** * Akcje komponentu currency * * @package stCurrencyPlugin * @subpackage actions */ class stCurrencyFrontendComponents extends sfComponents { /** * Funkcja wyświetlenia componentu do zmiany waluty */ public function executePickCurrency() { if ($this->getUser()->getParameter('hide', false, 'soteshop/stCurrencyPlugin')) { return sfView::NONE; } $config = stConfig::getInstance('stProduct'); if ($config->get('hide_price') || $this->hasFlash('stCurrency-hide_list')) { return sfView::NONE; } $currencies = CurrencyPeer::doSelectActive(); if (!$currencies || count($currencies) == 1) { return sfView::NONE; } $smarty = new stSmarty('stCurrencyFrontend'); $selected = stCurrency::getInstance($this->getContext())->get(); if ($this->getController()->getTheme()->getVersion() < 7) { $this->currencies = array(); foreach ($currencies as $currency) { $this->currencies[$currency->getId()] = $currency->getShortcut(); } $this->selected = $selected->getId(); $this->smarty = $smarty; } else { sfLoader::loadHelpers(array('Helper', 'stUrl')); $smarty->assign('currencies', $currencies); $smarty->assign('selected', $selected); $smarty->register_function('url_for_currency', array('stCurrencyFrontendComponents', 'urlForCurrency')); return $smarty; } } public static function urlForCurrency($params) { return st_url_for('@stCurrencyFrontend?action=change¤cy='.$params['currency']->getId()); } }