From 3d04fb75a980dba20e51dc91afd49f0eb9ee43fe Mon Sep 17 00:00:00 2001
From: Simon
Date: Wed, 9 Mar 2011 16:31:58 +0100
Subject: Form-Verhalten geändert & Datenbank korrigiert

---
 pbs-data.sql | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'pbs-data.sql')

diff --git a/pbs-data.sql b/pbs-data.sql
index 01ec4a1..f80c8eb 100644
--- a/pbs-data.sql
+++ b/pbs-data.sql
@@ -64,8 +64,11 @@ INSERT INTO `pbs_poolentries` (`poolentriesID`, `poolID`, `clientID`) VALUES
 (10, 3, 10);
 
 -- Insert Data for Sessions
+INSERT INTO `pbs`.`pbs_config` (`configID`, `title`, `groupID`, `membershipID`, `shellscript`, `created`) VALUES 
+(NULL, 'Config 1', '1', '1', 'Shellscirpt', UNIX_TIMESTAMP());
+
 INSERT INTO `pbs`.`pbs_bootos` (`bootosID`, `configID`, `groupID`, `membershipID`, `title`, `description`, `path_init`, `path_kernel`, `defaultkcl`, `created`, `expires`, `public`) VALUES 
-(1, NULL, 1, 1, 'BootOS 1', 'Description', '', '', '', '', NULL, 0);
+(1, 1, 1, 1, 'BootOS 1', 'Description', '', '', '', '', NULL, 0);
 
 INSERT INTO `pbs_bootiso` (`bootisoID`, `title`, `membershipID`, `groupID`, `path`, `serialnumber`, `created`, `expires`, `public`) VALUES
 (1, 'BootISO 1', 1, 1, '', 1337, '', NULL, 1),
@@ -75,3 +78,4 @@ INSERT INTO `pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `h
 (3, '1', '2', '3', '4', '5', '6', '7', NULL, '1299612370', 'test', NULL, '4207acba08cadccc397e2302a55b339a', 'f21ee663b17bcefc6868694dffda602a');
 
 
+
-- 
cgit v1.2.3-55-g7522


From 431b51eba154912c7a636f54cf8de918c7c09147 Mon Sep 17 00:00:00 2001
From: Simon
Date: Wed, 9 Mar 2011 18:37:34 +0100
Subject: Testen der Filter mit Dummywerten über Formular möglich

---
 .zfproject.xml                                     |   5 +
 application/controllers/FilterController.php       | 400 +++++++++++++--------
 application/forms/FilterEvaluate.php               | 123 +++++++
 application/layouts/main.phtml                     |   1 +
 application/views/scripts/filter/index.phtml       |   3 +
 .../views/scripts/filter/testevaluate.phtml        |   4 +
 pbs-data.sql                                       |   1 +
 public/media/css/style.css                         |   1 +
 8 files changed, 392 insertions(+), 146 deletions(-)
 create mode 100644 application/forms/FilterEvaluate.php
 create mode 100644 application/views/scripts/filter/testevaluate.phtml

(limited to 'pbs-data.sql')

diff --git a/.zfproject.xml b/.zfproject.xml
index 1147d7a..4ff354b 100644
--- a/.zfproject.xml
+++ b/.zfproject.xml
@@ -33,6 +33,7 @@
           <actionMethod actionName="evaluate"/>
           <actionMethod actionName="fillIP"/>
           <actionMethod actionName="removefilterentry"/>
+          <actionMethod actionName="testevaluate"/>
         </controllerFile>
         <controllerFile controllerName="Bootos">
           <actionMethod actionName="index"/>
@@ -102,6 +103,7 @@
         <formFile formName="PoolClient"/>
         <formFile formName="Client"/>
         <formFile formName="Session"/>
+        <formFile formName="FilterEvaluate"/>
       </formsDirectory>
       <layoutsDirectory enabled="false"/>
       <modelsDirectory>
@@ -309,6 +311,9 @@
           <viewControllerScriptsDirectory forControllerName="Auth">
             <viewScriptFile forActionName="index"/>
           </viewControllerScriptsDirectory>
