aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/calendar.php2
-rw-r--r--engine/lib/entities.php37
2 files changed, 38 insertions, 1 deletions
diff --git a/engine/lib/calendar.php b/engine/lib/calendar.php
index 15f7fff2e..70952cf7f 100644
--- a/engine/lib/calendar.php
+++ b/engine/lib/calendar.php
@@ -15,7 +15,7 @@
* Calendar interface for events.
*
*/
- interface Noteable {
+ interface Notable {
/**
* Calendar functionality.
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 4da55d6b2..99c8bdca6 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -26,6 +26,7 @@
* @subpackage Core
*/
abstract class ElggEntity implements
+ Notable, // Calendar interface
Exportable, // Allow export of data
Importable, // Allow import of data
Loggable, // Can events related to this object class be logged
@@ -710,6 +711,42 @@
return $res;
}
+ // NOTABLE INTERFACE ///////////////////////////////////////////////////////////////
+
+ /**
+ * Calendar functionality.
+ * This function sets the time of an object on a calendar listing.
+ *
+ * @param int $hour If ommitted, now is assumed.
+ * @param int $minute If ommitted, now is assumed.
+ * @param int $second If ommitted, now is assumed.
+ * @param int $day If ommitted, now is assumed.
+ * @param int $month If ommitted, now is assumed.
+ * @param int $year If ommitted, now is assumed.
+ * @param int $duration Duration of event, remainder of the day is assumed.
+ */
+ public function setCalendarTimeAndDuration($hour = NULL, $minute = NULL, $second = NULL, $day = NULL, $month = NULL, $year = NULL, $duration = NULL)
+ {
+ $start = mktime($hour, $minute, $second, $month, $day, $year);
+ $end = $start + abs($duration);
+ if (!$duration)
+ $end = get_day_end($day,$month,$year);
+
+ $this->calendar_start = $start;
+
+ return true;
+ }
+
+ /**
+ * Return the start timestamp.
+ */
+ public function getCalendarStartTime() { return (int)$this->calendar_start; }
+
+ /**
+ * Return the end timestamp.
+ */
+ public function getCalendarEndTime() { return (int)$this->calendar_end; }
+
// EXPORTABLE INTERFACE ////////////////////////////////////////////////////////////
/**