File modules/cms/action/folder/FolderCreatelinkAction.class.php
Last commit: Sat Mar 6 03:42:38 2021 +0100 Jan Dankert New: Better permission checks.
1 <?php 2 namespace cms\action\folder; 3 use cms\action\FolderAction; 4 use cms\action\Method; 5 use cms\model\BaseObject; 6 use cms\model\Link; 7 use cms\model\Permission; 8 use language\Messages; 9 10 11 class FolderCreatelinkAction extends FolderAction implements Method { 12 13 public function getRequiredPermission() { 14 return Permission::ACL_CREATE_LINK; 15 } 16 17 18 19 public function view() { 20 $this->setTemplateVar('objectid' ,$this->folder->objectid ); 21 } 22 23 24 public function post() { 25 $name = $this->request->getText('name'); 26 $description = $this->request->getText('description'); 27 28 $link = new Link(); 29 $link->filename = BaseObject::urlify( $name ); 30 $link->parentid = $this->folder->objectid; 31 32 $link->linkedObjectId = $this->request->getText('targetobjectid'); 33 $link->projectid = $this->folder->projectid; 34 35 $link->persist(); 36 $link->setNameForAllLanguages( $name,$description ); 37 38 $this->addNoticeFor( $link, Messages::ADDED); 39 $this->setTemplateVar('objectid',$link->objectid); 40 41 $this->folder->setTimestamp(); 42 } 43 }
Downloadmodules/cms/action/folder/FolderCreatelinkAction.class.php
History Sat, 6 Mar 2021 03:42:38 +0100 Jan Dankert New: Better permission checks. 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.