diff options
| author | Simon | 2011-03-07 17:17:56 +0100 |
|---|---|---|
| committer | Simon | 2011-03-07 17:17:56 +0100 |
| commit | 8763f6cff0d65317db93f4ba93d6656e690dc9d8 (patch) | |
| tree | fd816a207b7983ad18af747ae5b992a590726d49 | |
| parent | filter fertig (diff) | |
| download | pbs2-8763f6cff0d65317db93f4ba93d6656e690dc9d8.tar.gz pbs2-8763f6cff0d65317db93f4ba93d6656e690dc9d8.tar.xz pbs2-8763f6cff0d65317db93f4ba93d6656e690dc9d8.zip | |
dirty hack entfertn durch findBy-Methode
| -rw-r--r-- | application/controllers/FilterController.php | 15 | ||||
| -rw-r--r-- | application/models/FilterEntriesMapper.php | 6 | ||||
| -rw-r--r-- | application/views/scripts/filter/index.phtml | 27 | ||||
| -rw-r--r-- | pbs-data.sql | 1 |
4 files changed, 24 insertions, 25 deletions
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;} </tr> <tr><td></td> <td colspan=6> + <?php + $fe = new Application_Model_FilterEntriesMapper(); + # print_a($erg = $fe->findBy('filterID',$filter->getID())); + $erg = $fe->findBy('filterID',$filter->getID()); + ?> <table style='width:100%;'> - <?php foreach ($this->filterentries as $filterentry): ?> - <?php - // TODO: Quick and dirty - // hier wird die gesamte liste durchgegangen... unperformant - if($filterentry->filterID == $filter->getID()): ?> + <?php foreach ($erg as $filterentry): ?> + <tr> <td><?php + $filter2 = new Application_Model_FilterTypeMapper(); $erg = new Application_Model_FilterType(); - $filter2->find($filterentry->getFiltertypeID(),$erg); + $filter2->find($filterentry['filtertypeID'],$erg); //name zur ID finden - echo "[".$filterentry->getFiltertypeID()."] "; + echo "[".$filterentry['filtertypeID']."] "; echo $erg->getFiltertypename(); ?></td> - <td><?php echo $filterentry->getFiltervalue();?></td> - <td><?php echo $filterentry->getFiltervalue2();?></td> + <td><?php echo $filterentry['filtervalue'];?></td> + <td><?php echo $filterentry['filtervalue2'];?></td> <td><a href="<?php echo $this->url( array( 'controller' => 'filter', 'action' => 'editfilterentry', - 'filterentriesID' => $filterentry->getID() + 'filterentriesID' => $filterentry['filtertypeID'] ), 'default', true) ?>">edit filterentry</a> @@ -88,12 +91,12 @@ tr.filter{background-color:#DDD;} array( 'controller' => 'filter', 'action' => 'removefilterentry', - 'filterentriesID' => $filterentry->getID() + 'filterentriesID' => $filterentry['filtertypeID'] ), 'default', true) ?>">remove filterentry</a> </tr> - <?php endif; ?> + <?php endforeach ?> </table> </td> 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); |