+          <viewControllerScriptsDirectory forControllerName="Filter">
+            <viewScriptFile forActionName="testevaluate"/>
+          </viewControllerScriptsDirectory>
         </viewScriptsDirectory>
         <viewHelpersDirectory/>
         <viewFiltersDirectory enabled="false"/>
diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php
index 2853706..d17aceb 100644
--- a/application/controllers/FilterController.php
+++ b/application/controllers/FilterController.php
@@ -4,31 +4,33 @@ class FilterController extends Zend_Controller_Action
 {
 
     private $_filtermapper = null;
-	private $db;
+
+    private $db = null;
+
     public function init()
     {
         try{		 
-        	 
-        	$this->_filtermapper = new Application_Model_FilterMapper();
-        		}catch (Zend_Exception $e) {  
-        	echo "Error message 1: " . $e->getMessage() . "\n";
-		}
-		$this->db = Zend_Db_Table::getDefaultAdapter();
+                	 
+                	$this->_filtermapper = new Application_Model_FilterMapper();
+                		}catch (Zend_Exception $e) {  
+                	echo "Error message 1: " . $e->getMessage() . "\n";
+        		}
+        		$this->db = Zend_Db_Table::getDefaultAdapter();
     }
 
     public function indexAction()
     {
         try{			
-			$this->_filtermapper = new Application_Model_FilterMapper();
-       		$this->view->filters = $this->_filtermapper->fetchAll();
-    	}catch (Zend_Exception $e) {  
-			echo "Error message 2: " . $e->getMessage() . "\n";
-		}
-    }
+        			$this->_filtermapper = new Application_Model_FilterMapper();
+               		$this->view->filters = $this->_filtermapper->fetchAll();
+            	}catch (Zend_Exception $e) {  
+        			echo "Error message 2: " . $e->getMessage() . "\n";
+    		}
+	}
 
     public function addfilterAction()
     {
-		$bmmapper = new Application_Model_BootMenuMapper();
+        $bmmapper = new Application_Model_BootMenuMapper();
 		//TODO get bootmenu by group
 		$bootmenus = $bmmapper->fetchAll();
         if (!isset($_POST["add"])){		
@@ -60,65 +62,63 @@ class FilterController extends Zend_Controller_Action
 
     public function removefilterAction()
     {
-        
-		$filterID = $this->_request->getParam('filterID');
-		// TODO: ACL implementieren ob er den filter löschen darf
-		if(is_numeric($filterID)){
-			$deletefilter = new Application_Model_Filter();
-			$deletefilter->setID($filterID);
-			$filtermapper = new Application_Model_FilterMapper();
-			$filtermapper->delete($deletefilter);
-		}
-		$this->_redirect('/filter');
+        $filterID = $this->_request->getParam('filterID');
+        		// TODO: ACL implementieren ob er den filter löschen darf
+        		if(is_numeric($filterID)){
+        			$deletefilter = new Application_Model_Filter();
+        			$deletefilter->setID($filterID);
+        			$filtermapper = new Application_Model_FilterMapper();
+        			$filtermapper->delete($deletefilter);
+        		}
+        		$this->_redirect('/filter');
     }
 
     public function editfilterAction()
     {
-		$bmmapper = new Application_Model_BootMenuMapper();
-		//TODO get bootmenu by group
-		$bootmenus = $bmmapper->fetchAll();
-		if (!isset($_POST["add"])){
-		    // TODO: ACL implementieren ob er editieren darf
-			$filterID = $this->_request->getParam('filterID');
-			$filter = new Application_Model_Filter();
-			
-
-			$filtermapper = new Application_Model_FilterMapper();
-			$filtermapper->find($filterID,$filter);		
-			$filter2 = $filter->toArray();
-
-			$editfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus));  
-			$editfilterform->populate($filter2);
-			$this->view->editfilterform = $editfilterform;
-		
-		} else{
-			try{
-				$filterID = $this->_request->getParam('filterID');	
-				
-				$editfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus),$_POST);
-				//TODO: ACL integrieren				
-				$_POST['groupID'] = 1;
-				$_POST['membershipID'] = 1;
-				$_POST['created'] = time();
-
-				if ($editfilterform->isValid($_POST)) {	
-					$newfilterenty = new Application_Model_Filter($_POST);
-					$newfilterenty->setID($this->_request->getParam('filterID'));
-					$newfilter2 = new Application_Model_FilterMapper();				
-					$newfilter2->save($newfilterenty);
-					echo 'valid';	
-					$this->_redirect('/filter');				
-				}		
-				$this->view->editfilterform = $editfilterform;
-			}catch (Zend_Exception $e) {  
-    			echo "Error message 2: " . $e->getMessage() . "\n";  
-    		}
-		}		
+        $bmmapper = new Application_Model_BootMenuMapper();
+        		//TODO get bootmenu by group
+        		$bootmenus = $bmmapper->fetchAll();
+        		if (!isset($_POST["add"])){
+        		    // TODO: ACL implementieren ob er editieren darf
+        			$filterID = $this->_request->getParam('filterID');
+        			$filter = new Application_Model_Filter();
+        			
+        
+        			$filtermapper = new Application_Model_FilterMapper();
+        			$filtermapper->find($filterID,$filter);		
+        			$filter2 = $filter->toArray();
+        
+        			$editfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus));  
+        			$editfilterform->populate($filter2);
+        			$this->view->editfilterform = $editfilterform;
+        		
+        		} else{
+        			try{
+        				$filterID = $this->_request->getParam('filterID');	
+        				
+        				$editfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus),$_POST);
+        				//TODO: ACL integrieren				
+        				$_POST['groupID'] = 1;
+        				$_POST['membershipID'] = 1;
+        				$_POST['created'] = time();
+        
+        				if ($editfilterform->isValid($_POST)) {	
+        					$newfilterenty = new Application_Model_Filter($_POST);
+        					$newfilterenty->setID($this->_request->getParam('filterID'));
+        					$newfilter2 = new Application_Model_FilterMapper();				
+        					$newfilter2->save($newfilterenty);
+        					echo 'valid';	
+        					$this->_redirect('/filter');				
+        				}		
+        				$this->view->editfilterform = $editfilterform;
+        			}catch (Zend_Exception $e) {  
+            			echo "Error message 2: " . $e->getMessage() . "\n";  
+            		}
+        		}
     }
 
     public function addfilterentryAction()
     {
-		
         // TODO: ACL implementieren ob er editieren darf   
 		if (!isset($_POST["add"])){
 			try{
@@ -150,7 +150,8 @@ class FilterController extends Zend_Controller_Action
 			$this->view->editfilterform = $editfilterform;
 		}
     }
-	public function editfilterentryAction()
+
+    public function editfilterentryAction()
     {
         if (!isset($_POST["add"])){
 			echo "case1";
@@ -195,54 +196,86 @@ class FilterController extends Zend_Controller_Action
 				$this->view->editfilterform = $editfilterform;
 			}catch (Zend_Exception $e) {  
 				echo "Error message 2: " . $e->getMessage() . "\n";  
-			}
+			}				
 		}
     }
