GrouplistAction.class.php (1886B)
1 <?php 2 3 namespace cms\action; 4 5 use cms\model\Group; 6 // OpenRat Content Management System 7 // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de 8 // 9 // This program is free software; you can redistribute it and/or 10 // modify it under the terms of the GNU General Public License 11 // as published by the Free Software Foundation; either version 2 12 // of the License, or (at your option) any later version. 13 // 14 // This program is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 // GNU General Public License for more details. 18 // 19 // You should have received a copy of the GNU General Public License 20 // along with this program; if not, write to the Free Software 21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 23 24 /** 25 * Action-Klasse zum Bearbeiten einer Benutzergruppe. 26 * 27 * @author $Author$ 28 * @version $Revision$ 29 * @package openrat.actions 30 */ 31 32 class GrouplistAction extends BaseAction 33 { 34 public $security = Action::SECURITY_ADMIN; 35 36 function __construct() 37 { 38 parent::__construct(); 39 } 40 41 42 /** 43 * Liste aller Gruppen. 44 */ 45 function showView() 46 { 47 $list = array(); 48 49 foreach( Group::getAll() as $id=>$name ) 50 { 51 $list[$id] = array(); 52 $list[$id]['id' ] = $id; 53 $list[$id]['name'] = $name; 54 } 55 56 $this->setTemplateVar('el', $list); 57 } 58 59 60 function editView() 61 { 62 $this->nextSubAction('show'); 63 } 64 65 66 67 function addView() 68 { 69 } 70 71 72 function addPost() 73 { 74 if ( $this->getRequestVar('name') != '') 75 { 76 $this->group = new Group(); 77 $this->group->name = $this->getRequestVar('name'); 78 $this->group->add(); 79 $this->addNotice('group',$this->group->name,'ADDED','ok'); 80 $this->callSubAction('listing'); 81 } 82 else 83 { 84 $this->addValidationError('name'); 85 $this->callSubAction('add'); 86 } 87 } 88 89 90 91 92 }