diff options
Diffstat (limited to 'application')
51 files changed, 708 insertions, 190 deletions
diff --git a/application/models/BootIsoMapper.php b/application/models/BootIsoMapper.php index c8c4b41..5b3f748 100644 --- a/application/models/BootIsoMapper.php +++ b/application/models/BootIsoMapper.php @@ -5,13 +5,26 @@ class Application_Model_BootIsoMapper protected $_dbTable; - public function findBy($criteria, $value, $array=false) + public function findBy($where, $array=false, $order = false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } $stmt = $select->query(); $result = $stmt->fetchAll(); @@ -26,7 +39,7 @@ class Application_Model_BootIsoMapper }else{ return $result; } - + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/BootMenuEntriesMapper.php b/application/models/BootMenuEntriesMapper.php index 937d81b..4d82c96 100644 --- a/application/models/BootMenuEntriesMapper.php +++ b/application/models/BootMenuEntriesMapper.php @@ -5,44 +5,42 @@ class Application_Model_BootMenuEntriesMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false, $order=false) { + + foreach($where as $k => $v){ + $where[] = "$k = '$v'"; + } + $where = implode(" AND " ,$where); + try{ $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value) - ->order('order'); - $stmt = $select->query(); - $resultSet = $stmt->fetchAll(); - - $entries = array(); - foreach ($resultSet as $row) { + ->where($where) + ->order('order'); - $entry = new Application_Model_BootMenuEntries($row); - $entry->setID($row['bootmenuentriesID']); - $entries[] = $entry; + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); } - return $entries; - - }catch (Zend_Exception $e) { - echo "Error message 2: " . $e->getMessage() . "\n"; - } - } - - public function findByArray($criteria, $value) - { - try{ - $db = Zend_Db_Table::getDefaultAdapter(); - $select = $this->getDbTable()->select() - ->from($this->_dbTable) - ->where($criteria . ' = ?', $value) - ->order('order'); $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_BootMenuEntries($row); + $entry->setID($row['bootmenuentriesID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; diff --git a/application/models/BootMenuMapper.php b/application/models/BootMenuMapper.php index c8065ec..60c506d 100644 --- a/application/models/BootMenuMapper.php +++ b/application/models/BootMenuMapper.php @@ -5,13 +5,28 @@ class Application_Model_BootMenuMapper protected $_dbTable; - public function findBy($criteria, $value, $array=false) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); diff --git a/application/models/BootOsMapper.php b/application/models/BootOsMapper.php index 3ac2a8c..7a4be44 100644 --- a/application/models/BootOsMapper.php +++ b/application/models/BootOsMapper.php @@ -5,13 +5,28 @@ class Application_Model_BootOsMapper protected $_dbTable; - public function findBy($criteria, $value, $array=false) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); diff --git a/application/models/ClientMapper.php b/application/models/ClientMapper.php index 2c23cfc..a86f4b0 100644 --- a/application/models/ClientMapper.php +++ b/application/models/ClientMapper.php @@ -5,16 +5,43 @@ class Application_Model_ClientMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_Client($row); + $entry->setID($row['clientID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/ConfigMapper.php b/application/models/ConfigMapper.php index fd6760c..dbcb0e5 100644 --- a/application/models/ConfigMapper.php +++ b/application/models/ConfigMapper.php @@ -5,13 +5,28 @@ class Application_Model_ConfigMapper protected $_dbTable; - public function findBy($criteria, $value, $array=false) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); @@ -31,7 +46,6 @@ class Application_Model_ConfigMapper 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 11236af..e667997 100644 --- a/application/models/FilterEntriesMapper.php +++ b/application/models/FilterEntriesMapper.php @@ -5,16 +5,43 @@ class Application_Model_FilterEntriesMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_FilterEntries($row); + $entry->setID($row['filterentriesID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/FilterMapper.php b/application/models/FilterMapper.php index d4b8d54..4173cbf 100644 --- a/application/models/FilterMapper.php +++ b/application/models/FilterMapper.php @@ -5,19 +5,43 @@ class Application_Model_FilterMapper protected $_dbTable; - public function findBy($criteria, $value, $order='',$sort='') + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); - if($order != '' && $sort != ''){ - $select->order(array("$order $sort")); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_Filter($row); + $entry->setID($row['filterID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/FilterTypeMapper.php b/application/models/FilterTypeMapper.php index 45675d8..cd334ba 100644 --- a/application/models/FilterTypeMapper.php +++ b/application/models/FilterTypeMapper.php @@ -5,21 +5,47 @@ class Application_Model_FilterTypeMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_FilterType($row); + $entry->setID($row['filtertypeID']); + $entries[] = $entry; + } + return $entries; + }else{ + 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 f19ff02..a1329fe 100644 --- a/application/models/GroupGroupsMapper.php +++ b/application/models/GroupGroupsMapper.php @@ -5,20 +5,46 @@ class Application_Model_GroupGroupsMapper protected $_dbTable; - public function findBy($criteria, $value) - { - try{ + public function findBy($where, $array=false, $order=false) + { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + + try{ $db = Zend_Db_Table::getDefaultAdapter(); - $select = $this->getDbTable()->select() - ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; - }catch (Zend_Exception $e) { - echo "Error message 2: " . $e->getMessage() . "\n"; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_GroupGroups($row); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; } - } + } public function setDbTable($dbTable) { diff --git a/application/models/GroupMapper.php b/application/models/GroupMapper.php index fa458d1..f9c3819 100644 --- a/application/models/GroupMapper.php +++ b/application/models/GroupMapper.php @@ -5,16 +5,36 @@ class Application_Model_GroupMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_Group($row); + $entry->setID($row['groupID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/GroupRequestMapper.php b/application/models/GroupRequestMapper.php index dff8703..cac51cd 100644 --- a/application/models/GroupRequestMapper.php +++ b/application/models/GroupRequestMapper.php @@ -5,16 +5,43 @@ class Application_Model_GroupRequestMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_GroupRequest($row); + $entry->setID($row['grouprequestID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/MembershipMapper.php b/application/models/MembershipMapper.php index 5aa0bfd..67b4985 100644 --- a/application/models/MembershipMapper.php +++ b/application/models/MembershipMapper.php @@ -4,17 +4,44 @@ class Application_Model_MembershipMapper { protected $_dbTable; - - public function findBy($criteria, $value) + + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_Membership($row); + $entry->setID($row['membershipID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/PasswordRecoveryMapper.php b/application/models/PasswordRecoveryMapper.php index 97f5a5a..0bd6eb1 100644 --- a/application/models/PasswordRecoveryMapper.php +++ b/application/models/PasswordRecoveryMapper.php @@ -4,20 +4,46 @@ class Application_Model_PasswordRecoveryMapper { protected $_dbTable; - public function findBy($criteria, $value) - { - try{ + public function findBy($where, $array=false, $order=false) + { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + + try{ $db = Zend_Db_Table::getDefaultAdapter(); - $select = $this->getDbTable()->select() - ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; - }catch (Zend_Exception $e) { - echo "Error message 2: " . $e->getMessage() . "\n"; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_PasswordRecovery($row); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; } - } + } public function setDbTable($dbTable) { diff --git a/application/models/PersonMapper.php b/application/models/PersonMapper.php index de05c0c..537d862 100644 --- a/application/models/PersonMapper.php +++ b/application/models/PersonMapper.php @@ -5,16 +5,43 @@ class Application_Model_PersonMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_Person($row); + $entry->setID($row['personID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/PoolEntriesMapper.php b/application/models/PoolEntriesMapper.php index 8574c01..fd16cc1 100644 --- a/application/models/PoolEntriesMapper.php +++ b/application/models/PoolEntriesMapper.php @@ -5,16 +5,43 @@ class Application_Model_PoolEntriesMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_PoolEntries($row); + $entry->setID($row['poolentriesID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/PoolMapper.php b/application/models/PoolMapper.php index d809aff..d06dcbe 100644 --- a/application/models/PoolMapper.php +++ b/application/models/PoolMapper.php @@ -5,16 +5,43 @@ class Application_Model_PoolMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_Pool($row); + $entry->setID($row['poolID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/PreBootMapper.php b/application/models/PreBootMapper.php index 6053b19..28b8b04 100644 --- a/application/models/PreBootMapper.php +++ b/application/models/PreBootMapper.php @@ -5,25 +5,44 @@ class Application_Model_PreBootMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - $entries = array(); - foreach ($result as $row) { - - $entry = new Application_Model_PreBoot($row); - $entry->setID($row['prebootID']); - $entries[] = $entry; + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_PreBoot($row); + $entry->setID($row['prebootID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; } - return $entries; + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/RightCategoryMapper.php b/application/models/RightCategoryMapper.php index 1a3d093..4a7ca97 100644 --- a/application/models/RightCategoryMapper.php +++ b/application/models/RightCategoryMapper.php @@ -5,20 +5,47 @@ class Application_Model_RightCategoryMapper protected $_dbTable; - public function findBy($criteria, $value) - { - try{ + public function findBy($where, $array=false, $order=false) + { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + + try{ $db = Zend_Db_Table::getDefaultAdapter(); - $select = $this->getDbTable()->select() - ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; - }catch (Zend_Exception $e) { - echo "Error message 2: " . $e->getMessage() . "\n"; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_RightCategory($row); + $entry->setID($row['rightcategoryID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; } - } + } public function setDbTable($dbTable) { diff --git a/application/models/RightMapper.php b/application/models/RightMapper.php index d59f518..5c0fef9 100644 --- a/application/models/RightMapper.php +++ b/application/models/RightMapper.php @@ -5,16 +5,43 @@ class Application_Model_RightMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_Right($row); + $entry->setID($row['rightID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/RightRolesMapper.php b/application/models/RightRolesMapper.php index 6557618..32ed666 100644 --- a/application/models/RightRolesMapper.php +++ b/application/models/RightRolesMapper.php @@ -5,20 +5,46 @@ class Application_Model_RightRolesMapper protected $_dbTable; - public function findBy($criteria, $value) - { - try{ + public function findBy($where, $array=false, $order=false) + { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + + try{ $db = Zend_Db_Table::getDefaultAdapter(); - $select = $this->getDbTable()->select() - ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; - }catch (Zend_Exception $e) { - echo "Error message 2: " . $e->getMessage() . "\n"; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_RightRoles($row); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; } - } + } public function setDbTable($dbTable) { diff --git a/application/models/RoleMapper.php b/application/models/RoleMapper.php index 4001e3e..13ef789 100644 --- a/application/models/RoleMapper.php +++ b/application/models/RoleMapper.php @@ -5,16 +5,43 @@ class Application_Model_RoleMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_Role($row); + $entry->setID($row['roleID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/models/SessionMapper.php b/application/models/SessionMapper.php index 62740a0..d12a071 100644 --- a/application/models/SessionMapper.php +++ b/application/models/SessionMapper.php @@ -5,16 +5,43 @@ class Application_Model_SessionMapper protected $_dbTable; - public function findBy($criteria, $value) + public function findBy($where, $array=false, $order=false) { + foreach($where as $k => $v){ + if($v != null) + $where2[] = "$k = '$v'"; + else + $where2[] = "$k IS NULL"; + } + $where = implode(" AND " ,$where2); + try{ $db = Zend_Db_Table::getDefaultAdapter(); $select = $this->getDbTable()->select() ->from($this->_dbTable) - ->where($criteria . ' = ?', $value); + ->where($where); + + if(is_array($order)){ + foreach ($order as $k => $v) + $a[] = "$k $v"; + $select->order($a); + } + $stmt = $select->query(); $result = $stmt->fetchAll(); - return $result; + + if(!$array){ + $entries = array(); + foreach ($result as $row) { + $entry = new Application_Model_Session($row); + $entry->setID($row['sessionID']); + $entries[] = $entry; + } + return $entries; + }else{ + return $result; + } + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } diff --git a/application/modules/dev/controllers/AuthController.php b/application/modules/dev/controllers/AuthController.php index 078a4cf..3ff1dd3 100644 --- a/application/modules/dev/controllers/AuthController.php +++ b/application/modules/dev/controllers/AuthController.php @@ -49,7 +49,7 @@ class dev_AuthController extends Zend_Controller_Action if ($result->isValid()) { $this->personmapper = new Application_Model_PersonMapper(); - $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); + $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true); $person = new Application_Model_Person($result[0]); $person->setID($result[0]['personID']); $date = new DateTime(); @@ -143,7 +143,7 @@ class dev_AuthController extends Zend_Controller_Action } else if(isset($_GET['recoveryid'])) { $recoveryid = $_GET['recoveryid']; $passwordRecoveryMapper = new Application_Model_PasswordRecoveryMapper(); - $passwordRecovery = $passwordRecoveryMapper->findBy("recoveryID", $recoveryid); + $passwordRecovery = $passwordRecoveryMapper->findBy(array("recoveryID" => $recoveryid),true); if(count($passwordRecovery) > 0) { $passwordRecoveryObject = new Application_Model_PasswordRecovery(); $passwordRecoveryObject->setID($passwordRecovery[0]['personID']); @@ -209,7 +209,7 @@ class dev_AuthController extends Zend_Controller_Action { if($_POST['confirmdelete']) { $auth = Zend_Auth::getInstance(); - $result = $this->personmapper->findBy('email', $auth->getIdentity()); + $result = $this->personmapper->findBy(array('email' => $auth->getIdentity()), true); $person = $result[0]; $personID = $person["personID"]; if (isset($personID)){ diff --git a/application/modules/dev/controllers/BootmenuController.php b/application/modules/dev/controllers/BootmenuController.php index 2d2a1df..0f867d1 100644 --- a/application/modules/dev/controllers/BootmenuController.php +++ b/application/modules/dev/controllers/BootmenuController.php @@ -31,7 +31,7 @@ class dev_BootmenuController extends Zend_Controller_Action $this->view->bootmenulist = $bootmenumapper->fetchAll(); $bootmenuentries = array(); foreach ($this->view->bootmenulist as $bootmenu){ - $bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->findBy('bootmenuID',$bootmenu->getID()); + $bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->findBy(array('bootmenuID' => $bootmenu->getID())); $bootmenu->setGroupID("[".$bootmenu->getGroupID()."] ".$groupmapper->find($bootmenu->getGroupID())->getTitle()); $bootmenu->setMembershipID("[".$bootmenu->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootmenu->getMembershipID())->getPersonID())->getFirstname()); } diff --git a/application/modules/dev/controllers/FilterController.php b/application/modules/dev/controllers/FilterController.php index 4644d0e..497c7b0 100644 --- a/application/modules/dev/controllers/FilterController.php +++ b/application/modules/dev/controllers/FilterController.php @@ -354,7 +354,7 @@ class dev_FilterController extends Zend_Controller_Action if(!$testFilter){ $poolentry = new Application_Model_PoolEntries(); $poolentrymapper = new Application_Model_PoolEntriesMapper(); - $poolentry = $poolentrymapper->findby('clientID',$client->getID()); + $poolentry = $poolentrymapper->findby(array('clientID' => $client->getID()),true); $poolentry = $poolentry[0]; $poolID = $poolentry['poolID']; diff --git a/application/modules/dev/controllers/GroupController.php b/application/modules/dev/controllers/GroupController.php index 2770fd7..11f4a9e 100644 --- a/application/modules/dev/controllers/GroupController.php +++ b/application/modules/dev/controllers/GroupController.php @@ -110,7 +110,7 @@ class dev_GroupController extends Zend_Controller_Action { $groupID = $this->_request->getParam('groupID'); if($groupID) { - $groupRequests = $this->groupRequestMapper->findBy('groupID', $groupID); + $groupRequests = $this->groupRequestMapper->findBy(array('groupID' => $groupID),true); if(isset($groupRequests)) { foreach($groupRequests as $groupRequest) { $person = $this->personmapper->find($groupRequest['personID']); diff --git a/application/modules/dev/controllers/PersonController.php b/application/modules/dev/controllers/PersonController.php index 40e51af..a403038 100644 --- a/application/modules/dev/controllers/PersonController.php +++ b/application/modules/dev/controllers/PersonController.php @@ -13,7 +13,7 @@ class dev_PersonController extends Zend_Controller_Action public function init() { if (Zend_Auth::getInstance()->hasIdentity()) { $this->personmapper = new Application_Model_PersonMapper(); - $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); + $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true); $this->person = new Application_Model_Person($result[0]); $this->person->setID($result[0]['personID']); $this->groupMapper = new Application_Model_GroupMapper(); @@ -85,7 +85,7 @@ class dev_PersonController extends Zend_Controller_Action { $this->view->person = $this->person; $allgroups = $this->groupMapper->fetchAll(); - $groupRequests = $this->groupRequestMapper->findBy('personID', $this->person->getID()); + $groupRequests = $this->groupRequestMapper->findBy(array('personID' => $this->person->getID()),true); $count = 0; foreach($allgroups as $group) { foreach($groupRequests as $groupRequest) { diff --git a/application/modules/dev/controllers/ResourceController.php b/application/modules/dev/controllers/ResourceController.php index 4e92ce3..9ae7582 100644 --- a/application/modules/dev/controllers/ResourceController.php +++ b/application/modules/dev/controllers/ResourceController.php @@ -13,7 +13,7 @@ class dev_ResourceController extends Zend_Controller_Action $alphasessionID = $this->_request->getParam('alpha'); $session = new Application_Model_Session(); $sm = new Application_Model_SessionMapper(); - $result = $sm->findBy('alphasessionID',$alphasessionID); + $result = $sm->findBy(array('alphasessionID' => $alphasessionID), true); # print_a($result); $this->thisSession = $session->setOptions($result[0]); $this->thisSession->setID($result[0]['sessionID']); diff --git a/application/modules/dev/controllers/RoleController.php b/application/modules/dev/controllers/RoleController.php index 65989b6..0c3a2b8 100644 --- a/application/modules/dev/controllers/RoleController.php +++ b/application/modules/dev/controllers/RoleController.php @@ -21,7 +21,7 @@ class dev_RoleController extends Zend_Controller_Action { $roleNamespace = Zend_Session::namespaceGet('role'); if(isset($roleNamespace['groupID'])) { - $roleList = $this->roleMapper->findBy('groupID', $roleNamespace['groupID']); + $roleList = $this->roleMapper->findBy(array('groupID' => $roleNamespace['groupID']),true); $this->view->groupID = $roleNamespace['groupID']; $this->view->roleList = $roleList; } else { @@ -101,7 +101,7 @@ class dev_RoleController extends Zend_Controller_Action { $roleID = $this->_request->getParam('roleID'); if($roleID) { - $rightroles = $this->rightRolesMapper->findBy('roleID', $roleID); + $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID),true); if(count($rightroles) > 0) { foreach($rightroles as $rightrole) { $right = $this->rightMapper->find($rightrole['rightID']); @@ -145,7 +145,7 @@ class dev_RoleController extends Zend_Controller_Action { $roleID = $this->_request->getParam('roleID'); if(isset($roleID)) { - $rightroles = $this->rightRolesMapper->findBy('roleID', $roleID); + $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID),true); $rights = $this->rightMapper->fetchAll(); if(count($rightroles) > 0) { if(count($rights) > 0) { @@ -239,11 +239,11 @@ class dev_RoleController extends Zend_Controller_Action return; } else { $personMapper = new Application_Model_PersonMapper(); - $result = $personMapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); + $result = $personMapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true); $person = new Application_Model_Person($result[0]); $person->setID($result[0]['personID']); $membershipMapper = new Application_Model_MembershipMapper(); - $memberships = $membershipMapper->findBy("personID",$person->getID()); + $memberships = $membershipMapper->findBy(array("personID" => $person->getID(), true)); $groupMapper = new Application_Model_GroupMapper(); if(isset($memberships)) { foreach($memberships as $membership) { diff --git a/application/modules/dev/controllers/SessionController.php b/application/modules/dev/controllers/SessionController.php index 9686d1d..87a7e9c 100644 --- a/application/modules/dev/controllers/SessionController.php +++ b/application/modules/dev/controllers/SessionController.php @@ -50,7 +50,7 @@ class dev_SessionController extends Zend_Controller_Action try{ $uniqid = $this->getUniqueCode(10); $sm = new Application_Model_SessionMapper(); - while(count($sm->findBy('alphasessionID',$uniqid))>0){ + while(count($sm->findBy(array('alphasessionID' => $uniqid),true))>0){ $uniqid = $this->getUniqueCode(16); } diff --git a/application/modules/dev/views/scripts/filter/index.phtml b/application/modules/dev/views/scripts/filter/index.phtml index df97000..b555318 100644 --- a/application/modules/dev/views/scripts/filter/index.phtml +++ b/application/modules/dev/views/scripts/filter/index.phtml @@ -51,7 +51,7 @@ <?php $fe = new Application_Model_FilterEntriesMapper(); # print_a($erg = $fe->findBy('filterID',$filter->getID())); - $erg = $fe->findBy('filterID',$filter->getID()); + $erg = $fe->findBy(array('filterID' => $filter->getID()),true); ?> <?php if (count($erg)>0): ?> <tr class=detail> diff --git a/application/modules/dev/views/scripts/pool/index.phtml b/application/modules/dev/views/scripts/pool/index.phtml index 06764d0..cd49048 100644 --- a/application/modules/dev/views/scripts/pool/index.phtml +++ b/application/modules/dev/views/scripts/pool/index.phtml @@ -48,7 +48,7 @@ </tr> <?php $poolentriesMapper = new Application_Model_PoolEntriesMapper(); - $clients = $poolentriesMapper->findBy('poolID',$pool->getID()); + $clients = $poolentriesMapper->findBy(array('poolID' => $pool->getID()),true); ?> <?php if (count($clients)>0): ?> <tr class=detail> diff --git a/application/modules/fbgui/controllers/AuthController.php b/application/modules/fbgui/controllers/AuthController.php index 1b7b5fe..eef2156 100644 --- a/application/modules/fbgui/controllers/AuthController.php +++ b/application/modules/fbgui/controllers/AuthController.php @@ -47,7 +47,7 @@ class Fbgui_AuthController extends Zend_Controller_Action if ($result->isValid()) { $this->personmapper = new Application_Model_PersonMapper(); - $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); + $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true); $person = new Application_Model_Person($result[0]); $person->setID($result[0]['personID']); $date = new DateTime(); diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php index be84e58..b48806b 100644 --- a/application/modules/fbgui/controllers/IndexController.php +++ b/application/modules/fbgui/controllers/IndexController.php @@ -26,7 +26,7 @@ class Fbgui_IndexController extends Zend_Controller_Action $groupID = $bootiso->getGroupID(); } elseif(isset($_POST['serialnumber'])){ - $results = $bootisomapper->findBy('serialnumber',$_POST['serialnumber'],true); + $results = $bootisomapper->findBy(array('serialnumber' => $_POST['serialnumber']),true); if(count($results) == 0){ echo 'Your serialnumber is not known by the system'; } @@ -62,7 +62,7 @@ class Fbgui_IndexController extends Zend_Controller_Action 'Your client is '.$session->getClientID(), 'goto bootmenu '.$bootmenuID); $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); - $res = $bootmenuentriesMapper->findBy('bootmenuID',$bootmenuID); + $res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID),true); $this->view->entries = $res; } else{ @@ -87,7 +87,7 @@ class Fbgui_IndexController extends Zend_Controller_Action $bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry); $sessionMapper = new Application_Model_SessionMapper(); - $session_k = $sessionMapper->findBy('alphasessionID',$_SESSION['alphasessionID']); + $session_k = $sessionMapper->findBy(array('alphasessionID' => $_SESSION['alphasessionID']),true); $session = new Application_Model_Session(); $session->setOptions($session_k[0]); diff --git a/application/modules/fbgui/controllers/PersonController.php b/application/modules/fbgui/controllers/PersonController.php index 06076c5..1c3a4d7 100644 --- a/application/modules/fbgui/controllers/PersonController.php +++ b/application/modules/fbgui/controllers/PersonController.php @@ -11,11 +11,11 @@ class Fbgui_PersonController extends Zend_Controller_Action { if (Zend_Auth::getInstance()->hasIdentity()) { $this->personmapper = new Application_Model_PersonMapper(); - $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); + $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true); $this->person = new Application_Model_Person($result[0]); $this->person->setID($result[0]['personID']); $this->membershipMapper = new Application_Model_MembershipMapper(); - $this->memberships = $this->membershipMapper->findBy("personID",$this->person->getID()); + $this->memberships = $this->membershipMapper->findBy(array("personID" => $this->person->getID()),true); } else { $this->_helper->redirector('login', 'auth'); } diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php index 5d63b20..7eccc98 100644 --- a/application/modules/user/controllers/AuthController.php +++ b/application/modules/user/controllers/AuthController.php @@ -51,7 +51,7 @@ class User_AuthController extends Zend_Controller_Action if ($result->isValid()) { $this->personmapper = new Application_Model_PersonMapper(); - $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); + $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true); $person = new Application_Model_Person($result[0]); $person->setID($result[0]['personID']); $date = new DateTime(); @@ -122,7 +122,7 @@ class User_AuthController extends Zend_Controller_Action { if($_POST['confirmdelete']) { $auth = Zend_Auth::getInstance(); - $result = $this->personmapper->findBy('email', $auth->getIdentity()); + $result = $this->personmapper->findBy(array('email' => $auth->getIdentity()),true); $person = $result[0]; $personID = $person["personID"]; if (isset($personID)){ @@ -175,7 +175,7 @@ class User_AuthController extends Zend_Controller_Action } else if(isset($_GET['recoveryid'])) { $recoveryid = $_GET['recoveryid']; $passwordRecoveryMapper = new Application_Model_PasswordRecoveryMapper(); - $passwordRecovery = $passwordRecoveryMapper->findBy("recoveryID", $recoveryid); + $passwordRecovery = $passwordRecoveryMapper->findBy(array("recoveryID" => $recoveryid),true); if(count($passwordRecovery) > 0) { $passwordRecoveryObject = new Application_Model_PasswordRecovery(); $passwordRecoveryObject->setID($passwordRecovery[0]['personID']); @@ -202,7 +202,7 @@ class User_AuthController extends Zend_Controller_Action if ($recoverPasswordForm->isValid($_POST)) { $recoverPasswordForm->getView()->url(); $this->personmapper = new Application_Model_PersonMapper(); - $result = $this->personmapper->findBy('email', $_POST['email']); + $result = $this->personmapper->findBy(array('email' => $_POST['email']),true); $person = new Application_Model_Person($result[0]); $person->setID($result[0]['personID']); $email = $person->getEmail(); diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php index 20f5774..63a5e38 100644 --- a/application/modules/user/controllers/BootisoController.php +++ b/application/modules/user/controllers/BootisoController.php @@ -70,7 +70,7 @@ class user_BootisoController extends Zend_Controller_Action foreach($parents as $k => $parent){ foreach($parent as $p){ - $bootiso = $this->bootisoMapper->findBy("groupID", $p); + $bootiso = $this->bootisoMapper->findBy(array("groupID" => $p)); foreach ($bootiso as $b) if($b->getPublic() - $k >= 0 ) $this->view->bootisolist[] = $b; @@ -158,7 +158,7 @@ class user_BootisoController extends Zend_Controller_Action $childgroups = count($groupgroupsMapper->getChildGroups($groupID)); $prebootMapper = new Application_Model_PreBootMapper(); - $prebootlist = $prebootMapper->findBy("groupID", $groupID); + $prebootlist = $prebootMapper->findBy(array("groupID" => $groupID)); if (!isset($_POST["createbootiso"])){ $bootisoForm = new user_Form_Bootiso(array( 'action' => 'createbootiso', @@ -226,7 +226,7 @@ class user_BootisoController extends Zend_Controller_Action $groupID = $this->membership->getGroupID(); $prebootMapper = new Application_Model_PreBootMapper(); - $prebootlist = $prebootMapper->findBy("groupID", $groupID); + $prebootlist = $prebootMapper->findBy(array("groupID" => $groupID)); $groupgroupsMapper = new Application_Model_GroupGroupsMapper(); $childgroups = count($groupgroupsMapper->getChildGroups($groupID)); diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php index f20c093..2356515 100644 --- a/application/modules/user/controllers/BootmenuController.php +++ b/application/modules/user/controllers/BootmenuController.php @@ -57,7 +57,7 @@ class user_BootmenuController extends Zend_Controller_Action } - //TODO ACL Darf er BootOsMenu sehen? + //TODO ACL Darf er Bootmenus sehen? if(false) $this->_redirect('/user/index'); @@ -68,10 +68,10 @@ class user_BootmenuController extends Zend_Controller_Action if(true){ //TODO nur Bootmenus von Admins - $bootmenu = $this->bootmenuMapper->findBy('groupID', $this->membership->getGroupID()); + $bootmenu = $this->bootmenuMapper->findBy(array('groupID' => $this->membership->getGroupID())); foreach ($bootmenu as $bm){ $bootmenuID = $bm->getID(); - $bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy('bootmenuID',$bootmenuID); + $bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID)); foreach ($bootmenuentries[$bootmenuID] as $bootmenuentry){ $bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle()); $bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->gettitle()); @@ -79,9 +79,9 @@ class user_BootmenuController extends Zend_Controller_Action } }else{ - $bootmenu = $this->bootmenuMapper->findBy('membershipID', $this->membership->getID()); + $bootmenu = $this->bootmenuMapper->findBy(array('membershipID' => $this->membership->getID())); $bootmenuID = $bootmenu[0]->getID(); - $bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy('bootmenuID',$bootmenuID); + $bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID)); foreach ($bootmenuentries[$bootmenuID] as $bootmenuentry){ $bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle()); $bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->gettitle()); diff --git a/application/modules/user/controllers/BootosController.php b/application/modules/user/controllers/BootosController.php index 8121a71..69f3140 100644 --- a/application/modules/user/controllers/BootosController.php +++ b/application/modules/user/controllers/BootosController.php @@ -63,7 +63,7 @@ class user_BootosController extends Zend_Controller_Action $configMapper = new Application_Model_ConfigMapper(); - $this->view->bootoslist = $this->bootosMapper->findBy("groupID", $groupID); + $this->view->bootoslist = $this->bootosMapper->findBy(array("groupID" => $groupID)); $this->view->update = array(); @@ -112,7 +112,7 @@ class user_BootosController extends Zend_Controller_Action //TODO nur configs von admins $configMapper = new Application_Model_ConfigMapper(); - $configlist = $configMapper->findBy("groupID", $groupID); + $configlist = $configMapper->findBy(array("groupID" => $groupID)); if (!isset($_POST["createbootos"])){ $bootosForm = new user_Form_Bootos(array( @@ -271,7 +271,7 @@ class user_BootosController extends Zend_Controller_Action $childgroups = count($groupgroupsMapper->getChildGroups($groupID)); $configMapper = new Application_Model_ConfigMapper(); - $configlist = $configMapper->findBy("groupID", $groupID); + $configlist = $configMapper->findBy(array("groupID" => $groupID)); $bootos = new Application_Model_BootOs(); $bootos = $this->bootosMapper->find($bootosID); diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index 5827d03..e26075b 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -47,7 +47,7 @@ class User_ClientController extends Zend_Controller_Action } $clientMapper = new Application_Model_ClientMapper(); - $clientsInGroup = $clientMapper->findBy('groupID',$this->membership->getGroupID()); + $clientsInGroup = $clientMapper->findBy(array('groupID' => $this->membership->getGroupID()),true); $perpage = 10; diff --git a/application/modules/user/controllers/ConfigController.php b/application/modules/user/controllers/ConfigController.php index 3618901..f00d1bc 100644 --- a/application/modules/user/controllers/ConfigController.php +++ b/application/modules/user/controllers/ConfigController.php @@ -57,9 +57,9 @@ class user_ConfigController extends Zend_Controller_Action if(true){ //TODO nur Configs von Admins - $this->view->configlist = $this->configMapper->findBy('groupID', $this->membership->getGroupID()); + $this->view->configlist = $this->configMapper->findBy(array('groupID' => $this->membership->getGroupID())); }else{ - $this->view->configlist = $this->configMapper->findBy('membershipID', $this->membership->getID()); + $this->view->configlist = $this->configMapper->findBy(array('membershipID' => $this->membership->getID())); } foreach ($this->view->configlist as $config){ diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php index b1bc84f..83ccdc4 100644 --- a/application/modules/user/controllers/FilterController.php +++ b/application/modules/user/controllers/FilterController.php @@ -48,7 +48,7 @@ class User_FilterController extends Zend_Controller_Action $this->view->notification = $pbsNotifier->notify('modify',$result); } - $filters = $this->filterMapper->findBy('groupID',$this->membership->getGroupID(),'priority','DESC'); + $filters = $this->filterMapper->findBy(array('groupID' => $this->membership->getGroupID()),true,'priority','DESC'); foreach($filters as $filter){ $ff = new Application_Model_Filter(); $ff->setOptions($filter); @@ -79,7 +79,7 @@ class User_FilterController extends Zend_Controller_Action $this->_redirect('/user'); $bmmapper = new Application_Model_BootMenuMapper(); - $result = $bmmapper->findBy('groupID',$this->membership->getGroupID(),true); + $result = $bmmapper->findBy(array('groupID' => $this->membership->getGroupID()),true); print_a($result); foreach($result as $rr){ @@ -158,7 +158,7 @@ class User_FilterController extends Zend_Controller_Action public function editfilterAction() { $bmmapper = new Application_Model_BootMenuMapper(); - $result = $bmmapper->findBy('groupID',$this->membership->getGroupID(),true); + $result = $bmmapper->findBy(array('groupID' => $this->membership->getGroupID()),true); foreach($result as $rr){ $bm = new Application_Model_BootMenu(); $bm->setOptions($rr); diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php index 7a21aa9..76639bd 100644 --- a/application/modules/user/controllers/GroupController.php +++ b/application/modules/user/controllers/GroupController.php @@ -129,7 +129,7 @@ class User_GroupController extends Zend_Controller_Action } } if($groupID) { - $groupRequests = $this->groupRequestMapper->findBy('groupID', $groupID); + $groupRequests = $this->groupRequestMapper->findBy(array('groupID' => $groupID),true); if(isset($groupRequests)) { foreach($groupRequests as $groupRequest) { $person = $this->personmapper->find($groupRequest['personID']); @@ -141,9 +141,9 @@ class User_GroupController extends Zend_Controller_Action if(is_array($groupRequestList)) { $this->view->groupRequestList = $groupRequestList; } - $this->view->roleList = $this->rolemapper->findBy('groupID', $groupID); + $this->view->roleList = $this->rolemapper->findBy(array('groupID' => $groupID),true); } - $members = $this->membershipMapper->findBy('groupID', $groupID); + $members = $this->membershipMapper->findBy(array('groupID' => $groupID),true); if(isset($members)) { foreach($members as $member) { $person = $this->personmapper->find($member['personID']); @@ -156,7 +156,7 @@ class User_GroupController extends Zend_Controller_Action $this->view->membersList = $membersList; } } - $groupgroups = $this->groupGroupsMapper->findBy('groupID', $groupID); + $groupgroups = $this->groupGroupsMapper->findBy(array('groupID' => $groupID),true); if(is_object($groupgroups)) { $parentGroup = $this->groupMapper->find($groupgroups->getParentID()); $this->view->$parentGroup = $parentGroup; diff --git a/application/modules/user/controllers/PersonController.php b/application/modules/user/controllers/PersonController.php index 62d3b6b..e614b98 100644 --- a/application/modules/user/controllers/PersonController.php +++ b/application/modules/user/controllers/PersonController.php @@ -15,13 +15,13 @@ class user_PersonController extends Zend_Controller_Action { if (Zend_Auth::getInstance()->hasIdentity()) { $this->personmapper = new Application_Model_PersonMapper(); - $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); + $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true); $this->person = new Application_Model_Person($result[0]); $this->person->setID($result[0]['personID']); $this->groupMapper = new Application_Model_GroupMapper(); $this->groupRequestMapper = new Application_Model_GroupRequestMapper(); $this->membershipMapper = new Application_Model_MembershipMapper(); - $this->memberships = $this->membershipMapper->findBy("personID",$this->person->getID()); + $this->memberships = $this->membershipMapper->findBy(array("personID" => $this->person->getID()),true); if(isset($this->memberships)) { foreach($this->memberships as $membership) { $group = $this->groupMapper->find($membership['groupID']); @@ -91,7 +91,7 @@ class user_PersonController extends Zend_Controller_Action } $this->view->person = $this->person; $allgroups = $this->groupMapper->fetchAll(); - $groupRequests = $this->groupRequestMapper->findBy('personID', $this->person->getID()); + $groupRequests = $this->groupRequestMapper->findBy(array('personID' => $this->person->getID()),true); $count = 0; foreach($allgroups as $group) { foreach($groupRequests as $groupRequest) { diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index d5cab09..7bf3446 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -57,7 +57,7 @@ class User_PoolController extends Zend_Controller_Action // get all pools from this group $poolMapper = new Application_Model_PoolMapper(); - $pools = $poolMapper->findBy('groupID',$this->membership->getGroupID()); + $pools = $poolMapper->findBy(array('groupID' => $this->membership->getGroupID()),true); foreach($pools as $pool){ $ff = new Application_Model_Pool(); $ff->setOptions($pool); @@ -81,7 +81,7 @@ class User_PoolController extends Zend_Controller_Action // Get all Clients from this group $clientmapper = new Application_Model_ClientMapper(); - $clientsArray = $clientmapper->findBy('groupID',$this->membership->getGroupID()); + $clientsArray = $clientmapper->findBy(array('groupID' => $this->membership->getGroupID()),true); // Get all assigned Clients $assignedclientmapper = new Application_Model_PoolEntriesMapper(); @@ -216,7 +216,7 @@ class User_PoolController extends Zend_Controller_Action if(!isset($_POST['clientID']) && ($clientID == '')){ $clientmapper = new Application_Model_ClientMapper(); - $clients = $clientmapper->findBy('groupID',$this->membership->getGroupID()); + $clients = $clientmapper->findBy(array('groupID',$this->membership->getGroupID()),true); $assignedclientmapper = new Application_Model_PoolEntriesMapper(); $assignedclients = $assignedclientmapper->fetchAll(); foreach($assignedclients as $c){ diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php index b4382cf..73e838d 100644 --- a/application/modules/user/controllers/PrebootController.php +++ b/application/modules/user/controllers/PrebootController.php @@ -62,7 +62,7 @@ class User_PrebootController extends Zend_Controller_Action if(false) $this->_redirect('/user/index'); - $this->view->prebootlist = $this->prebootMapper->findBy("groupID", $groupID); + $this->view->prebootlist = $this->prebootMapper->findBy(array("groupID" => $groupID)); // Pagination $perpage = 2; diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php index 6246c9d..059d9c4 100644 --- a/application/modules/user/controllers/RoleController.php +++ b/application/modules/user/controllers/RoleController.php @@ -23,7 +23,7 @@ class User_RoleController extends Zend_Controller_Action public function indexAction() { if(isset($this->userIDsNamespace['groupID'])) { - $roleList = $this->roleMapper->findBy('groupID', $this->userIDsNamespace['groupID']); + $roleList = $this->roleMapper->findBy(array('groupID' => $this->userIDsNamespace['groupID']),true); $this->view->roleList = $roleList; $this->view->userIDsNamespace = $this->userIDsNamespace; } else { @@ -153,7 +153,7 @@ class User_RoleController extends Zend_Controller_Action $role = $roleMapper->find($roleID); $roleGroupID = $role->getGroupID(); if($this->userIDsNamespace['groupID'] == $roleGroupID) { - $rightroles = $this->rightRolesMapper->findBy('roleID', $roleID); + $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID),true); if(count($rightroles) > 0) { foreach($rightroles as $rightrole) { $right = $this->rightMapper->find($rightrole['rightID']); @@ -242,7 +242,7 @@ class User_RoleController extends Zend_Controller_Action $role = $roleMapper->find($roleID); $roleGroupID = $role->getGroupID(); if($this->userIDsNamespace['groupID'] == $roleGroupID) { - $rightroles = $this->rightRolesMapper->findBy('roleID', $roleID); + $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID),true); $rights = $this->rightMapper->fetchAll(); if(count($rightroles) > 0) { if(count($rights) > 0) { diff --git a/application/modules/user/views/scripts/bootmenu/index.phtml b/application/modules/user/views/scripts/bootmenu/index.phtml index 5f150aa..a43a058 100644 --- a/application/modules/user/views/scripts/bootmenu/index.phtml +++ b/application/modules/user/views/scripts/bootmenu/index.phtml @@ -4,7 +4,6 @@ 'onclick' => 'self.location="/user/bootmenu/createbootmenu/page/'.$this->page.'"', 'class' => 'addbutton'))?> - <table> <tr> <th>ID</th> diff --git a/application/modules/user/views/scripts/filter/index.phtml b/application/modules/user/views/scripts/filter/index.phtml index 1716a95..9800d42 100644 --- a/application/modules/user/views/scripts/filter/index.phtml +++ b/application/modules/user/views/scripts/filter/index.phtml @@ -55,7 +55,7 @@ <?php $fe = new Application_Model_FilterEntriesMapper(); # print_a($erg = $fe->findBy('filterID',$filter->getID())); - $erg = $fe->findBy('filterID',$filter->getID()); + $erg = $fe->findBy(array('filterID' => $filter->getID()),true); ?> <?php if (count($erg)>0): ?> <tr class=detail> diff --git a/application/modules/user/views/scripts/pool/index.phtml b/application/modules/user/views/scripts/pool/index.phtml index 4d224a1..80053f2 100644 --- a/application/modules/user/views/scripts/pool/index.phtml +++ b/application/modules/user/views/scripts/pool/index.phtml @@ -52,7 +52,7 @@ </tr> <?php $poolentriesMapper = new Application_Model_PoolEntriesMapper(); - $clients = $poolentriesMapper->findBy('poolID',$pool->getID()); + $clients = $poolentriesMapper->findBy(array('poolID' => $pool->getID()),true); ?> <?php if (count($clients)>0): ?> <tr class=detail> |