*/ /** * Klasa stNavigationBackendActions * * @package stNavigationPlugin * @subpackage actions */ class stNavigationBackendActions extends stAdminGeneratorActions { /** * Wyświetla konfigurację modułu */ public function executeIndex() { $i18n = $this->getContext()->getI18N(); $this->config = stConfig::getInstance($this->getContext(), array('culture' => $this->getRequestParameter('culture', stLanguage::getOptLanguage()))); if ($this->getRequest()->getMethod() == sfRequest::POST) { $req = $this->getRequestParameter('navigation'); foreach (array( 'view_type', 'bar', 'navigation', 'historyOn', 'history', 'history_link', 'history_products', 'decrease', 'decrease_last', 'decrease_length','history_box', 'history_box_limit',) as $param) $this->config->set(@$param, @$req[@$param]); $this->config->set('navigation_start_name', @$req['navigation_start_name'], true); $this->config->save(); stFastCacheManager::clearCache(); $this->setFlash('notice', $i18n->__('Twoje zmiany zostały zapisane', null, 'stAdminGeneratorPlugin')); } $i18n = $this->getContext()->getI18N(); $this->getBreadcrumbs()->add($i18n->__('Konfiguracja', null, 'stAdminGeneratorPlugin')); } public function validateIndex() { if ($this->getRequest()->getMethod() == sfRequest::POST && !stTheme::hideOldConfiguration()) { stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), $this->getModuleName()); } return true; } /** * Akcja w przypadku błędu w uzupełnianiu pól */ public function handleErrorIndex() { $i18n = $this->getContext()->getI18N(); $this->config = stConfig::getInstance($this->getContext()); $this->labels = array( 'navigation{history_products}' => $i18n->__('Ilość ostatnio oglądanych produktów'), 'navigation{decrease_length}' => $i18n->__('Ilość znaków po obcięciu'), 'navigation{history_box_limit}' => $i18n->__('Ilość wyświetlanych produktów w boksie'), 'navigation{navigation_start_name}' => $i18n->__('Nazwa pierwszego elementu')); $i18n = $this->getContext()->getI18N(); $this->getBreadcrumbs()->add($i18n->__('Konfiguracja', null, 'stAdminGeneratorPlugin')); return sfView::SUCCESS; } protected function getBreadcrumbs(){ if (null === $this->breadcrumbs){ $i18n = $this->getContext()->getI18N(); $this->breadcrumbs = parent::getBreadcrumbs(); $this->breadcrumbs->add($i18n->__('Nawigacja'), '@stNavigationPlugin'); } return $this->breadcrumbs; } }