aboutsummaryrefslogtreecommitdiff
path: root/views/default/event_calendar/input
diff options
context:
space:
mode:
authorKevin Jardine <kevinjardine@yahoo.com>2011-10-24 12:08:24 +0200
committerKevin Jardine <kevinjardine@yahoo.com>2011-10-24 12:08:24 +0200
commitdb951f94b6ae60f899f719f17dce4aa6c47edf54 (patch)
tree6631b3bac1f3ecb3c93238fb94269a90ea2adf8f /views/default/event_calendar/input
parent1ca017f9f9f8b44fbdcb08105a52e059df6bb504 (diff)
downloadelgg-db951f94b6ae60f899f719f17dce4aa6c47edf54.tar.gz
elgg-db951f94b6ae60f899f719f17dce4aa6c47edf54.tar.bz2
now uses a date_local view to consistently display events in local server time
Diffstat (limited to 'views/default/event_calendar/input')
-rw-r--r--views/default/event_calendar/input/date_local.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/views/default/event_calendar/input/date_local.php b/views/default/event_calendar/input/date_local.php
new file mode 100644
index 000000000..f9979cb38
--- /dev/null
+++ b/views/default/event_calendar/input/date_local.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Elgg date input
+ * Displays a text field with a popup date picker.
+ *
+ * The elgg.ui JavaScript library initializes the jQueryUI datepicker based
+ * on the CSS class .elgg-input-date. It uses the ISO 8601 standard for date
+ * representation: yyyy-mm-dd.
+ *
+ * Unix timestamps are supported by setting the 'timestamp' parameter to true.
+ * The date is still displayed to the user in a text format but is submitted as
+ * a unix timestamp in seconds.
+ *
+ * @uses $vars['value'] The current value, if any (as a unix timestamp)
+ * @uses $vars['class'] Additional CSS class
+ * @uses $vars['timestamp'] Store as a Unix timestamp in seconds. Default = false
+ * Note: you cannot use an id with the timestamp option.
+ */
+
+//@todo popup_calendar deprecated in 1.8. Remove in 2.0
+if (isset($vars['class'])) {
+ $vars['class'] = "elgg-input-date popup_calendar {$vars['class']}";
+} else {
+ $vars['class'] = "elgg-input-date popup_calendar";
+}
+
+$defaults = array(
+ 'value' => '',
+ 'disabled' => false,
+ 'timestamp' => false,
+);
+
+$vars = array_merge($defaults, $vars);
+
+$timestamp = $vars['timestamp'];
+unset($vars['timestamp']);
+
+if ($timestamp) {
+ echo elgg_view('input/hidden', array(
+ 'name' => $vars['name'],
+ 'value' => $vars['value'],
+ ));
+
+ $vars['class'] = "{$vars['class']} elgg-input-timestamp";
+ $vars['id'] = $vars['name'];
+ unset($vars['name']);
+ unset($vars['internalname']);
+}
+
+// convert timestamps to text for display
+if (is_numeric($vars['value'])) {
+ $vars['value'] = date('Y/m/d', $vars['value']);
+}
+
+$attributes = elgg_format_attributes($vars);
+echo "<input type=\"text\" $attributes />";