summaryrefslogtreecommitdiffstats
path: root/application/controllers/SessionController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/SessionController.php')
-rw-r--r--application/controllers/SessionController.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/application/controllers/SessionController.php b/application/controllers/SessionController.php
index bf318a0..ddb6fac 100644
--- a/application/controllers/SessionController.php
+++ b/application/controllers/SessionController.php
@@ -35,9 +35,12 @@ class SessionController extends Zend_Controller_Action
$bmem = new Application_Model_BootMenuEntriesMapper();
$bootmenuentries = $bmem->fetchAll();
+ $mm = new Application_Model_MembershipMapper();
+ $memberships = $mm->fetchAll();
+
if (!isset($_POST["add"])){
- $createsession = new Application_Form_Session(array('buttontext' => 'Create Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
+ $createsession = new Application_Form_Session(array('buttontext' => 'Create Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos,'memberships'=>$memberships));
$this->view->createsession = $createsession;
}else {
// TODO extend with normal function not only with post
@@ -67,6 +70,9 @@ class SessionController extends Zend_Controller_Action
if($session->getBootmenuentryID() == ''){
$session->setBootmenuentryID(null);
}
+ if($session->getMembershipID() == ''){
+ $session->setMembershipID(null);
+ }
$sessionmapper = new Application_Model_SessionMapper();
$sessionmapper->save($session);
@@ -93,6 +99,9 @@ class SessionController extends Zend_Controller_Action
$bmem = new Application_Model_BootMenuEntriesMapper();
$bootmenuentries = $bmem->fetchAll();
+
+ $mm = new Application_Model_MembershipMapper();
+ $memberships = $mm->fetchAll();
if (!isset($_POST["add"])){
// TODO: ACL implementieren ob er editieren darf
@@ -106,7 +115,7 @@ class SessionController extends Zend_Controller_Action
$session2 = $session->toArray();
#print_a($session2);
- $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos));
+ $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos,'memberships'=>$memberships));
$editsession->populate($session2);
$this->view->editsession = $editsession;
}catch (Zend_Exception $e) {
@@ -117,7 +126,7 @@ class SessionController extends Zend_Controller_Action
try{
$sessionID = $this->_request->getParam('sessionID');
- $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
+ $editsession = new Application_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos,'memberships'=>$memberships),$_POST);
if ($editsession->isValid($_POST)) {
$session = new Application_Model_Session($_POST);
@@ -132,6 +141,9 @@ class SessionController extends Zend_Controller_Action
if($session->getBootmenuentryID() == ''){
$session->setBootmenuentryID(null);
}
+ if($session->getMembershipID() == ''){
+ $session->setMembershipID(null);
+ }
$sessionmapper = new Application_Model_SessionMapper();
$sessionmapper->save($session);
echo 'valid';