summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authormichael pereira2011-03-08 14:53:36 +0100
committermichael pereira2011-03-08 14:53:36 +0100
commitb457bd7b0e70b3f76fd1d30b7d31ff2d609b4de8 (patch)
treeb861c99b5942e74d77ca2a7b58865ee93dcb3010 /application/controllers
parentBootMenu fix (diff)
downloadpbs2-b457bd7b0e70b3f76fd1d30b7d31ff2d609b4de8.tar.gz
pbs2-b457bd7b0e70b3f76fd1d30b7d31ff2d609b4de8.tar.xz
pbs2-b457bd7b0e70b3f76fd1d30b7d31ff2d609b4de8.zip
BootMenuEntries select
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/BootmenuController.php40
1 files changed, 30 insertions, 10 deletions
diff --git a/application/controllers/BootmenuController.php b/application/controllers/BootmenuController.php
index 2a0ec8a..1b4bbfb 100644
--- a/application/controllers/BootmenuController.php
+++ b/application/controllers/BootmenuController.php
@@ -2,7 +2,7 @@
class BootmenuController extends Zend_Controller_Action
{
-
+
public function init()
{
$db = Zend_Db_Table::getDefaultAdapter();
@@ -12,24 +12,31 @@ class BootmenuController extends Zend_Controller_Action
{
$bootmenumapper = new Application_Model_BootMenuMapper();
$bootmenuentriesmapper = new Application_Model_BootMenuEntriesMapper();
- $bootmenuentries = array();
+
$this->view->bootmenulist = $bootmenumapper->fetchAll();
+
+ $bootmenuentries = array();
foreach ($this->view->bootmenulist as $bootmenu){
$bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->findBy('bootmenuID',$bootmenu->getID());
}
$this->view->bootmenuentrylist = $bootmenuentries;
-
}
public function addbootmenuentryAction()
{
$bootmenuID = $this->_request->getParam('bootmenuID');
+ $bootosmapper = new Application_Model_BootOsMapper();
+// $bootmenuentriesmapper = new Application_Model_BootMenuEntriesMapper();
+//
+// $bootoslist = $this->arrayDiff($bootosmapper->fetchAll(), $bootmenuentriesmapper->findBy('bootmenuID',$bootmenuID));
+
if (!isset($_POST["addbootmenuentry"])){
- $addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd();
+ $addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll()));
+
} else {
$addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd($_POST);
-
+
if ($addbootmenuentryForm->isValid($_POST)) {
$bootmenuentry = new Application_Model_BootMenuEntries($_POST);
@@ -130,18 +137,20 @@ class BootmenuController extends Zend_Controller_Action
{
$bootmenuentryID = $this->_request->getParam('bootmenuentryID');
$bootmenuID = $this->_request->getParam('bootmenuID');
+ $bootosmapper = new Application_Model_BootOsMapper();
if (!isset($_POST["editbootmenuentry"])){
$bootmenuentryID = $this->_request->getParam('bootmenuentryID');
if (!isset($bootmenuentryID) || !is_numeric($bootmenuentryID)){
$this->_redirect('/bootmenu');
} else {
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
- $bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry);
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
+ $bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry);
+
+ $editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit(array('bootoslist'=>$bootosmapper->fetchAll()));
- $editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit();
- $editbootmenuentryForm->populate($bootmenuentry->toArray());
+ $editbootmenuentryForm->populate($bootmenuentry->toArray());
}
}else{
$editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit($_POST);
@@ -200,6 +209,17 @@ class BootmenuController extends Zend_Controller_Action
$this->_redirect('/bootmenu');
}
+ private function arrayDiff($a, $b){
+ foreach($a as $k1 => $i1){
+ foreach($b as $k2 => $i2){
+ if($i1->getID() == $i2->getBootosID()){
+ unset($a[$k1]);
+ }
+ }
+ }
+ return $a;
+ }
+
}