summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichael pereira2011-03-05 13:27:20 +0100
committermichael pereira2011-03-05 13:27:20 +0100
commit3e86f2118ae8fd85e433913410c82915232cd073 (patch)
tree3fbb90e62a1974cc9daf94d58a79f06ae449e0fd
parentbootos v1 (diff)
parentOberfläche der filter wurde verbessert, sodass nun filterentrys angelegt wer... (diff)
downloadpbs2-3e86f2118ae8fd85e433913410c82915232cd073.tar.gz
pbs2-3e86f2118ae8fd85e433913410c82915232cd073.tar.xz
pbs2-3e86f2118ae8fd85e433913410c82915232cd073.zip
.zfproject fix
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 Conflicts: .zfproject.xml
-rw-r--r--.zfproject.xml5
-rw-r--r--application/configs/application.ini2
-rw-r--r--application/controllers/FilterController.php156
-rw-r--r--application/forms/FilterEdit.php54
-rw-r--r--application/forms/FilterEntriesAdd.php53
-rw-r--r--application/models/DbTable/FilterEntries.php2
-rw-r--r--application/models/FilterEntriesMapper.php45
-rw-r--r--application/models/FilterType.php2
-rw-r--r--application/models/FilterTypeMapper.php6
-rw-r--r--application/views/scripts/filter/addfilterentry.phtml3
-rw-r--r--application/views/scripts/filter/editfilter.phtml16
-rw-r--r--application/views/scripts/filter/index.phtml59
-rw-r--r--notes-1.txt385
-rw-r--r--notes-2.txt76
-rw-r--r--simonFilter.sql7
-rw-r--r--simonFilter.txt9
-rwxr-xr-xzend-su.sh (renamed from zend-einrichten.sh)2
-rw-r--r--zend-user.sh4
18 files changed, 808 insertions, 78 deletions
diff --git a/.zfproject.xml b/.zfproject.xml
index 3927d78..cfbefcf 100644
--- a/.zfproject.xml
+++ b/.zfproject.xml
@@ -28,6 +28,7 @@
<actionMethod actionName="addfilter"/>
<actionMethod actionName="removefilter"/>
<actionMethod actionName="editfilter"/>
+ <actionMethod actionName="addfilterentry"/>
</controllerFile>
<controllerFile controllerName="Bootos">
<actionMethod actionName="index"/>
@@ -47,6 +48,8 @@
<formFile formName="BootosDelete"/>
<formFile formName="BootosEdit"/>
<formFile formName="BootosIndex"/>
+ <formFile formName="FilterEdit"/>
+ <formFile formName="FilterEntriesAdd"/>
</formsDirectory>
<layoutsDirectory enabled="false"/>
<modelsDirectory>
@@ -175,6 +178,8 @@
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Bootos">
<viewScriptFile forActionName="deletebootos"/>
+ <viewControllerScriptsDirectory forControllerName="Filter">
+ <viewScriptFile forActionName="addfilterentry"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
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/FilterController.php b/application/controllers/FilterController.php
index d066c53..6acaae8 100644
--- a/application/controllers/FilterController.php
+++ b/application/controllers/FilterController.php
@@ -8,70 +8,134 @@ class FilterController extends Zend_Controller_Action
public function init()
{
try{
- $this->_filtermapper = new Application_Model_FilterMapper();
- }catch (Zend_Exception $e) {
- echo "Error message 1: " . $e->getMessage() . "\n";
+ $this->_filtermapper = new Application_Model_FilterMapper();
+ }catch (Zend_Exception $e) {
+ echo "Error message 1: " . $e->getMessage() . "\n";
}
}
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();
+
+ $filterentries = new Application_Model_FilterEntriesMapper();
+
+ $this->view->filterentries = $filterentries->fetchAll();
+
+ }catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
}
public function addfilterAction()
{
- $db = Zend_Db_Table::getDefaultAdapter();
if (!isset($_POST["add"])){
- $addfilterform = new Application_Form_FilterAdd();
- $this->view->addfilterform = $addfilterform;
- }else {
- $addfilterform = new Application_Form_FilterAdd($_POST);
- if ($addfilterform->isValid($_POST)) {
- try{
- $newfilter = new Application_Model_Filter();
- $newfilter->setTitle($_POST['title']);
- $newfilter->setCreated(time());
- $newfilter->setDescription($_POST['description']);
- $newfilter->setPriority($_POST['priority']);
-
- // TODO: Ändere mit ACL
- $newfilter->setGroupID('1');
- $newfilter->setMembershipID('1');
- $newfilter->setBootmenuID('1');
-
-
-
- $newfilter2 = new Application_Model_FilterMapper();
- $newfilter2->save($newfilter);
-
- $this->_redirect('/filter');
- return;
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
+ $addfilterform = new Application_Form_FilterAdd();
+ $this->view->addfilterform = $addfilterform;
+ }else {
+ $addfilterform = new Application_Form_FilterAdd($_POST);
+ if ($addfilterform->isValid($_POST)) {
+ try{
+ $newfilter = new Application_Model_Filter();
+ $newfilter->setTitle($_POST['title']);
+ $newfilter->setCreated(time());
+ $newfilter->setDescription($_POST['description']);
+ $newfilter->setPriority($_POST['priority']);
+
+ // TODO: Ändere mit ACL
+ $newfilter->setGroupID('1');
+ $newfilter->setMembershipID('1');
+ $newfilter->setBootmenuID('1');
+
+ $newfilter2 = new Application_Model_FilterMapper();
+ $newfilter2->save($newfilter);
+
+ $this->_redirect('/filter');
+ return;
+ }catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
}
}
public function removefilterAction()
- {
- $filterID = $_GET['filterID'];
- // TODO: ACL implementieren ob er den filter löschen darf
- if(is_numeric($filterID)){
- // TODO: lösche den aktuellen eintrag
- }
- // action body
+ {
+ echo 'test';
+ print_r($_GET);
+ $filterID = $this->_request->getParam('filterID');
+ // TODO: ACL implementieren ob er den filter löschen darf
+ if(is_numeric($filterID)){
+ // TODO: lösche den aktuellen eintrag
+ $deletefilter = new Application_Model_Filter();
+ $deletefilter->setID($filterID);
+ $filtermapper = new Application_Model_FilterMapper();
+ $filtermapper->delete($deletefilter);
+ }
+ $this->_redirect('/filter');
}
public function editfilterAction()
{
- // action body
+ // TODO: ACL implementieren ob er editieren darf
+ // TODO: korrigieren, damit man einen filter (priorität und namen ändern kann)
+ }
+
+ public function addfilterentryAction()
+ {
+ // TODO: ACL implementieren ob er editieren darf
+ if (!isset($_POST["add"])){
+ echo "case1";
+ try{
+ $editfilterform = new Application_Form_FilterEntriesAdd(array('filterID' => $this->_request->getParam('filterID')));
+ $this->view->editfilterform = $editfilterform;
+ echo "case 1.1";
+
+ }catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ } else{
+ $editfilterform = new Application_Form_FilterEntriesAdd($_POST);
+ echo "case2";
+
+ if ($editfilterform->isValid($_POST)) {
+
+ $newfilterenty = new Application_Model_FilterEntries();
+ $newfilterenty->setFilterID($_POST['filterID']);
+ $newfilterenty->setFiltertypeID($_POST['filtertype']);
+ $newfilterenty->setFiltervalue($_POST['filtervalue1']);
+ $newfilterenty->setFiltervalue2($_POST['filtervalue2']);
+
+ $newfilter2 = new Application_Model_FilterEntriesMapper();
+
+ $newfilter2->save($newfilterenty);
+ }
+ $this->_redirect('/filter');
+ }
+ }
+ public function editfilterentryAction()
+ {
+
+ }
+ public function removefilterentryAction()
+ {
+ echo 'test';
+ $filterID = $this->_request->getParam('filterID');
+ $filtertypeID = $this->_request->getParam('filtertypeID');
+ var_dump(array($filterID,$filtertypeID));
+ // TODO: ACL implementieren ob er den filter löschen darf
+ if(is_numeric($filterID)){
+ // TODO: lösche den aktuellen eintrag
+ $deletefilterentry = new Application_Model_FilterEntries();
+ $deletefilterentry->setFilterID($filterID);
+ $deletefilterentry->setFiltertypeID($filtertypeID);
+
+ $filterentriesmapper = new Application_Model_FilterEntriesMapper();
+ $filterentriesmapper->delete($deletefilterentry);
+ }
+ #$this->_redirect('/filter');
}
@@ -83,3 +147,5 @@ class FilterController extends Zend_Controller_Action
+
+
diff --git a/application/forms/FilterEdit.php b/application/forms/FilterEdit.php
new file mode 100644
index 0000000..5d5a242
--- /dev/null
+++ b/application/forms/FilterEdit.php
@@ -0,0 +1,54 @@
+<?php
+
+class Application_Form_FilterEdit extends Zend_Form
+{
+ private $filterID = null;
+
+ public function init()
+ {
+ $this->setName("Add Filter");
+ $this->setMethod('post');
+
+
+ try{
+ $filtertypemapper = new Application_Model_FilterTypeMapper();
+ $filtertype = $filtertypemapper->fetchAll();
+ }catch (Zend_Exception $e) {
+ echo "Error message 1: " . $e->getMessage() . "\n";
+ }
+
+ $filtertypes = $this->createElement('select','filtertype');
+ $filtertypes ->setLabel('Type:');
+ foreach($filtertype as $f){
+ $filtertypes->addMultiOption($f->getID(),$f->getFiltertypename());
+ }
+ $this->addElement($filtertypes);
+
+
+ $this->addElement('text', 'filtervalue1', array(
+ 'label' => 'Value1:'
+ ));
+
+ $this->addElement('text', 'filtervalue2', array(
+ 'label' => 'Value2:'
+ ));
+
+ $this->addElement('hidden', 'filterID', array(
+ 'value' => $this->filterID
+ ));
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Add Filtertype',
+ ));
+ }
+ public function setFilterID($id)
+ {
+ $this->filterID = $id;
+ }
+
+
+
+}
+
diff --git a/application/forms/FilterEntriesAdd.php b/application/forms/FilterEntriesAdd.php
new file mode 100644
index 0000000..8ec5bd9
--- /dev/null
+++ b/application/forms/FilterEntriesAdd.php
@@ -0,0 +1,53 @@
+<?php
+
+class Application_Form_FilterEntriesAdd extends Zend_Form
+{
+
+ private $filterID = null;
+
+ public function init()
+ {
+ $this->setName("Add Filterentry");
+ $this->setMethod('post');
+
+
+ try{
+ $filtertypemapper = new Application_Model_FilterTypeMapper();
+ $filtertype = $filtertypemapper->fetchAll();
+ }catch (Zend_Exception $e) {
+ echo "Error message 1: " . $e->getMessage() . "\n";
+ }
+
+ $filtertypes = $this->createElement('select','filtertype');
+ $filtertypes ->setLabel('Type:');
+ foreach($filtertype as $f){
+ $filtertypes->addMultiOption($f->getID(),$f->getFiltertypename());
+ }
+ $this->addElement($filtertypes);
+
+
+ $this->addElement('text', 'filtervalue1', array(
+ 'label' => 'Value1:'
+ ));
+
+ $this->addElement('text', 'filtervalue2', array(
+ 'label' => 'Value2:'
+ ));
+
+ $this->addElement('hidden', 'filterID', array(
+ 'value' => $this->filterID
+ ));
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Add Filtertype',
+ ));
+ }
+ public function setFilterID($id)
+ {
+ $this->filterID = $id;
+ }
+
+}
+
diff --git a/application/models/DbTable/FilterEntries.php b/application/models/DbTable/FilterEntries.php
index f0f976d..309858d 100644
--- a/application/models/DbTable/FilterEntries.php
+++ b/application/models/DbTable/FilterEntries.php
@@ -4,7 +4,7 @@ class Application_Model_DbTable_FilterEntries extends Zend_Db_Table_Abstract
{
protected $_name = 'pbs_filterentries';
-
+ protected $_primary = array('filterID','filtertypeID');
}
diff --git a/application/models/FilterEntriesMapper.php b/application/models/FilterEntriesMapper.php
index 58ea563..41f1023 100644
--- a/application/models/FilterEntriesMapper.php
+++ b/application/models/FilterEntriesMapper.php
@@ -32,36 +32,59 @@ class Application_Model_FilterEntriesMapper
public function save(Application_Model_FilterEntries $filterentries)
{
- $data = array('filterID'=> $filterentries->getFilterID() ,'filtertypeID'=> $filterentries->getFiltertypeID() ,'filtervalue'=> $filterentries->getFiltervalue() ,'filtervalue2'=> $filterentries->getFiltervalue2() );
-
- if (null === ($id = $filterentries->getID()) ) {
- unset($data['filterentriesID']);
+ $data = array('filterID'=> $filterentries->getFilterID() ,
+ 'filtertypeID'=> $filterentries->getFiltertypeID() ,
+ 'filtervalue'=> $filterentries->getFiltervalue() ,
+ 'filtervalue2'=> $filterentries->getFiltervalue2() );
+
+ if (null != ($id1 = $filterentries->getFilterID()) &&
+ null != ($id2 = $filterentries->getFiltertypeID()) &&
+ $this->getDbTable()->find($filterentries->getFilterID(),$filterentries->getFiltertypeID())) {
$this->getDbTable()->insert($data);
+ echo 'fall1';
} else {
- $this->getDbTable()->update($data, array('filterentriesID = ?' => $id));
+ $this->getDbTable()->update($data, array('filterID = ?' => $id1, 'filtertypeID = ?' => $id2));
+ echo 'fall2';
}
}
public function delete(Application_Model_FilterEntries $filterentries)
{
- if (null === ($id = $filterentries->getID()) ) {
+ $id1 = $filterentries->getFilterID();
+ $id2 = $filterentries->getFiltertypeID();
+ var_dump(array($id1,$id2));
+ //TODO: Löschen klappt nicht
+ if ((null != $id1) && (null != $id2) &&
+ $this->getDbTable()->find($filterentries->getFilterID(),$filterentries->getFiltertypeID())) {
return;
} else {
- $this->getDbTable()->delete(array('filterentriesID = ?' => $id));
+ $this->getDbTable()->delete(array('filterID = ?' => $id1, 'filtertypeID = ?' => $id2));
}
}
- public function find($id, Application_Model_FilterEntries $filterentries)
+ public function find($filterID,$filtertypeID, Application_Model_FilterEntries $filterentries)
{
- $result = $this->getDbTable()->find($id);
+ $result = $this->getDbTable()->find($filterID,$filtertypeID);
+ echo 'dump1';
if (0 == count($result)) {
return;
}
-
+ echo 'dump2';
$row = $result->current();
- $filterentries->setFilterID($row->filterID)->setFiltertypeID($row->filtertypeID)->setFiltervalue($row->filtervalue)->setFiltervalue2($row->filtervalue2);
+ $filterentries->setFilterID($row->filterID)
+ ->setFiltertypeID($row->filtertypeID)
+ ->setFiltervalue($row->filtervalue)
+ ->setFiltervalue2($row->filtervalue2);
+ return $filterentries;
}
+ public function findBy($field,$value)
+ {
+ $db = $this->getAdapter();
+ $where = $db->quoteInto($db->quoteIdentifier($field).' = ?', value);
+ return $this->fetchAll($where);
+
+ }
public function fetchAll()
{
diff --git a/application/models/FilterType.php b/application/models/FilterType.php
index 9601368..a66950a 100644
--- a/application/models/FilterType.php
+++ b/application/models/FilterType.php
@@ -50,6 +50,7 @@ class Application_Model_FilterType
public function setID($_filtertypeID)
{
$this->_filtertypeID = $_filtertypeID;
+ return $this;
}
public function getFiltertypename()
{
@@ -58,6 +59,7 @@ class Application_Model_FilterType
public function setFiltertypename($_filtertypename)
{
$this->_filtertypename = $_filtertypename;
+ return $this;
}
}
diff --git a/application/models/FilterTypeMapper.php b/application/models/FilterTypeMapper.php
index f10ee21..8ed2722 100644
--- a/application/models/FilterTypeMapper.php
+++ b/application/models/FilterTypeMapper.php
@@ -60,7 +60,8 @@ class Application_Model_FilterTypeMapper
$row = $result->current();
- $filtertype->setID($row->filtertypeID)->setFiltertypename($row->filtertypename);
+ $filtertype->setID($row->filtertypeID)
+ ->setFiltertypename($row->filtertypename);
}
public function fetchAll()
@@ -70,7 +71,8 @@ class Application_Model_FilterTypeMapper
foreach ($resultSet as $row) {
$entry = new Application_Model_FilterType();
- $entry->setID($row->filtertypeID)->setFiltertypename($row->filtertypename);
+ $entry->setID($row->filtertypeID)
+ ->setFiltertypename($row->filtertypename);
$entries[] = $entry;
}
diff --git a/application/views/scripts/filter/addfilterentry.phtml b/application/views/scripts/filter/addfilterentry.phtml
new file mode 100644
index 0000000..8bf501a
--- /dev/null
+++ b/application/views/scripts/filter/addfilterentry.phtml
@@ -0,0 +1,3 @@
+<?php
+$this->editfilterform->setAction($this->url());
+echo $this->editfilterform;
diff --git a/application/views/scripts/filter/editfilter.phtml b/application/views/scripts/filter/editfilter.phtml
index 452a096..9b54ac7 100644
--- a/application/views/scripts/filter/editfilter.phtml
+++ b/application/views/scripts/filter/editfilter.phtml
@@ -1 +1,15 @@
-<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>editfilter</b></center> \ No newline at end of file
+<h1>Edit Filter</h1>
+<?php
+echo "<h2>".$this->filterID."</h2>";
+echo 'test';
+?>
+<?php
+echo
+
+$this->editfilterform->setAction($this->url());
+
+
+$this->editfilterform;
+
+
+?>
diff --git a/application/views/scripts/filter/index.phtml b/application/views/scripts/filter/index.phtml
index 33043dc..b3c3013 100644
--- a/application/views/scripts/filter/index.phtml
+++ b/application/views/scripts/filter/index.phtml
@@ -1,4 +1,9 @@
<h1>Filters</h1>
+<style>
+table{font-family:verdana;font-size:12px;}
+td{border:1px solid #CCC;}
+tr.filter{background-color:#DDD;}
+</style>
<p><a href="<?php echo $this->url(
array(
'controller' => 'filter',
@@ -12,13 +17,15 @@
<!-- A table of filters. -->
<table border=1>
<tr>
- <th>filterid</th>
- <th>filterID</th>
+ <th>filterID</th>
+ <th>Title</th>
+ <th>Priority</th>
</tr>
<?php foreach ($this->filters as $filter): ?>
- <tr>
+ <tr class='filter'>
<td><?php echo $this->escape($filter->getID()) ?></td>
<td><?php echo $this->escape($filter->title) ?></td>
+ <td><?php echo $this->escape($filter->priority) ?></td>
<td><a href="<?php echo $this->url(
array(
'controller' => 'filter',
@@ -27,11 +34,51 @@
),
'default',
true) ?>">edit filter</a></td>
+ <td><a href="<?php echo $this->url(
+ array(
+ 'controller' => 'filter',
+ 'action' => 'removefilter',
+ 'filterID' => $filter->getID()
+ ),
+ 'default',
+ true) ?>">delete filter</a></td>
+ <td><a href="<?php echo $this->url(
+ array(
+ 'controller' => 'filter',
+ 'action' => 'addfilterentry',
+ 'filterID' => $filter->getID()
+ ),
+ 'default',
+ true) ?>">add filterentry</a></td>
+ </tr>
+ <tr><td></td>
+ <td colspan=5>
+ <table style='width:100%;'>
+ <?php foreach ($this->filterentries as $filterentry): ?>
+ <?php
+ // TODO: Quick and dirty
+ // hier wird die gesamte liste durchgegangen... unperformant
+ if($filterentry->filterID == $filter->getID()): ?>
+ <tr>
+ <td><?php echo $filterentry->getFiltertypeID();?></td>
+ <td><?php echo $filterentry->getFiltervalue();?></td>
+ <td><?php echo $filterentry->getFiltervalue();?></td>
+ <td><a href="<?php echo $this->url(
+ array(
+ 'controller' => 'filter',
+ 'action' => 'removefilterentry',
+ 'filterID' => $filter->getID(),
+ 'filtertypeID' => $filterentry->getFiltertypeID()
+ ),
+ 'default',
+ true) ?>">remove filterentry</a>
+ </tr>
+ <?php endif; ?>
+ <?php endforeach ?>
+ </table>
+ </td>
</tr>
<?php endforeach ?>
-
-
-
</table>
<?php else: ?>
diff --git a/notes-1.txt b/notes-1.txt
new file mode 100644
index 0000000..95c33f5
--- /dev/null
+++ b/notes-1.txt
@@ -0,0 +1,385 @@
+
+wget -qO - "$@" http://132.230.4.3/uniontmp.php | tar -C testdownload/ -zxvf -
+
+
+Whitelist:
+tar cz --file=/home/mp57/whitelist --ignore-failed-read --exclude=.wh* ./*
+
+Blacklist:
+find /uniontmp/ -name .wh* >> /home/mp57/blacklist
+
+
+http://piratepad.net/master-projekt
+Whiteliste anlegen
+echo '#!/bin/sh' > whitelist.sh
+find * -printf 'chmod %m %p\n' >> whitelist.sh
+chmod a+x whitelist.sh
+
+Setzen aller Ordner auf 777
+chmod -R 755 ./*
+
+Gepackt werden (bleibt mit ordnerberechtigung 755 auf dem server
+nach herunterladen müssen die dateiberechtigugnen wieder gesetzt werden
+./whitelist.sh
+
+
+http://akrabat.com/zend-framework-tutorial/
+
+http://lab.ks.uni-freiburg.de/projects/preboot/wiki/ZendWebInterface
+http://lab.ks.uni-freiburg.de/projects/preboot/wiki/Zend_einrichten
+
+##############################################################
+controller erstellen
+zf create controller person
+zf create action register person
+zf create action login person
+zf create action edit person
+zf create action request person
+
+datenbankanbindung in der application.ini setzen
+ resources.db.adapter = PDO_MYSQL
+ resources.db.params.host = localhost
+ resources.db.params.username = rob
+ resources.db.params.password = 123456
+ resources.db.params.dbname = pbs
+
+Datenbank initialisieren (pbs datenbank anlegen
+ pbs.sql einfügen
+
+
+zf create db-table Person pbs_person
+=> erstellt application/models/DbTable/Person.php
+
+Mapper erstellen
+ zf create model PersonMapper
+=> erstellt application/models/PersonMapper.php
+http://framework.zend.com/manual/en/learning.quickstart.create-model.html
+
+ zf create model Person
+=> erstellt /var/www/pbs/application/models/Person.php
+
+zf create controller Person
+
+
+
+
+
+
+
+
+
+
+
+
+
+<!-- application/views/scripts/guestbook/index.phtml -->
+
+<p><a href="<?php echo $this->url(
+ array(
+ 'controller' => 'guestbook',
+ 'action' => 'sign'
+ ),
+ 'default',
+ true) ?>">Sign Our Guestbook</a></p>
+
+Guestbook Entries: <br />
+<dl>
+ <?php foreach ($this->entries as $entry): ?>
+ <dt><?php echo $this->escape($entry->email) ?></dt>
+ <dd><?php echo $this->escape($entry->comment) ?></dd>
+ <?php endforeach ?>
+</dl>
+
+
+
+
+
+
+<?php
+// application/models/PersonMapper.php
+
+class Application_Model_PersonMapper
+{
+protected $_dbTable;
+
+public function setDbTable($dbTable)
+{
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+ $this->_dbTable = $dbTable;
+ return $this;
+}
+
+public function getDbTable()
+{
+ if (null === $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_Person');
+ }
+ return $this->_dbTable;
+}
+
+public function save(Application_Model_Person $person)
+{
+ $data = array(
+ 'title' => $person->getTitle(),
+ 'name' => $person->getName(),
+ 'firstname' => $person->getFirstname(),
+ 'street' => $person->getStreet(),
+ 'housenumber' => $person->getHousenumber(),
+ 'city' => $person->getCity(),
+ 'postalcode' => $person->getPostalcode(),
+ 'logindate' => $person->getlogindate(),
+ 'registerdate' => $person->getRegisterdate(),
+ 'email' => $person->getEmail(),
+ 'login' => $person->getLogin(),
+ 'password' => $person->getPassword()
+ );
+
+ if (null === ($id = $person->getPersonID())) {
+ unset($data['personID']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('personID = ?' => $id));
+ }
+}
+
+public function find($id, Application_Model_Person $person)
+{
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+ $row = $result->current();
+ $guestbook->setPersonID($row->personID)
+ ->setTitle($row->title)
+ ->setName($row->name)
+ ->setFirstname($row->firstname)
+ ->setStreet($row->street)
+ ->setHousenumber($row->housenumber)
+ ->setCity($row->city)
+ ->setPostalcode($row->postalcode)
+ ->setLogindate($row->logindate)
+ ->setRegisterdate($row->registerdate)
+ ->setEmail($row->email)
+ ->setLogin($row->login)
+ ->setPassword($row->password);
+}
+
+public function fetchAll()
+{
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_Person();
+ $entry->setPersonID($row->personID)
+ ->setTitle($row->title)
+ ->setName($row->name)
+ ->setFirstname($row->firstname)
+ ->setStreet($row->street)
+ ->setHousenumber($row->housenumber)
+ ->setCity($row->city)
+ ->setPostalcode($row->postalcode)
+ ->setLogindate($row->logindate)
+ ->setRegisterdate($row->registerdate)
+ ->setEmail($row->email)
+ ->setLogin($row->login)
+ ->setPassword($row->password);
+ $entries[] = $entry;
+ }
+ return $entries;
+}
+}
+
+
+
+
+<?php
+// application/models/Person.php
+
+class Application_Model_Person
+{
+ protected $_title;
+ protected $_name;
+ protected $_firstname;
+ protected $_street;
+ protected $_housenumber;
+ protected $_city;
+ protected $_postalcode;
+ protected $_logindate;
+ protected $_registerdate;
+ protected $_email;
+ protected $_login;
+ protected $_password;
+ protected $_personID;
+
+ public function __construct(array $options = null)
+ {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
+
+ public function __set($name, $value)
+ {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid person property');
+ }
+ $this->$method($value);
+ }
+
+ public function __get($name)
+ {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid person property');
+ }
+ return $this->$method();
+ }
+
+ public function setOptions(array $options)
+ {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
+
+ public function setTitle($text)
+ {
+ $this->_title = (string) $text;
+ return $this;
+ }
+ public function getTitle()
+ {
+ return $this->_title;
+ }
+
+ public function setName($text)
+ {
+ $this->_name = (string) $text;
+ return $this;
+ }
+ public function getName()
+ {
+ return $this->_name;
+ }
+ public function setFirstname($text)
+ {
+ $this->_firstname = (string) $text;
+ return $this;
+ }
+ public function getFirstname()
+ {
+ return $this->_firstname;
+ }
+
+ public function setStreet($text)
+ {
+ $this->_street = (string) $text;
+ return $this;
+ }
+ public function getStreet()
+ {
+ return $this->_street;
+ }
+
+ public function setHousenumber($text)
+ {
+ $this->_housenumber = (string) $text;
+ return $this;
+ }
+ public function getHousenumber()
+ {
+ return $this->_housenumber;
+ }
+
+ public function setCity($text)
+ {
+ $this->_city = (string) $text;
+ return $this;
+ }
+ public function getCity()
+ {
+ return $this->_city;
+ }
+
+ public function setPostalcode($text)
+ {
+ $this->_postalcode = (string) $text;
+ return $this;
+ }
+ public function getPostalcode()
+ {
+ return $this->_postalcode;
+ }
+ public function setLogindate($text)
+ {
+ $this->_logindate = (string) $text;
+ return $this;
+ }
+ public function getLogindate()
+ {
+ return $this->_logindate;
+ }
+ public function setRegisterdate($text)
+ {
+ $this->_registerdate = (string) $text;
+ return $this;
+ }
+ public function getRegisterdate()
+ {
+ return $this->_registerdate;
+ }
+
+ registerdate
+
+ public function setEmail($email)
+ {
+ $this->_email = (string) $email;
+ return $this;
+ }
+ public function getEmail()
+ {
+ return $this->_email;
+ }
+
+ public function setLogin($login)
+ {
+ $this->_login = (string) $login;
+ return $this;
+ }
+ public function getLogin()
+ {
+ return $this->_login;
+ }
+ public function setPassword($login)
+ {
+ $this->_password = (string) $login;
+ return $this;
+ }
+ public function getPassword()
+ {
+ return $this->_password;
+ }
+
+
+ public function setPersonID($id)
+ {
+ $this->_personID = (int) $id;
+ return $this;
+ }
+ public function getPersonID()
+ {
+ return $this->_personID;
+ }
+}
+
diff --git a/notes-2.txt b/notes-2.txt
new file mode 100644
index 0000000..39718f5
--- /dev/null
+++ b/notes-2.txt
@@ -0,0 +1,76 @@
+drop trigger if exists GroupGroups_Trigger;
+
+CREATE TRIGGER Groups_Trigger
+BEFORE delete ON pbs_group
+FOR EACH ROW
+ INSERT INTO pbs_groupgroups g SET g.parentID = (SELECT parentID FROM pbs_groupgroups WHERE groupID = old.gro
+
+INSERT INTO pbs_group (title) VALUES ('testgruppe1');
+INSERT INTO pbs_group (title) VALUES ('testgruppe2');
+INSERT INTO pbs_group (title) VALUES ('testgruppe3');
+INSERT INTO pbs_group (title) VALUES ('testgruppe4');
+INSERT INTO pbs_group (title) VALUES ('testgruppe5');
+INSERT INTO pbs_groupgroups (parentID,groupID) VALUES (1,2);
+INSERT INTO pbs_groupgroups (parentID,groupID) VALUES (2,3);
+INSERT INTO pbs_groupgroups (parentID,groupID) VALUES (1,4);
+INSERT INTO pbs_groupgroups (parentID,groupID) VALUES (3,5);
+
+Löschen von Gruppen
+
+Case 1. Lösche alle Untergruppen
+Case 2. Untergruppen werden an Root gehängt
+Case 2. Untergruppen werden an alle Obergruppen der Gruppe gehängt (Authorisation der Obergruppe?)
+Case 3. Untergruppen werden an bestimmte Obergruppen gehängt (Authorisation der Obergruppe?)
+
+Löschen von Groupgroups
+
+Case1. Gruppe hat noch andere Obergruppen -> tue nichts
+Case2. Gruppe hat keine Obergruppen mehr -> hänge gruppe an root
+
+Gruppen verwalten
+
+root-gruppen
+Gruppen die unter Root hängen repräsentieren eine PBS-Datenbank Instanz, sog. root-gruppen (z.b. PBS-Server1)
+root-gruppen können nicht gelöscht werden
+root-gruppen können Untergruppen anlegen und wieder löschen
+root-gruppen besitzen angehörige, rollen, rechte
+angehörige mit den nötigen Rechten können Untergruppen erstellen und löschen.
+angehörige mit den nötigen Rechten können Personen anlegen, angehörigkeiten und rollen zuweisen
+angehörige mit den nötigen Rechten können rechte erstellen, ändern und löschen
+angehörige mit den nötigen Rechten können Untergruppen einen oder mehreren Gruppen unterstellen
+
+Gruppen
+Jede Gruppe kann mehrere Untergruppen erstellen und löschen
+Gruppen können sich nicht selbst löschen
+
+Jede Gruppe außer root-gruppen können mehrere Obergruppen besitzen
+
+
+
+Sanity Checks
+
+Constraints
+
+1. Group -> Groupgroups
+1. Groupgroups -> group, group
+2. Grouprequests -> person, group
+3. RightRoles -> role, right
+4. Membership -> role, group, right
+5. Role -> group
+6. Config -> membership
+7. BootOs -> group
+8. Bootmenuentries -> bootos, bootmenu
+9. Bootmenu -> membership
+10. BootIso -> membership
+11. Session -> client, bootos
+12. MembershipFilters -> membership, filter
+13. Poolentries -> pool, client
+14. Filter -> membership, bootmenu
+15. Poolfilters -> pool, filter
+16. Filterentries -> filter, filtertype
+
+Not Null
+...
+
+
+
diff --git a/simonFilter.sql b/simonFilter.sql
new file mode 100644
index 0000000..c9cf9fa
--- /dev/null
+++ b/simonFilter.sql
@@ -0,0 +1,7 @@
+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'); \ No newline at end of file
diff --git a/simonFilter.txt b/simonFilter.txt
deleted file mode 100644
index bac6fd7..0000000
--- a/simonFilter.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-
-- IP / IP-range
-- Mac Adresse
-- PoolID
-- BootIso
-- Besitzer
-- Uhrzeit
-
-
diff --git a/zend-einrichten.sh b/zend-su.sh
index 46b685b..234505e 100755
--- a/zend-einrichten.sh
+++ b/zend-su.sh
@@ -27,5 +27,3 @@ echo " </VirtualHost>" >> /etc/apache2/sites-available/pbs2
ln -s /etc/apache2/sites-available/pbs2 /etc/apache2/sites-enabled/pbs2
echo "127.0.0.2 pbs2.local" >> /etc/hosts
/etc/init.d/apache2 restart
-mysql -u root -plsfks-openslx < /tmp/pbs2/pbs.sql
-su sf34 -c "cp ~/pbs2/application/configs/application.ini /tmp/pbs2/application/configs/application.ini"
diff --git a/zend-user.sh b/zend-user.sh
new file mode 100644
index 0000000..801920e
--- /dev/null
+++ b/zend-user.sh
@@ -0,0 +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/simonFilterSqlTests.sql \ No newline at end of file