summaryrefslogtreecommitdiffstats
path: root/application/models/EventMapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/models/EventMapper.php')
-rwxr-xr-xapplication/models/EventMapper.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/application/models/EventMapper.php b/application/models/EventMapper.php
index 8bad409..7e5f41a 100755
--- a/application/models/EventMapper.php
+++ b/application/models/EventMapper.php
@@ -465,4 +465,21 @@ class Application_Model_EventMapper
}
+ public function getOverlappingEvents($start, $end) {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = "SELECT * FROM poolctrl_event WHERE ( start < '" . $start . "' ) AND ( end BETWEEN '" . $end . "' AND '" . $start . "' )";
+ $stmt1 = $db->query($select);
+ $result1 = $stmt1->fetchAll();
+ $select = "SELECT * FROM poolctrl_event WHERE ( start BEETWEEN '" . $start . "' AND '" . $end . "' ) AND ( end BEETWEEN '" . $start . "' AND '" . $end . "' )";
+ $stmt2 = $db->query($select);
+ $result2 = $stmt2->fetchAll();
+ $merge = array_merge($result1, $result2);
+ $select = "SELECT * FROM poolctrl_event WHERE ( start BEETWEEN '" . $start . "' AND '" . $end . "' ) AND ( end > '" . $end . "' )";
+ $stmt3 = $db->query($select);
+ $result3 = $stmt3->fetchAll();
+ $return = array_merge($merge, $result3);
+
+ return $return;
+ }
+
} \ No newline at end of file