summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authormichael pereira2011-03-09 11:55:55 +0100
committermichael pereira2011-03-09 11:55:55 +0100
commit52304b789d93e1745c0f6ad6cbe833bbc4e37ba2 (patch)
treedf3ef4566129c4f1cdb3fc5410093c2b83900993 /application/controllers
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-52304b789d93e1745c0f6ad6cbe833bbc4e37ba2.tar.gz
pbs2-52304b789d93e1745c0f6ad6cbe833bbc4e37ba2.tar.xz
pbs2-52304b789d93e1745c0f6ad6cbe833bbc4e37ba2.zip
ACHTUNG: Habe in einigen Mappern die find() Methode geändert, sie liefern jetzt ein Object des Models zurück und nehmen als Parameter die ID! (Group, Config, Membership, Person, u.a.) || Alle Controller soweit fertig
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/BootisoController.php17
-rw-r--r--application/controllers/BootmenuController.php21
-rw-r--r--application/controllers/BootosController.php23
-rw-r--r--application/controllers/ConfigController.php23
-rw-r--r--application/controllers/FilterController.php7
5 files changed, 75 insertions, 16 deletions
diff --git a/application/controllers/BootisoController.php b/application/controllers/BootisoController.php
index 771a48d..c49cdf3 100644
--- a/application/controllers/BootisoController.php
+++ b/application/controllers/BootisoController.php
@@ -11,13 +11,25 @@ class BootisoController extends Zend_Controller_Action
public function indexAction()
{
$bootisomapper = new Application_Model_BootIsoMapper();
+ $groupmapper = new Application_Model_GroupMapper();
+ $membershipmapper = new Application_Model_MembershipMapper();
+ $personmapper = new Application_Model_PersonMapper();
+
$this->view->bootisolist = $bootisomapper->fetchAll();
+
+ foreach ($this->view->bootisolist as $bootiso){
+ $bootiso->setGroupID("[".$bootiso->getGroupID()."] ".$groupmapper->find($bootiso->getGroupID())->getTitle());
+ $bootiso->setMembershipID("[".$bootiso->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootiso->getMembershipID())->getPersonID())->getFirstname());
+ }
+
}
public function createbootisoAction()
{
+ $groupmapper = new Application_Model_GroupMapper();
+
if (!isset($_POST["createbootiso"])){
- $createbootisoForm = new Application_Form_BootisoCreate();
+ $createbootisoForm = new Application_Form_BootisoCreate(array('grouplist' => $groupmapper->fetchAll()));
} else {
$createbootisoForm = new Application_Form_BootisoCreate($_POST);
@@ -47,6 +59,7 @@ class BootisoController extends Zend_Controller_Action
public function editbootisoAction()
{
$bootisoID = $this->_request->getParam('bootisoID');
+ $groupmapper = new Application_Model_GroupMapper();
if (!isset($_POST["editbootiso"])){
$bootisoID = $this->_request->getParam('bootisoID');
@@ -57,7 +70,7 @@ class BootisoController extends Zend_Controller_Action
$bootisomapper = new Application_Model_BootIsoMapper();
$bootisomapper->find($bootisoID, $bootiso);
- $editbootisoForm = new Application_Form_BootisoEdit();
+ $editbootisoForm = new Application_Form_BootisoEdit(array('grouplist' => $groupmapper->fetchAll()));
$editbootisoForm->populate($bootiso->toArray());
}
}else{
diff --git a/application/controllers/BootmenuController.php b/application/controllers/BootmenuController.php
index 41cee9d..239aa4f 100644
--- a/application/controllers/BootmenuController.php
+++ b/application/controllers/BootmenuController.php
@@ -13,13 +13,20 @@ class BootmenuController extends Zend_Controller_Action
$bootmenumapper = new Application_Model_BootMenuMapper();
$bootmenuentriesmapper = new Application_Model_BootMenuEntriesMapper();
$bootosmapper = new Application_Model_BootOsMapper();
+ $configmapper = new Application_Model_ConfigMapper();
+ $membershipmapper = new Application_Model_MembershipMapper();
+ $groupmapper = new Application_Model_GroupMapper();
+ $personmapper = new Application_Model_PersonMapper();
$this->view->bootosmapper = $bootosmapper;
+ $this->view->configmapper = $configmapper;
$this->view->bootmenulist = $bootmenumapper->fetchAll();
$bootmenuentries = array();
foreach ($this->view->bootmenulist as $bootmenu){
$bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->findBy('bootmenuID',$bootmenu->getID());
+ $bootmenu->setGroupID("[".$bootmenu->getGroupID()."] ".$groupmapper->find($bootmenu->getGroupID())->getTitle());
+ $bootmenu->setMembershipID("[".$bootmenu->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootmenu->getMembershipID())->getPersonID())->getFirstname());
}
$this->view->bootmenuentrylist = $bootmenuentries;
@@ -29,12 +36,13 @@ class BootmenuController extends Zend_Controller_Action
{
$bootmenuID = $this->_request->getParam('bootmenuID');
$bootosmapper = new Application_Model_BootOsMapper();
+ $configmapper = new Application_Model_ConfigMapper();
// $bootmenuentriesmapper = new Application_Model_BootMenuEntriesMapper();
//
// $bootoslist = $this->arrayDiff($bootosmapper->fetchAll(), $bootmenuentriesmapper->findBy('bootmenuID',$bootmenuID));
if (!isset($_POST["addbootmenuentry"])){
- $addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder')));
+ $addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll()));
$addbootmenuentryForm->populate(array('order' => $this->_request->getParam('maxorder')));
} else {
@@ -69,8 +77,10 @@ class BootmenuController extends Zend_Controller_Action
public function createbootmenuAction()
{
+ $groupmapper = new Application_Model_GroupMapper();
+
if (!isset($_POST["createbootmenu"])){
- $createbootmenuForm = new Application_Form_BootmenuCreate();
+ $createbootmenuForm = new Application_Form_BootmenuCreate(array('grouplist' => $groupmapper->fetchAll()));
} else {
$createbootmenuForm = new Application_Form_BootmenuCreate($_POST);
@@ -100,6 +110,8 @@ class BootmenuController extends Zend_Controller_Action
public function editbootmenuAction()
{
$bootmenuID = $this->_request->getParam('bootmenuID');
+ $groupmapper = new Application_Model_GroupMapper();
+
if (!isset($_POST["editbootmenu"])){
$bootmenuID = $this->_request->getParam('bootmenuID');
if (!isset($bootmenuID) || !is_numeric($bootmenuID)){
@@ -109,7 +121,7 @@ class BootmenuController extends Zend_Controller_Action
$bootmenumapper = new Application_Model_BootMenuMapper();
$bootmenumapper->find($bootmenuID, $bootmenu);
- $editbootmenuForm = new Application_Form_BootmenuEdit();
+ $editbootmenuForm = new Application_Form_BootmenuEdit(array('grouplist' => $groupmapper->fetchAll()));
$editbootmenuForm->populate($bootmenu->toArray());
}
}else{
@@ -145,6 +157,7 @@ class BootmenuController extends Zend_Controller_Action
$bootmenuentryID = $this->_request->getParam('bootmenuentryID');
$bootmenuID = $this->_request->getParam('bootmenuID');
$bootosmapper = new Application_Model_BootOsMapper();
+ $configmapper = new Application_Model_ConfigMapper();
$bootmenuentry = new Application_Model_BootMenuEntries();
$bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
@@ -156,7 +169,7 @@ class BootmenuController extends Zend_Controller_Action
$bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry);
- $editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder' => $this->_request->getParam('maxorder')));
+ $editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder' => $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll()));
$editbootmenuentryForm->populate($bootmenuentry->toArray());
}
}else{
diff --git a/application/controllers/BootosController.php b/application/controllers/BootosController.php
index a644a5c..d052503 100644
--- a/application/controllers/BootosController.php
+++ b/application/controllers/BootosController.php
@@ -11,13 +11,30 @@ class BootosController extends Zend_Controller_Action
public function indexAction()
{
$bootosmapper = new Application_Model_BootOsMapper();
+
+ $groupmapper = new Application_Model_GroupMapper();
+ $membershipmapper = new Application_Model_MembershipMapper();
+ $personmapper = new Application_Model_PersonMapper();
+ $configmapper = new Application_Model_ConfigMapper();
+
$this->view->bootoslist = $bootosmapper->fetchAll();
+
+ 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();
+ $createbootosForm = new Application_Form_BootosCreate(array('grouplist' => $groupmapper->fetchAll() ,'configlist'=>$configmapper->fetchAll()));
} else {
$createbootosForm = new Application_Form_BootosCreate($_POST);
@@ -49,6 +66,8 @@ class BootosController extends Zend_Controller_Action
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');
@@ -59,7 +78,7 @@ class BootosController extends Zend_Controller_Action
$bootosmapper = new Application_Model_BootOsMapper();
$bootos = $bootosmapper->find($bootosID);
- $editbootosForm = new Application_Form_BootosEdit();
+ $editbootosForm = new Application_Form_BootosEdit(array('grouplist' => $groupmapper->fetchAll() ,'configlist'=>$configmapper->fetchAll()));
$editbootosForm->populate($bootos->toArray());
}
}else{
diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php
index 461c288..ae2a520 100644
--- a/application/controllers/ConfigController.php
+++ b/application/controllers/ConfigController.php
@@ -11,13 +11,25 @@ class ConfigController extends Zend_Controller_Action
public function indexAction()
{
$configmapper = new Application_Model_ConfigMapper();
- $this->view->configlist = $configmapper->fetchAll();
+
+ $groupmapper = new Application_Model_GroupMapper();
+ $membershipmapper = new Application_Model_MembershipMapper();
+ $personmapper = new Application_Model_PersonMapper();
+
+ $this->view->configlist = $configmapper->fetchAll();
+
+ foreach ($this->view->configlist as $config){
+ $config->setGroupID("[".$config->getGroupID()."] ".$groupmapper->find($config->getGroupID())->getTitle());
+ $config->setMembershipID("[".$config->getMembershipID()."] ".$personmapper->find($membershipmapper->find($config->getMembershipID())->getPersonID())->getFirstname());
+ }
+
}
public function createconfigAction()
{
+ $groupmapper = new Application_Model_GroupMapper();
if (!isset($_POST["createconfig"])){
- $createconfigForm = new Application_Form_ConfigCreate();
+ $createconfigForm = new Application_Form_ConfigCreate(array('grouplist' => $groupmapper->fetchAll()));
} else {
$createconfigForm = new Application_Form_ConfigCreate($_POST);
@@ -48,7 +60,8 @@ class ConfigController extends Zend_Controller_Action
public function editconfigAction()
{
$configID = $this->_request->getParam('configID');
-
+ $groupmapper = new Application_Model_GroupMapper();
+
if (!isset($_POST["editconfig"])){
$configID = $this->_request->getParam('configID');
if (!isset($configID) || !is_numeric($configID)){
@@ -56,9 +69,9 @@ class ConfigController extends Zend_Controller_Action
} else {
$config = new Application_Model_Config();
$configmapper = new Application_Model_ConfigMapper();
- $configmapper->find($configID, $config);
+ $config = $configmapper->find($configID);
- $editconfigForm = new Application_Form_ConfigEdit();
+ $editconfigForm = new Application_Form_ConfigEdit(array('grouplist' => $groupmapper->fetchAll()));
$editconfigForm->populate($config->toArray());
}
}else{
diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php
index 1ebb35e..54bcb19 100644
--- a/application/controllers/FilterController.php
+++ b/application/controllers/FilterController.php
@@ -7,10 +7,11 @@ class FilterController extends Zend_Controller_Action
private $db;
public function init()
{
- try{
- $this->_filtermapper = new Application_Model_FilterMapper();
+ try{
+
+ $this->_filtermapper = new Application_Model_FilterMapper();
}catch (Zend_Exception $e) {
- echo "Error message 1: " . $e->getMessage() . "\n";
+ echo "Error message 1: " . $e->getMessage() . "\n";
}
$this->db = Zend_Db_Table::getDefaultAdapter();
}