From b5cbdd6b400aa1ec77c9846e9cc8d4257f437e3c Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 14 Mar 2011 16:09:03 +0100 Subject: Application in 3 Modules gesplittet, Dev = unsere entwicklungsumgebung, user = die weboberfläche fr anwender mit acl etc, fbgui = für die fbgui truppe - links in dev müssen noch angepasst werden --- .../modules/dev/controllers/BootosController.php | 147 +++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 application/modules/dev/controllers/BootosController.php (limited to 'application/modules/dev/controllers/BootosController.php') diff --git a/application/modules/dev/controllers/BootosController.php b/application/modules/dev/controllers/BootosController.php new file mode 100644 index 0000000..3a7ab90 --- /dev/null +++ b/application/modules/dev/controllers/BootosController.php @@ -0,0 +1,147 @@ +view->bootoslist = $bootosmapper->fetchAll(); + if(count($this->view->bootoslist)>0){ + foreach ($this->view->bootoslist as $bootos){ + $bootos->setGroupID("[".$bootos->getGroupID()."] ".$groupmapper->find($bootos->getGroupID())->getTitle()); + $bootos->setMembershipID("[".$bootos->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootos->getMembershipID())->getPersonID())->getFirstname()); + $bootos->setConfigID("[".$bootos->getConfigID()."] ".$configmapper->find($bootos->getConfigID())->getTitle()); + + } + } + + } + + public function createbootosAction() + { + $groupmapper = new Application_Model_GroupMapper(); + $configmapper = new Application_Model_ConfigMapper(); + + if (!isset($_POST["createbootos"])){ + $createbootosForm = new Application_Form_BootosCreate(array('grouplist' => $groupmapper->fetchAll() ,'configlist'=>$configmapper->fetchAll())); + } else { + + $createbootosForm = new Application_Form_BootosCreate(array('grouplist' => $groupmapper->fetchAll() ,'configlist'=>$configmapper->fetchAll()),$_POST); + + if ($createbootosForm->isValid($_POST)) { + + $bootos = new Application_Model_BootOs($_POST); + $bootos->setMembershipID('1'); + if($bootos->getConfigID() == '') + $bootos->setConfigID(NULL); + $bootosmapper = new Application_Model_BootOsMapper(); + $bootos->setCreated(time()); + + try { + $bootosID = $bootosmapper->save($bootos); + + $initpath = "../resources/bootos/".$bootosID."/initramfs/"; + $kernelpath = "../resources/bootos/".$bootosID."/kernel/"; + + exec("wget -P ".$kernelpath." ".$bootos->getPath_kernel()); + exec("wget -P ".$initpath." ".$bootos->getPath_init()); + + }catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "
"; + echo "Message: " . $e->getMessage() . "
"; + + } + + $this->_redirect('/bootos'); + } + } + + $this->view->createbootosForm = $createbootosForm; + } + + public function editbootosAction() + { + $bootosID = $this->_request->getParam('bootosID'); + $groupmapper = new Application_Model_GroupMapper(); + $configmapper = new Application_Model_ConfigMapper(); + + if (!isset($_POST["editbootos"])){ + $bootosID = $this->_request->getParam('bootosID'); + if (!isset($bootosID) || !is_numeric($bootosID)){ + $this->_redirect('/bootos'); + } else { + $bootos = new Application_Model_BootOs(); + $bootosmapper = new Application_Model_BootOsMapper(); + $bootos = $bootosmapper->find($bootosID); + + $editbootosForm = new Application_Form_BootosEdit(array('grouplist' => $groupmapper->fetchAll() ,'configlist'=>$configmapper->fetchAll())); + $editbootosForm->populate($bootos->toArray()); + } + }else{ + $editbootosForm = new Application_Form_BootosEdit(array('grouplist' => $groupmapper->fetchAll() ,'configlist'=>$configmapper->fetchAll()),$_POST); + + if ($editbootosForm->isValid($_POST)) { + + $bootos = new Application_Model_BootOs($_POST); + $bootos->setMembershipID('1'); + if($bootos->getConfigID() == '') + $bootos->setConfigID(NULL); + $bootosmapper = new Application_Model_BootOsMapper(); + $bootos->setCreated(time()); + $bootos->setID($bootosID); + + try { + $bootosmapper->save($bootos); + }catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "
"; + echo "Message: " . $e->getMessage() . "
"; + } + + $this->_redirect('/bootos'); + } + + } + + $this->view->editbootosForm = $editbootosForm; + + } + + public function deletebootosAction() + { + $bootosID = $this->_request->getParam('bootosID'); + if (!isset($bootosID)){ + $this->_redirect('/bootos'); + } else { + $bootos = new Application_Model_BootOs(); + $bootos->setID($bootosID); + $bootosmapper = new Application_Model_BootOsMapper(); + $bootosmapper->delete($bootos); + } + $this->_redirect('/bootos'); + + } + + +} + + + + + + + -- cgit v1.2.3-55-g7522