summaryrefslogtreecommitdiffstats
path: root/application/controllers/EventController.php
diff options
context:
space:
mode:
authorBjörn Geiger2011-06-29 22:35:21 +0200
committerBjörn Geiger2011-06-29 22:35:21 +0200
commita5fca8d5651e2d36a25e1030d4e63e558ff2def3 (patch)
tree060500c90d778bd1a457a47de21c02a0500c00d6 /application/controllers/EventController.php
parentminor (diff)
downloadpoolctrl-a5fca8d5651e2d36a25e1030d4e63e558ff2def3.tar.gz
poolctrl-a5fca8d5651e2d36a25e1030d4e63e558ff2def3.tar.xz
poolctrl-a5fca8d5651e2d36a25e1030d4e63e558ff2def3.zip
Bootmenu wird beim ändern bzw. löschen eines Events wieder gelöscht
Diffstat (limited to 'application/controllers/EventController.php')
-rw-r--r--application/controllers/EventController.php41
1 files changed, 29 insertions, 12 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index edd0415..65b169d 100644
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -126,13 +126,15 @@ class EventController extends Zend_Controller_Action
$_POST['end'] = date ('Y-m-d H:i', strtotime($_POST['end']));
$event = new Application_Model_Event($_POST);
$event->setPbs_membershipID(1);
+ $bootmenuquery = "bootosID=" . $event->getPbs_bootosID() . "&startcounter=0&title=" . $event->getTitle() . "&defaultbootmenu=1&order=0&kcl=0";
+ $bootmenuApiResult = PostToHost('pbs2poolctrl.mp.openslx.org', '/resource/addbootmenu/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $bootmenuquery);
+ $bootmenuXMLString = $bootmenuApiResult['http-body'];
+ $bootmenuXML = new SimpleXMLElement($bootmenuXMLString);
+ $bootmenuID = sprintf("%s", $bootmenuXML->bootmenuid);
+ $event->setPbs_bootmenuID($bootmenuID);
+ //$event->setPbs_filterID($filterID);
try {
$eventID = $this->eventMapper->save($event);
- $bootmenuquery = "bootosID=" . $event->getPbs_bootosID() . "&startcounter=0&title=" . $event->getTitle() . "&defaultbootmenu=1&order=0&kcl=0";
- $bootmenuApiResult = PostToHost('pbs2poolctrl.mp.openslx.org', '/resource/addbootmenu/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $bootmenuquery);
- $bootmenuXMLString = $bootmenuApiResult['http-body'];
- $bootmenuXML = new SimpleXMLElement($bootmenuXMLString);
- $bootmenuID = sprintf("%s", $bootmenuXML->bootmenuid);
} catch(Zend_Exception $e)
{
echo "Caught exception: " . get_class($e) . "<br/>";
@@ -152,6 +154,12 @@ class EventController extends Zend_Controller_Action
$eventID = $this->_request->getParam('eventID');
if(isset($eventID)) {
$event = new Application_Model_Event();
+ if($event->getPbs_bootmenuID()) {
+ $bootmenuApiResult = PostToHost('pbs2poolctrl.mp.openslx.org', '/resource/deletebootmenu/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_bootmenuID());
+ }
+ if($event->getPbs_filterID()) {
+ $filterApiResult = PostToHost('pbs2poolctrl.mp.openslx.org', '/resource/deletefilter/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_filterID());
+ }
$this->eventMapper->find($eventID, $event);
try {
$this->eventMapper->delete($event);
@@ -215,16 +223,25 @@ class EventController extends Zend_Controller_Action
if ($editForm->isValid($_POST)) {
$_POST['start'] = date ('Y-m-d H:i', strtotime($_POST['start']));
$_POST['end'] = date ('Y-m-d H:i', strtotime($_POST['end']));
- $event = new Application_Model_Event($_POST);
+ $event = new Application_Model_Event();
+ $this->eventMapper->find($eventID, $event);
+ if($event->getPbs_bootmenuID()) {
+ $bootmenuApiResult = PostToHost('pbs2poolctrl.mp.openslx.org', '/resource/deletebootmenu/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_bootmenuID());
+ }
+ if($event->getPbs_filterID()) {
+ $filterApiResult = PostToHost('pbs2poolctrl.mp.openslx.org', '/resource/deletefilter/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "bootmenuid=" . $event->getPbs_filterID());
+ }
+ $event->setOptions($_POST);
$event->setID($eventID);
- $event->setPbs_membershipID(1);
+ $bootmenuquery = "bootosID=" . $event->getPbs_bootosID() . "&startcounter=0&title=" . $event->getTitle() . "&defaultbootmenu=1&order=0&kcl=0";
+ $bootmenuApiResult = PostToHost('pbs2poolctrl.mp.openslx.org', '/resource/addbootmenu/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $bootmenuquery);
+ $bootmenuXMLString = $bootmenuApiResult['http-body'];
+ $bootmenuXML = new SimpleXMLElement($bootmenuXMLString);
+ $bootmenuID = sprintf("%s", $bootmenuXML->bootmenuid);
+ $event->setPbs_bootmenuID($bootmenuID);
+ //$event->setPbs_filterID($filterID);
try {
$this->eventMapper->save($event);
- $bootmenuquery = "bootosID=" . $event->getPbs_bootosID() . "&startcounter=0&title=" . $event->getTitle() . "&defaultbootmenu=1&order=0&kcl=0";
- $bootmenuApiResult = PostToHost('pbs2poolctrl.mp.openslx.org', '/resource/addbootmenu/apikey/apikey1', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $bootmenuquery);
- $bootmenuXMLString = $bootmenuApiResult['http-body'];
- $bootmenuXML = new SimpleXMLElement($bootmenuXMLString);
- $bootmenuID = sprintf("%s", $bootmenuXML->bootmenuid);
} catch(Zend_Exception $e)
{
echo "Caught exception: " . get_class($e) . "<br/>";