From 5688b750744f8568414dc745961747e5629bd194 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 7 Mar 2011 13:57:04 +0100 Subject: Pool actions zum bearbeiten von Pools hinzugefügt --- application/views/scripts/pool/createpool.phtml | 3 ++- application/views/scripts/pool/editpool.phtml | 5 +++- application/views/scripts/pool/index.phtml | 28 +++++++++++++++++++++-- application/views/scripts/pool/linkclient.phtml | 1 + application/views/scripts/pool/unlinkclient.phtml | 1 + 5 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 application/views/scripts/pool/linkclient.phtml create mode 100644 application/views/scripts/pool/unlinkclient.phtml (limited to 'application/views') diff --git a/application/views/scripts/pool/createpool.phtml b/application/views/scripts/pool/createpool.phtml index 3d7f8ca..305b36e 100644 --- a/application/views/scripts/pool/createpool.phtml +++ b/application/views/scripts/pool/createpool.phtml @@ -1 +1,2 @@ -

View script for controller Pool and script/action name createpool
\ No newline at end of file +addpool; diff --git a/application/views/scripts/pool/editpool.phtml b/application/views/scripts/pool/editpool.phtml index c70464e..359a5f9 100644 --- a/application/views/scripts/pool/editpool.phtml +++ b/application/views/scripts/pool/editpool.phtml @@ -1 +1,4 @@ -

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

Edit Pool

+editpoolform; diff --git a/application/views/scripts/pool/index.phtml b/application/views/scripts/pool/index.phtml index 989cf41..1bee0fe 100644 --- a/application/views/scripts/pool/index.phtml +++ b/application/views/scripts/pool/index.phtml @@ -1,5 +1,13 @@

Pools

+create pool + pools): ?> @@ -19,11 +27,27 @@ edit pool + delete pool + remove pool + true) ?>">link client diff --git a/application/views/scripts/pool/linkclient.phtml b/application/views/scripts/pool/linkclient.phtml new file mode 100644 index 0000000..1cc06e4 --- /dev/null +++ b/application/views/scripts/pool/linkclient.phtml @@ -0,0 +1 @@ +

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

