diff options
author | Bart Visscher <bartv@thisnet.nl> | 2011-10-17 19:58:56 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2011-10-20 23:49:27 +0200 |
commit | 4075d18050b8c894fe58c700703ac0844f8b95b8 (patch) | |
tree | 1264dcf655355d4818f8166a8cf4f578b565dd8f /apps/calendar/lib | |
parent | a12cdb55b10b60983a7653ed86afe453d11da57b (diff) | |
download | nextcloud-server-4075d18050b8c894fe58c700703ac0844f8b95b8.tar.gz nextcloud-server-4075d18050b8c894fe58c700703ac0844f8b95b8.zip |
Implement loading of events in calendar
Diffstat (limited to 'apps/calendar/lib')
-rw-r--r-- | apps/calendar/lib/object.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 0c3e497d4f2..4afeb341a9c 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -31,6 +31,34 @@ class OC_Calendar_Object{ } /** + * @brief Returns all objects of a calendar between $start and $end + * @param integer $id + * @param DateTime $start + * @param DateTime $end + * @return array + * + * The objects are associative arrays. You'll find the original vObject + * in ['calendardata'] + */ + public static function allInPeriod($id, $start, $end){ + $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE calendarid = ?' + .' AND ((startdate >= ? AND startdate <= ? AND repeating = 0)' + .' OR (startdate <= ? AND enddate >= ? AND repeating = 1))' ); + $start = self::getUTCforMDB($start); + $end = self::getUTCforMDB($end); + $result = $stmt->execute(array($id, + $start, $end, + $end, $start)); + + $calendarobjects = array(); + while( $row = $result->fetchRow()){ + $calendarobjects[] = $row; + } + + return $calendarobjects; + } + + /** * @brief Returns an object * @param integer $id * @return associative array |