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 | |
| parent | Config fertig (diff) | |
| download | pbs2-0e017ebdc1edbbf230f0f0160f103c39ef675725.tar.gz pbs2-0e017ebdc1edbbf230f0f0160f103c39ef675725.tar.xz pbs2-0e017ebdc1edbbf230f0f0160f103c39ef675725.zip | |
datenbank erweitert, BootMenu, Config fertig
| -rw-r--r-- | application/controllers/BootmenuController.php | 85 | ||||
| -rw-r--r-- | application/controllers/BootosController.php | 8 | ||||
| -rw-r--r-- | application/controllers/ConfigController.php | 6 | ||||
| -rw-r--r-- | application/forms/BootmenuCreate.php | 33 | ||||
| -rw-r--r-- | application/forms/BootmenuEdit.php | 36 | ||||
| -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 | ||||
| -rw-r--r-- | application/views/scripts/bootmenu/createbootmenu.phtml | 5 | ||||
| -rw-r--r-- | application/views/scripts/bootmenu/editbootmenu.phtml | 5 | ||||
| -rw-r--r-- | application/views/scripts/bootmenu/index.phtml | 48 | ||||
| -rw-r--r-- | application/views/scripts/bootos/index.phtml | 2 | ||||
| -rw-r--r-- | application/views/scripts/config/index.phtml | 4 | ||||
| -rw-r--r-- | pbs.sql | 37 |
18 files changed, 273 insertions, 154 deletions
diff --git a/application/controllers/BootmenuController.php b/application/controllers/BootmenuController.php index 20f471e..e20ef23 100644 --- a/application/controllers/BootmenuController.php +++ b/application/controllers/BootmenuController.php @@ -5,12 +5,13 @@ class BootmenuController extends Zend_Controller_Action public function init() { - /* Initialize action controller here */ - } + $db = Zend_Db_Table::getDefaultAdapter(); + } public function indexAction() { - // action body + $bootmenumapper = new Application_Model_BootMenuMapper(); + $this->view->bootmenulist = $bootmenumapper->fetchAll(); } public function addbootmenuentryAction() @@ -20,12 +21,76 @@ class BootmenuController extends Zend_Controller_Action public function createbootmenuAction() { - // action body + if (!isset($_POST["createbootmenu"])){ + $createbootmenuForm = new Application_Form_BootmenuCreate(); + } else { + + $createbootmenuForm = new Application_Form_BootmenuCreate($_POST); + + if ($createbootmenuForm->isValid($_POST)) { + + $bootmenu = new Application_Model_BootMenu($_POST); + $bootmenu->setMembershipID('1'); + $bootmenu->setCreated(time()); + $bootmenumapper = new Application_Model_BootMenuMapper(); + + try { + $bootmenumapper->save($bootmenu); + }catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + + } + $this->_redirect('/bootmenu'); + } + } + + $this->view->createbootmenuForm = $createbootmenuForm; } public function editbootmenuAction() { - // action body + $bootmenuID = $this->_request->getParam('bootmenuID'); + + if (!isset($_POST["editbootmenu"])){ + $bootmenuID = $this->_request->getParam('bootmenuID'); + if (!isset($bootmenuID) || !is_numeric($bootmenuID)){ + $this->_redirect('/bootmenu'); + } else { + $bootmenu = new Application_Model_BootMenu(); + $bootmenumapper = new Application_Model_BootMenuMapper(); + $bootmenumapper->find($bootmenuID, $bootmenu); + + $editbootmenuForm = new Application_Form_BootmenuEdit(); + $editbootmenuForm->populate($bootmenu->toArray()); + } + }else{ + $editbootmenuForm = new Application_Form_BootmenuEdit($_POST); + + if ($editbootmenuForm->isValid($_POST)) { + + $bootmenu = new Application_Model_BootMenu($_POST); + $bootmenu->setMembershipID('1'); + $bootmenu->setCreated(time()); + $bootmenumapper = new Application_Model_BootMenuMapper(); + + $bootmenu->setID($bootmenuID); + + try { + $bootmenumapper->save($bootmenu); + }catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + } + + $this->_redirect('/bootmenu'); + } + + } + + $this->view->editbootmenuForm = $editbootmenuForm; } public function editbootmenuentryAction() @@ -40,6 +105,16 @@ class BootmenuController extends Zend_Controller_Action public function deletebootmenuAction() { + $bootmenuID = $this->_request->getParam('bootmenuID'); + if (!isset($bootmenuID)){ + $this->_redirect('/bootmenu'); + } else { + $bootmenu = new Application_Model_BootMenu(); + $bootmenu->setID($bootmenuID); + $bootmenumapper = new Application_Model_BootMenuMapper(); + $bootmenumapper->delete($bootmenu); + } + $this->_redirect('/bootmenu'); // action body } diff --git a/application/controllers/BootosController.php b/application/controllers/BootosController.php index 69621f0..358204b 100644 --- a/application/controllers/BootosController.php +++ b/application/controllers/BootosController.php @@ -25,11 +25,11 @@ class BootosController extends Zend_Controller_Action if ($createbootosForm->isValid($_POST)) { $bootos = new Application_Model_BootOs($_POST); + $bootos->setMembershipID('1'); if($bootos->getConfigID() == '') $bootos->setConfigID(NULL); $bootosmapper = new Application_Model_BootOsMapper(); - $date = new DateTime(); - $bootos->setCreated($date->getTimestamp()); + $bootos->setCreated(time()); try { $bootosmapper->save($bootos); @@ -68,11 +68,11 @@ class BootosController extends Zend_Controller_Action if ($editbootosForm->isValid($_POST)) { $bootos = new Application_Model_BootOs($_POST); + $bootos->setMembershipID('1'); if($bootos->getConfigID() == '') $bootos->setConfigID(NULL); $bootosmapper = new Application_Model_BootOsMapper(); - $date = new DateTime(); - $bootos->setCreated($date->getTimestamp()); + $bootos->setCreated(time()); $bootos->setID($bootosID); try { diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index de64cbf..461c288 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -25,6 +25,9 @@ class ConfigController extends Zend_Controller_Action if ($createconfigForm->isValid($_POST)) { $config = new Application_Model_Config($_POST); + $config->setCreated(time()); + $config->setMembershipID('1'); + $configmapper = new Application_Model_ConfigMapper(); try { @@ -65,7 +68,8 @@ class ConfigController extends Zend_Controller_Action $config = new Application_Model_Config($_POST); $configmapper = new Application_Model_ConfigMapper(); - + $config->setCreated(time()); + $config->setMembershipID('1'); $config->setID($configID); try { diff --git a/application/forms/BootmenuCreate.php b/application/forms/BootmenuCreate.php index 35d476f..5b284f5 100644 --- a/application/forms/BootmenuCreate.php +++ b/application/forms/BootmenuCreate.php @@ -5,7 +5,38 @@ class Application_Form_BootmenuCreate extends Zend_Form public function init() { - /* Form Elements & Other Definitions Here ... */ + $this->setName("BootMenuCreate"); + $this->setMethod('post'); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + + $this->addElement('text', 'groupID', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'GroupID:', + 'value' => '1', + )); + + $this->addElement('submit', 'createbootmenu', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Create Bootmenu', + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/bootmenu"' + )); + } diff --git a/application/forms/BootmenuEdit.php b/application/forms/BootmenuEdit.php index 3bc0a1d..a3733bf 100644 --- a/application/forms/BootmenuEdit.php +++ b/application/forms/BootmenuEdit.php @@ -3,11 +3,41 @@ class Application_Form_BootmenuEdit extends Zend_Form { - public function init() + public function init() { - /* Form Elements & Other Definitions Here ... */ - } + $this->setName("BootMenuEdit"); + $this->setMethod('post'); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + + $this->addElement('text', 'groupID', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'GroupID:', + 'value' => '1', + )); + + $this->addElement('submit', 'editbootmenu', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Edit BootMenu', + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/bootmenu"' + )); + } } 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; } diff --git a/application/views/scripts/bootmenu/createbootmenu.phtml b/application/views/scripts/bootmenu/createbootmenu.phtml index 1741819..2d2c2df 100644 --- a/application/views/scripts/bootmenu/createbootmenu.phtml +++ b/application/views/scripts/bootmenu/createbootmenu.phtml @@ -1 +1,4 @@ -<br /><br /><center>View script for controller <b>Bootmenu</b> and script/action name <b>createbootmenu</b></center>
\ No newline at end of file +<?php +$this->createbootmenuForm->setAction($this->url()); +echo $this->createbootmenuForm; +?> diff --git a/application/views/scripts/bootmenu/editbootmenu.phtml b/application/views/scripts/bootmenu/editbootmenu.phtml index 3274ee4..b7adc4a 100644 --- a/application/views/scripts/bootmenu/editbootmenu.phtml +++ b/application/views/scripts/bootmenu/editbootmenu.phtml @@ -1 +1,4 @@ -<br /><br /><center>View script for controller <b>Bootmenu</b> and script/action name <b>editbootfilter</b></center>
\ No newline at end of file +<?php +$this->editbootmenuForm->setAction($this->url()); +echo $this->editbootmenuForm; +?> diff --git a/application/views/scripts/bootmenu/index.phtml b/application/views/scripts/bootmenu/index.phtml index d09bb34..3f29b9e 100644 --- a/application/views/scripts/bootmenu/index.phtml +++ b/application/views/scripts/bootmenu/index.phtml @@ -1,53 +1,41 @@ -<h1>BootOS</h1> +<h1>BootMenu</h1> <table border=1> <tr> <th>ID</th> <th>Title</th> <th>GroupID</th> - <th>ConfigID</th> - <th>Init</th> - <th>Kernel</th> - <th>Kcl</th> - <th>Description</th> + <th>MembershipID</th> <th>Changed</th> - <th>Expires</th> - <th>Public</th> </tr> - <?php foreach ($this->bootoslist as $bootos): ?> + <?php foreach ($this->bootmenulist as $bootmenu): ?> <tr> - <td><?php echo $this->escape($bootos->getID()); ?></td> - <td><?php echo $this->escape($bootos->getTitle()); ?></td> - <td><?php echo $this->escape($bootos->getGroupID()); ?></td> - <td><?php echo $this->escape($bootos->getConfigID()); ?></td> - <td><?php echo $this->escape($bootos->getPath_init()); ?></td> - <td><?php echo $this->escape($bootos->getPath_kernel()); ?></td> - <td><?php echo $this->escape($bootos->getDefaultkcl()); ?></td> - <td><?php echo $this->escape($bootos->getDescription()); ?></td> - <td><?php echo $this->escape(date('Y-m-d H:i:s', $bootos->getCreated())); ?></td> - <td><?php echo $this->escape($bootos->getExpires()); ?></td> - <td><?php echo $this->escape($bootos->getPublic()); ?></td> + <td><?php echo $this->escape($bootmenu->getID()); ?></td> + <td><?php echo $this->escape($bootmenu->getTitle()); ?></td> + <td><?php echo $this->escape($bootmenu->getGroupID()); ?></td> + <td><?php echo $this->escape($bootmenu->getMembershipID()); ?></td> + <td><?php echo $this->escape(date('Y-m-d H:i:s', $bootmenu->getCreated())); ?></td> <td><a href="<?php echo $this->url( array( - 'controller' => 'bootos', - 'action' => 'editbootos', - 'bootosID' => $bootos->getID() + 'controller' => 'bootmenu', + 'action' => 'editbootmenu', + 'bootmenuID' => $bootmenu->getID() ), 'default', - true, false) ?>">Edit BootOS</a></td> + true, false) ?>">Edit BootMenu</a></td> <td><a href="<?php echo $this->url( array( - 'controller' => 'bootos', - 'action' => 'deletebootos', - 'bootosID' => $bootos->getID() + 'controller' => 'bootmenu', + 'action' => 'deletebootmenu', + 'bootmenuID' => $bootmenu->getID() ), 'default', - true) ?>">Delete BootOS</a></td> + true) ?>">Delete BootMenu</a></td> </tr> <?php endforeach; ?> </table> <br/> -<?php echo $this->formButton('createbootos', 'Create BootOS', array( - 'onclick' => 'self.location="/bootos/createbootos"'))?> +<?php echo $this->formButton('createbootmenu', 'Create BootMenu', array( + 'onclick' => 'self.location="/bootmenu/createbootmenu"'))?> diff --git a/application/views/scripts/bootos/index.phtml b/application/views/scripts/bootos/index.phtml index d09bb34..f7f6e0f 100644 --- a/application/views/scripts/bootos/index.phtml +++ b/application/views/scripts/bootos/index.phtml @@ -4,6 +4,7 @@ <th>ID</th> <th>Title</th> <th>GroupID</th> + <th>MembershipID</th> <th>ConfigID</th> <th>Init</th> <th>Kernel</th> @@ -18,6 +19,7 @@ <td><?php echo $this->escape($bootos->getID()); ?></td> <td><?php echo $this->escape($bootos->getTitle()); ?></td> <td><?php echo $this->escape($bootos->getGroupID()); ?></td> + <td><?php echo $this->escape($bootos->getMembershipID()); ?></td> <td><?php echo $this->escape($bootos->getConfigID()); ?></td> <td><?php echo $this->escape($bootos->getPath_init()); ?></td> <td><?php echo $this->escape($bootos->getPath_kernel()); ?></td> diff --git a/application/views/scripts/config/index.phtml b/application/views/scripts/config/index.phtml index ea6c381..5348387 100644 --- a/application/views/scripts/config/index.phtml +++ b/application/views/scripts/config/index.phtml @@ -4,14 +4,18 @@ <th>ID</th> <th>Title</th> <th>GroupID</th> + <th>MembershipID</th> <th>Shellscript</th> + <th>Changed</th> </tr> <?php foreach ($this->configlist as $config): ?> <tr> <td><?php echo $this->escape($config->getID()); ?></td> <td><?php echo $this->escape($config->getTitle()); ?></td> <td><?php echo $this->escape($config->getGroupID()); ?></td> + <td><?php echo $this->escape($config->getMembershipID()); ?></td> <td><?php echo $this->escape($config->getShellscript()); ?></td> + <td><?php echo $this->escape(date('Y-m-d H:i:s', $config->getCreated())); ?></td> <td><a href="<?php echo $this->url( array( 'controller' => 'config', @@ -105,19 +105,24 @@ CREATE TABLE IF NOT EXISTS `pbs_config` ( `configID` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(30) NOT NULL, `groupID` int(11) NOT NULL, + `membershipID` int(11) NOT NULL, `shellscript` text NOT NULL, + `created` VARCHAR(14) NOT NULL, PRIMARY KEY (`configID`), - KEY `groupID` (`groupID`) + KEY `groupID` (`groupID`), + KEY `membershipID` (`membershipID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; ALTER TABLE `pbs_config` - ADD CONSTRAINT `pbs_config_ibfk_1` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`) ON DELETE CASCADE; + ADD CONSTRAINT `pbs_config_ibfk_1` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`), + ADD CONSTRAINT `pbs_config_ibfk_2` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE; CREATE TABLE IF NOT EXISTS `pbs_userconfig` ( `userconfigID` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(30) NOT NULL, `membershipID` int(11) NOT NULL, `shellscript` text NOT NULL, + `created` VARCHAR(14) NOT NULL, PRIMARY KEY (`userconfigID`), KEY `membershipID` (`membershipID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; @@ -130,6 +135,7 @@ CREATE TABLE IF NOT EXISTS `pbs_bootos` ( `bootosID` int(11) NOT NULL AUTO_INCREMENT, `configID` int(11), `groupID` int(11) NOT NULL, + `membershipID` int(11), `title` varchar(30) NOT NULL, `description` varchar(140), `path_init` varchar(140) NOT NULL, @@ -140,25 +146,42 @@ CREATE TABLE IF NOT EXISTS `pbs_bootos` ( `public` int(11) NOT NULL, PRIMARY KEY (`bootosID`), KEY `configID` (`configID`), - KEY `groupID` (`groupID`) + KEY `groupID` (`groupID`), + KEY `membershipID` (`membershipID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; ALTER TABLE `pbs_bootos` ADD CONSTRAINT `pbs_bootos_ibfk_1` FOREIGN KEY (`configID`) REFERENCES `pbs_config` (`configID`), - ADD CONSTRAINT `pbs_bootos_ibfk_2` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE; + ADD CONSTRAINT `pbs_bootos_ibfk_2` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE, + ADD CONSTRAINT `pbs_bootos_ibfk_3` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`); CREATE TABLE IF NOT EXISTS `pbs_bootmenu` ( `bootmenuID` int(11) NOT NULL AUTO_INCREMENT, - `membershipID` int(11) NOT NULL, + `membershipID` int(11), + `groupID` int(11) NOT NULL, `title` varchar(30) NOT NULL, - `time` varchar(14) NOT NULL, + `created` varchar(14) NOT NULL, PRIMARY KEY (`bootmenuID`), + KEY `groupID` (`groupID`), KEY `membershipID` (`membershipID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; ALTER TABLE `pbs_bootmenu` - ADD CONSTRAINT `pbs_bootmenu_ibfk_1` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`) ON DELETE CASCADE; + ADD CONSTRAINT `pbs_bootmenu_ibfk_1` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`), + ADD CONSTRAINT `pbs_bootmenu_ibfk_2` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE; + CREATE TABLE IF NOT EXISTS `pbs_userbootmenu` ( + `userbootmenuID` int(11) NOT NULL AUTO_INCREMENT, + `membershipID` int(11) NOT NULL, + `title` varchar(30) NOT NULL, + `created` varchar(14) NOT NULL, + PRIMARY KEY (`userbootmenuID`), + KEY `membershipID` (`membershipID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +ALTER TABLE `pbs_userbootmenu` + ADD CONSTRAINT `pbs_userbootmenu_ibfk_1` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`) ON DELETE CASCADE; + CREATE TABLE IF NOT EXISTS `pbs_bootmenuentries` ( `bootosID` int(11) NOT NULL, `bootmenuID` int(11) NOT NULL, |
