2010-07-21 12:44:01 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @copyright Copyright (c) 2010, The volkszaehler.org project
|
2010-07-22 18:37:14 +02:00
|
|
|
* @package default
|
2010-07-21 12:44:01 +02:00
|
|
|
* @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
|
2010-07-22 16:21:26 +02:00
|
|
|
*/
|
|
|
|
/*
|
2010-07-21 12:44:01 +02:00
|
|
|
* This file is part of volkzaehler.org
|
2010-06-08 15:39:31 +02:00
|
|
|
*
|
2010-07-21 12:44:01 +02:00
|
|
|
* volkzaehler.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* volkzaehler.org is distributed in the hope that it will be useful,
|
2010-06-08 15:39:31 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2010-07-21 12:44:01 +02:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2010-06-08 15:39:31 +02:00
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2010-07-21 12:44:01 +02:00
|
|
|
* along with volkszaehler.org. If not, see <http://www.gnu.org/licenses/>.
|
2010-06-08 15:39:31 +02:00
|
|
|
*/
|
|
|
|
|
2010-07-18 17:12:00 +02:00
|
|
|
namespace Volkszaehler\Controller;
|
|
|
|
|
2010-07-21 12:44:01 +02:00
|
|
|
/**
|
|
|
|
* group controller
|
|
|
|
*
|
2010-07-22 11:13:11 +02:00
|
|
|
* @author Steffen Vogel (info@steffenvogel.de)
|
2010-07-22 18:37:14 +02:00
|
|
|
* @package default
|
2010-07-21 12:44:01 +02:00
|
|
|
*/
|
2010-07-22 16:10:08 +02:00
|
|
|
class GroupController extends Controller {
|
2010-07-22 11:13:11 +02:00
|
|
|
|
2010-07-21 12:44:01 +02:00
|
|
|
/**
|
2010-07-22 11:13:11 +02:00
|
|
|
*
|
2010-07-21 12:44:01 +02:00
|
|
|
*/
|
2010-07-09 23:50:20 +02:00
|
|
|
public function get() {
|
|
|
|
// TODO get groups from entitymanager according to API specs
|
2010-07-22 11:13:11 +02:00
|
|
|
|
2010-07-09 23:50:20 +02:00
|
|
|
foreach ($groups as $group) {
|
|
|
|
$this->view->addGroup($group);
|
|
|
|
}
|
|
|
|
}
|
2010-07-22 11:13:11 +02:00
|
|
|
|
2010-07-21 12:44:01 +02:00
|
|
|
/**
|
2010-07-22 11:13:11 +02:00
|
|
|
*
|
2010-07-21 12:44:01 +02:00
|
|
|
*/
|
2010-06-08 15:39:31 +02:00
|
|
|
public function add() {
|
2010-06-09 19:34:29 +02:00
|
|
|
$group = new Group();
|
2010-07-22 11:13:11 +02:00
|
|
|
|
2010-07-18 17:12:00 +02:00
|
|
|
$group->name = $this->view->request->getParameter('name');
|
|
|
|
$group->description = $this->view->request->getParameter('description');
|
2010-07-22 11:13:11 +02:00
|
|
|
|
2010-07-18 17:12:00 +02:00
|
|
|
$this->em->persist($group);
|
|
|
|
$this->em->flush();
|
2010-07-22 11:13:11 +02:00
|
|
|
|
2010-07-18 17:12:00 +02:00
|
|
|
$this->view->add($group);
|
2010-06-08 15:39:31 +02:00
|
|
|
}
|
2010-07-22 11:13:11 +02:00
|
|
|
|
2010-07-21 12:44:01 +02:00
|
|
|
/**
|
|
|
|
* @todo authentification/indentification
|
|
|
|
*/
|
2010-06-08 15:39:31 +02:00
|
|
|
public function delete() {
|
2010-07-18 17:12:00 +02:00
|
|
|
$group = Group::getByUuid($this->view->request->getParameter('ugid'));
|
2010-07-22 11:13:11 +02:00
|
|
|
|
2010-07-18 17:12:00 +02:00
|
|
|
$this->em->remove($group);
|
|
|
|
$this->em->flush();
|
2010-06-08 15:39:31 +02:00
|
|
|
}
|
2010-07-22 11:13:11 +02:00
|
|
|
|
2010-07-21 12:44:01 +02:00
|
|
|
/**
|
|
|
|
* edit group properties
|
2010-07-22 11:13:11 +02:00
|
|
|
*
|
2010-07-21 12:44:01 +02:00
|
|
|
* @todo implement Controller\Group::edit()
|
|
|
|
*/
|
2010-07-09 23:50:20 +02:00
|
|
|
public function edit() {
|
2010-07-21 12:44:01 +02:00
|
|
|
|
|
|
|
}
|
2010-06-08 15:39:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|