From cca7e33721f67c2e0f7abf2c7b801116b80873ba Mon Sep 17 00:00:00 2001
From: Simon
Date: Wed, 9 Mar 2011 15:01:35 +0100
Subject: datenbankfehler behoben

---
 pbs.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'pbs.sql')

diff --git a/pbs.sql b/pbs.sql
index 58c9392..a4149c2 100644
--- a/pbs.sql
+++ b/pbs.sql
@@ -217,7 +217,7 @@ ALTER TABLE `pbs_session` ADD `bootisoID` INT NOT NULL AFTER `bootosID`;
 
 ALTER TABLE `pbs_session`
   ADD CONSTRAINT `pbs_session_ibfk_1` FOREIGN KEY (`clientID`) REFERENCES `pbs_client` (`clientID`),
-  ADD CONSTRAINT `pbs_session_ibfk_2` FOREIGN KEY (`bootosID`) REFERENCES `pbs_bootos` (`bootosID`);
+  ADD CONSTRAINT `pbs_session_ibfk_2` FOREIGN KEY (`bootosID`) REFERENCES `pbs_bootos` (`bootosID`),
   ADD CONSTRAINT `pbs_session_ibfk_3` FOREIGN KEY (`bootisoID`) REFERENCES `pbs_bootiso` (`bootisoID`);
 
 CREATE TABLE IF NOT EXISTS `pbs_pool` (
-- 
cgit v1.2.3-55-g7522


From 5767c4f644a586d5f19e86fdd2de2ad47a21cb1a Mon Sep 17 00:00:00 2001
From: Simon
Date: Wed, 9 Mar 2011 20:49:24 +0100
Subject: FilterController Evaluate funktioniert

---
 application/Bootstrap.php                     |   1 -
 application/controllers/FilterController.php  | 139 +++++++++++++++-----------
 application/controllers/SessionController.php |  50 +++++++--
 application/forms/Session.php                 |  71 ++++++++-----
 application/layouts/main.phtml                |   3 +
 application/views/scripts/filter/index.phtml  |   4 +-
 application/views/scripts/session/index.phtml |   2 +-
 pbs-newdata.sql                               | 125 +++++++++++++++++++++++
 pbs.sql                                       |  13 ++-
 public/media/css/style.css                    |   3 +
 zend-user.sh                                  |   6 +-
 11 files changed, 316 insertions(+), 101 deletions(-)
 create mode 100644 pbs-newdata.sql

(limited to 'pbs.sql')

diff --git a/application/Bootstrap.php b/application/Bootstrap.php
index c286ad1..f0fe7d3 100644
--- a/application/Bootstrap.php
+++ b/application/Bootstrap.php
@@ -22,7 +22,6 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
         $view->doctype('XHTML1_STRICT');
         $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
         $view->headLink()->appendStylesheet('/media/css/style.css');
-        $view->headTitle()->setSeparator(' - ');
         $view->headTitle('pbs²')
              ->setSeparator(' :: ');
     }
diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php
index d17aceb..9141e10 100644
--- a/application/controllers/FilterController.php
+++ b/application/controllers/FilterController.php
@@ -316,15 +316,18 @@ class FilterController extends Zend_Controller_Action
 				$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
-							CONV(HEX('filtervalue'),16,10) <= CONV(HEX('".$macAdress."'),16,10) AND
-							CONV(HEX('".$macAdress."'),16,10) <= CONV(HEX('filtervalue2'),16,10)");
-			$result = $stmt->fetchAll();
-			foreach($result as $r){
-				$set[$filtertypID][] = $r['filterID'];	
+			try{
+				$macAdress = str_replace(":","",$this->fillMac($ipAdress));			
+				$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
+								filtertypeID  = ".$filtertypID." AND
+								CONV(HEX('filtervalue'),16,10) <= CONV(HEX('".$macAdress."'),16,10) AND
+								CONV(HEX('".$macAdress."'),16,10) <= CONV(HEX('filtervalue2'),16,10)");
+				$result = $stmt->fetchAll();
+				foreach($result as $r){
+					$set[$filtertypID][] = $r['filterID'];	
+				}
 			}
+			catch(Exception $e){}
 			if($showPartResults)
 				print_a('macAdress',$result,$set[$filtertypID]);
 
@@ -341,16 +344,18 @@ class FilterController extends Zend_Controller_Action
 				$poolID = $poolentry['poolID'];
 			}			
 			
