summaryrefslogtreecommitdiffstats
path: root/application/controllers/EventController.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/EventController.php')
-rwxr-xr-xapplication/controllers/EventController.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index f221753..b2ff1ae 100755
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -621,6 +621,53 @@ class EventController extends Zend_Controller_Action
$this->view->poollist = $poollist;
}
+ public function checkoverlapeventsAction() {
+ if(!$this->acl->checkRight('eo')) {
+ $this->_redirect('/');
+ }
+ $this->_helper->layout->disableLayout();
+
+ $eventID = $this->getRequest()->getParam('eventID');
+ $date = intval(strtotime(substr($this->getRequest()->getParam('date'), 0, 24)));
+
+ $events = $this->eventMapper->getDraggingEvents($eventID);
+ $others = $this->eventMapper->getNotDraggingEvents($eventID);
+
+
+
+
+
+
+ // Fetch all events with same title as dragged one (fetch repeats)
+
+
+ // Calculate time shift
+ $diff=0;
+ foreach($events as $e) {
+ if($e['eventID'] == $eventID)
+ $diff = $date - strtotime($e['start']);
+ }
+
+ // Check for overlap
+ $overlaps = array();
+ foreach($events as $e) {
+
+ $enewstart = strtotime($e['start']) + $diff;
+ $enewend = strtotime($e['end']) + $diff;
+
+ foreach($others as $o) {
+ if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start'])
+ || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']))
+ $overlaps[] = $o;
+ }
+ }
+
+ $this->view->events = $events;
+ $this->view->others = $others;
+ $this->view->overlaps = $overlaps;
+
+ }
+
public function eventmoveAction() {
if(!$this->acl->checkRight('eo')) {
$this->_redirect('/');