From 36165ba32a0e45c3c51e84ad4d94f41c861fa804 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 6 Mar 2011 18:42:08 +0100 Subject: Client und Pool-Controller hinzugefügt && addclientAction hinzugefügt --- application/controllers/PoolController.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 application/controllers/PoolController.php (limited to 'application/controllers/PoolController.php') diff --git a/application/controllers/PoolController.php b/application/controllers/PoolController.php new file mode 100644 index 0000000..795fe3a --- /dev/null +++ b/application/controllers/PoolController.php @@ -0,0 +1,18 @@ + + + + @@ -242,6 +245,15 @@ + + + + + + + + + diff --git a/application/controllers/PoolController.php b/application/controllers/PoolController.php index 795fe3a..f9e54be 100644 --- a/application/controllers/PoolController.php +++ b/application/controllers/PoolController.php @@ -9,6 +9,22 @@ class PoolController extends Zend_Controller_Action } public function indexAction() + { + $poolMapper = new Application_Model_PoolMapper(); + $this->view->pools = $poolMapper->fetchAll(); + } + + public function createpoolAction() + { + // action body + } + + public function deletepoolAction() + { + // action body + } + + public function editpoolAction() { // action body } @@ -16,3 +32,9 @@ class PoolController extends Zend_Controller_Action } + + + + + + diff --git a/application/models/PoolMapper.php b/application/models/PoolMapper.php index f9be34f..e2d351a 100644 --- a/application/models/PoolMapper.php +++ b/application/models/PoolMapper.php @@ -32,13 +32,16 @@ class Application_Model_PoolMapper public function save(Application_Model_Pool $pol) { - $data = array('poolID'=> $pol->getPoolID() ,'title'=> $pol->getTitle() ,'description'=> $pol->getDescription() ,'location'=> $pol->getLocation() ); + $data = array('poolID'=> $pol->getID() , + 'title'=> $pol->getTitle() , + 'description'=> $pol->getDescription() , + 'location'=> $pol->getLocation() ); if (null === ($id = $pol->getID()) ) { - unset($data['polID']); + unset($data['poolID']); $this->getDbTable()->insert($data); } else { - $this->getDbTable()->update($data, array('polID = ?' => $id)); + $this->getDbTable()->update($data, array('poolID = ?' => $id)); } } @@ -47,7 +50,7 @@ class Application_Model_PoolMapper if (null === ($id = $pol->getID()) ) { return; } else { - $this->getDbTable()->delete(array('polID = ?' => $id)); + $this->getDbTable()->delete(array('poolID = ?' => $id)); } } @@ -60,7 +63,7 @@ class Application_Model_PoolMapper $row = $result->current(); - $pol->setPoolID($row->poolID)->setTitle($row->title)->setDescription($row->description)->setLocation($row->location); + $pol->setID($row->poolID)->setTitle($row->title)->setDescription($row->description)->setLocation($row->location); } public function fetchAll() @@ -70,7 +73,7 @@ class Application_Model_PoolMapper foreach ($resultSet as $row) { $entry = new Application_Model_Pool(); - $entry->setPoolID($row->poolID)->setTitle($row->title)->setDescription($row->description)->setLocation($row->location); + $entry->setID($row->poolID)->setTitle($row->title)->setDescription($row->description)->setLocation($row->location); $entries[] = $entry; } diff --git a/application/views/scripts/pool/createpool.phtml b/application/views/scripts/pool/createpool.phtml new file mode 100644 index 0000000..3d7f8ca --- /dev/null +++ b/application/views/scripts/pool/createpool.phtml @@ -0,0 +1 @@ +

View script for controller Pool and script/action name createpool
\ No newline at end of file diff --git a/application/views/scripts/pool/deletepool.phtml b/application/views/scripts/pool/deletepool.phtml new file mode 100644 index 0000000..622e663 --- /dev/null +++ b/application/views/scripts/pool/deletepool.phtml @@ -0,0 +1 @@ +

View script for controller Pool and script/action name deletepool
\ No newline at end of file diff --git a/application/views/scripts/pool/editpool.phtml b/application/views/scripts/pool/editpool.phtml new file mode 100644 index 0000000..c70464e --- /dev/null +++ b/application/views/scripts/pool/editpool.phtml @@ -0,0 +1 @@ +

View script for controller Pool and script/action name editpool
\ No newline at end of file diff --git a/application/views/scripts/pool/index.phtml b/application/views/scripts/pool/index.phtml index 5266a4e..989cf41 100644 --- a/application/views/scripts/pool/index.phtml +++ b/application/views/scripts/pool/index.phtml @@ -1 +1,36 @@ -

View script for controller Pool and script/action name index
\ No newline at end of file +

Pools

+ +pools): ?> + + + + + + + + + + pools as $pool): ?> + + + + + + + + +
poolIDTitleDescriptionLocation
escape($pool->getID()) ?>escape($pool->getTitle()) ?>escape($pool->getDescription()) ?>escape($pool->getLocation()) ?>remove pool
+ + + + +

There are no pools to display.

+ + diff --git a/pbs-data.sql b/pbs-data.sql index e3cef5f..1aec562 100644 --- a/pbs-data.sql +++ b/pbs-data.sql @@ -44,3 +44,7 @@ INSERT INTO `pbs_client` (`clientID`, `macadress`, `hardwarehash`) VALUES (9, '24:64:26:9a:92:90', '695610ee509c060b1fca9c8011529af4'), (10, '84:34:26:9a:92:90', 'a3562c8cad2a4fa4fc11656025dc911b'); +INSERT INTO `pbs`.`pbs_pool` (`poolID`, `title`, `description`, `location`) VALUES +(NULL, 'Pool 1', 'Description 1', 'Keller'), +(NULL, 'Pool 2', 'Description 2', 'Keller'); + -- cgit v1.2.3-55-g7522