summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorBjörn Geiger2011-10-10 17:50:37 +0200
committerBjörn Geiger2011-10-10 17:50:37 +0200
commit7b20fca7aa3f3830a50e48ec9cc9ab9b38fa5bcf (patch)
tree8071bc69add6731bb6d6b769822193a9e27262be /application
parentweitere Korrekturen (diff)
downloadpoolctrl-7b20fca7aa3f3830a50e48ec9cc9ab9b38fa5bcf.tar.gz
poolctrl-7b20fca7aa3f3830a50e48ec9cc9ab9b38fa5bcf.tar.xz
poolctrl-7b20fca7aa3f3830a50e48ec9cc9ab9b38fa5bcf.zip
weitere Änderung
Diffstat (limited to 'application')
-rwxr-xr-xapplication/controllers/EventController.php91
1 files changed, 44 insertions, 47 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index 1f0b2ba..4fd0675 100755
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -453,7 +453,7 @@ class EventController extends Zend_Controller_Action
$params['immediate'] = 0;
$event->setOptions($params);
$event->setID($eventID);
- if($oldEvent->getRepeat()) {
+ if($oldEvent->getRepeat() && isset($params['wdh'])) {
$event->setRepeat($oldEvent->getRepeat());
$event->setRepeatdate($oldEvent->getRepeatdate());
$event->setRepeatend($oldEvent->getRepeatend());
@@ -478,38 +478,33 @@ class EventController extends Zend_Controller_Action
unset($filterApiResult);
}
if(isset($diff['start']) || isset($diff['end']) || isset($diff['pbs_poolID'])) {
- if(isset($params['wdh'])) {
+ if($event->getRepeat()) {
$filterApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['deletefilter'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', "filterid=" . $event->getPbs_filterID());
unset($filterApiResult);
}
- $newFilter = true;
- } else {
- $newFilter = false;
- }
- if($newFilter) {
$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);
}
- $filterentriesquery1 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=7&filtervalue=" . $startTime . "&filtervalue2=" . $endTime;
- $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);
- $filterentriesquery2 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=3&filtervalue=" . $event->getPbs_poolID();
+ $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);
- if(!isset($params['wdh'])) {
+ if(!$event->getRepeat()) {
$startDate = date('d.m.Y', strtotime($event->getStart()));
if($event->getEnd()) {
$endDate = date('d.m.Y', strtotime($event->getEnd()));
@@ -523,7 +518,7 @@ class EventController extends Zend_Controller_Action
$filterentriesID3 = sprintf("%s", $filterentriesXML3->filterentry->id);
}
}
- if($event->getRepeat() && isset($params['wdh'])) {
+ if($event->getRepeat()) {
$this->editRepeatEvent($oldEvent, $event);
} else {
try {
@@ -571,12 +566,6 @@ class EventController extends Zend_Controller_Action
}
}
- /*
- * ------------------------
- * START CALENDAR FUNCTIONS
- * ------------------------
- */
-
public function deleteallAction() {
if (!$this->acl->checkRight('ed')) {
$this->_redirect('/');
@@ -614,6 +603,12 @@ class EventController extends Zend_Controller_Action
}
}
+ /*
+ * ------------------------
+ * START CALENDAR FUNCTIONS
+ * ------------------------
+ */
+
public function getpoollistAction() {
$this->_helper->layout->disableLayout();
@@ -687,7 +682,6 @@ class EventController extends Zend_Controller_Action
$event = new Application_Model_Event();
-
$evid = $this->getRequest()->getParam('evid');
$evstart = $this->getRequest()->getParam('evstart');
$evend = $this->getRequest()->getParam('evend');
@@ -2232,6 +2226,26 @@ class EventController extends Zend_Controller_Action
$diffEnd = intval(strtotime($newEvent->getEnd())) - intval(strtotime($oldEvent->getEnd()));
unset($diff['end']);
}
+ $repeattypeMapper = new Application_Model_RepeattypeMapper();
+ $repeattype = new Application_Model_Repeattype();
+ $repeattypeMapper->find($newEvent->getRepeattype(), $repeattype);
+ if($repeattype == "Once a week") {
+ $weekday = date('N', strtotime($diff['start']));
+ $filterentriesquery1 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=10&filtervalue=" . $weekday . "&filtervalue2=" . $weekday;
+ $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);
+ $filterentriesID = sprintf("%s", $filterentriesXML1->filterentry->id);
+ } else {
+ $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);
+ }
+ $filterentriesquery1 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=7&filtervalue=" . $startTime . "&filtervalue2=" . $endTime;
+ $filterentriesApiResult1 = PostToHost($this->pbs2host, $this->config['pbs2']['addfilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesquery1);
+ }
$events = $this->eventMapper->findBy(array($oldEvent->getTitle()));
try {
foreach($events as $event) {
@@ -2252,11 +2266,7 @@ class EventController extends Zend_Controller_Action
$newStart = date('Y-m-d H:i:s', strtotime($event->getStart()) + $diffStart);
}
}
- $oldStartDate = date('Y-m-d', strtotime($event->getStart()));
- $oldStartTime = date('H:i', strtotime($event->getStart()));
$event->setStart($newStart);
- $newStartDate = date('Y-m-d', strotime($event->getStart()));
- $newStartTime = date('H:i', strtotime($event->getStart()));
}
if(isset($diffEnd)) {
$summertimeEnd = intval(date('I', strtotime($event->getEnd())));
@@ -2274,27 +2284,17 @@ class EventController extends Zend_Controller_Action
$newEnd = date('Y-m-d H:i:s', strtotime($event->getEnd()) + $diffEnd);
}
}
- $oldEndDate = date('Y-m-d', strtotime($event->getEnd()));
- $oldEndTime = date('H:i', strtotime($event->getEnd()));
$event->setEnd($newEnd);
- $newEndDate = date('Y-m-d', strotime($event->getEnd()));
- $newEndTime = date('H:i', strtotime($event->getEnd()));
}
- $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);
+ $startDate = date('Y-m-d', strotime($event->getStart()));
+ if($event->getEnd()) {
+ $endDate = date('Y-m-d', strotime($event->getEnd()));
} 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);
+ $endDate = date('Y-m-d', strotime($event->getStart()) + 900);
+ }
+ if($repeattype != "Once a week") {
+ $filterentriesquery2 = "filterID=" . $event->getPbs_filterID() . "&filtertypeID=11&filtervalue=" . $startDate . "&filtervalue2=" . $endDate;
+ $filterentriesApiResult2 = PostToHost($this->pbs2host, $this->config['pbs2']['addfilterentry'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $filterentriesquery2);
}
$this->eventMapper->save($event);
}
@@ -2303,9 +2303,6 @@ class EventController extends Zend_Controller_Action
echo "Message: " . $e->getMessage() . "<br/>";
return;
}
- if($diff['pbs_filterID']) {
-
- }
} else {
$events = $this->eventMapper->findBy(array($oldEvent->getTitle()));
try {