summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authorsebastian wagner2011-10-23 20:11:41 +0200
committersebastian wagner2011-10-23 20:11:41 +0200
commit656fd134e8b450bb98d84c10df263210eea1f680 (patch)
treec17dcb659169288b357c2cf5b567608145ed05df /application/controllers
parentminor (diff)
downloadpoolctrl-656fd134e8b450bb98d84c10df263210eea1f680.tar.gz
poolctrl-656fd134e8b450bb98d84c10df263210eea1f680.tar.xz
poolctrl-656fd134e8b450bb98d84c10df263210eea1f680.zip
repeat == 0 query implemented
Diffstat (limited to 'application/controllers')
-rwxr-xr-xapplication/controllers/EventController.php41
1 files changed, 29 insertions, 12 deletions
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index f7711ed..2a280b3 100755
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -693,11 +693,19 @@ class EventController extends Zend_Controller_Action
$cfv = true;
// overlap events
- foreach($others as $o) {
- if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start'])
- || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end'])) {
- $overlapswithrepeat[] = $o;
- $cfv = false;
+ foreach($allEvents as $o) {
+ if($e['running'] == 0) {
+ if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) && $o['eventID'] != $e['eventID']
+ || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']) && $o['eventID'] != $e['eventID']) {
+ $overlapswithrepeat[] = $o;
+ $cfv = false;
+ }
+ } else {
+ if($e['start'] <= strtotime($o['start']) && $e['end'] >= strtotime($o['start']) && $o['eventID'] != $e['eventID']
+ || $e['start'] >= strtotime($o['start']) && $e['start'] <= strtotime($o['end']) && $o['eventID'] != $e['eventID']) {
+ $overlapswithrepeat[] = $o;
+ $cfv = false;
+ }
}
}
// conflict free events with repeat
@@ -789,15 +797,22 @@ class EventController extends Zend_Controller_Action
$enewstart = strtotime($e['start']);
$enewend = strtotime($e['end']) + $diffDelta;
$cfv = true;
-
// overlap events
foreach($allEvents as $o) {
- if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) && $o['eventID'] != $e['eventID'] && $o['eventID'] != $eventID
- || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']) && $o['eventID'] != $e['eventID'] && $o['eventID'] != $eventID) {
- $overlapswithrepeat[] = $o;
- $cfv = false;
- }
- }
+ if($e['running'] == 0) {
+ if($enewstart <= strtotime($o['start']) && $enewend >= strtotime($o['start']) && $o['eventID'] != $e['eventID']
+ || $enewstart >= strtotime($o['start']) && $enewstart <= strtotime($o['end']) && $o['eventID'] != $e['eventID']) {
+ $overlapswithrepeat[] = $o;
+ $cfv = false;
+ }
+ } else {
+ if($e['start'] <= strtotime($o['start']) && $e['end'] >= strtotime($o['start']) && $o['eventID'] != $e['eventID']
+ || $e['start'] >= strtotime($o['start']) && $e['start'] <= strtotime($o['end']) && $o['eventID'] != $e['eventID']) {
+ $overlapswithrepeat[] = $o;
+ $cfv = false;
+ }
+ }
+ }
// conflict free events with repeat
if($cfv) {
$cfeventswithrepeat[] = $e;
@@ -952,6 +967,7 @@ class EventController extends Zend_Controller_Action
}
try {
foreach($events as $event) {
+ if($event->getRunning() == 0) {
//1min = 60sec, 1d = 86400sec
$oldStartTime = date('H:i', strtotime($event->getStart()));
$oldStartDate = date('d.m.Y', strtotime($event->getStart()));
@@ -995,6 +1011,7 @@ class EventController extends Zend_Controller_Action
}
$this->eventMapper->save($event); //save the event with the new data
}
+ }
} catch (Zend_Exception $e) {
echo "Caught exception: " . get_class($e) . "<br/>";
echo "Message: " . $e->getMessage() . "<br/>";