summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichael pereira2011-03-06 20:12:43 +0100
committermichael pereira2011-03-06 20:12:43 +0100
commitc2e050df18557a3fe1093f0fef1685c2e631b95b (patch)
tree532672f37cf928d0c2c81b6e3d55fd8cda7e393d
parentdatenbank erweitert, BootMenu, Config fertig (diff)
parentPool add, edit und remove hinzugefügt (diff)
downloadpbs2-c2e050df18557a3fe1093f0fef1685c2e631b95b.tar.gz
pbs2-c2e050df18557a3fe1093f0fef1685c2e631b95b.tar.xz
pbs2-c2e050df18557a3fe1093f0fef1685c2e631b95b.zip
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
-rw-r--r--.zfproject.xml36
-rw-r--r--application/Bootstrap.php20
-rw-r--r--application/configs/application.ini2
-rw-r--r--application/controllers/ClientController.php54
-rw-r--r--application/controllers/FilterController.php185
-rw-r--r--application/controllers/PoolController.php40
-rw-r--r--application/forms/FilterAdd.php2
-rw-r--r--application/models/PoolMapper.php15
-rw-r--r--application/views/scripts/client/addclient.phtml1
-rw-r--r--application/views/scripts/client/index.phtml34
-rw-r--r--application/views/scripts/client/removeclient.phtml1
-rw-r--r--application/views/scripts/filter/evaluate.phtml0
-rw-r--r--application/views/scripts/pool/createpool.phtml1
-rw-r--r--application/views/scripts/pool/deletepool.phtml1
-rw-r--r--application/views/scripts/pool/editpool.phtml1
-rw-r--r--application/views/scripts/pool/index.phtml36
-rw-r--r--pbs-data.sql38
-rw-r--r--tests/application/controllers/ClientControllerTest.php20
-rw-r--r--tests/application/controllers/PoolControllerTest.php20
19 files changed, 453 insertions, 54 deletions
diff --git a/.zfproject.xml b/.zfproject.xml
index f07e618..ea102b1 100644
--- a/.zfproject.xml
+++ b/.zfproject.xml
@@ -54,10 +54,21 @@
<actionMethod actionName="removebootmenuentry"/>
<actionMethod actionName="deletebootmenu"/>
</controllerFile>
+ <controllerFile controllerName="Client">
+ <actionMethod actionName="index"/>
+ <actionMethod actionName="addclient"/>
+ <actionMethod actionName="removeclient"/>
+ </controllerFile>
+ <controllerFile controllerName="Pool">
+ <actionMethod actionName="index"/>
+ <actionMethod actionName="createpool"/>
+ <actionMethod actionName="deletepool"/>
+ <actionMethod actionName="editpool"/>
+ </controllerFile>
</controllersDirectory>
<formsDirectory>
<formFile formName="AuthLogin"/>
- <formFile formName="AuthDelete"/>
+ <formFile formName="AuthDelete"/>
<formFile formName="AuthRegister"/>
<formFile formName="FilterAdd"/>
<formFile formName="FilterEntriesAdd"/>
@@ -222,6 +233,27 @@
<viewControllerScriptsDirectory forControllerName="Bootmenu">
<viewScriptFile forActionName="editbootmenuentry"/>
</viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Client">
+ <viewScriptFile forActionName="index"/>
+ </viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Pool">
+ <viewScriptFile forActionName="index"/>
+ </viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Client">
+ <viewScriptFile forActionName="addclient"/>
+ </viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Client">
+ <viewScriptFile forActionName="removeclient"/>
+ </viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Pool">
+ <viewScriptFile forActionName="createpool"/>
+ </viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Pool">
+ <viewScriptFile forActionName="deletepool"/>
+ </viewControllerScriptsDirectory>
+ <viewControllerScriptsDirectory forControllerName="Pool">
+ <viewScriptFile forActionName="editpool"/>
+ </viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory enabled="false"/>
@@ -262,6 +294,8 @@
<testApplicationControllerFile filesystemName="BootosControllerTest.php"/>
<testApplicationControllerFile filesystemName="ConfigControllerTest.php"/>
<testApplicationControllerFile filesystemName="BootmenuControllerTest.php"/>
+ <testApplicationControllerFile filesystemName="ClientControllerTest.php"/>
+ <testApplicationControllerFile filesystemName="PoolControllerTest.php"/>
</testApplicationControllerDirectory>
</testApplicationDirectory>
<testLibraryDirectory>
diff --git a/application/Bootstrap.php b/application/Bootstrap.php
index 6ac8a0e..a836253 100644
--- a/application/Bootstrap.php
+++ b/application/Bootstrap.php
@@ -8,4 +8,24 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$auth->setStorage(new Zend_Auth_Storage_Session('auth'));
}
}
+function print_a(){
+ $numargs = func_num_args();
+ if($numargs>1){
+ $out = '';
+ ob_start();
+ echo "<div style='background-color:#FFCC33;border:1px solid black;margin:3px;padding:5px;'>";
+ for($a=0;$a<$numargs;$a++)
+ print_a(func_get_arg($a));
+ echo "</div>";
+ $out .= ob_get_contents();
+ ob_end_clean();
+ echo $out;
+ }else{
+ echo "<pre style='background-color:#FFDF80;border:1px solid #000;margin:3px;padding:5px;'>";
+ $a = func_get_arg(0);
+ $a = (is_bool($a))?(($a)?'true':'false'):$a;
+ print_r($a);
+ echo "</pre>";
+ }
+}
diff --git a/application/configs/application.ini b/application/configs/application.ini
index 6970da3..9bfaec2 100644
--- a/application/configs/application.ini
+++ b/application/configs/application.ini
@@ -10,7 +10,7 @@ resources.frontController.params.displayExceptions = 0
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = root
-resources.db.params.password = lsfks
+resources.db.params.password = 123456
resources.db.params.dbname = pbs
resources.db.isDefaultTableAdapter = true
diff --git a/application/controllers/ClientController.php b/application/controllers/ClientController.php
new file mode 100644
index 0000000..336bf9e
--- /dev/null
+++ b/application/controllers/ClientController.php
@@ -0,0 +1,54 @@
+<?php
+
+class ClientController extends Zend_Controller_Action
+{
+
+ public function init()
+ {
+ /* Initialize action controller here */
+ }
+
+ public function indexAction()
+ {
+ $clientMapper = new Application_Model_ClientMapper();
+ $this->view->clients = $clientMapper->fetchAll();
+ }
+
+ public function addclientAction()
+ {
+ $mac = $this->_request->getParam('mac');
+ $hh = $this->_request->getParam('hh');
+
+ if($mac != '' && $hh != ''){
+ $client = new Application_Model_Client();
+ $client->setMacadress($mac);
+ $client->setHardwarehash($hh);
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientmapper->save($client);
+ print_a('inserted');
+ }
+ else{
+ print_a('no insert');
+ }
+ }
+
+ public function removeclientAction()
+ {
+ $clientID = $this->_request->getParam('clientID');
+ // TODO: ACL implementieren ob er den filter löschen darf
+ if(is_numeric($clientID)){
+ $removeClient = new Application_Model_Client();
+ $removeClient->setID($clientID);
+ $clientMapper = new Application_Model_ClientMapper();
+ $clientMapper->delete($removeClient);
+ }
+ $this->_redirect('/client');
+ }
+
+
+}
+
+
+
+
+
diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php
index 55188cf..1305689 100644
--- a/application/controllers/FilterController.php
+++ b/application/controllers/FilterController.php
@@ -4,7 +4,7 @@ class FilterController extends Zend_Controller_Action
{
private $_filtermapper = null;
-
+ private $db;
public function init()
{
try{
@@ -12,6 +12,7 @@ class FilterController extends Zend_Controller_Action
}catch (Zend_Exception $e) {
echo "Error message 1: " . $e->getMessage() . "\n";
}
+ $this->db = Zend_Db_Table::getDefaultAdapter();
}
public function indexAction()
@@ -24,9 +25,9 @@ class FilterController extends Zend_Controller_Action
$this->view->filterentries = $filterentries->fetchAll();
- }catch (Zend_Exception $e) {
+ }catch (Zend_Exception $e) {
echo "Error message 2: " . $e->getMessage() . "\n";
- }
+ }
}
public function addfilterAction()
@@ -254,48 +255,150 @@ class FilterController extends Zend_Controller_Action
}
return implode(".",$representation);
}
- public function evaluate(){
+ 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;
+ try{
+ #########################################################
+ // IP Adress
+ $filtertypID = 1;
+ $ipAdress = "111.10.10.10";
+ $ipAdress = str_replace(".","",$this->fillIP($ipAdress));
+ $select = $db->select()
+ ->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]);
- // IP bereich
- /*
- $ipAdress = $this->fillIP('192.168.2.1');
- if( ( replace(".","",filtervalue) <= replace(".","",$ipAdress)
- && replace(".","",$ipAdress) <= replace(".","",filtervalue2)
- // resultset
- */
- #########################################################
- // Mac bereich
- /*
-
- */
- #########################################################
- // PoolID
- /*
- If client comes from a specific pool
- */
- #########################################################
- // BootIso
- /*
- WHERE bootiso = bootiso
- */
- #########################################################
- // Membership
- /*
+ #########################################################
+ // Mac range
+ $filtertypID = 2;
+ $macAdress = "00:1e:0b:27:f4:99";
+ $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'];
+ }
+ if($showPartResults)
+ print_a('macAdress',$result,$set[$filtertypID]);
+ #########################################################
+ // PoolID
+ $filtertypID = 3;
+ /*
+ If client comes from a specific pool
+ */
+ #########################################################
+ // BootIso
+ $filtertypID = 4;
+ /*
+ WHERE bootiso = bootiso
+ */
+ #########################################################
+ // Membership
+ $filtertypID = 5;
+ /*
- */
- #########################################################
- // Group
- #########################################################
- // Time
- /*
+ */
+ #########################################################
+ // Group
+ $filtertypID = 6;
+ /*
+
+ */
+ #########################################################
+ // Time
+ $filtertypID = 7;
$nowShort = date('H-i',time());
$nowLong = date('Y-m-d-H-i',time());
- if( ( replace("-","",filtervalue) <= replace("-","",$nowShort)
- && replace("-","",$nowShort) <= replace("-","",filtervalue2)
- ||( replace("-","",filtervalue) <= replace("-","",$nowLong)
- && replace("-","",$nowLong) <= replace("-","",filtervalue2))
- // resultset
- */
+
+ $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);
+
+ $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){
+ $kk = array_merge($kk,$myset);
+ }
+ $set = $kk;
+ // counting how often a filter is evaluated at database
+ foreach($set as $k=> $s){
+ $a[$s] += 1;
+ }
+
+ // 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'];
+ }
+
+ // remove all filters from resultset, which to few filtertypes satisfied
+ foreach($a as $i=>$b){
+ if($a[$i] < $database[$i]){
+ unset($a[$i]);
+ }
+ else{
+ $result[] = $i;
+ }
+ }
+
+ print_a('result set of filterIDs',$result);
+ // now selecting the filter with the highest priority
+ $query = 'SELECT filterID, bootmenuID, priority
+ FROM pbs_filter WHERE ';
+ foreach($result as $e){
+ $queryTmp[] = "filterID = '$e'";
+ }
+ $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>";
+
+ }catch (Zend_Exception $e) {
+ echo "class: ".get_class($e)."<br>\n";
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
}
}
diff --git a/application/controllers/PoolController.php b/application/controllers/PoolController.php
new file mode 100644
index 0000000..f9e54be
--- /dev/null
+++ b/application/controllers/PoolController.php
@@ -0,0 +1,40 @@
+<?php
+
+class PoolController extends Zend_Controller_Action
+{
+
+ public function init()
+ {
+ /* Initialize action controller here */
+ }
+
+ public function indexAction()
+ {
+ $poolMapper = new Application_Model_PoolMapper();
+ $this->view->pools = $poolMapper->fetchAll();
+ }
+
+ public function createpoolAction()
+ {
+ // action body
+ }
+
+ public function deletepoolAction()
+ {
+ // action body
+ }
+
+ public function editpoolAction()
+ {
+ // action body
+ }
+
+
+}
+
+
+
+
+
+
+
diff --git a/application/forms/FilterAdd.php b/application/forms/FilterAdd.php
index 43efb71..931bfee 100644
--- a/application/forms/FilterAdd.php
+++ b/application/forms/FilterAdd.php
@@ -21,6 +21,8 @@ class Application_Form_FilterAdd extends Zend_Form
'required' => false,
'label' => 'Description:',
));
+ // TODO: Add target of Filter
+
$this->addElement('text', 'priority', array(
'filters' => array('StringTrim'),
'validators' => array(
diff --git a/application/models/PoolMapper.php b/application/models/PoolMapper.php
index f9be34f..e2d351a 100644
--- a/application/models/PoolMapper.php
+++ b/application/models/PoolMapper.php
@@ -32,13 +32,16 @@ class Application_Model_PoolMapper
public function save(Application_Model_Pool $pol)
{
- $data = array('poolID'=> $pol->getPoolID() ,'title'=> $pol->getTitle() ,'description'=> $pol->getDescription() ,'location'=> $pol->getLocation() );
+ $data = array('poolID'=> $pol->getID() ,
+ 'title'=> $pol->getTitle() ,
+ 'description'=> $pol->getDescription() ,
+ 'location'=> $pol->getLocation() );
if (null === ($id = $pol->getID()) ) {
- unset($data['polID']);
+ unset($data['poolID']);
$this->getDbTable()->insert($data);
} else {
- $this->getDbTable()->update($data, array('polID = ?' => $id));
+ $this->getDbTable()->update($data, array('poolID = ?' => $id));
}
}
@@ -47,7 +50,7 @@ class Application_Model_PoolMapper
if (null === ($id = $pol->getID()) ) {
return;
} else {
- $this->getDbTable()->delete(array('polID = ?' => $id));
+ $this->getDbTable()->delete(array('poolID = ?' => $id));
}
}
@@ -60,7 +63,7 @@ class Application_Model_PoolMapper
$row = $result->current();
- $pol->setPoolID($row->poolID)->setTitle($row->title)->setDescription($row->description)->setLocation($row->location);
+ $pol->setID($row->poolID)->setTitle($row->title)->setDescription($row->description)->setLocation($row->location);
}
public function fetchAll()
@@ -70,7 +73,7 @@ class Application_Model_PoolMapper
foreach ($resultSet as $row) {
$entry = new Application_Model_Pool();
- $entry->setPoolID($row->poolID)->setTitle($row->title)->setDescription($row->description)->setLocation($row->location);
+ $entry->setID($row->poolID)->setTitle($row->title)->setDescription($row->description)->setLocation($row->location);
$entries[] = $entry;
}
diff --git a/application/views/scripts/client/addclient.phtml b/application/views/scripts/client/addclient.phtml
new file mode 100644
index 0000000..9d1c04e
--- /dev/null
+++ b/application/views/scripts/client/addclient.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Client</b> and script/action name <b>addclient</b></center> \ No newline at end of file
diff --git a/application/views/scripts/client/index.phtml b/application/views/scripts/client/index.phtml
new file mode 100644
index 0000000..4095a5f
--- /dev/null
+++ b/application/views/scripts/client/index.phtml
@@ -0,0 +1,34 @@
+<h1>Clients</h1>
+
+<?php if ($this->clients): ?>
+
+ <!-- A table of filters. -->
+ <table border=1>
+ <tr>
+ <th>clientID</th>
+ <th>MAC</th>
+ <th>Hardwarehash</th>
+ </tr>
+ <?php foreach ($this->clients as $client): ?>
+ <tr class='client'>
+ <td><?php echo $this->escape($client->getID()) ?></td>
+ <td><?php echo $this->escape($client->getMacadress()) ?></td>
+ <td><?php echo $this->escape($client->getHardwarehash()) ?></td>
+ <td><a href="<?php echo $this->url(
+ array(
+ 'controller' => 'client',
+ 'action' => 'removeclient',
+ 'clientID' => $client->getID()
+ ),
+ 'default',
+ true) ?>">remove client</a></td>
+ </tr>
+ <?php endforeach ?>
+ </table>
+
+<?php else: ?>
+
+
+ <p>There are no clients to display.</p>
+
+<?php endif;?>
diff --git a/application/views/scripts/client/removeclient.phtml b/application/views/scripts/client/removeclient.phtml
new file mode 100644
index 0000000..7b5f64f
--- /dev/null
+++ b/application/views/scripts/client/removeclient.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Client</b> and script/action name <b>deleteclient</b></center> \ No newline at end of file
diff --git a/application/views/scripts/filter/evaluate.phtml b/application/views/scripts/filter/evaluate.phtml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/application/views/scripts/filter/evaluate.phtml
diff --git a/application/views/scripts/pool/createpool.phtml b/application/views/scripts/pool/createpool.phtml
new file mode 100644
index 0000000..3d7f8ca
--- /dev/null
+++ b/application/views/scripts/pool/createpool.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>createpool</b></center> \ No newline at end of file
diff --git a/application/views/scripts/pool/deletepool.phtml b/application/views/scripts/pool/deletepool.phtml
new file mode 100644
index 0000000..622e663
--- /dev/null
+++ b/application/views/scripts/pool/deletepool.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>deletepool</b></center> \ No newline at end of file
diff --git a/application/views/scripts/pool/editpool.phtml b/application/views/scripts/pool/editpool.phtml
new file mode 100644
index 0000000..c70464e
--- /dev/null
+++ b/application/views/scripts/pool/editpool.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>editpool</b></center> \ No newline at end of file
diff --git a/application/views/scripts/pool/index.phtml b/application/views/scripts/pool/index.phtml
new file mode 100644
index 0000000..989cf41
--- /dev/null
+++ b/application/views/scripts/pool/index.phtml
@@ -0,0 +1,36 @@
+<h1>Pools</h1>
+
+<?php if ($this->pools): ?>
+
+ <!-- A table of filters. -->
+ <table border=1>
+ <tr>
+ <th>poolID</th>
+ <th>Title</th>
+ <th>Description</th>
+ <th>Location</th>
+ </tr>
+ <?php foreach ($this->pools as $pool): ?>
+ <tr class='pool'>
+ <td><?php echo $this->escape($pool->getID()) ?></td>
+ <td><?php echo $this->escape($pool->getTitle()) ?></td>
+ <td><?php echo $this->escape($pool->getDescription()) ?></td>
+ <td><?php echo $this->escape($pool->getLocation()) ?></td>
+ <td><a href="<?php echo $this->url(
+ array(
+ 'controller' => 'pool',
+ 'action' => 'removepool',
+ 'poolID' => $pool->getID()
+ ),
+ 'default',
+ true) ?>">remove pool</a></td>
+ </tr>
+ <?php endforeach ?>
+ </table>
+
+<?php else: ?>
+
+
+ <p>There are no pools to display.</p>
+
+<?php endif;?>
diff --git a/pbs-data.sql b/pbs-data.sql
index b93c679..1aec562 100644
--- a/pbs-data.sql
+++ b/pbs-data.sql
@@ -11,12 +11,40 @@ INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NU
INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'Time');
-- Insert example data for filters
-
INSERT INTO `pbs`.`pbs_group` (`groupID` ,`title` ,`description`)VALUES (NULL , 'testgruppe1', NULL);
INSERT INTO `pbs`.`pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `housenumber`, `city`, `postalcode`, `logindate`, `registerdate`, `email`, `login`, `password`, `password_salt`) VALUES (NULL, 'Mr.Test', 'te', 'st', NULL, NULL, NULL, NULL, NULL, '', '', 'test', '', '');
INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`) VALUES (NULL, '1', 'Testrolle', NULL);
INSERT INTO `pbs`.`pbs_membership` (`membershipID`, `groupID`, `roleID`, `personID`) VALUES (NULL, '1', '1', '1');
-INSERT INTO `pbs`.`pbs_bootmenu` (`bootmenuID`, `membershipID`, `title`, `time`) VALUES (NULL, '1', 'Bootmenu1', UNIX_TIMESTAMP());
-INSERT INTO `pbs`.`pbs_bootmenu` (`bootmenuID`, `membershipID`, `title`, `time`) VALUES (NULL, '1', 'Bootmenu2', UNIX_TIMESTAMP());
-INSERT INTO `pbs`.`pbs_filter` (`filterID`, `membershipID`, `groupID`, `bootmenuID`, `title`, `description`, `created`, `priority`) VALUES (NULL, '1', '1', '1', 'Regel 1', NULL, UNIX_TIMESTAMP(), '1');
-INSERT INTO `pbs`.`pbs_filter` (`filterID`, `membershipID`, `groupID`, `bootmenuID`, `title`, `description`, `created`, `priority`) VALUES (NULL, '1', '1', '2', 'Regel 2', NULL, UNIX_TIMESTAMP(), '5');
+
+INSERT INTO `pbs`.`pbs_bootmenu` (`bootmenuID`, `membershipID`, `groupID`, `title`, `created`) VALUES (NULL, '1', '1', 'Bootmenu 1', UNIX_TIMESTAMP());
+INSERT INTO `pbs`.`pbs_bootmenu` (`bootmenuID`, `membershipID`, `groupID`, `title`, `created`) VALUES (NULL, '1', '1', 'Bootmenu 2', UNIX_TIMESTAMP());
+INSERT INTO `pbs`.`pbs_bootmenu` (`bootmenuID`, `membershipID`, `groupID`, `title`, `created`) VALUES (NULL, '1', '1', 'Bootmenu 3', UNIX_TIMESTAMP());
+
+INSERT INTO `pbs`.`pbs_filter` (`filterID`, `membershipID`, `groupID`, `bootmenuID`, `title`, `description`, `created`, `priority`) VALUES (NULL, '1', '1', '1', 'Filter 1', NULL, UNIX_TIMESTAMP(), '1');
+INSERT INTO `pbs`.`pbs_filter` (`filterID`, `membershipID`, `groupID`, `bootmenuID`, `title`, `description`, `created`, `priority`) VALUES (NULL, '1', '1', '2', 'Filter 2', NULL, UNIX_TIMESTAMP(), '5');
+INSERT INTO `pbs`.`pbs_filter` (`filterID`, `membershipID`, `groupID`, `bootmenuID`, `title`, `description`, `created`, `priority`) VALUES (NULL, '1', '1', '2', 'Filter 3', NULL, UNIX_TIMESTAMP(), '9');
+
+INSERT INTO `pbs_filterentries` (`filterentriesID`, `filterID`, `filtertypeID`, `filtervalue`, `filtervalue2`) VALUES
+(1, 1, 1, '100.100.100.100', '200.200.200.200'),
+(3, 1, 7, '08-00', '22-00'),
+(4, 2, 7, '08-00', '19-00'),
+(5, 3, 7, '12-00', '18-00'),
+(6, 3, 2, '00:1e:0b:27:f4:00', '00:1e:0b:27:f4:f0');
+
+-- Inser example data for clients and pools
+INSERT INTO `pbs_client` (`clientID`, `macadress`, `hardwarehash`) VALUES
+(1, '00:1e:0b:27:f4:99', 'ea9b82d9de911bc2d3cd23f53a6cab48'),
+(2, '00:10:0a:25:44:69', '1e2b1599710fbbef0dc789e8cfe12455'),
+(3, '01:50:2a:24:42:60', '8f6209ca3d6b35e223a11c249d1b69fc'),
+(4, '04:34:26:9a:92:90', 'e17ab09f3586464f19629e2e8b1e9a9d'),
+(5, '44:74:26:9a:92:90', '9bf70279d283b85440c2031c19bb6812'),
+(6, '64:24:26:9a:92:90', 'ad3bce4464a6267441ec144744439c7e'),
+(7, '84:94:26:9a:92:90', 'e8d7e80d79f224771b7a3a0af4e02748'),
+(8, 'b4:84:26:9a:92:90', 'ded66ce272f384e9e386c1b57ded3e4d'),
+(9, '24:64:26:9a:92:90', '695610ee509c060b1fca9c8011529af4'),
+(10, '84:34:26:9a:92:90', 'a3562c8cad2a4fa4fc11656025dc911b');
+
+INSERT INTO `pbs`.`pbs_pool` (`poolID`, `title`, `description`, `location`) VALUES
+(NULL, 'Pool 1', 'Description 1', 'Keller'),
+(NULL, 'Pool 2', 'Description 2', 'Keller');
+
diff --git a/tests/application/controllers/ClientControllerTest.php b/tests/application/controllers/ClientControllerTest.php
new file mode 100644
index 0000000..921b2fd
--- /dev/null
+++ b/tests/application/controllers/ClientControllerTest.php
@@ -0,0 +1,20 @@
+<?php
+
+require_once 'PHPUnit/Framework/TestCase.php';
+
+class ClientControllerTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ /* Setup Routine */
+ }
+
+ public function tearDown()
+ {
+ /* Tear Down Routine */
+ }
+
+
+}
+
diff --git a/tests/application/controllers/PoolControllerTest.php b/tests/application/controllers/PoolControllerTest.php
new file mode 100644
index 0000000..cf16d54
--- /dev/null
+++ b/tests/application/controllers/PoolControllerTest.php
@@ -0,0 +1,20 @@
+<?php
+
+require_once 'PHPUnit/Framework/TestCase.php';
+
+class PoolControllerTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ /* Setup Routine */
+ }
+
+ public function tearDown()
+ {
+ /* Tear Down Routine */
+ }
+
+
+}
+