summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Geiger2011-10-06 13:37:16 +0200
committerBjörn Geiger2011-10-06 13:37:16 +0200
commita3045d9ec3ebbb77a6112f8ce4315b7b3ce80acf (patch)
treeccc8c2430650de6e2b36ed524ffb6ecf8824a3be
parentsome statistic changes (diff)
downloadpoolctrl-a3045d9ec3ebbb77a6112f8ce4315b7b3ce80acf.tar.gz
poolctrl-a3045d9ec3ebbb77a6112f8ce4315b7b3ce80acf.tar.xz
poolctrl-a3045d9ec3ebbb77a6112f8ce4315b7b3ce80acf.zip
PBS Tabellen aus DB entfernt
-rwxr-xr-xapplication/models/BootOsMapper.php146
-rwxr-xr-xapplication/models/ClientMapper.php175
-rwxr-xr-xapplication/models/ConfigMapper.php148
-rwxr-xr-xapplication/models/DbTable/BootOs.php20
-rwxr-xr-xapplication/models/DbTable/Client.php20
-rwxr-xr-xapplication/models/DbTable/Config.php20
-rwxr-xr-xapplication/models/DbTable/Membership.php20
-rwxr-xr-xapplication/models/DbTable/Pool.php20
-rwxr-xr-xapplication/models/DbTable/PoolEntries.php20
-rwxr-xr-xapplication/models/PoolEntriesMapper.php141
-rwxr-xr-xapplication/models/PoolMapper.php152
-rwxr-xr-xsetup/poolctrl.sql77
12 files changed, 2 insertions, 957 deletions
diff --git a/application/models/BootOsMapper.php b/application/models/BootOsMapper.php
deleted file mode 100755
index 2bde6db..0000000
--- a/application/models/BootOsMapper.php
+++ /dev/null
@@ -1,146 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_BootOsMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_BootOs($row);
- $entry->setID($row['bootosID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- 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_BootOs');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_BootOs $botos)
- {
- $data = array('bootosID'=> $botos->getID() ,'groupID'=> $botos->getGroupID() ,'title'=> $botos->getTitle(), 'membershipID'=> $botos->getMembershipID(),'defaultkcl'=> $botos->getDefaultkcl() ,'created'=> $botos->getCreated() ,'description'=> $botos->getDescription() ,'expires'=> $botos->getExpires() ,'public'=> $botos->getPublic(),'source'=> $botos->getSource(),'distro'=> $botos->getDistro(),'distroversion'=> $botos->getDistroversion(),'shortname'=> $botos->getShortname(),'share'=> $botos->getShare() );
- if (null === ($id = $botos->getID()) ) {
- unset($data['bootosID']);
- return $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('bootosID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_BootOs $botos)
- {
- if (null === ($id = $botos->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('bootosID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_BootOs $botos = null)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- if($botos == null){
- $botos = new Application_Model_BootOs();
- $botos->setID($row->bootosID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public)->setSource($row->source)->setDistro($row->distro)->setDistroversion($row->distroversion)->setShortname($row->shortname)->setShare($row->share);
- return $botos;
- }else{
- $botos->setID($row->bootosID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public)->setSource($row->source)->setDistro($row->distro)->setDistroversion($row->distroversion)->setShortname($row->shortname)->setShare($row->share);
- }
-
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_BootOs();
-
- $entry->setID($row->bootosID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public)->setSource($row->source)->setDistro($row->distro)->setDistroversion($row->distroversion)->setShortname($row->shortname)->setShare($row->share);
-
- $entries[$row->bootosID] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_BootOs $v1,Application_Model_BootOs $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
-}
-
diff --git a/application/models/ClientMapper.php b/application/models/ClientMapper.php
deleted file mode 100755
index cc17c45..0000000
--- a/application/models/ClientMapper.php
+++ /dev/null
@@ -1,175 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_ClientMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Client($row);
- $entry->setID($row['clientID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- 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_Client');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Client $client)
- {
-
- $data = array('clientID'=> $client->getID() ,
- 'groupID' => $client->getGroupID(),
- 'macadress'=> $client->getMacadress() ,
- 'hardwarehash'=> $client->getHardwarehash(),
- 'ip' => $client->getIp(),
- 'ip6' => $client->getIp6(),
- 'created'=> $client->getCreated()
- );
-
- if (null === ($id = $client->getID()) ) {
- unset($data['clientID']);
- return $this->getDbTable()->insert($data);
- } else {
- return $this->getDbTable()->update($data, array('clientID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Client $client)
- {
- if (null === ($id = $client->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('clientID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_Client $client = null)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- if($client == null) {
- $return = true;
- }
-
- $row = $result->current();
-
- if($return) {
- $client = new Application_Model_Client;
- $client->setID($row->clientID)
- ->setGroupID($row->groupID)
- ->setMacadress($row->macadress)
- ->setIp($row->ip)
- ->setIp6($row->ip6)
- ->setHardwarehash($row->hardwarehash)
- ->setCreated($row->created);
- return $client;
- } else {
- $client->setID($row->clientID)
- ->setGroupID($row->groupID)
- ->setMacadress($row->macadress)
- ->setIp($row->ip)
- ->setIp6($row->ip6)
- ->setHardwarehash($row->hardwarehash)
- ->setCreated($row->created);
- }
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Client();
-
- $entry->setID($row->clientID)
- ->setGroupID($row->groupID)
- ->setMacadress($row->macadress)
- ->setIp($row->ip)
- ->setIp6($row->ip6)
- ->setHardwarehash($row->hardwarehash)
- ->setCreated($row->created);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Client $v1,Application_Model_Client $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-}
-
diff --git a/application/models/ConfigMapper.php b/application/models/ConfigMapper.php
deleted file mode 100755
index f46bd72..0000000
--- a/application/models/ConfigMapper.php
+++ /dev/null
@@ -1,148 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_ConfigMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Config($row);
- $entry->setID($row['configID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
- 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_Config');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Config $config)
- {
-
- $data = array('configID'=> $config->getID() ,'groupID'=> $config->getGroupID(), 'membershipID'=> $config->getMembershipID(), 'title'=> $config->getTitle() , 'created'=> $config->getCreated(), 'description' => $config->getDescription(), 'visible' => $config->getVisible(), 'bootosID' => $config->getBootosID() );
-
- if (null === ($id = $config->getID()) ) {
- unset($data['configID']);
- return $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('configID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Config $config)
- {
- if (null === ($id = $config->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('configID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_Config $config = null)
- {
-
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- if($config == null){
- $config = new Application_Model_Config();
- $config->setID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setCreated($row->created)->setTitle($row->title)->setDescription($row->description)->setVisible($row->visible)->setBootosID($row->bootosID);
- return $config;
- }else{
- $config->setID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setCreated($row->created)->setTitle($row->title)->setDescription($row->description)->setVisible($row->visible)->setBootosID($row->bootosID);
- }
-
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Config();
-
- $entry->setID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setCreated($row->created)->setTitle($row->title)->setDescription($row->description)->setVisible($row->visible)->setBootosID($row->bootosID);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Config $v1,Application_Model_Config $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
-}
-
diff --git a/application/models/DbTable/BootOs.php b/application/models/DbTable/BootOs.php
deleted file mode 100755
index a61167a..0000000
--- a/application/models/DbTable/BootOs.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_DbTable_BootOs extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'pbs_bootos';
-
-
-}
-
diff --git a/application/models/DbTable/Client.php b/application/models/DbTable/Client.php
deleted file mode 100755
index 59d71a1..0000000
--- a/application/models/DbTable/Client.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_DbTable_Client extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'pbs_client';
-
-
-}
-
diff --git a/application/models/DbTable/Config.php b/application/models/DbTable/Config.php
deleted file mode 100755
index 56b6a41..0000000
--- a/application/models/DbTable/Config.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_DbTable_Config extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'pbs_config';
-
-
-}
-
diff --git a/application/models/DbTable/Membership.php b/application/models/DbTable/Membership.php
deleted file mode 100755
index cc1d4cc..0000000
--- a/application/models/DbTable/Membership.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_DbTable_Membership extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'pbs_membership';
-
-
-}
-
diff --git a/application/models/DbTable/Pool.php b/application/models/DbTable/Pool.php
deleted file mode 100755
index 9650166..0000000
--- a/application/models/DbTable/Pool.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_DbTable_Pool extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'pbs_pool';
-
-
-}
-
diff --git a/application/models/DbTable/PoolEntries.php b/application/models/DbTable/PoolEntries.php
deleted file mode 100755
index 275f443..0000000
--- a/application/models/DbTable/PoolEntries.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_DbTable_PoolEntries extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'pbs_poolentries';
-
-
-}
-
diff --git a/application/models/PoolEntriesMapper.php b/application/models/PoolEntriesMapper.php
deleted file mode 100755
index c5a6893..0000000
--- a/application/models/PoolEntriesMapper.php
+++ /dev/null
@@ -1,141 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_PoolEntriesMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_PoolEntries($row);
- $entry->setID($row['poolentriesID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- 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_PoolEntries');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_PoolEntries $polentries)
- {
-
- $data = array('poolentriesID' => $polentries->getID(), 'poolID'=> $polentries->getPoolID() ,'clientID'=> $polentries->getClientID() );
-
- if (null === ($id = $polentries->getID()) ) {
- unset($data['poolentriesID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('poolentriesID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_PoolEntries $polentries)
- {
- if (null === ($id = $polentries->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('poolentriesID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_PoolEntries $polentries)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $polentries->setID($row->poolentriesID)->setPoolID($row->poolID)->setClientID($row->clientID);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_PoolEntries();
-
- $entry->setID($row->poolentriesID)->setPoolID($row->poolID)->setClientID($row->clientID);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_PoolEntries $v1,Application_Model_PoolEntries $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
-}
-
diff --git a/application/models/PoolMapper.php b/application/models/PoolMapper.php
deleted file mode 100755
index 469ab92..0000000
--- a/application/models/PoolMapper.php
+++ /dev/null
@@ -1,152 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_PoolMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Pool($row);
- $entry->setID($row['poolID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- 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_Pool');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Pool $pol)
- {
- print_a($pol);
- $data = array('poolID'=> $pol->getID() ,
- 'groupID'=> $pol->getGroupID() ,
- 'title'=> $pol->getTitle() ,
- 'description'=> $pol->getDescription() ,
- 'location'=> $pol->getLocation() );
-
- if (null === ($id = $pol->getID()) ) {
- unset($data['poolID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('poolID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Pool $pol)
- {
- if (null === ($id = $pol->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('poolID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_Pool $pol)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $pol->setID($row->poolID)
- ->setGroupID($row->groupID)
- ->setTitle($row->title)
- ->setDescription($row->description)
- ->setLocation($row->location);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Pool();
-
- $entry->setID($row->poolID)
- ->setGroupID($row->groupID)
- ->setTitle($row->title)
- ->setDescription($row->description)
- ->setLocation($row->location);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Pool $v1,Application_Model_Pool $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-}
-
diff --git a/setup/poolctrl.sql b/setup/poolctrl.sql
index c3bf12f..070c79d 100755
--- a/setup/poolctrl.sql
+++ b/setup/poolctrl.sql
@@ -77,82 +77,7 @@ CREATE TABLE IF NOT EXISTS `poolctrl_eventreport` (
KEY `type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
--- PBS2 Tabellen
--- TO DO: Tabellen an dieser Stelle nicht per Hand erzeugen sondern von der PBS2-Datenbank kopieren, sodass diese auf dem neusten Stand sind
-CREATE TABLE IF NOT EXISTS `pbs_bootos` (
- `bootosID` int(11) NOT NULL AUTO_INCREMENT,
- `groupID` int(11) NOT NULL,
- `membershipID` int(11),
- `title` varchar(30) NOT NULL,
- `description` varchar(140),
- `distro` varchar(30),
- `distroversion` varchar(30),
- `source` varchar(140),
- `share` varchar(30),
- `shortname` varchar(30),
- `defaultkcl` varchar(255),
- `created` VARCHAR(14) NOT NULL,
- `expires` VARCHAR(14),
- `public` int(11) NOT NULL DEFAULT '-1',
- PRIMARY KEY (`bootosID`),
- KEY `groupID` (`groupID`),
- KEY `membershipID` (`membershipID`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-
-CREATE TABLE IF NOT EXISTS `pbs_config` (
- `configID` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(30) NOT NULL,
- `description` varchar(140),
- `groupID` int(11),
- `membershipID` int(11),
- `visible` tinyint(1) DEFAULT '0',
- `created` VARCHAR(14) NOT NULL,
- `bootosID` int(11) NOT NULL,
- PRIMARY KEY (`configID`),
- KEY `bootosID` (`bootosID`),
- KEY `groupID` (`groupID`),
- KEY `membershipID` (`membershipID`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-
-CREATE TABLE IF NOT EXISTS `pbs_pool` (
- `poolID` int(11) NOT NULL AUTO_INCREMENT,
- `groupID` int(11) NOT NULL,
- `title` varchar(30) NOT NULL,
- `description` varchar(140),
- `location` varchar(30),
- PRIMARY KEY (`poolID`),
- KEY `groupID` (`groupID`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
-
-CREATE TABLE IF NOT EXISTS `pbs_client` (
- `clientID` int(11) NOT NULL AUTO_INCREMENT,
- `groupID` int(11) NOT NULL,
- `macadress` varchar(17) NOT NULL,
- `hardwarehash` varchar(32),
- `ip` varchar(15) NOT NULL,
- `ip6` varchar(45),
- `created` int(15),
- PRIMARY KEY (`clientID`),
- KEY `groupID` (`groupID`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
-
-CREATE TABLE IF NOT EXISTS `pbs_poolentries` (
- `poolentriesID` INT NOT NULL AUTO_INCREMENT,
- `poolID` int(11) NOT NULL,
- `clientID` int(11) NOT NULL,
- PRIMARY KEY (`poolentriesID`),
- KEY `poolID` (`poolID`),
- KEY `clientID` (`clientID`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
-
-- Constraints
-ALTER TABLE `pbs_config`
- ADD CONSTRAINT `pbs_config_ibfk` FOREIGN KEY (`bootosID`) REFERENCES `pbs_bootos` (`bootosID`) ON DELETE CASCADE;
-
-ALTER TABLE `pbs_poolentries`
- ADD CONSTRAINT `pbs_poolentries_ibfk_1` FOREIGN KEY (`poolID`) REFERENCES `pbs_pool` (`poolID`) ON DELETE CASCADE,
- ADD CONSTRAINT `pbs_poolentries_ibfk_2` FOREIGN KEY (`clientID`) REFERENCES `pbs_client` (`clientID`) ON DELETE CASCADE;
-
ALTER TABLE `poolctrl_eventreport`
ADD CONSTRAINT `pbs_eventreport_eventidC` FOREIGN KEY (`eventID`) REFERENCES `poolctrl_event` (`eventID`) ON DELETE CASCADE,
ADD CONSTRAINT `pbs_eventreport_typeidC` FOREIGN KEY (`type`) REFERENCES `poolctrl_runningtype` (`runningtypeID`) ON DELETE CASCADE;
@@ -165,6 +90,8 @@ ALTER TABLE `poolctrl_event`
ADD CONSTRAINT `poolctrl_event_startC` CHECK (start > CURRENT_TIMESTAMP()),
ADD CONSTRAINT `poolctrl_event_endC` CHECK (end > start);
+-- Insert Data
+
-- Adding eventcategories
INSERT INTO `poolctrl_eventcategory` (`eventcategoryID`, `title`, `color`) VALUES
(1, 'Lecture', 'green'),