-	public function removefilterentryAction()
-    {
-		      
-		try{    		
-			$filterentriesID = $this->_request->getParam('filterentriesID');
-
-			// TODO: ACL implementieren ob er den filter löschen darf
-			if(is_numeric($filterentriesID)){
-				$deletefilterentry = new Application_Model_FilterEntries();
-				$deletefilterentry->setID($filterentriesID);
-				echo "<pre style='border:1px solid black;background-color:#F5B800'>";
-				print_r($deletefilterentry);
-				echo "</pre>";
 
-				$filterentriesmapper = new Application_Model_FilterEntriesMapper();
-				$filterentriesmapper->delete($deletefilterentry);
-				echo "ok";
+    public function removefilterentryAction()
+    {
+        try{    		
+        			$filterentriesID = $this->_request->getParam('filterentriesID');
+        
+        			// TODO: ACL implementieren ob er den filter löschen darf
+        			if(is_numeric($filterentriesID)){
+        				$deletefilterentry = new Application_Model_FilterEntries();
+        				$deletefilterentry->setID($filterentriesID);
+        				echo "<pre style='border:1px solid black;background-color:#F5B800'>";
+        				print_r($deletefilterentry);
+        				echo "</pre>";
+        
+        				$filterentriesmapper = new Application_Model_FilterEntriesMapper();
+        				$filterentriesmapper->delete($deletefilterentry);
+        				echo "ok";
+        			}
+        			$this->_redirect('/filter');
+        		}catch (Zend_Exception $e) {  
+        			echo "Error message 2: " . $e->getMessage() . "\n";
 			}
-#			echo "ready";
-			$this->_redirect('/filter');
-		}catch (Zend_Exception $e) {  
-			echo "Error message 2: " . $e->getMessage() . "\n";  
-		}
     }
-	private function fillIP($ip){
-		$ar = explode(".",$ip);
-		$representation = array();
-		foreach($ar as $part){
-			$representation[] = sprintf("%03s",$part);
-		}
-		return implode(".",$representation);
-	}
-	private function fillMac($ip){
-		$ar = explode(":",$ip);
-		$representation = array();
-		foreach($ar as $part){
-			$representation[] = sprintf("%02s",$part);
+
+    private function fillIP($ip)
+    {
+        $ar = explode(".",$ip);
+        		$representation = array();
+        		foreach($ar as $part){
+        			$representation[] = sprintf("%03s",$part);
+        		}
+        		return implode(".",$representation);
+    }
+
+    private function fillMac($ip)
+    {
+        $ar = explode(":",$ip);
+        		$representation = array();
+        		foreach($ar as $part){
+        			$representation[] = sprintf("%02s",$part);
+        		}
+        		return implode(":",$representation);
+    }
+
+    public function evaluateAction()
+    {
+        $db = $this->db;	
+		$showPartResults = false;
+		// For Testing Filters
+		
+
+		$testFilter = (isset($_POST['submit']))?true:false;
+		
+		if($testFilter){
+			$ipAdress = $_POST['ip'];
+			$macAdress = $_POST['mac'];
+			$poolID = $_POST['poolID'];
+			$bootisoID = $_POST['bootisoID'];
+			$membershipID = $_POST['membershipID'];
+			$groupID = $_POST['groupID'];
+			$time = strtotime($_POST['time']);
+			$clientID = $_POST['clientID'];
+			print_a('Input',
+				array('ipAdress'=>$ipAdress,
+					'macAdress'=>$macAdress,
+					'poolID' => $poolID,
+					'bootisoID' => $bootisoID,
+					'membershipID'=>$membershipID,
+					'groupID'=>$groupID,
+					'time'=>$time." - ".date('d.m.Y H:i:s',$time),
+					'clientID' => $clientID));
 		}
-		return implode(":",$representation);
-	}
-	public function evaluateAction(){
-		$db = $this->db;	
-		$showPartResults = false;	
+		
+		
 		try{ 			
 			$mysession = '1';
+			$set = array();
 
 			$filtertypID = 8;
 			$session = new Application_Model_Session();
@@ -252,31 +285,37 @@ class FilterController extends Zend_Controller_Action
 			// IP Adress
 			$filtertypID = 1;
 			// get it from session_table with session_id from the session
-			$ipAdress = $session->getIp();
+			if(!$testFilter){
+				$ipAdress = $session->getIp();
+			}
 			$ipAdress = str_replace(".","",$this->fillIP($ipAdress));
+
 			$select = $db->select()
-		         ->from(array('pbs_filterentries')
+			     ->from(array('pbs_filterentries')
 					)
 				->where('filtertypeID  = ?',$filtertypID)
 				->where('REPLACE(filtervalue,".","") <= ?',$ipAdress)
 				->where('? <= REPLACE(filtervalue2,".","")',$ipAdress);
-		
+	
 			$stmt = $select->query();
 			$result = $stmt->fetchAll();
 			foreach($result as $r){
 				$set[$filtertypID][] = $r['filterID'];	
 			}
+
 			if($showPartResults)
 				print_a('ipAdress',$result,$set[$filtertypID]);	
+
 			#########################################################
 			// Mac range
 			$filtertypID = 2;
 			// get it from session_table with session_id from the session
-			$client = new Application_Model_Client();
-			$clientmapper = new Application_Model_ClientMapper();
-			$clientmapper->find($session->getClientID(),$client);
-
-			$macAdress = $client->getMacadress();
+			if(!$testFilter){
+				$client = new Application_Model_Client();
+				$clientmapper = new Application_Model_ClientMapper();
+				$clientmapper->find($session->getClientID(),$client);
+				$macAdress = $client->getMacadress();
+			}
 			$macAdress = str_replace(":","",$this->fillMac($ipAdress));			
 			$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
 							filtertypeID  = ".$filtertypID." AND
@@ -288,44 +327,60 @@ class FilterController extends Zend_Controller_Action
 			}
 			if($showPartResults)
 				print_a('macAdress',$result,$set[$filtertypID]);
+
 			#########################################################
 			// PoolID
 			$filtertypID = 3;
 				// get PoolID from client_ID from session_id from the session
-			$poolentry = new Application_Model_PoolEntries();
-			$poolentrymapper = new Application_Model_PoolEntriesMapper();
-			$poolentry = $poolentrymapper->findby('clientID',$client->getID());
-			$poolentry = $poolentry[0];
+			if(!$testFilter){			
+				$poolentry = new Application_Model_PoolEntries();
+				$poolentrymapper = new Application_Model_PoolEntriesMapper();
+				$poolentry = $poolentrymapper->findby('clientID',$client->getID());
+				$poolentry = $poolentry[0];		
+			
+				$poolID = $poolentry['poolID'];
+			}			
+			
 
-			$poolID = $poolentry['poolID'];
-			print_a($poolentry);
 			$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
 							filtertypeID  = ".$filtertypID." AND
-							filtervalue = ".$poolID." ");
+							filtervalue = ".$poolID." ");			
 			$result = $stmt->fetchAll();
-			foreach($result as $r){
-				$set[$filtertypID][] = $r['filterID'];	
+			if(count($result)>0){
+				foreach($result as $r){
+					$set[$filtertypID][] = $r['filterID'];	
+				}
 			}
+
 			if($showPartResults)
 				print_a('poolID',$result,$set[$filtertypID]);
 			#########################################################
 			// ClientID		
 			$filtertypID = 8;	
 			// get client_ID from session_id from the session
+			
+			if(!$testFilter){
+				$clientID = $session->getClientID();
+			}
+
 			$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
 							filtertypeID  = ".$filtertypID." AND
-							filtervalue = ".$session->getClientID()." ");
+							filtervalue = ".$clientID." ");
 			$result = $stmt->fetchAll();
 			foreach($result as $r){
 				$set[$filtertypID][] = $r['filterID'];	
 			}
+
 			if($showPartResults)
 				print_a('clientID',$result,$set[$filtertypID]);
 			#########################################################
 			// BootIsoID
 			$filtertypID = 4;
-				// get BootIsoID from client_ID from session_id from the session			
-			$bootisoID = $session->getBootisoID();
+				// get BootIsoID from client_ID from session_id from the session	
+			if(!$testFilter){		
+				$bootisoID = $session->getBootisoID();
+			}
+
 			$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
 							filtertypeID  = ".$filtertypID." AND
 							filtervalue = ".$bootisoID." ");
@@ -333,14 +388,18 @@ class FilterController extends Zend_Controller_Action
 			foreach($result as $r){
 				$set[$filtertypID][] = $r['filterID'];	
 			}
+
 			if($showPartResults)
 				print_a('bootisoID',$result,$set[$filtertypID]);
 			#########################################################
 			// MembershipID
 			$filtertypID = 5;
+
+			if(!$testFilter){		
 				// get membership from the session
-			//TODO: GET MEMBERSHIP from SESSION
-			$membershipID = 1;
+				//TODO: GET MEMBERSHIP from SESSION
+				$membershipID = 1;
+			}
 
 			$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
 							filtertypeID  = ".$filtertypID." AND
@@ -349,14 +408,18 @@ class FilterController extends Zend_Controller_Action
 			foreach($result as $r){
 				$set[$filtertypID][] = $r['filterID'];	
 			}
+
 			if($showPartResults)
 				print_a('membership',$result,$set[$filtertypID]);
 			#########################################################
 			// GroupID
 			$filtertypID = 6;
+
+			if(!$testFilter){		
 				// get membership from the session
-			//TODO: GET GROUP from SESSION
-			$groupID = 1;
+				//TODO: GET GROUP from SESSION
+				$groupID = 1;	
+			}
 
 			$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
 							filtertypeID  = ".$filtertypID." AND
@@ -365,35 +428,41 @@ class FilterController extends Zend_Controller_Action
 			foreach($result as $r){
 				$set[$filtertypID][] = $r['filterID'];	
 			}
+
 			if($showPartResults)
 				print_a('membership',$result,$set[$filtertypID]);
 			#########################################################
 			// Time
 			$filtertypID = 7;
-			$nowShort = date('H-i',time());
-			$nowLong = date('Y-m-d-H-i',time());
+			if(!$testFilter){
+				$time = time();
+			}
+
+			$nowShort = date('H-i',$time);
+			$nowLong = date('Y-m-d-H-i',$time);
 
 			$nowShort = str_replace("-","",$nowShort);
 			$nowLong = str_replace("-","",$nowLong);
 
 			$select = $db->select()
-		         ->from(array('pbs_filterentries')
+			     ->from(array('pbs_filterentries')
 					)
 				->where('filtertypeID  = ?',$filtertypID)
 				->where('REPLACE(filtervalue,"-","") <= ? AND ? <= REPLACE(filtervalue2,"-","")',$nowShort)
 				->orWhere('REPLACE(filtervalue,"-","") <= ? AND ? <= REPLACE(filtervalue2,"-","")',$nowLong);
-		
+	
 			$stmt = $select->query();
 			$result = $stmt->fetchAll();
 			foreach($result as $r){
 				$set[$filtertypID][] = $r['filterID'];	
 			}
+
 			if($showPartResults)
 				print_a('time',$result,$set[$filtertypID]);	
 			########################################
 			// ErgebnisSet auswerten
 			print_a('the result sets of the filtertypes',$set);			
-			
+		
 			// Merging of the resultsets of the filter
 			$kk = array();
 			foreach($set as $myset){
@@ -401,18 +470,21 @@ class FilterController extends Zend_Controller_Action
 			}
 			$set = $kk;
 			// counting how often a filter is evaluated at database
+			$a = array();
 			foreach($set as $k=> $s){
 				$a[$s] += 1;
 			}	
-				
+			print_a('Übereinstimmungen pro Filter',$a);
 			// Get the number of filtertypes every filter has
 			$stmt = $db->query('SELECT filterID, COUNT(filtertypeID) as num FROM pbs_filterentries GROUP BY filterID');			 
 			$resultset = $stmt->fetchAll();
 			foreach($resultset as $d){
 				$database[$d['filterID']] = $d['num'];
 			}
-			
+			print_a('Anzahl Filterentries in Datenbank',$database);
+		
 			// remove all filters from resultset, which to few filtertypes satisfied
+			$result = array();
 			foreach($a as $i=>$b){
 				if($a[$i] < $database[$i]){
 					unset($a[$i]);
@@ -421,8 +493,8 @@ class FilterController extends Zend_Controller_Action
 					$result[] = $i;
 				}
 			}
-			
-			print_a('result set of filterIDs',$result);
+		
+			print_a('True Filters',$result);
 			// now selecting the filter with the highest priority
 			$query = 'SELECT filterID, bootmenuID, priority 
 				FROM pbs_filter WHERE ';
@@ -431,16 +503,50 @@ class FilterController extends Zend_Controller_Action
 			}
 			$query .= implode(" OR ", $queryTmp);
 			$query .= 'ORDER BY priority DESC LIMIT 0,1';
-			$stmt = $db->query($query);
-			$resultset = $stmt->fetchAll();
-			print_a($resultset);
-			echo "<h1>".$resultset[0]['bootmenuID']."</h1>";
-		
+			$bootmenuID = 'null';
+			try{
+				$stmt = $db->query($query);
+				$resultset = $stmt->fetchAll();
+				$bootmenuID = $resultset[0]['bootmenuID'];
+			}
+			catch(Exception $e){				
+			}
+			
+			echo "<h1>Redirected BootmenuID: ".$bootmenuID."</h1>";
+	
 		}catch (Zend_Exception $e) {  
 				echo "class: ".get_class($e)."<br>\n";
-				echo "Error message 2: " . $e->getMessage() . "\n";  
+				echo "Error message 2: " . $e->getMessage() . "\n";
 		}
-	}
+    }
+
+    public function testevaluateAction()
+    {		
+		$pm = new Application_Model_PoolMapper();
+		$pools = $pm->fetchAll();
+
+		$bim = new Application_Model_BootIsoMapper();
+		$bootisos = $bim->fetchAll();
+
+		$mm = new Application_Model_MembershipMapper();
+		$memberships = $mm->fetchAll();
+
+		$gm = new Application_Model_GroupMapper();
+		$groups = $gm->fetchAll();
+
+		$cm = new Application_Model_ClientMapper();
+		$clients = $cm->fetchAll();
+
+		$filterevaluate = new Application_Form_FilterEvaluate(
+			array(	'pools' 		=>	$pools,
+					'bootisos' 		=>	$bootisos,
+					'memberships'	=>	$memberships,
+					'groups'		=>	$groups,
+					'clients'		=>	$clients
+			));
+        $this->view->filterevaluate = $filterevaluate;
+    }
+
 
 }
 
@@ -452,3 +558,5 @@ class FilterController extends Zend_Controller_Action
 
 
 
+
+
diff --git a/application/forms/FilterEvaluate.php b/application/forms/FilterEvaluate.php
new file mode 100644
index 0000000..2c93aef
--- /dev/null
+++ b/application/forms/FilterEvaluate.php
@@ -0,0 +1,123 @@
+<?php
+
+class Application_Form_FilterEvaluate extends Zend_Form
+{
+	private $pools;
+	private $bootisos;
+	private $memberships;
+	private $groups;
+	private $clients;
+
+    public function init()
+    {
+		$this->setName("Test Filter");
+		$this->setMethod('post');
+		$this->setAction('/filter/evaluate');
+
+        $this->addElement('text', 'ip', array(
+			'filters' => array('StringTrim'),
+			'validators' => array(
+				array('StringLength', false, array(0, 50)),
+			),
+			'required' => false,
+			'label' => 'IP:',
+		));
+		######################################
+		 $this->addElement('text', 'mac', array(
+			'filters' => array('StringTrim'),
+			'validators' => array(
+				array('StringLength', false, array(0, 50)),
+			),
+			'required' => false,
+			'label' => 'Mac:',
+		));
+		######################################
+		$poolfield = $this->createElement('select','poolID');
+        $poolfield ->setLabel('Pool:');
+		$poolfield->addMultiOption('','');
+        if(count($this->pools)>0){
+			foreach($this->pools as $id => $g){
+				$poolfield->addMultiOption($g->getID(), $g->getTitle());
+			}       
+        }
+		$poolfield->setRegisterInArrayValidator(false);
+		$this->addElement($poolfield);
+		######################################
+		$bootisofield = $this->createElement('select','bootisoID');
+        $bootisofield ->setLabel('BootIso:');
+		$bootisofield->addMultiOption('','');
+        if(count($this->bootisos)>0){
+			foreach($this->bootisos as $id => $g){
+				$bootisofield->addMultiOption($g->getID(), $g->getTitle());
+			}       
+        }
+		$bootisofield->setRegisterInArrayValidator(false);
+		$this->addElement($bootisofield);
+		######################################
+		$membershipfield = $this->createElement('select','membershipID');
+        $membershipfield ->setLabel('Membership:');
+		$membershipfield->addMultiOption('','');
+        if(count($this->memberships)>0){
+			foreach($this->memberships as $id => $g){
+				$membershipfield->addMultiOption($g->getID(), $g->getPersonID());
+			}       
+        }
+		$membershipfield->setRegisterInArrayValidator(false);
+		$this->addElement($membershipfield);
+		######################################
+		$groupfield = $this->createElement('select','groupID');
+        $groupfield ->setLabel('Group:');
+		$groupfield->addMultiOption('','');
+        if(count($this->groups)>0){
+			foreach($this->groups as $id => $g){
+				$groupfield->addMultiOption($g->getID(), $g->getTitle());
+			}       
+        }
+		$groupfield->setRegisterInArrayValidator(false);
+		$this->addElement($groupfield);
+		######################################
+		 $this->addElement('text', 'time', array(
+			'filters' => array('StringTrim'),
+			'validators' => array(
+				array('StringLength', false, array(0, 50)),
+			),
+			'required' => false,
+			'label' => 'Time:',
+		));
+		######################################
+		$clientfield = $this->createElement('select','clientID');
+        $clientfield ->setLabel('Client:');
+		$clientfield->addMultiOption('','');
+        if(count($this->clients)>0){
+			foreach($this->clients as $id => $g){
+				$clientfield->addMultiOption($g->getID(), $g->getMacadress());
+			}       
+        }
+		$clientfield->setRegisterInArrayValidator(false);
+		$this->addElement($clientfield);
+
+		$this->addElement('submit', 'submit', array(
+            'required' => false,
+            'ignore'   => true,
+            'label'    => 'Get It On!',
+        ));  
+    }
+	function setPools($v){
+		$this->pools = $v;
+	}
+	function setBootisos($v){
+		$this->bootisos = $v;
+	}
+	function setMemberships($v){
+		$this->memberships = $v;
+	}
+	function setGroups($v){
+		$this->groups = $v;
+	}
+	function setClients($v){
+		$this->clients = $v;
+	}
+
+
+}
+
diff --git a/application/layouts/main.phtml b/application/layouts/main.phtml
index 3d95f2f..9ad6122 100644
--- a/application/layouts/main.phtml
+++ b/application/layouts/main.phtml
@@ -32,6 +32,7 @@ echo $this->headScript()."\n";
 	</div>
 	<div id='innerwrapper'>
 	<?php echo $this->layout()->content; ?>
+	<div class='clear'></div>
 	</div>
  </div>
 </body></html>
diff --git a/application/views/scripts/filter/index.phtml b/application/views/scripts/filter/index.phtml
index a3d3efa..c14bf51 100644
--- a/application/views/scripts/filter/index.phtml
+++ b/application/views/scripts/filter/index.phtml
@@ -110,3 +110,6 @@
     <p>There are no filters to display.</p>
  
 <?php endif;?>
+<?php echo $this->formButton('createconfig', 'Test Filters', array(
+							'onclick' => 'self.location="/filter/testevaluate"',
+							'class' => 'addbutton'))?>
diff --git a/application/views/scripts/filter/testevaluate.phtml b/application/views/scripts/filter/testevaluate.phtml
new file mode 100644
index 0000000..8a10629
--- /dev/null
+++ b/application/views/scripts/filter/testevaluate.phtml
@@ -0,0 +1,4 @@
+<h1>Test Filters</h1>
+
+<?php
+echo $this->filterevaluate;
diff --git a/pbs-data.sql b/pbs-data.sql
index f80c8eb..a1f1c1b 100644
--- a/pbs-data.sql
+++ b/pbs-data.sql
@@ -77,5 +77,6 @@ INSERT INTO `pbs_bootiso` (`bootisoID`, `title`, `membershipID`, `groupID`, `pat
 INSERT INTO `pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `housenumber`, `city`, `postalcode`, `logindate`, `registerdate`, `email`, `login`, `password`, `password_salt`) VALUES
 (3, '1', '2', '3', '4', '5', '6', '7', NULL, '1299612370', 'test', NULL, '4207acba08cadccc397e2302a55b339a', 'f21ee663b17bcefc6868694dffda602a');
 
+INSERT INTO `pbs`.`pbs_session` (`sessionID`, `clientID`, `bootosID`, `bootisoID`, `time`, `ip`, `ip6`) VALUES (NULL, '1', '1', '1', UNIX_TIMESTAMP(), '1.1.1.2', NULL);
 
 
diff --git a/public/media/css/style.css b/public/media/css/style.css
index ec6fcc7..6fe0906 100644
--- a/public/media/css/style.css
+++ b/public/media/css/style.css
@@ -126,3 +126,4 @@ tr td.action{
 	width:20px;
 }
 td.action img{border:none;}
+.clear{clear:both;}
-- 
cgit v1.2.3-55-g7522

