コード例 #1
0
ファイル: LanguageForm.php プロジェクト: ngukho/ducbui-cms
 /**
  *  this helper renders a language selector
  *  it also processes the selected language
  *  it must be rendered above the content in order for the current
  *  content to reflect the language selection
  */
 public function languageForm()
 {
     //process form if this is a post back
     if (Digitalus_Filter_Post::has('setLang')) {
         Digitalus_Language::setLanguage($_POST['language']);
         // @todo: this needs to redirect so it loads the whole page in the new language
     }
     $currentLanguage = Digitalus_Language::getLanguage();
     $languageSelector = $this->view->selectLanguage('language', $currentLanguage);
     $xhtml = '<form action="' . $this->view->ModuleAction() . '" method="post">';
     $xhtml .= '<p>' . $languageSelector . '</p>';
     $xhtml .= '<p>' . $this->view->formSubmit('setLang', $this->view->getTranslation('Set Language')) . '</p>';
     $xhtml .= '</form>';
     return $xhtml;
 }