aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php37
1 files changed, 37 insertions, 0 deletions
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 ////////////////////////////////////////////////////////////
/**