File modules/cms/action/object/ObjectNameAction.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\object; 3 use cms\action\Method; 4 use cms\action\ObjectAction; 5 use cms\model\Language; 6 use cms\model\Permission; 7 use language\Messages; 8 use util\exception\ValidationException; 9 10 11 class ObjectNameAction extends ObjectAction implements Method { 12 public function view() { 13 $name = $this->baseObject->getNameForLanguage( $this->request->getLanguageId() ); 14 15 $nameProps = $name->getProperties(); 16 17 $language = new Language( $name->languageid ); 18 $language->load(); 19 $nameProps[ 'languageName' ] = $language->name; 20 $this->setTemplateVars( $nameProps ); 21 } 22 23 24 public function post() { 25 $name = $this->baseObject->getNameForLanguage( $this->request->getLanguageId() ); 26 27 $this->request->handleText('name',function($value) use ($name) { 28 $name->name = $value; 29 }); 30 31 $this->request->handleText('description',function($value) use ($name) { 32 $name->description = $value; 33 }); 34 35 $name->persist(); 36 37 $this->addNoticeFor($this->baseObject, Messages::SAVED); 38 } 39 40 41 /** 42 * @return int Permission-flag. 43 */ 44 public function getRequiredPermission() { 45 return Permission::ACL_WRITE; 46 } 47 }
Download modules/cms/action/object/ObjectNameAction.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, 3 Dec 2021 23:27:44 +0100 dankert New: Only allowed methods are shown in the dropdown menu; Some security enhancements. 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.