File modules/cms/action/language/LanguagePropAction.class.php
Last commit: Wed Mar 9 13:28:52 2022 +0100 dankert Refactoring: Checkbox values are always sent to the server. In the actions we must test the value with 'isTrue()'
1 <?php 2 namespace cms\action\language; 3 use cms\action\Action; 4 use cms\action\LanguageAction; 5 use cms\action\Method; 6 use cms\base\Configuration; 7 use language\Messages; 8 9 10 class LanguagePropAction extends LanguageAction implements Method { 11 12 public function view() { 13 $this->setTemplateVar('isocode' ,$this->language->isoCode ); 14 $this->setTemplateVar('name' ,$this->language->name ); 15 $this->setTemplateVar('is_default',$this->language->isDefault ); 16 } 17 18 19 public function post() { 20 21 if ( $name = $this->request->getText('name') ) 22 { 23 $this->language->name = $name; 24 $this->language->isoCode = $this->request->getText('isocode'); 25 } 26 else 27 { 28 $countries = Configuration::subset('countries'); 29 $iso = $this->request->getText('isocode'); 30 $this->language->name = $countries->get($iso,$iso); 31 $this->language->isoCode = strtolower( $iso ); 32 } 33 34 if ( $this->request->isTrue('is_default') ) 35 $this->language->setDefault(); 36 37 $this->language->save(); 38 39 $this->addNoticeFor($this->language,Messages::DONE); 40 } 41 }
Downloadmodules/cms/action/language/LanguagePropAction.class.php
History Wed, 9 Mar 2022 13:28:52 +0100 dankert Refactoring: Checkbox values are always sent to the server. In the actions we must test the value with 'isTrue()' Fri, 26 Feb 2021 01:06:01 +0100 Jan Dankert Refactoring accessing the request parameter values. Thu, 19 Nov 2020 14:49:58 +0100 Jan Dankert Fix: Action::addNotice() is replaced by Action::addNoticeFor() Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.