-
-			$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
-							filtertypeID  = ".$filtertypID." AND
-							filtervalue = ".$poolID." ");			
-			$result = $stmt->fetchAll();
-			if(count($result)>0){
-				foreach($result as $r){
-					$set[$filtertypID][] = $r['filterID'];	
+			try{
+				$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
+								filtertypeID  = ".$filtertypID." AND
+								filtervalue = ".$poolID." ");			
+				$result = $stmt->fetchAll();
+				if(count($result)>0){
+					foreach($result as $r){
+						$set[$filtertypID][] = $r['filterID'];	
+					}
 				}
 			}
+			catch(Exception $e){}
 
 			if($showPartResults)
 				print_a('poolID',$result,$set[$filtertypID]);
@@ -362,14 +367,16 @@ class FilterController extends Zend_Controller_Action
 			if(!$testFilter){
 				$clientID = $session->getClientID();
 			}
-
-			$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
-							filtertypeID  = ".$filtertypID." AND
-							filtervalue = ".$clientID." ");
-			$result = $stmt->fetchAll();
-			foreach($result as $r){
-				$set[$filtertypID][] = $r['filterID'];	
+			try{
+				$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
+								filtertypeID  = ".$filtertypID." AND
+								filtervalue = ".$clientID." ");
+				$result = $stmt->fetchAll();
+				foreach($result as $r){
+					$set[$filtertypID][] = $r['filterID'];	
+				}
 			}
+			catch(Exception $e){}
 
 			if($showPartResults)
 				print_a('clientID',$result,$set[$filtertypID]);
@@ -380,14 +387,16 @@ class FilterController extends Zend_Controller_Action
 			if(!$testFilter){		
 				$bootisoID = $session->getBootisoID();
 			}
-
-			$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
-							filtertypeID  = ".$filtertypID." AND
-							filtervalue = ".$bootisoID." ");
-			$result = $stmt->fetchAll();
-			foreach($result as $r){
-				$set[$filtertypID][] = $r['filterID'];	
+			try{
+				$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
+								filtertypeID  = ".$filtertypID." AND
+								filtervalue = ".$bootisoID." ");
+				$result = $stmt->fetchAll();
+				foreach($result as $r){
+					$set[$filtertypID][] = $r['filterID'];	
+				}
 			}
+			catch(Exception $e){}
 
 			if($showPartResults)
 				print_a('bootisoID',$result,$set[$filtertypID]);
@@ -400,14 +409,16 @@ class FilterController extends Zend_Controller_Action
 				//TODO: GET MEMBERSHIP from SESSION
 				$membershipID = 1;
 			}
-
-			$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
-							filtertypeID  = ".$filtertypID." AND
-							filtervalue = ".$membershipID." ");
-			$result = $stmt->fetchAll();
-			foreach($result as $r){
-				$set[$filtertypID][] = $r['filterID'];	
+			try{
+				$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
+								filtertypeID  = ".$filtertypID." AND
+								filtervalue = ".$membershipID." ");
+				$result = $stmt->fetchAll();
+				foreach($result as $r){
+					$set[$filtertypID][] = $r['filterID'];	
+				}
 			}
+			catch(Exception $e){}
 
 			if($showPartResults)
 				print_a('membership',$result,$set[$filtertypID]);
@@ -420,14 +431,16 @@ class FilterController extends Zend_Controller_Action
 				//TODO: GET GROUP from SESSION
 				$groupID = 1;	
 			}
-
-			$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
-							filtertypeID  = ".$filtertypID." AND
-							filtervalue = ".$groupID." ");
-			$result = $stmt->fetchAll();
-			foreach($result as $r){
-				$set[$filtertypID][] = $r['filterID'];	
+			try{
+				$stmt = $db->query("SELECT * FROM pbs_filterentries WHERE 
+								filtertypeID  = ".$filtertypID." AND
+								filtervalue = ".$groupID." ");
+				$result = $stmt->fetchAll();
+				foreach($result as $r){
+					$set[$filtertypID][] = $r['filterID'];	
+				}
 			}
+			catch(Exception $e){}
 
 			if($showPartResults)
 				print_a('membership',$result,$set[$filtertypID]);
@@ -443,19 +456,21 @@ class FilterController extends Zend_Controller_Action
 
 			$nowShort = str_replace("-","",$nowShort);
 			$nowLong = str_replace("-","",$nowLong);
-
-			$select = $db->select()
-			     ->from(array('pbs_filterentries')
-					)
-				->where('filtertypeID  = ?',$filtertypID)
-				->where('REPLACE(filtervalue,"-","") <= ? AND ? <= REPLACE(filtervalue2,"-","")',$nowShort)
-				->orWhere('REPLACE(filtervalue,"-","") <= ? AND ? <= REPLACE(filtervalue2,"-","")',$nowLong);
+			try{
+				$select = $db->select()
+					 ->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'];	
+				$stmt = $select->query();
+				$result = $stmt->fetchAll();
+				foreach($result as $r){
+					$set[$filtertypID][] = $r['filterID'];	
+				}
 			}
+			catch(Exception $e){}
 
 			if($showPartResults)
 				print_a('time',$result,$set[$filtertypID]);	
@@ -511,9 +526,16 @@ class FilterController extends Zend_Controller_Action
 			}
 			catch(Exception $e){				
 			}
+			if($bootmenuID != 'null'){
+				$bm = new Application_Model_BootMenu();
+				$bmmapper = new Application_Model_BootMenuMapper();
+				$bmmapper->find($bootmenuID,$bm);
+				echo "<h1><a href='/bootmenu/index/bootmenuID/".$bootmenuID."'>Goto BootmenuID: ".$bootmenuID."</a></h1>";
+			}
+			else{
+			echo "<h1>No Result :-(</h1>";
+			}
 			
-			echo "<h1>Redirected BootmenuID: ".$bootmenuID."</h1>";
-	
 		}catch (Zend_Exception $e) {  
 				echo "class: ".get_class($e)."<br>\n";
 				echo "Error message 2: " . $e->getMessage() . "\n";
@@ -542,7 +564,8 @@ class FilterController extends Zend_Controller_Action
 					'bootisos' 		=>	$bootisos,
 					'memberships'	=>	$memberships,
 					'groups'		=>	$groups,
-					'clients'		=>	$clients
+					'clients'		=>	$clients,
+					
 			));
         $this->view->filterevaluate = $filterevaluate;
     }
diff --git a/application/controllers/SessionController.php b/application/controllers/SessionController.php
index 21f94fa..09eadc9 100644
--- a/application/controllers/SessionController.php
+++ b/application/controllers/SessionController.php
@@ -16,16 +16,32 @@ class SessionController extends Zend_Controller_Action
 
     public function createsessionAction()
     {
+		$cm = new Application_Model_ClientMapper();
+		$clients = $cm->fetchAll();
+
+		$bm = new Application_Model_BootOsMapper();
+		$bootos = $bm->fetchAll();
+
+		$bi = new Application_Model_BootIsoMapper();
+		$bootisos = $bi->fetchAll();
+
 		if (!isset($_POST["add"])){
-    		$createsession = new Application_Form_Session();    		
+    		$createsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos)); 		
 			$this->view->createsession = $createsession;		
 		}else {
 			// TODO extend with normal function not only with post
-			$createsession = new Application_Form_Session($_POST);
+			$createsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
 			print_a($_POST);
 			if ($createsession->isValid($_POST)) {			
 				try{
 					$session = new Application_Model_Session($_POST);
+					$session->setTime(strtotime($_POST['time']));
+					if($session->getClientID() == ''){
+						$session->setClientID(null);
+					}
+					if($session->getBootosID() == ''){
+						$session->setBootosID(null);
+					}
 					$sessionmapper = new Application_Model_SessionMapper();
 					$sessionmapper->save($session);
 				
@@ -35,16 +51,22 @@ class SessionController extends Zend_Controller_Action
         			echo "Error message 2: " . $e->getMessage() . "\n";  
         		}
 				print_a('saved');
-				$this->_redirect('/session');
-			}
-			else{
-				print_a('not saved');
+				#$this->_redirect('/session');
 			}
+			$this->view->createsession = $createsession;
 		}
     }
 
     public function editsessionAction()
     {
+		$cm = new Application_Model_ClientMapper();
+		$clients = $cm->fetchAll();
+
+		$bm = new Application_Model_BootOsMapper();
+		$bootos = $bm->fetchAll();
+
+		$bi = new Application_Model_BootIsoMapper();
+		$bootisos = $bi->fetchAll();
        if (!isset($_POST["add"])){
 		    // TODO: ACL implementieren ob er editieren darf
 			$sessionID = $this->_request->getParam('sessionID');
@@ -52,10 +74,11 @@ class SessionController extends Zend_Controller_Action
 			
 
 			$sessionmapper = new Application_Model_SessionMapper();
-			$sessionmapper->find($sessionID,$session);		
+			$sessionmapper->find($sessionID,$session);				
+			$session->setTime(date('d.m.Y H:i',$session->getTime()));	
 			$session2 = $session->toArray();
 
-			$editsession = new Application_Form_Session();  
+			$editsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos)); 
 			$editsession->populate($session2);
 			$this->view->editsession = $editsession;
 		
