summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorBjörn Geiger2011-09-08 16:50:44 +0200
committerBjörn Geiger2011-09-08 16:50:44 +0200
commit547edc4052803e19650ca0bc18ec0fd5240b44a8 (patch)
tree8a161a22f9fee7f892fe58f1f8c356f629572cde /application
parentminor (diff)
downloadpoolctrl-547edc4052803e19650ca0bc18ec0fd5240b44a8.tar.gz
poolctrl-547edc4052803e19650ca0bc18ec0fd5240b44a8.tar.xz
poolctrl-547edc4052803e19650ca0bc18ec0fd5240b44a8.zip
Fehler korrigiert
Diffstat (limited to 'application')
-rw-r--r--application/controllers/EventController.php42
1 files changed, 27 insertions, 15 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index 6f014fe..dc3ecd6 100644
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -247,13 +247,20 @@ class EventController extends Zend_Controller_Action
} else {
$addForm = new Application_Form_EventAdd(array('eventcategorylist' => $eventcategorylist, 'bootoslist' => $bootoslist, 'poollist' => $poollist, 'start' => $start, 'end' => $end, $this->getRequest()->getParams()));
if ($addForm->isValid($this->getRequest()->getParams())) {
- $startTimestamp = strtotime($this->getRequest()->getParam('start'));
- $this->getRequest()->setParam('start', date ('Y-m-d H:i', $startTimestamp));
- if($this->getRequest()->getParam('end')) {
- $endTimestamp = strtotime($this->getRequest()->getParam('end'));
- $this->getRequest()->setParam('end', date ('Y-m-d H:i', $endTimestamp));
+ $params = $this->getRequest()->getParams();
+ $params['start'] = date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('start')));
+ if($params['end']) {
+ $params['end'] = date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('end')));
+ } else {
+ unset($params['end']);
+ }
+ if($params['repeatEnd']) {
+ $params['repeatEnd'] = date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('repeatEnd')));
+ } else {
+ unset($params['repeatEnd']);
+ $params['repeat'] = 0;
}
- $event = new Application_Model_Event($this->getRequest()->getParams());
+ $event = new Application_Model_Event($params);
$event->setPbs_membershipID($this->userIDsNamespace['membershipID']);
$bootmenuquery = "bootosID=" . $event->getPbs_bootosID() . "&startcounter=0&title=" . $event->getTitle() . "&defaultbootmenu=1&order=0&kcl=0";
$bootmenuApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['addbootmenu'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $bootmenuquery);
@@ -414,14 +421,19 @@ class EventController extends Zend_Controller_Action
$save = $this->getRequest()->getParam("save");
if (isset($save)){
$params = $this->getRequest()->getParams();
- $editForm = new Application_Form_EventEdit(array('eventcategorylist' => $eventcategorylist, 'bootoslist' => $bootoslist, 'poollist' => $poollist, $this->getRequest()->getParams()));
- if ($editForm->isValid($this->getRequest()->getParams())) {
- $this->getRequest()->setParam('start', date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('start'))));
- if($this->getRequest()->getParam('end')) {
- $this->getRequest()->setParam('end', date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('end'))));
+ $editForm = new Application_Form_EventEdit(array('eventcategorylist' => $eventcategorylist, 'bootoslist' => $bootoslist, 'poollist' => $poollist, 'params' => $params));
+ if ($editForm->isValid($params)) {
+ $params['start'] = date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('start')));
+ if($params['end']) {
+ $params['end'] = date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('end')));
+ } else {
+ unset($params['end']);
}
- if($this->getRequest()->getParam('repeatEnd')) {
- $this->getRequest()->setParam('repeatEnd', date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('repeatEnd'))));
+ if($params['repeatEnd']) {
+ $params['repeatEnd'] = date ('Y-m-d H:i', strtotime($this->getRequest()->getParam('repeatEnd')));
+ } else {
+ unset($params['repeatEnd']);
+ $params['repeat'] = 0;
}
if($event->getPbs_bootmenuID()) {
$bootmenuApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['deletebootmenu'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_bootmenuID());
@@ -431,7 +443,7 @@ class EventController extends Zend_Controller_Action
$filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['deletefilter'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_filterID());
unset($filterApiResult);
}
- $event->setOptions($this->getRequest()->getParams());
+ $event->setOptions($params);
$event->setID($eventID);
$bootmenuquery = "bootosID=" . $event->getPbs_bootosID() . "&startcounter=0&title=" . $event->getTitle() . "&defaultbootmenu=1&order=0&kcl=0";
$bootmenuApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['addbootmenu'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $bootmenuquery);
@@ -490,7 +502,7 @@ class EventController extends Zend_Controller_Action
echo "Message: " . $e->getMessage() . "<br/>";
return;
}
- $this->_redirect('/event/');
+ //$this->_redirect('/event/');
}
} else {
$this->getRequest()->setParam('title', $event->getTitle());