File modules/cms/action/languagelist/LanguagelistAddAction.class.php
Last commit: Fri Feb 26 01:06:01 2021 +0100 Jan Dankert Refactoring accessing the request parameter values.
1 <?php 2 namespace cms\action\languagelist; 3 use cms\action\LanguagelistAction; 4 use cms\action\Method; 5 use cms\base\Configuration; 6 use cms\model\Language; 7 use language\Messages; 8 9 10 class LanguagelistAddAction extends LanguagelistAction implements Method { 11 public function view() { 12 $countryList = Configuration::subset('countries')->getConfig(); 13 14 foreach( $this->project->getLanguageIds() as $id ) 15 { 16 17 $l = new Language( $id ); 18 $l->load(); 19 20 unset( $countryList[$l->isoCode] ); 21 } 22 23 asort( $countryList ); 24 25 $this->setTemplateVar('isocodes' ,$countryList ); 26 $this->setTemplateVar('isocode' ,'' ); 27 } 28 public function post() { 29 30 $countryList = Configuration::Conf()->get('countries',[]); 31 32 $iso = $this->request->getText('isocode'); 33 $language = new Language(); 34 $language->projectid = $this->project->projectid; 35 $language->isoCode = $iso; 36 $language->name = @$countryList[$iso]; 37 $language->persist(); 38 39 $this->addNoticeFor($language, Messages::ADDED); 40 } 41 }
Downloadmodules/cms/action/languagelist/LanguagelistAddAction.class.php
History Fri, 26 Feb 2021 01:06:01 +0100 Jan Dankert Refactoring accessing the request parameter values. Wed, 18 Nov 2020 01:46:36 +0100 Jan Dankert Refactoring of model classes: New method persist() and some other cleanups. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.