summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-10-31 09:27:16 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-10-31 09:27:16 (GMT)
commite7432c6c0283ad219555579e3a6dfb7c5cf9d77b (patch)
tree6a2a89a567aede40eb6946df3780499e0ed53f26
parent9889e6561f7cabfdb7ddb69848b55ac52151e21f (diff)
downloadkolab-freebusy-e7432c6c0283ad219555579e3a6dfb7c5cf9d77b.tar.gz
Use utility functions to get period start/end dates
-rw-r--r--lib/Kolab/FreeBusy/SourceIMAP.php4
-rw-r--r--lib/Kolab/FreeBusy/Utils.php22
2 files changed, 24 insertions, 2 deletions
diff --git a/lib/Kolab/FreeBusy/SourceIMAP.php b/lib/Kolab/FreeBusy/SourceIMAP.php
index 9f39313..5a4bd43 100644
--- a/lib/Kolab/FreeBusy/SourceIMAP.php
+++ b/lib/Kolab/FreeBusy/SourceIMAP.php
@@ -113,8 +113,8 @@ class SourceIMAP extends Source
\libcalendaring::get_ical();
$utc = new \DateTimezone('UTC');
- $dtstart = new \DateTime('now - 8 weeks 00:00:00', $utc);
- $dtend = new \DateTime('now + 16 weeks 00:00:00', $utc);
+ $dtstart = Utils::periodStartDT();
+ $dtend = Utils::periodEndDT();
$calendar = VObject\Component::create('VCALENDAR');
$seen = array();
diff --git a/lib/Kolab/FreeBusy/Utils.php b/lib/Kolab/FreeBusy/Utils.php
index 942341e..362461d 100644
--- a/lib/Kolab/FreeBusy/Utils.php
+++ b/lib/Kolab/FreeBusy/Utils.php
@@ -181,6 +181,17 @@ class Utils
}
/**
+ * Getter for the free/busy period start time
+ *
+ * @return object DateTime instance
+ */
+ public static function periodStartDT()
+ {
+ // Should probably be a setting. For now, do 8 weeks in the past
+ return new \DateTime('now - 8 weeks 00:00:00', new \DateTimezone('UTC'));
+ }
+
+ /**
* Getter for the free/busy period end time
*
* @return int Unix timestamp
@@ -192,6 +203,17 @@ class Utils
}
/**
+ * Getter for the free/busy period end time
+ *
+ * @return object DateTime instance
+ */
+ public static function periodEndDT()
+ {
+ // Should probably be a setting. For now, do 8 weeks in the past
+ return new \DateTime('now + 16 weeks 00:00:00', new \DateTimezone('UTC'));
+ }
+
+ /**
* Returns an apparent empty Free/Busy list for the given user
*/
public static function dummyVFreebusy($user)