@@ -63,11 +86,18 @@ class SessionController extends Zend_Controller_Action
 			try{
 				$sessionID = $this->_request->getParam('sessionID');	
 				
-				$editsession = new Application_Form_Session($_POST);
+				$editsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
 
 				if ($editsession->isValid($_POST)) {	
 					$session = new Application_Model_Session($_POST);
-					$session->setID($this->_request->getParam('sessionID'));
+					$session->setID($this->_request->getParam('sessionID'));					
+					$session->setTime(strtotime($_POST['time']));
+					if($session->getClientID() == ''){
+						$session->setClientID(null);
+					}
+					if($session->getBootosID() == ''){
+						$session->setBootosID(null);
+					}
 					$sessionmapper = new Application_Model_SessionMapper();				
 					$sessionmapper->save($session);
 					echo 'valid';					
diff --git a/application/forms/Session.php b/application/forms/Session.php
index f094676..30aefda 100644
--- a/application/forms/Session.php
+++ b/application/forms/Session.php
@@ -3,36 +3,48 @@
 class Application_Form_Session extends Zend_Form
 {
 
+	private $clients;
+	private $bootos;
+	private $bootisos;
+
     public function init()
     {
         $this->setName("session");
 		$this->setMethod('post');
 
-        $this->addElement('text', 'clientID', array(
-			'filters' => array('StringTrim'),
-			'validators' => array(
-				array('StringLength', false, array(0, 50)),
-			),
-			'required' => true,
-			'label' => 'clientID:',
-		));
+        $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);
+
+
+		$bootosfield = $this->createElement('select','bootosID');
+        $bootosfield ->setLabel('BootOs:');
+		$bootosfield->addMultiOption('','');
+        if(count($this->bootos)>0){
+			foreach($this->bootos as $id => $g){
+				$bootosfield->addMultiOption($g->getID(), $g->getTitle());
+			}       
+        }
+		$bootosfield->setRegisterInArrayValidator(false);
+		$this->addElement($bootosfield);
+		
+		$bootisofield = $this->createElement('select','bootisoID');
+        $bootisofield ->setLabel('BootIso:');
+        if(count($this->bootisos)>0){
+			foreach($this->bootisos as $id => $g){
+				$bootisofield->addMultiOption($g->getID(), $g->getTitle());
+			}       
+        }
+		$bootisofield->setRegisterInArrayValidator(false);
+		$this->addElement($bootisofield);
 
-		$this->addElement('text', 'bootosID', array(
-			'filters' => array('StringTrim'),
-			'validators' => array(
-				array('StringLength', false, array(0, 50)),
-			),
-			'required' => true,
-			'label' => 'bootosID:',
-		));
-$this->addElement('text', 'bootisoID', array(
-			'filters' => array('StringTrim'),
-			'validators' => array(
-				array('StringLength', false, array(0, 50)),
-			),
-			'required' => true,
-			'label' => 'bootisoID:',
-		));
 $this->addElement('text', 'time', array(
 			'filters' => array('StringTrim'),
 			'validators' => array(
@@ -64,7 +76,16 @@ $this->addElement('text', 'ip6', array(
             'label'    => 'Save',
         ));  
     }
-
+	function setClients($v){
+		$this->clients = $v;
+	}	
+	function setBootos($v){
+		$this->bootos = $v;
+	}
+	function setBootisos($v){
+		$this->bootisos = $v;
+	}
+	
 
 }
 
diff --git a/application/layouts/main.phtml b/application/layouts/main.phtml
index 483d267..57d09c7 100644
--- a/application/layouts/main.phtml
+++ b/application/layouts/main.phtml
@@ -4,6 +4,9 @@
 <head>
  
 <?php
+$request = Zend_Controller_Front::getInstance()->getRequest();
+$this->headTitle()->append(ucwords($request->getControllerName()));
+$this->headTitle()->append(ucwords($request->getActionName()));
 echo $this->headTitle()."\n";
 echo $this->headMeta()."\n";
 echo $this->headStyle()."\n";
diff --git a/application/views/scripts/filter/index.phtml b/application/views/scripts/filter/index.phtml
index c14bf51..188bed3 100644
--- a/application/views/scripts/filter/index.phtml
+++ b/application/views/scripts/filter/index.phtml
@@ -8,6 +8,7 @@
         <tr>
             <th>ID</th>
 			<th>Title</th>
+			<th>Description</th>
 			<th>Priority</th>
 			<th>TargetBootMenu</th>
  			<th colspan=3>Actions</th>
@@ -16,6 +17,7 @@
     <tr class='entry'>
 			<td><?php echo $this->escape($filter->getID()) ?></td>
             <td><?php echo $this->escape($filter->title) ?></td>
+			<td><?php echo $this->escape($filter->Description) ?></td>
 			<td><?php echo $this->escape($filter->priority) ?></td>
 			<td><?php echo $this->escape($filter->bootmenuID) ?></td>
 			<td class='action'><a href="<?php echo $this->url(
@@ -51,7 +53,7 @@
 			<?php if (count($erg)>0): ?>
 			<tr class=detail>
 			<td class=arrowtop>↳</td>
-			<td colspan=6>
+			<td colspan=7>
 				<?php
 					
 				?>	
diff --git a/application/views/scripts/session/index.phtml b/application/views/scripts/session/index.phtml
index 0ff255d..6e87acf 100644
--- a/application/views/scripts/session/index.phtml
+++ b/application/views/scripts/session/index.phtml
@@ -19,7 +19,7 @@
 		<td><?php echo $this->escape($session->getClientID()) ?></td>
 		<td><?php echo $this->escape($session->getBootosID()) ?></td>
 		<td><?php echo $this->escape($session->getBootisoID()) ?></td>		
-		<td><?php echo $this->escape($session->getTime()) ?></td>
+		<td><?php echo date('d.m.Y H:i',$this->escape($session->getTime())) ?></td>
 		<td><?php echo $this->escape($session->getIp()) ?></td>
 		<td><?php echo $this->escape($session->getIp6()) ?></td>
 		<td class='action'><a href="<?php echo $this->url(
diff --git a/pbs-newdata.sql b/pbs-newdata.sql
new file mode 100644
index 0000000..48a1dc6
--- /dev/null
+++ b/pbs-newdata.sql
@@ -0,0 +1,125 @@
+USE pbs;
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+
+-- Adding person test//test
+INSERT INTO `pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `housenumber`, `city`, `postalcode`, `logindate`, `registerdate`, `email`, `login`, `password`, `password_salt`) VALUES
+(1, 'Herr', 'Test 1', 'Test 1', 'Teststr,', '5', 'Testburg', '1337', NULL, '1299612370', 'test', NULL, '4207acba08cadccc397e2302a55b339a', 'f21ee663b17bcefc6868694dffda602a');
+-- Adding person test2//test
+INSERT INTO `pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `housenumber`, `city`, `postalcode`, `logindate`, `registerdate`, `email`, `login`, `password`, `password_salt`) VALUES
+(2, 'Herr', 'Test 2', 'Test 2', 'Teststr,', '5', 'Testburg', '1337', NULL, '1299612370', 'test2', NULL, '4207acba08cadccc397e2302a55b339a', 'f21ee663b17bcefc6868694dffda602a');
+
+-- Adding group
+INSERT INTO `pbs`.`pbs_group` (`groupID` ,`title` ,`description`)VALUES (1 , 'Group 1', NULL);
+
+-- Adding role
+INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`) VALUES (1, '1', 'Role 1', NULL);
+INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`) VALUES (2, '1', 'Role 2', NULL);
+
+-- Adding memberships
+INSERT INTO `pbs`.`pbs_membership` (`membershipID`, `groupID`, `roleID`, `personID`) VALUES (1, '1', '1', '1');
+INSERT INTO `pbs`.`pbs_membership` (`membershipID`, `groupID`, `roleID`, `personID`) VALUES (2, '1', '2', '2');
+
+-- Adding clients
+INSERT INTO `pbs_client` (`clientID`, `macadress`, `hardwarehash`) VALUES
+(1, '00:00:00:00:00:10', 'ea9b82d9de911bc2d3cd23f53a6cab48'),
+(2, '00:00:00:00:10:00', '1e2b1599710fbbef0dc789e8cfe12455'),
+(3, '00:00:00:10:10:00', '8f6209ca3d6b35e223a11c249d1b69fc'),
+(4, '00:00:10:00:00:00', 'e17ab09f3586464f19629e2e8b1e9a9d'),
+(5, '00:10:00:00:00:00', '9bf70279d283b85440c2031c19bb6812'),
+(6, '10:00:00:00:00:00', 'ad3bce4464a6267441ec144744439c7e'),
+(7, '00:55:00:55:00:55', 'e8d7e80d79f224771b7a3a0af4e02748'),
+(8, '66:00:66:00:66:00', 'ded66ce272f384e9e386c1b57ded3e4d'),
+(9, '00:ff:ff:ff:ff:ff', '695610ee509c060b1fca9c8011529af4'),
+(10, '00:22:00:22:00:22', 'a3562c8cad2a4fa4fc11656025dc911b');
+
+-- Adding config
+INSERT INTO `pbs_config` (`configID`, `title`, `groupID`, `membershipID`, `shellscript`, `created`) VALUES
+(1, 'Config 1', 1, 1, 'shellscript 1', '1299693677'),
+(2, 'Config 2', 1, 1, 'shellskript 2', '1299693690'),
+(3, 'Config 3', 1, 1, 'shellskript 3', '1299693690'),
+(4, 'Config 4', 1, 1, 'shellskript 4', '1299693690'),
+(5, 'Config 5', 1, 1, 'shellskript 5', '1299693690');
+
+-- Adding bootos
+INSERT INTO `pbs_bootos` (`bootosID`, `configID`, `groupID`, `membershipID`, `title`, `description`, `path_init`, `path_kernel`, `defaultkcl`, `created`, `expires`, `public`) VALUES
+(1, 1, 1, 1, 'BootOs 1', 'Description 1', 'initpath 1', 'kernelpath 1', 'default kcl 1', '1299693782', '2012-03-09', 0),
+(2, 1, 1, 1, 'BootOs 2', 'Description 2', 'initpath 2', 'kernelpath 2', 'default kcl 2', '1299693782', '2012-03-09', 0),
+(3, 1, 1, 1, 'BootOs 3', 'Description 3', 'initpath 3', 'kernelpath 3', 'default kcl 3', '1299693782', '2012-03-09', 0),
+(4, 1, 1, 1, 'BootOs 4', 'Description 4', 'initpath 4', 'kernelpath 4', 'default kcl 4', '1299693782', '2012-03-09', 0),
+(5, 1, 1, 1, 'BootOs 5', 'Description 5', 'initpath 5', 'kernelpath 5', 'default kcl 5', '1299693782', '2012-03-09', 0),
+(6, 1, 1, 1, 'BootOs 6', 'Description 6', 'initpath 6', 'kernelpath 6', 'default kcl 6', '1299693782', '2012-03-09', 0),
+(7, 1, 1, 1, 'BootOs 7', 'Description 7', 'initpath 7', 'kernelpath 7', 'default kcl 7', '1299693782', '2012-03-09', 0),
+(8, 1, 1, 1, 'BootOs 8', 'Description 8', 'initpath 8', 'kernelpath 8', 'default kcl 8', '1299693782', '2012-03-09', 0),
+(9, 1, 1, 1, 'BootOs 9', 'Description 9', 'initpath 9', 'kernelpath 9', 'default kcl 9', '1299693782', '2012-03-09', 0),
+(10, 1, 1, 1, 'BootOs 10', 'Description 10', 'initpath 10', 'kernelpath 10', 'default kcl 10', '1299693782', '2012-03-09', 0);
+
+-- Adding bootiso
+INSERT INTO `pbs_bootiso` (`bootisoID`, `title`, `membershipID`, `groupID`, `path`, `serialnumber`, `created`, `expires`, `public`) VALUES
+(1, 'BootIso 1', 1, 1, 'Path 1', 123456789, '1299693879', '2012-03-09', 0),
+(2, 'BootIso 2', 1, 1, 'Path 2', 2147483647, '1299693899', '2012-03-09', 0),
+(3, 'BootIso 3', 1, 1, 'Path 3', 2147483647, '1299693899', '2012-03-09', 0);
+
+-- Adding Pools
+INSERT INTO `pbs_pool` (`poolID`, `title`, `description`, `location`) VALUES
+(1, 'Pool 1', 'Description 1', 'Keller'),
+(2, 'Pool 2', 'Description 2', 'EG'),
+(3, 'Pool 3', 'Description 3', '1 OG'),
+(4, 'Pool 4', 'Description', '2 OG');
+
+-- Adding BootOs to BootMenus
+INSERT INTO `pbs_bootmenuentries` (`bootmenuentriesID`, `bootosID`, `bootmenuID`, `title`, `kcl`, `configID`, `order`) VALUES
+(1, 1, 1, 'Select BootOs 1', 'kcl 1', 1, 0),
+(2, 1, 1, 'Select BootOs 1', 'kcl 2', 2, 1),
+(3, 2, 1, 'Select BootOs 2', 'kcl 3', 2, 2),
+(4, 5, 2, 'Select BootOs 5', 'kcl 5', 2, 0),
+(5, 4, 2, 'Select BootOs 4', 'kcl 4', 2, 1),
+(6, 10, 3, 'Select BootOs 10', 'kcl 10', 3, 0),
+(7, 8, 3, 'Select BootOs 8', 'kcl 8', 4, 1),
+(8, 1, 2, 'Select BootOs 7', 'kcl 7', 5, 2),
+(9, 1, 5, 'Select BootOs 3', 'kcl 3', 4, 0),
+(10, 9, 4, 'Select BootOs 9', 'kcl 9', 3, 0),
+(11, 7, 4, 'Select BootOs 7', 'kcl 7', 5, 1);
+
+-- Adding client to pools (poolentries)
+INSERT INTO `pbs_poolentries` (`poolentriesID`, `poolID`, `clientID`) VALUES
+(1, 1, 1),
+(2, 1, 2),
+(3, 1, 3),
+(4, 1, 4),
+(5, 2, 5),
+(6, 2, 6),
+(7, 3, 7),
+(8, 3, 8),
+(9, 4, 9),
+(10, 4, 10);
+
+-- Adding Bootmenus
+INSERT INTO `pbs_bootmenu` (`bootmenuID`, `membershipID`, `groupID`, `title`, `created`) VALUES
+(1, 1, 1, 'Bootmenu 1', '1299694422'),
+(2, 1, 1, 'Bootmenu 2', '1299694433'),
+(3, 1, 1, 'Bootmenu 3', '1299694441'),
+(4, 1, 1, 'Bootmenu 4', '1299694454'),
+(5, 1, 1, 'Bootmenu 5', '1299694461');
+
+-- Adding Sessions
+INSERT INTO `pbs_session` (`sessionID`, `clientID`, `bootosID`, `bootisoID`, `time`, `ip`, `ip6`) VALUES
+(1, 1, NULL, 1, '1299684000', '132.230.5.6', ''),
+(2, 9, NULL, 2, '1299684000', '132.230.10.2', ''),
+(3, 10, NULL, 1, '1299648000', '132.20.20.2', ''),
+(4, 7, NULL, 3, '1299676800', '84.23.56.86', ''),
+(5, 4, NULL, 3, '1299674340', '70.81.94.222', ''),
+(6, 5, NULL, 3, '1299683100', '210.84.65.2', '');
+
+-- Adding Filter
+INSERT INTO `pbs_filter` (`filterID`, `membershipID`, `groupID`, `bootmenuID`, `title`, `description`, `created`, `priority`) VALUES
+(1, 1, 1, 1, 'Filter 1', 'Innerhalb der Uni', '1299697337', 10),
+(2, 1, 1, 5, 'Filter 2', 'Ausserhalb der Uni', '1299697073', 20),
+(3, 1, 1, 4, 'Filter 3', 'Desc3', '1299697277', 5);
+
+-- Adding Filterentries
+INSERT INTO `pbs_filterentries` (`filterentriesID`, `filterID`, `filtertypeID`, `filtervalue`, `filtervalue2`) VALUES
+(1, 1, 7, '08-00', '18-00'),
+(2, 2, 1, '001.001.001.001', '132.229.255.255'),
+(3, 2, 1, '132.231.001.001', '255.255.255.255'),
+(4, 1, 1, '132.230.001.001', '132.230.255.255'),
+(5, 3, 3, '1', '');
diff --git a/pbs.sql b/pbs.sql
index a4149c2..f404b0a 100644
--- a/pbs.sql
+++ b/pbs.sql
@@ -204,8 +204,8 @@ CREATE TABLE IF NOT EXISTS `pbs_client` (
 
 CREATE TABLE IF NOT EXISTS `pbs_session` (
   `sessionID` int(11) NOT NULL AUTO_INCREMENT,
-  `clientID` int(11) NOT NULL,
-  `bootosID` int(11) NOT NULL,
+  `clientID` int(11),
+  `bootosID` int(11),
   `time` varchar(14) NOT NULL,
   `ip` varchar(15) NOT NULL,
   `ip6` varchar(45),
@@ -303,5 +303,14 @@ ALTER TABLE `pbs_filterentries`
   ADD CONSTRAINT `pbs_filterentries_ibfk_2` FOREIGN KEY (`filtertypeID`) REFERENCES `pbs_filtertype` (`filtertypeID`) ON DELETE CASCADE;
 
 
+-- Insert Filtertypes
+INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'IP');
+INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'MAC');
+INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'PoolID');
+INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'BootIso');
+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');
 
 
diff --git a/public/media/css/style.css b/public/media/css/style.css
index 345ba12..1d3da5d 100644
--- a/public/media/css/style.css
+++ b/public/media/css/style.css
@@ -85,6 +85,9 @@ border:1px solid #CCC;
 .addbutton {
 	float:right;	
 }
+.addbutton:before{
+	content: url(/media/img/create.png)' ';
+}
 
 .monospace {
 font-family:Courier New, monospace;
diff --git a/zend-user.sh b/zend-user.sh
index 6e4bbeb..16ba63e 100644
--- a/zend-user.sh
+++ b/zend-user.sh
@@ -1,4 +1,4 @@
 #!/bin/bash
-cp ~/pbs2/application/configs/application.ini /tmp/pbs2/application/configs/application.ini
-mysql -u root -p < /tmp/pbs2/pbs.sql
-mysql -u root -p < /tmp/pbs2/pbs-data.sql
+cp /tmp/pbs2/application/configs/application.ini.dist /tmp/pbs2/application/configs/application.ini
+mysql -u root -p </tmp/pbs2/pbs.sql
+mysql -u root -p </tmp/pbs2/pbs-newdata.sql
-- 
cgit v1.2.3-55-g7522

