diff options
| author | michael pereira | 2011-03-06 20:12:36 +0100 |
|---|---|---|
| committer | michael pereira | 2011-03-06 20:12:36 +0100 |
| commit | 0e017ebdc1edbbf230f0f0160f103c39ef675725 (patch) | |
| tree | e7848e531d30a01145f2f98d8a3189ea6699c54d /application/models | |
| parent | Config fertig (diff) | |
| download | pbs2-0e017ebdc1edbbf230f0f0160f103c39ef675725.tar.gz pbs2-0e017ebdc1edbbf230f0f0160f103c39ef675725.tar.xz pbs2-0e017ebdc1edbbf230f0f0160f103c39ef675725.zip | |
datenbank erweitert, BootMenu, Config fertig
Diffstat (limited to 'application/models')
| -rw-r--r-- | application/models/BootMapper.php | 83 | ||||
| -rw-r--r-- | application/models/BootMenu.php | 20 | ||||
| -rw-r--r-- | application/models/BootMenuMapper.php | 12 | ||||
| -rw-r--r-- | application/models/BootOs.php | 10 | ||||
| -rw-r--r-- | application/models/BootOsMapper.php | 6 | ||||
| -rw-r--r-- | application/models/Config.php | 21 | ||||
| -rw-r--r-- | application/models/ConfigMapper.php | 6 |
7 files changed, 57 insertions, 101 deletions
diff --git a/application/models/BootMapper.php b/application/models/BootMapper.php deleted file mode 100644 index 43f9d3d..0000000 --- a/application/models/BootMapper.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -class Application_Model_BootMapper -{ - - 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_Boot'); - } - - return $this->_dbTable; - } - - public function save(Application_Model_Boot $bot) - { - - $data = array(); - - if (null === ($id = $bot->getID()) ) { - unset($data['botID']); - $this->getDbTable()->insert($data); - } else { - $this->getDbTable()->update($data, array('botID = ?' => $id)); - } - } - - public function delete(Application_Model_Boot $bot) - { - if (null === ($id = $bot->getID()) ) { - return; - } else { - $this->getDbTable()->delete(array('botID = ?' => $id)); - } - } - - public function find($id, Application_Model_Boot $bot) - { - $result = $this->getDbTable()->find($id); - if (0 == count($result)) { - return; - } - - $row = $result->current(); - - $bot; - } - - public function fetchAll() - { - $resultSet = $this->getDbTable()->fetchAll(); - $entries = array(); - foreach ($resultSet as $row) { - $entry = new Application_Model_Boot(); - - $entry; - - $entries[] = $entry; - } - return $entries; - } - - - -} - diff --git a/application/models/BootMenu.php b/application/models/BootMenu.php index 09a5c0d..da4e4d1 100644 --- a/application/models/BootMenu.php +++ b/application/models/BootMenu.php @@ -4,8 +4,9 @@ class Application_Model_BootMenu { protected $_bootmenuID; protected $_membershipID; + protected $_groupID; protected $_title; - protected $_time; + protected $_created; public function __construct(array $options = null) { @@ -62,6 +63,15 @@ class Application_Model_BootMenu $this->_membershipID = $_membershipID; return $this; } + public function getGroupID() + { + return $this->_groupID; + } + public function setGroupID($_groupID) + { + $this->_groupID = $_groupID; + return $this; + } public function getTitle() { return $this->_title; @@ -71,13 +81,13 @@ class Application_Model_BootMenu $this->_title = $_title; return $this; } - public function getTime() + public function getCreated() { - return $this->_time; + return $this->_created; } - public function setTime($_time) + public function setCreated($_created) { - $this->_time = $_time; + $this->_created = $_created; return $this; } /** diff --git a/application/models/BootMenuMapper.php b/application/models/BootMenuMapper.php index fa9b8a7..51e85ef 100644 --- a/application/models/BootMenuMapper.php +++ b/application/models/BootMenuMapper.php @@ -32,13 +32,13 @@ class Application_Model_BootMenuMapper public function save(Application_Model_BootMenu $botmenu) { - $data = array('bootmenuID'=> $botmenu->getBootmenuID() ,'membershipID'=> $botmenu->getMembershipID() ,'title'=> $botmenu->getTitle() ,'time'=> $botmenu->getTime() ); + $data = array('bootmenuID'=> $botmenu->getID() ,'membershipID'=> $botmenu->getMembershipID(), 'groupID'=> $botmenu->getGroupID() ,'title'=> $botmenu->getTitle() ,'created'=> $botmenu->getCreated() ); if (null === ($id = $botmenu->getID()) ) { - unset($data['botmenuID']); + unset($data['bootmenuID']); $this->getDbTable()->insert($data); } else { - $this->getDbTable()->update($data, array('botmenuID = ?' => $id)); + $this->getDbTable()->update($data, array('bootmenuID = ?' => $id)); } } @@ -47,7 +47,7 @@ class Application_Model_BootMenuMapper if (null === ($id = $botmenu->getID()) ) { return; } else { - $this->getDbTable()->delete(array('botmenuID = ?' => $id)); + $this->getDbTable()->delete(array('bootmenuID = ?' => $id)); } } @@ -60,7 +60,7 @@ class Application_Model_BootMenuMapper $row = $result->current(); - $botmenu->setBootmenuID($row->bootmenuID)->setMembershipID($row->membershipID)->setTitle($row->title)->setTime($row->time); + $botmenu->setID($row->bootmenuID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setTitle($row->title)->setCreated($row->created); } public function fetchAll() @@ -70,7 +70,7 @@ class Application_Model_BootMenuMapper foreach ($resultSet as $row) { $entry = new Application_Model_BootMenu(); - $entry->setBootmenuID($row->bootmenuID)->setMembershipID($row->membershipID)->setTitle($row->title)->setTime($row->time); + $entry->setID($row->bootmenuID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setTitle($row->title)->setCreated($row->created); $entries[] = $entry; } diff --git a/application/models/BootOs.php b/application/models/BootOs.php index b61be41..bab23db 100644 --- a/application/models/BootOs.php +++ b/application/models/BootOs.php @@ -5,6 +5,7 @@ class Application_Model_BootOs protected $_bootosID; protected $_configID; protected $_groupID; + protected $_membershipID; protected $_title; protected $_path_init; protected $_path_kernel; @@ -79,6 +80,15 @@ class Application_Model_BootOs $this->_groupID = $_groupID; return $this; } + public function getMembershipID() + { + return $this->_membershipID; + } + public function setMembershipID($_membershipID) + { + $this->_membershipID = $_membershipID; + return $this; + } public function getTitle() { return $this->_title; diff --git a/application/models/BootOsMapper.php b/application/models/BootOsMapper.php index 9807911..d4a43af 100644 --- a/application/models/BootOsMapper.php +++ b/application/models/BootOsMapper.php @@ -31,7 +31,7 @@ class Application_Model_BootOsMapper public function save(Application_Model_BootOs $botos) { - $data = array('bootosID'=> $botos->getID() ,'configID'=> $botos->getConfigID() ,'groupID'=> $botos->getGroupID() ,'title'=> $botos->getTitle() ,'path_init'=> $botos->getPath_init() ,'path_kernel'=> $botos->getPath_kernel() ,'defaultkcl'=> $botos->getDefaultkcl() ,'created'=> $botos->getCreated() ,'description'=> $botos->getDescription() ,'expires'=> $botos->getExpires() ,'public'=> $botos->getPublic() ); + $data = array('bootosID'=> $botos->getID() ,'configID'=> $botos->getConfigID() ,'groupID'=> $botos->getGroupID() ,'title'=> $botos->getTitle(), 'membershipID'=> $botos->getMembershipID() ,'path_init'=> $botos->getPath_init() ,'path_kernel'=> $botos->getPath_kernel() ,'defaultkcl'=> $botos->getDefaultkcl() ,'created'=> $botos->getCreated() ,'description'=> $botos->getDescription() ,'expires'=> $botos->getExpires() ,'public'=> $botos->getPublic() ); if (null === ($id = $botos->getID()) ) { unset($data['bootosID']); $this->getDbTable()->insert($data); @@ -58,7 +58,7 @@ class Application_Model_BootOsMapper $row = $result->current(); - $botos->setID($row->bootosID)->setConfigID($row->configID)->setGroupID($row->groupID)->setTitle($row->title)->setPath_init($row->path_init)->setPath_kernel($row->path_kernel)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public); + $botos->setID($row->bootosID)->setConfigID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setPath_init($row->path_init)->setPath_kernel($row->path_kernel)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public); } public function fetchAll() @@ -68,7 +68,7 @@ class Application_Model_BootOsMapper foreach ($resultSet as $row) { $entry = new Application_Model_BootOs(); - $entry->setID($row->bootosID)->setConfigID($row->configID)->setGroupID($row->groupID)->setTitle($row->title)->setPath_init($row->path_init)->setPath_kernel($row->path_kernel)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public); + $entry->setID($row->bootosID)->setConfigID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setPath_init($row->path_init)->setPath_kernel($row->path_kernel)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public); $entries[] = $entry; } diff --git a/application/models/Config.php b/application/models/Config.php index 8107705..1fbac0a 100644 --- a/application/models/Config.php +++ b/application/models/Config.php @@ -4,8 +4,10 @@ class Application_Model_Config { protected $_configID; protected $_groupID; + protected $_membershipID; protected $_title; protected $_shellscript; + protected $_created; public function __construct(array $options = null) { @@ -63,6 +65,15 @@ class Application_Model_Config $this->_groupID = $_groupID; return $this; } + public function getMembershipID() + { + return $this->_membershipID; + } + public function setMembershipID($_membershipID) + { + $this->_membershipID = $_membershipID; + return $this; + } public function getShellscript() { return $this->_shellscript; @@ -81,7 +92,15 @@ class Application_Model_Config $this->_title = $_title; return $this; } - + public function getCreated() + { + return $this->_created; + } + public function setCreated($_created) + { + $this->_created = $_created; + return $this; + } /** * Returns current data as associative array using ReflectionClass diff --git a/application/models/ConfigMapper.php b/application/models/ConfigMapper.php index 52dcb86..8ee9e0c 100644 --- a/application/models/ConfigMapper.php +++ b/application/models/ConfigMapper.php @@ -32,7 +32,7 @@ class Application_Model_ConfigMapper public function save(Application_Model_Config $config) { - $data = array('configID'=> $config->getID() ,'groupID'=> $config->getGroupID() ,'shellscript'=> $config->getShellscript(), 'title'=> $config->getTitle() ); + $data = array('configID'=> $config->getID() ,'groupID'=> $config->getGroupID(), 'membershipID'=> $config->getMembershipID(), 'shellscript'=> $config->getShellscript(), 'title'=> $config->getTitle() , 'created'=> $config->getCreated() ); if (null === ($id = $config->getID()) ) { unset($data['configID']); @@ -60,7 +60,7 @@ class Application_Model_ConfigMapper $row = $result->current(); - $config->setID($row->configID)->setGroupID($row->groupID)->setShellscript($row->shellscript)->setTitle($row->title); + $config->setID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setCreated($row->created)->setShellscript($row->shellscript)->setTitle($row->title); } public function fetchAll() @@ -70,7 +70,7 @@ class Application_Model_ConfigMapper foreach ($resultSet as $row) { $entry = new Application_Model_Config(); - $entry->setID($row->configID)->setGroupID($row->groupID)->setShellscript($row->shellscript)->setTitle($row->title); + $entry->setID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setCreated($row->created)->setShellscript($row->shellscript)->setTitle($row->title); $entries[] = $entry; } |
