summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorBjörn Geiger2011-10-11 14:17:05 +0200
committerBjörn Geiger2011-10-11 14:17:05 +0200
commit7ddf4befeb22a5ac36df8c03121d8bd2f54a3ac9 (patch)
tree4fdde9c7e5a0cc659544660b3a66729ffb54e81a /application
parentminor (diff)
downloadpoolctrl-7ddf4befeb22a5ac36df8c03121d8bd2f54a3ac9.tar.gz
poolctrl-7ddf4befeb22a5ac36df8c03121d8bd2f54a3ac9.tar.xz
poolctrl-7ddf4befeb22a5ac36df8c03121d8bd2f54a3ac9.zip
event move und resize korrigiert
Diffstat (limited to 'application')
-rwxr-xr-xapplication/controllers/EventController.php116
1 files changed, 88 insertions, 28 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index 3ded7f6..a23adb1 100755
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -690,6 +690,7 @@ class EventController extends Zend_Controller_Action
$event = new Application_Model_Event();
+ $oldEvent = new Application_Model_Event();
$evid = $this->getRequest()->getParam('evid');
$evstart = $this->getRequest()->getParam('evstart');
@@ -697,6 +698,12 @@ class EventController extends Zend_Controller_Action
if ($evid!="null") {
$this->eventMapper->find($evid,$event); //locate the event in the DB
+ $this->eventMapper->find($evid,$oldEvent);
+ $event->setRepeat(0);
+ $event->setRepeattype(null);
+ $event->setRepeatend(null);
+ $event->setRepeatdate(null);
+ $event->setRepeatings(null);
$oldStartTime = date('H:i', strtotime($event->getStart()));
$oldStartDate = date('d.m.Y', strtotime($event->getStart()));
$evstartTime = intval(strtotime(substr($evstart, 0, 24)));
@@ -711,34 +718,46 @@ class EventController extends Zend_Controller_Action
$newEndDate = date('d.m.Y', $evendTime);
$event->setEnd(date('Y-m-d H:i:s', $evendTime));
}
- $this->eventMapper->save($event); //save the event with the new data
if($event->getPbs_filterID()) {
- if($event->getRepeat()) {
- $repeattypeMapper = new Application_Model_RepeattypeMapper();
- $repeattype = new Application_Model_Repeattype();
- $repeattypeMapper->find($event->getRepeattype(), $repeattype);
- if($repeattype == "Once a week") {
- $filterentriesquery1 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=7&filtervalue=" . $newStartTime . "&filtervalue2=" . $newEndTime;
- $filterentriesApiResult1 = PostToHost($this->pbs2host, $this->config['pbs2']['addfilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesquery1);
- $filterentriesquery2 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=11&filtervalue=" . $newStartDate . "&filtervalue2=" . $newEndDate;
- $filterentriesApiResult2 = PostToHost($this->pbs2host, $this->config['pbs2']['addfilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesquery1);
- } else {
- $filterentriesQuerie = "filterid=" . $event->getPbs_filterID() . "&oldvalue1=" . $oldStartDate . "&oldvalue2=" . $oldEndDate . "&value1=" . $newStartDate . "&value2=" . $newEndDate;
- $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['changefilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesQuerie);
- unset($filterApiResult);
- $filterentriesQuerie = "filterid=" . $event->getPbs_filterID() . "&oldvalue1=" . $oldStartTime . "&oldvalue2=" . $oldEndTime . "&value1=" . $newStartTime . "&value2=" . $newEndTime;
- $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['changefilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesQuerie);
- unset($filterApiResult);
- }
- } else {
- $filterentriesQuerie = "filterid=" . $event->getPbs_filterID() . "&oldvalue1=" . $oldStartDate . "&oldvalue2=" . $oldEndDate . "&value1=" . $newStartDate . "&value2=" . $newEndDate;
- $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['changefilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesQuerie);
- unset($filterApiResult);
- $filterentriesQuerie = "filterid=" . $event->getPbs_filterID() . "&oldvalue1=" . $oldStartTime . "&oldvalue2=" . $oldEndTime . "&value1=" . $newStartTime . "&value2=" . $newEndTime;
- $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['changefilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesQuerie);
+ if(!$oldEvent->getRepeat()) {
+ $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['deletefilter'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "filterid=" . $oldEvent->getPbs_filterID());
unset($filterApiResult);
}
+ $filterquery = "bootmenuID=" . $event->getPbs_bootmenuID() . "&title=Poolctrl-Filter for " . $event->getTitle() . "&description=This Filter was automatically created by the Poolctrl for Event " . $event->getTitle() . "&created= " . time() . "&priority=100";
+ $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['addfilter'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterquery);
+ $filterXMLString = $filterApiResult['http-body'];
+ $filterXML = new SimpleXMLElement($filterXMLString);
+ $filterID = sprintf("%s", $filterXML->filter->id);
+ $event->setPbs_filterID($filterID);
+ $filterentriesquery1 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=3&filtervalue=" . $event->getPbs_poolID();
+ $filterentriesApiResult1 = PostToHost($this->pbs2host, $this->config['pbs2']['addfilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesquery1);
+ $filterentriesXMLString1 = $filterentriesApiResult1['http-body'];
+ $filterentriesXML1 = new SimpleXMLElement($filterentriesXMLString1);
+ $filterentriesID1 = sprintf("%s", $filterentriesXML1->filterentry->id);
+ $startTime = date('H:i', strtotime($event->getStart()));
+ if($event->getEnd()) {
+ $endTime = date('H:i', strtotime($event->getEnd()));
+ } else {
+ $endTime = date('H:i', strtotime($event->getStart()) + 900);
+ }
+ $filterentriesquery2 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=7&filtervalue=" . $startTime . "&filtervalue2=" . $endTime;
+ $filterentriesApiResult2 = PostToHost($this->pbs2host, $this->config['pbs2']['addfilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesquery2);
+ $filterentriesXMLString2 = $filterentriesApiResult2['http-body'];
+ $filterentriesXML2 = new SimpleXMLElement($filterentriesXMLString2);
+ $filterentriesID2 = sprintf("%s", $filterentriesXML2->filterentry->id);
+ $startDate = date('d.m.Y', strtotime($event->getStart()));
+ if($event->getEnd()) {
+ $endDate = date('d.m.Y', strtotime($event->getEnd()));
+ } else {
+ $endDate = date('d.m.Y', strtotime($event->getStart()));
+ }
+ $filterentriesquery3 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=11&filtervalue=" . $startDate . "&filtervalue2=" . $endDate;
+ $filterentriesApiResult3 = PostToHost($this->pbs2host, $this->config['pbs2']['addfilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesquery3);
+ $filterentriesXMLString3 = $filterentriesApiResult3['http-body'];
+ $filterentriesXML3 = new SimpleXMLElement($filterentriesXMLString3);
+ $filterentriesID3 = sprintf("%s", $filterentriesXML3->filterentry->id);
}
+ $this->eventMapper->save($event); //save the event with the new data
}
}
@@ -825,6 +844,7 @@ class EventController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender();
$event = new Application_Model_Event();
+ $oldEvent = new Application_Model_Event();
$evid = $this->getRequest()->getParam('evid');
$evend = $this->getRequest()->getParam('evend');
@@ -832,18 +852,58 @@ class EventController extends Zend_Controller_Action
if ($evid!=null) {
$this->eventMapper->find($evid,$event); //locate the event in the DB
+ $this->eventMapper->find($evid,$oldEvent);
+ $event->setRepeat(0);
+ $event->setRepeattype(null);
+ $event->setRepeatend(null);
+ $event->setRepeatdate(null);
+ $event->setRepeatings(null);
$oldStartTime = date('H:i', strtotime($event->getStart()));
$newStartTime = $oldStartTime;
$oldEndTime = date('H:i', strtotime($event->getEnd()));
$newEndTime = date('H:i', strtotime(substr($evend, 0, 24)));
$event->setEnd(date('Y-m-d H:i:s', strtotime(substr($evend, 0, 24))));
$event->setPbs_poolID($poolID);
- $this->eventMapper->save($event); //save the event with the new data
if($event->getPbs_filterID()) {
- $filterentriesQuerie = "filterid=" . $event->getPbs_filterID() . "&oldvalue1=" . $oldStartTime . "&oldvalue2=" . $oldEndTime . "&value1=" . $newStartTime . "&value2=" . $newEndTime;
- $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['changefilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesQuerie);
- unset($filterApiResult);
+ if(!$oldEvent->getRepeat()) {
+ $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['deletefilter'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "filterid=" . $oldEvent->getPbs_filterID());
+ unset($filterApiResult);
+ }
+ $filterquery = "bootmenuID=" . $event->getPbs_bootmenuID() . "&title=Poolctrl-Filter for " . $event->getTitle() . "&description=This Filter was automatically created by the Poolctrl for Event " . $event->getTitle() . "&created= " . time() . "&priority=100";
+ $filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['addfilter'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterquery);
+ $filterXMLString = $filterApiResult['http-body'];
+ $filterXML = new SimpleXMLElement($filterXMLString);
+ $filterID = sprintf("%s", $filterXML->filter->id);
+ $event->setPbs_filterID($filterID);
+ $filterentriesquery1 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=3&filtervalue=" . $event->getPbs_poolID();
+ $filterentriesApiResult1 = PostToHost($this->pbs2host, $this->config['pbs2']['addfilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesquery1);
+ $filterentriesXMLString1 = $filterentriesApiResult1['http-body'];
+ $filterentriesXML1 = new SimpleXMLElement($filterentriesXMLString1);
+ $filterentriesID1 = sprintf("%s", $filterentriesXML1->filterentry->id);
+ $startTime = date('H:i', strtotime($event->getStart()));
+ if($event->getEnd()) {
+ $endTime = date('H:i', strtotime($event->getEnd()));
+ } else {
+ $endTime = date('H:i', strtotime($event->getStart()) + 900);
+ }
+ $filterentriesquery2 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=7&filtervalue=" . $startTime . "&filtervalue2=" . $endTime;
+ $filterentriesApiResult2 = PostToHost($this->pbs2host, $this->config['pbs2']['addfilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesquery2);
+ $filterentriesXMLString2 = $filterentriesApiResult2['http-body'];
+ $filterentriesXML2 = new SimpleXMLElement($filterentriesXMLString2);
+ $filterentriesID2 = sprintf("%s", $filterentriesXML2->filterentry->id);
+ $startDate = date('d.m.Y', strtotime($event->getStart()));
+ if($event->getEnd()) {
+ $endDate = date('d.m.Y', strtotime($event->getEnd()));
+ } else {
+ $endDate = date('d.m.Y', strtotime($event->getStart()));
+ }
+ $filterentriesquery3 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=11&filtervalue=" . $startDate . "&filtervalue2=" . $endDate;
+ $filterentriesApiResult3 = PostToHost($this->pbs2host, $this->config['pbs2']['addfilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesquery3);
+ $filterentriesXMLString3 = $filterentriesApiResult3['http-body'];
+ $filterentriesXML3 = new SimpleXMLElement($filterentriesXMLString3);
+ $filterentriesID3 = sprintf("%s", $filterentriesXML3->filterentry->id);
}
+ $this->eventMapper->save($event); //save the event with the new data
}
}