aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-20 18:31:26 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-20 18:31:26 +0000
commit3de118dae7fdc17e117330078846f538254411d0 (patch)
treed37beac589f63e8a46ba2a11396c41a17145726a /engine/lib/entities.php
parentee522526e7ea18d27889071177a025e585fc4f6c (diff)
downloadelgg-3de118dae7fdc17e117330078846f538254411d0.tar.gz
elgg-3de118dae7fdc17e117330078846f538254411d0.tar.bz2
Refs #452: Calendar interface on entities
git-svn-id: https://code.elgg.org/elgg/trunk@2480 36083f99-b078-4883-b0ff-0f9b5a30f544
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 ////////////////////////////////////////////////////////////
/**