getContext()->getI18N(); $this->labels = $this->getLabels(); $current = sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.sfConfig::get('sf_web_dir_name'); $filename = $current.'/favicon.ico'; if (file_exists($filename)) { $this->favicon_exists = true; } else { $this->favicon_exists = false; } if ($this->favicon_exists == false){ $notice = ''.$i18n->__('Wejdź na stronę')." ".$i18n->__(' i utwórz swoją ikonę favicon..').''; $this->setFlash("info", $notice, false); } if ($this->getRequest()->getMethod() == sfRequest::POST) { $favicon = $this->getRequest()->getFileName('favicon'); if (!empty($favicon)) { $this->getRequest()->moveFile('favicon', $filename); stFastCacheManager::clearCache(); $this->setFlash('notice', $i18n->__('Twoje zmiany zostały zapisane', null, 'stAdminGeneratorPlugin')); } $this->redirect('appFaviconBackend/index'); } $this->getBreadcrumbs()->add($i18n->__('Konfiguracja', null, 'stAdminGeneratorPlugin')); } public function validateIndex() { $i18n = $this->getContext()->getI18N(); $this->labels = $this->getLabels(); $request = $this->getRequest(); if ($request->getMethod() == sfRequest::POST) { return true; } return!$request->hasErrors(); } public function handleErrorIndex() { $current = sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.sfConfig::get('sf_web_dir_name'); $filename = $current.'/favicon.ico'; if (file_exists($filename)) { $this->favicon_exists = 1; } return sfView::SUCCESS; } protected function getLabels() { $current = sfConfig::get('sf_root_dir').DIRECTORY_SEPARATOR.sfConfig::get('sf_web_dir_name'); $filename = $current.'/favicon.ico'; if (file_exists($filename)) { return array( 'favicon' => 'Zmień favicon', ); } else { return array( 'favicon' => 'Dodaj favicon', ); } } protected function getBreadcrumbs(){ if (null === $this->breadcrumbs){ $i18n = $this->getContext()->getI18N(); $this->breadcrumbs = parent::getBreadcrumbs(); $this->breadcrumbs->add($i18n->__('Favicon'), '@appFaviconPlugin'); } return $this->breadcrumbs; } }