View script for controller Pool and script/action name unlinkclient
\ No newline at end of file -- cgit v1.2.3-55-g7522 From 8dcde51a354a3308017564a64ef69e794f430974 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 7 Mar 2011 15:51:56 +0100 Subject: Alle mapper mit findBy(criteria, value) ausgestattet && clients zu pool hinzufügen --- .zfproject.xml | 1 + application/controllers/PoolController.php | 49 ++++++++++++++++++++++++- application/forms/PoolClient.php | 31 ++++++++++++++++ application/models/BootIsoMapper.php | 15 ++++++++ application/models/BootMenuEntriesMapper.php | 15 ++++++++ application/models/BootMenuMapper.php | 15 ++++++++ application/models/BootOsMapper.php | 15 ++++++++ application/models/ClientMapper.php | 18 ++++++++- application/models/ConfigMapper.php | 15 ++++++++ application/models/FilterEntriesMapper.php | 15 ++++++++ application/models/FilterMapper.php | 15 ++++++++ application/models/FilterTypeMapper.php | 15 ++++++++ application/models/GroupGroupsMapper.php | 15 ++++++++ application/models/GroupMapper.php | 15 ++++++++ application/models/GroupRequestMapper.php | 15 ++++++++ application/models/MembershipFiltersMapper.php | 15 ++++++++ application/models/MembershipMapper.php | 15 ++++++++ application/models/PersonMapper.php | 15 ++++++++ application/models/PoolEntriesMapper.php | 15 ++++++++ application/models/PoolFiltersMapper.php | 15 ++++++++ application/models/PoolMapper.php | 16 +++++++- application/models/RightMapper.php | 15 ++++++++ application/models/RightRolesMapper.php | 15 ++++++++ application/models/RoleMapper.php | 15 ++++++++ application/models/RolesMapper.php | 15 ++++++++ application/models/SessionMapper.php | 15 ++++++++ application/views/scripts/pool/linkclient.phtml | 4 +- 27 files changed, 429 insertions(+), 5 deletions(-) create mode 100644 application/forms/PoolClient.php (limited to 'application/views') diff --git a/.zfproject.xml b/.zfproject.xml index b36ab70..417a947 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -91,6 +91,7 @@ + diff --git a/application/controllers/PoolController.php b/application/controllers/PoolController.php index 27e81a3..f4287cb 100644 --- a/application/controllers/PoolController.php +++ b/application/controllers/PoolController.php @@ -12,6 +12,10 @@ class PoolController extends Zend_Controller_Action { $poolMapper = new Application_Model_PoolMapper(); $this->view->pools = $poolMapper->fetchAll(); + + $poolentriesMapper = new Application_Model_PoolEntriesMapper(); + print_a($poolentriesMapper->findBy('poolID',1)); + } public function createpoolAction() @@ -80,8 +84,51 @@ class PoolController extends Zend_Controller_Action public function linkclientAction() { - // action body + if(!isset($_POST['clientID'])){ + print_a($_POST); + $clientmapper = new Application_Model_ClientMapper(); + $clients = $clientmapper->fetchAll(); + foreach($clients as $c){ + #$client = new Application_Model_Client($c); + $clientsArray[] = $c->toArray(); + } + $assignedclientmapper = new Application_Model_PoolEntriesMapper(); + $assignedclients = $assignedclientmapper->fetchAll(); + foreach($assignedclients as $c){ + $assignedclientsArray[] = $c->toArray(); + } + $freeclients = $this->arrayDiff($clientsArray,$assignedclientsArray); + + $poolclient = new Application_Form_PoolClient(array('clients'=> $freeclients)); + $this->view->poolclient = $poolclient; + }else { + #$_POST['poolID'] = $this->_request->getParam('poolID'); + $poolclientform = new Application_Form_PoolClient($_POST); + + try{ + $pool = new Application_Model_PoolEntries($_POST); + $pool->setPoolID($this->_request->getParam('poolID')); + + $poolmapper = new Application_Model_PoolEntriesMapper(); + $poolmapper->save($pool); + $this->_redirect('/pool'); + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + + } } + private function arrayDiff($a, $b){ + foreach($a as $k1 => $i1){ + foreach($b as $k2 => $i2){ + if($i1['clientID'] == $i2['clientID']){ + unset($a[$k1]); + } + } + } + return $a; + } + public function unlinkclientAction() { diff --git a/application/forms/PoolClient.php b/application/forms/PoolClient.php new file mode 100644 index 0000000..7bacae0 --- /dev/null +++ b/application/forms/PoolClient.php @@ -0,0 +1,31 @@ +setName("addClientToPool"); + $this->setMethod('post'); + + $clientfield = $this->createElement('select','clientID'); + $clientfield ->setLabel('Client:'); + foreach($this->clients as $c){ + $clientfield->addMultiOption($c['clientID'],$c['macadress']." - ".$c['hardwarehash']); + } + $this->addElement($clientfield); + + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Save', + )); + } + public function setClients($clients){ + $this->clients = $clients; + return $this; + } + +} + diff --git a/application/models/BootIsoMapper.php b/application/models/BootIsoMapper.php index 0039677..11af0d7 100644 --- a/application/models/BootIsoMapper.php +++ b/application/models/BootIsoMapper.php @@ -5,6 +5,21 @@ class Application_Model_BootIsoMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/BootMenuEntriesMapper.php b/application/models/BootMenuEntriesMapper.php index 632d578..83e00fc 100644 --- a/application/models/BootMenuEntriesMapper.php +++ b/application/models/BootMenuEntriesMapper.php @@ -5,6 +5,21 @@ class Application_Model_BootMenuEntriesMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/BootMenuMapper.php b/application/models/BootMenuMapper.php index 51e85ef..550e956 100644 --- a/application/models/BootMenuMapper.php +++ b/application/models/BootMenuMapper.php @@ -5,6 +5,21 @@ class Application_Model_BootMenuMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/BootOsMapper.php b/application/models/BootOsMapper.php index d4a43af..2f43916 100644 --- a/application/models/BootOsMapper.php +++ b/application/models/BootOsMapper.php @@ -5,6 +5,21 @@ class Application_Model_BootOsMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/ClientMapper.php b/application/models/ClientMapper.php index bf513ea..7016ae7 100644 --- a/application/models/ClientMapper.php +++ b/application/models/ClientMapper.php @@ -5,6 +5,21 @@ class Application_Model_ClientMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { @@ -75,8 +90,7 @@ class Application_Model_ClientMapper $entries[] = $entry; } return $entries; - } - + } } diff --git a/application/models/ConfigMapper.php b/application/models/ConfigMapper.php index 8ee9e0c..dc2a524 100644 --- a/application/models/ConfigMapper.php +++ b/application/models/ConfigMapper.php @@ -5,6 +5,21 @@ class Application_Model_ConfigMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/FilterEntriesMapper.php b/application/models/FilterEntriesMapper.php index 10fd3f1..350f081 100644 --- a/application/models/FilterEntriesMapper.php +++ b/application/models/FilterEntriesMapper.php @@ -5,6 +5,21 @@ class Application_Model_FilterEntriesMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/FilterMapper.php b/application/models/FilterMapper.php index 3960c0d..eba9b71 100644 --- a/application/models/FilterMapper.php +++ b/application/models/FilterMapper.php @@ -5,6 +5,21 @@ class Application_Model_FilterMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/FilterTypeMapper.php b/application/models/FilterTypeMapper.php index 8ed2722..105daf4 100644 --- a/application/models/FilterTypeMapper.php +++ b/application/models/FilterTypeMapper.php @@ -5,6 +5,21 @@ class Application_Model_FilterTypeMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/GroupGroupsMapper.php b/application/models/GroupGroupsMapper.php index 79bf774..d7f5095 100644 --- a/application/models/GroupGroupsMapper.php +++ b/application/models/GroupGroupsMapper.php @@ -5,6 +5,21 @@ class Application_Model_GroupGroupsMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/GroupMapper.php b/application/models/GroupMapper.php index b9c7e30..f48fc5f 100644 --- a/application/models/GroupMapper.php +++ b/application/models/GroupMapper.php @@ -5,6 +5,21 @@ class Application_Model_GroupMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/GroupRequestMapper.php b/application/models/GroupRequestMapper.php index c09e047..aa83095 100644 --- a/application/models/GroupRequestMapper.php +++ b/application/models/GroupRequestMapper.php @@ -5,6 +5,21 @@ class Application_Model_GroupRequestMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/MembershipFiltersMapper.php b/application/models/MembershipFiltersMapper.php index e894c82..353eea1 100644 --- a/application/models/MembershipFiltersMapper.php +++ b/application/models/MembershipFiltersMapper.php @@ -5,6 +5,21 @@ class Application_Model_MembershipFiltersMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/MembershipMapper.php b/application/models/MembershipMapper.php index f2c0aee..58fa9d5 100644 --- a/application/models/MembershipMapper.php +++ b/application/models/MembershipMapper.php @@ -5,6 +5,21 @@ class Application_Model_MembershipMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/PersonMapper.php b/application/models/PersonMapper.php index 07c0347..79a84c7 100644 --- a/application/models/PersonMapper.php +++ b/application/models/PersonMapper.php @@ -5,6 +5,21 @@ class Application_Model_PersonMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/PoolEntriesMapper.php b/application/models/PoolEntriesMapper.php index d730fb8..61e4e0a 100644 --- a/application/models/PoolEntriesMapper.php +++ b/application/models/PoolEntriesMapper.php @@ -5,6 +5,21 @@ class Application_Model_PoolEntriesMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/PoolFiltersMapper.php b/application/models/PoolFiltersMapper.php index 582f955..7cc20bb 100644 --- a/application/models/PoolFiltersMapper.php +++ b/application/models/PoolFiltersMapper.php @@ -5,6 +5,21 @@ class Application_Model_PoolFiltersMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/PoolMapper.php b/application/models/PoolMapper.php index be096b7..994a3fd 100644 --- a/application/models/PoolMapper.php +++ b/application/models/PoolMapper.php @@ -5,6 +5,21 @@ class Application_Model_PoolMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { @@ -83,7 +98,6 @@ class Application_Model_PoolMapper return $entries; } - } diff --git a/application/models/RightMapper.php b/application/models/RightMapper.php index 35e5b05..570259a 100644 --- a/application/models/RightMapper.php +++ b/application/models/RightMapper.php @@ -5,6 +5,21 @@ class Application_Model_RightMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/RightRolesMapper.php b/application/models/RightRolesMapper.php index ae409d8..e2adff5 100644 --- a/application/models/RightRolesMapper.php +++ b/application/models/RightRolesMapper.php @@ -5,6 +5,21 @@ class Application_Model_RightRolesMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/RoleMapper.php b/application/models/RoleMapper.php index da8d73a..bc9bc48 100644 --- a/application/models/RoleMapper.php +++ b/application/models/RoleMapper.php @@ -5,6 +5,21 @@ class Application_Model_RoleMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/RolesMapper.php b/application/models/RolesMapper.php index 681c173..d48d747 100644 --- a/application/models/RolesMapper.php +++ b/application/models/RolesMapper.php @@ -5,6 +5,21 @@ class Application_Model_RolesMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/models/SessionMapper.php b/application/models/SessionMapper.php index dac5c4e..57b2fdf 100644 --- a/application/models/SessionMapper.php +++ b/application/models/SessionMapper.php @@ -5,6 +5,21 @@ class Application_Model_SessionMapper protected $_dbTable; + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + public function setDbTable($dbTable) { if (is_string($dbTable)) { diff --git a/application/views/scripts/pool/linkclient.phtml b/application/views/scripts/pool/linkclient.phtml index 1cc06e4..cbd2dd4 100644 --- a/application/views/scripts/pool/linkclient.phtml +++ b/application/views/scripts/pool/linkclient.phtml @@ -1 +1,3 @@ -

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

Link Clients

+poolclient; -- cgit v1.2.3-55-g7522 From 813b2381138772ecc74674a177984fe31a852f8d Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 7 Mar 2011 16:23:57 +0100 Subject: filter fertig --- application/controllers/PoolController.php | 4 ++-- application/views/scripts/pool/index.phtml | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) (limited to 'application/views') diff --git a/application/controllers/PoolController.php b/application/controllers/PoolController.php index f4287cb..28bde8e 100644 --- a/application/controllers/PoolController.php +++ b/application/controllers/PoolController.php @@ -14,7 +14,7 @@ class PoolController extends Zend_Controller_Action $this->view->pools = $poolMapper->fetchAll(); $poolentriesMapper = new Application_Model_PoolEntriesMapper(); - print_a($poolentriesMapper->findBy('poolID',1)); + #print_a($poolentriesMapper->findBy('poolID',1)); } @@ -62,7 +62,7 @@ class PoolController extends Zend_Controller_Action $poolmapper->find($poolID,$pool); $poolArray = $pool->toArray(); - $editpool = new Application_Form_Pool(); + $editpool = new Application_Form_Pool(); $editpool->populate($poolArray); $this->view->editpoolform = $editpool; diff --git a/application/views/scripts/pool/index.phtml b/application/views/scripts/pool/index.phtml index 1bee0fe..25f1528 100644 --- a/application/views/scripts/pool/index.phtml +++ b/application/views/scripts/pool/index.phtml @@ -49,6 +49,34 @@ 'default', true) ?>">link client + + + + + findBy('poolID',$pool->getID()); + foreach ($clients as $client): ?> + + + find($client['clientID'],$cli); + ?> + + + + + +
clientIDmachardwarehash
macAdress); ?>hardwarehash); ?>unlink client
-- cgit v1.2.3-55-g7522 From 8763f6cff0d65317db93f4ba93d6656e690dc9d8 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 7 Mar 2011 17:17:56 +0100 Subject: dirty hack entfertn durch findBy-Methode --- application/controllers/FilterController.php | 15 ++++++++------- application/models/FilterEntriesMapper.php | 6 ------ application/views/scripts/filter/index.phtml | 27 +++++++++++++++------------ pbs-data.sql | 1 + 4 files changed, 24 insertions(+), 25 deletions(-) (limited to 'application/views') diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php index 1305689..73b087c 100644 --- a/application/controllers/FilterController.php +++ b/application/controllers/FilterController.php @@ -20,11 +20,6 @@ class FilterController extends Zend_Controller_Action try{ $this->_filtermapper = new Application_Model_FilterMapper(); $this->view->filters = $this->_filtermapper->fetchAll(); - - $filterentries = new Application_Model_FilterEntriesMapper(); - - $this->view->filterentries = $filterentries->fetchAll(); - }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } @@ -309,6 +304,12 @@ class FilterController extends Zend_Controller_Action If client comes from a specific pool */ ######################################################### + // ClientID + $filtertypID = 8; + /* + If client is a specific client + */ + ######################################################### // BootIso $filtertypID = 4; /* @@ -318,13 +319,13 @@ class FilterController extends Zend_Controller_Action // Membership $filtertypID = 5; /* - + user is in a defined membership */ ######################################################### // Group $filtertypID = 6; /* - + user is in a defined groupID */ ######################################################### // Time diff --git a/application/models/FilterEntriesMapper.php b/application/models/FilterEntriesMapper.php index 350f081..bf57dbd 100644 --- a/application/models/FilterEntriesMapper.php +++ b/application/models/FilterEntriesMapper.php @@ -107,13 +107,7 @@ class Application_Model_FilterEntriesMapper ->setFiltervalue2($row->filtervalue2); return $filterentries; } - public function findBy($field,$value) - { - $db = $this->getAdapter(); - $where = $db->quoteInto($db->quoteIdentifier($field).' = ?', value); - return $this->fetchAll($where); - } public function fetchAll() { diff --git a/application/views/scripts/filter/index.phtml b/application/views/scripts/filter/index.phtml index bbc7374..a3e6f25 100644 --- a/application/views/scripts/filter/index.phtml +++ b/application/views/scripts/filter/index.phtml @@ -57,30 +57,33 @@ tr.filter{background-color:#DDD;} + findBy('filterID',$filter->getID())); + $erg = $fe->findBy('filterID',$filter->getID()); + ?> - filterentries as $filterentry): ?> - filterID == $filter->getID()): ?> + + - - + + - +
find($filterentry->getFiltertypeID(),$erg); + $filter2->find($filterentry['filtertypeID'],$erg); //name zur ID finden - echo "[".$filterentry->getFiltertypeID()."] "; + echo "[".$filterentry['filtertypeID']."] "; echo $erg->getFiltertypename(); ?>getFiltervalue();?>getFiltervalue2();?> edit filterentry @@ -88,12 +91,12 @@ tr.filter{background-color:#DDD;} array( 'controller' => 'filter', 'action' => 'removefilterentry', - 'filterentriesID' => $filterentry->getID() + 'filterentriesID' => $filterentry['filtertypeID'] ), 'default', true) ?>">remove filterentry
diff --git a/pbs-data.sql b/pbs-data.sql index 1aec562..0549e0b 100644 --- a/pbs-data.sql +++ b/pbs-data.sql @@ -9,6 +9,7 @@ INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NU INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'Membership'); INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'Group'); INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'Time'); +INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'Client'); -- Insert example data for filters INSERT INTO `pbs`.`pbs_group` (`groupID` ,`title` ,`description`)VALUES (NULL , 'testgruppe1', NULL); -- cgit v1.2.3-55-g7522