summaryrefslogtreecommitdiffstats
path: root/application/controllers/BootmenuController.php
diff options
context:
space:
mode:
authorSimon2011-03-08 16:41:17 +0100
committerSimon2011-03-08 16:41:17 +0100
commitac3db805402222515bf8de77b8dd1bd1d7ed5497 (patch)
treea2fa9c4aa95ff13f5b4d4b72314fada128bda6a7 /application/controllers/BootmenuController.php
parentcreate, edit, delete session - fehlt noch mit selectboxen && sql-data abgeä... (diff)
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-ac3db805402222515bf8de77b8dd1bd1d7ed5497.tar.gz
pbs2-ac3db805402222515bf8de77b8dd1bd1d7ed5497.tar.xz
pbs2-ac3db805402222515bf8de77b8dd1bd1d7ed5497.zip
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
Diffstat (limited to 'application/controllers/BootmenuController.php')
-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;
+ }
+
}