From dee12ef18da0dc4db4f1a87c62aa98d321b76bac Mon Sep 17 00:00:00 2001
From: Simon
Date: Sun, 6 Mar 2011 19:56:24 +0100
Subject: clients hinzufügen und entfernen && sql-data erweitert

---
 pbs-data.sql | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

(limited to 'pbs-data.sql')

diff --git a/pbs-data.sql b/pbs-data.sql
index b93c679..e3cef5f 100644
--- a/pbs-data.sql
+++ b/pbs-data.sql
@@ -11,12 +11,36 @@ 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');
+
-- 
cgit v1.2.3-55-g7522


From bfea08336f782e0e796b15dc7a1b4af4b1e3783a Mon Sep 17 00:00:00 2001
From: Simon
Date: Sun, 6 Mar 2011 20:12:10 +0100
Subject: Pool add, edit und remove hinzugefügt

---
 .zfproject.xml                                  | 12 ++++++++
 application/controllers/PoolController.php      | 22 +++++++++++++++
 application/models/PoolMapper.php               | 15 ++++++----
 application/views/scripts/pool/createpool.phtml |  1 +
 application/views/scripts/pool/deletepool.phtml |  1 +
 application/views/scripts/pool/editpool.phtml   |  1 +
 application/views/scripts/pool/index.phtml      | 37 ++++++++++++++++++++++++-
 pbs-data.sql                                    |  4 +++
 8 files changed, 86 insertions(+), 7 deletions(-)
 create mode 100644 application/views/scripts/pool/createpool.phtml
 create mode 100644 application/views/scripts/pool/deletepool.phtml
 create mode 100644 application/views/scripts/pool/editpool.phtml

(limited to 'pbs-data.sql')

diff --git a/.zfproject.xml b/.zfproject.xml
index adfe5d7..ea102b1 100644
--- a/.zfproject.xml
+++ b/.zfproject.xml
@@ -61,6 +61,9 @@
         </controllerFile>
         <controllerFile controllerName="Pool">
           <actionMethod actionName="index"/>
+          <actionMethod actionName="createpool"/>
+          <actionMethod actionName="deletepool"/>
+          <actionMethod actionName="editpool"/>
         </controllerFile>
       </controllersDirectory>
       <formsDirectory>
@@ -242,6 +245,15 @@
           <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"/>
diff --git a/application/controllers/PoolController.php b/application/controllers/PoolController.php
index 795fe3a..f9e54be 100644
--- a/application/controllers/PoolController.php
+++ b/application/controllers/PoolController.php
@@ -9,6 +9,22 @@ class PoolController extends Zend_Controller_Action
     }
 
     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
     }
@@ -16,3 +32,9 @@ class PoolController extends Zend_Controller_Action
 
 }
 
+
+
+
+
+
+
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/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
index 5266a4e..989cf41 100644
--- a/application/views/scripts/pool/index.phtml
+++ b/application/views/scripts/pool/index.phtml
@@ -1 +1,36 @@
-<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>index</b></center>
\ No newline at end of file
+<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 e3cef5f..1aec562 100644
--- a/pbs-data.sql
+++ b/pbs-data.sql
@@ -44,3 +44,7 @@ INSERT INTO `pbs_client` (`clientID`, `macadress`, `hardwarehash`) VALUES
 (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');
+
-- 
cgit v1.2.3-55-g7522

