summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authormichael pereira2011-03-07 04:56:52 +0100
committermichael pereira2011-03-07 04:56:52 +0100
commitc2e98ec0e67d0f0221ad05981c32510781f8ce4b (patch)
tree392515126ebca6b6c7d93d8b05a535e76a8c90c1 /application
parentBootIso Interface fertig (diff)
downloadpbs2-c2e98ec0e67d0f0221ad05981c32510781f8ce4b.tar.gz
pbs2-c2e98ec0e67d0f0221ad05981c32510781f8ce4b.tar.xz
pbs2-c2e98ec0e67d0f0221ad05981c32510781f8ce4b.zip
BootMenuEntries angelegt
Diffstat (limited to 'application')
-rw-r--r--application/controllers/BootmenuController.php26
-rw-r--r--application/forms/BootmenuEntriesAdd.php64
-rw-r--r--application/forms/BootmenuEntriesEdit.php65
-rw-r--r--application/models/BootMenuEntries.php10
-rw-r--r--application/models/BootMenuEntriesMapper.php14
-rw-r--r--application/views/scripts/bootmenu/addbootmenuentry.phtml5
-rw-r--r--application/views/scripts/bootmenu/editbootmenuentry.phtml5
-rw-r--r--application/views/scripts/bootmenu/index.phtml8
8 files changed, 182 insertions, 15 deletions
diff --git a/application/controllers/BootmenuController.php b/application/controllers/BootmenuController.php
index e20ef23..1dfa641 100644
--- a/application/controllers/BootmenuController.php
+++ b/application/controllers/BootmenuController.php
@@ -16,7 +16,31 @@ class BootmenuController extends Zend_Controller_Action
public function addbootmenuentryAction()
{
- // action body
+ if (!isset($_POST["addbootmenuentry"])){
+ $addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd();
+ } else {
+
+ $addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd($_POST);
+
+ if ($addbootmenuentryForm->isValid($_POST)) {
+
+ $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
+ $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
+
+ try {
+ $bootmenuentrymapper->save($bootmenuentry);
+ }catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+
+ }
+ $this->_redirect('/bootmenu');
+ }
+ }
+
+ $this->view->addbootmenuentryForm = $addbootmenuentryForm;
+
}
public function createbootmenuAction()
diff --git a/application/forms/BootmenuEntriesAdd.php b/application/forms/BootmenuEntriesAdd.php
index 56de36d..0577ede 100644
--- a/application/forms/BootmenuEntriesAdd.php
+++ b/application/forms/BootmenuEntriesAdd.php
@@ -3,10 +3,70 @@
class Application_Form_BootmenuEntriesAdd extends Zend_Form
{
- public function init()
+ public function init()
{
- /* Form Elements & Other Definitions Here ... */
+ $this->setName("BootMenuEntryAdd");
+ $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', 'bootosID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'BootOsID:',
+ 'value' => '1',
+ ));
+
+ $this->addElement('text', 'kcl', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'KCL:',
+ ));
+
+ $this->addElement('text', 'configID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'ConfigID:',
+ 'value' => '1',
+ ));
+
+ $this->addElement('text', 'order', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'order:',
+ ));
+
+ $this->addElement('submit', 'addbootmenuentry', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Add Bootmenuentry',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/bootmenu"'
+ ));
+
}
+
}
diff --git a/application/forms/BootmenuEntriesEdit.php b/application/forms/BootmenuEntriesEdit.php
index a63621d..e69dc8b 100644
--- a/application/forms/BootmenuEntriesEdit.php
+++ b/application/forms/BootmenuEntriesEdit.php
@@ -3,11 +3,70 @@
class Application_Form_BootmenuEntriesEdit extends Zend_Form
{
- public function init()
+ public function init()
{
- /* Form Elements & Other Definitions Here ... */
- }
+ $this->setName("BootMenuEntryAdd");
+ $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', 'bootosID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'BootOsID:',
+ 'value' => '1',
+ ));
+
+ $this->addElement('text', 'kcl', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'KCL:',
+ ));
+
+ $this->addElement('text', 'configID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'ConfigID:',
+ 'value' => '1',
+ ));
+
+ $this->addElement('text', 'order', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'order:',
+ ));
+
+ $this->addElement('submit', 'editbootmenuentry', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Edit Bootmenuentry',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/bootmenu"'
+ ));
+ }
+
}
diff --git a/application/models/BootMenuEntries.php b/application/models/BootMenuEntries.php
index 9b6985c..d27fd20 100644
--- a/application/models/BootMenuEntries.php
+++ b/application/models/BootMenuEntries.php
@@ -6,6 +6,7 @@ class Application_Model_BootMenuEntries
protected $_bootmenuID;
protected $_title;
protected $_kcl;
+ protected $_configID;
protected $_order;
public function __construct(array $options = null)
@@ -80,6 +81,15 @@ class Application_Model_BootMenuEntries
$this->_kcl = $_kcl;
return $this;
}
+ public function getConfigID()
+ {
+ return $this->_configID;
+ }
+ public function setConfigID($_configID)
+ {
+ $this->_configID = $_configID;
+ return $this;
+ }
public function getOrder()
{
return $this->_order;
diff --git a/application/models/BootMenuEntriesMapper.php b/application/models/BootMenuEntriesMapper.php
index cf7ba46..2dac085 100644
--- a/application/models/BootMenuEntriesMapper.php
+++ b/application/models/BootMenuEntriesMapper.php
@@ -32,13 +32,13 @@ class Application_Model_BootMenuEntriesMapper
public function save(Application_Model_BootMenuEntries $botmenuentries)
{
- $data = array('bootosID'=> $botmenuentries->getBootosID() ,'bootmenuID'=> $botmenuentries->getBootmenuID() ,'title'=> $botmenuentries->getTitle() ,'kcl'=> $botmenuentries->getKcl() ,'order'=> $botmenuentries->getOrder() );
+ $data = array('bootosID'=> $botmenuentries->getBootosID() ,'bootmenuID'=> $botmenuentries->getBootmenuID() ,'configID'=> $botmenuentries->getConfigID() ,'title'=> $botmenuentries->getTitle() ,'kcl'=> $botmenuentries->getKcl() ,'order'=> $botmenuentries->getOrder() );
- if (null === ($id = $botmenuentries->getID()) ) {
- unset($data['botmenuentriesID']);
+ if (null === ($id1 = $botmenuentries->getID()) ) {
+
$this->getDbTable()->insert($data);
} else {
- $this->getDbTable()->update($data, array('botmenuentriesID = ?' => $id));
+ $this->getDbTable()->update($data, array('bootosID = ?' => $id1, 'bootmenuID = ?' => $id2));
}
}
@@ -47,7 +47,7 @@ class Application_Model_BootMenuEntriesMapper
if (null === ($id = $botmenuentries->getID()) ) {
return;
} else {
- $this->getDbTable()->delete(array('botmenuentriesID = ?' => $id));
+ $this->getDbTable()->delete(array('bootmenuentriesID = ?' => $id));
}
}
@@ -60,7 +60,7 @@ class Application_Model_BootMenuEntriesMapper
$row = $result->current();
- $botmenuentries->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setKcl($row->kcl)->setOrder($row->order);
+ $botmenuentries->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setConfigID($row->configID)->setKcl($row->kcl)->setOrder($row->order);
}
public function fetchAll()
@@ -70,7 +70,7 @@ class Application_Model_BootMenuEntriesMapper
foreach ($resultSet as $row) {
$entry = new Application_Model_BootMenuEntries();
- $entry->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setKcl($row->kcl)->setOrder($row->order);
+ $entry->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setConfigID($row->configID)->setKcl($row->kcl)->setOrder($row->order);
$entries[] = $entry;
}
diff --git a/application/views/scripts/bootmenu/addbootmenuentry.phtml b/application/views/scripts/bootmenu/addbootmenuentry.phtml
index 3854273..914cc9c 100644
--- a/application/views/scripts/bootmenu/addbootmenuentry.phtml
+++ b/application/views/scripts/bootmenu/addbootmenuentry.phtml
@@ -1 +1,4 @@
-<br /><br /><center>View script for controller <b>Bootmenu</b> and script/action name <b>addbootmenuentry</b></center> \ No newline at end of file
+<?php
+$this->addbootmenuentryForm->setAction($this->url());
+echo $this->addbootmenuentryForm;
+?> \ No newline at end of file
diff --git a/application/views/scripts/bootmenu/editbootmenuentry.phtml b/application/views/scripts/bootmenu/editbootmenuentry.phtml
index fcfb558..5680d65 100644
--- a/application/views/scripts/bootmenu/editbootmenuentry.phtml
+++ b/application/views/scripts/bootmenu/editbootmenuentry.phtml
@@ -1 +1,4 @@
-<br /><br /><center>View script for controller <b>Bootmenu</b> and script/action name <b>editbootmenuentry</b></center> \ No newline at end of file
+<?php
+$this->editbootmenuentryForm->setAction($this->url());
+echo $this->editbootmenuentryForm;
+?> \ No newline at end of file
diff --git a/application/views/scripts/bootmenu/index.phtml b/application/views/scripts/bootmenu/index.phtml
index 3f29b9e..c4cdb99 100644
--- a/application/views/scripts/bootmenu/index.phtml
+++ b/application/views/scripts/bootmenu/index.phtml
@@ -30,6 +30,14 @@
),
'default',
true) ?>">Delete BootMenu</a></td>
+ <td><a href="<?php echo $this->url(
+ array(
+ 'controller' => 'bootmenu',
+ 'action' => 'addbootmenuentry',
+ 'bootmenuID' => $bootmenu->getID()
+ ),
+ 'default',
+ true) ?>">Add BootMenuEntry</a></td>
</tr>
<?php endforeach; ?>
</table>