aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/views
diff options
context:
space:
mode:
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-05 22:21:29 +0000
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-05 22:21:29 +0000
commit67168b0ea5781951eaf6a7566762b44acc17d12c (patch)
tree654e12b005be9173072a5018280f7865d598957b /mod/blog/views
parenteb538def799eb54e1ce29996dfbc56f4c960e3f3 (diff)
downloadelgg-67168b0ea5781951eaf6a7566762b44acc17d12c.tar.gz
elgg-67168b0ea5781951eaf6a7566762b44acc17d12c.tar.bz2
Adding a datetime view for use with blog publication.
git-svn-id: http://code.elgg.org/elgg/trunk@5630 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/blog/views')
-rw-r--r--mod/blog/views/default/blog/css.php10
-rw-r--r--mod/blog/views/default/blog/forms/edit.php2
-rw-r--r--mod/blog/views/default/input/datetime.php46
3 files changed, 57 insertions, 1 deletions
diff --git a/mod/blog/views/default/blog/css.php b/mod/blog/views/default/blog/css.php
index 3cddd3105..834be737e 100644
--- a/mod/blog/views/default/blog/css.php
+++ b/mod/blog/views/default/blog/css.php
@@ -19,4 +19,14 @@
}
.blogpost .body p {
line-height: 1.4em;
+}
+
+input.blog_publish_day,
+input.blog_publish_hour,
+input.blog_publish_minute {
+ width: 25px;
+}
+
+input.blog_publish_year {
+ width: 50px;
} \ No newline at end of file
diff --git a/mod/blog/views/default/blog/forms/edit.php b/mod/blog/views/default/blog/forms/edit.php
index b2b494c7a..7fc5d6c91 100644
--- a/mod/blog/views/default/blog/forms/edit.php
+++ b/mod/blog/views/default/blog/forms/edit.php
@@ -137,7 +137,7 @@ $access_input = elgg_view('input/access', array(
));
$publish_date_label = elgg_echo('blog:publish_date');
-$publish_date_input = elgg_view('input/datepicker', array(
+$publish_date_input = elgg_view('input/datetime', array(
'internalname' => 'publish_date',
'internalid' => 'blog_publish_date',
'value' => $values['publish_date']
diff --git a/mod/blog/views/default/input/datetime.php b/mod/blog/views/default/input/datetime.php
new file mode 100644
index 000000000..5586464f1
--- /dev/null
+++ b/mod/blog/views/default/input/datetime.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * A date-time view for the blog publication date.
+ */
+
+// default date to current time
+$publish_date = ($vars['value']) ? $vars['value'] : time();
+
+$months = array();
+for ($i=1; $i <= 12; $i++) {
+ $value = str_pad($i, 2, '0', STR_PAD_LEFT);
+ $months[$value] = date('M', strtotime("$value/01/2010"));
+}
+
+$month = elgg_view('input/pulldown', array(
+ 'internalname' => 'publish_month',
+ 'value' => date('m', $publish_date),
+ 'options_values' => $months,
+ 'class' => 'blog_publish_month',
+));
+
+$day = elgg_view('input/text', array(
+ 'internalname' => 'publish_day',
+ 'value' => date('d', $publish_date),
+ 'class' => 'blog_publish_day',
+));
+
+$year = elgg_view('input/text', array(
+ 'internalname' => 'publish_year',
+ 'value' => date('Y', $publish_date),
+ 'class' => 'blog_publish_year',
+));
+
+$hour = elgg_view('input/text', array(
+ 'internalname' => 'publish_hour',
+ 'value' => date('H', $publish_date),
+ 'class' => 'blog_publish_hour',
+));
+
+$minute = elgg_view('input/text', array(
+ 'internalname' => 'publish_minute',
+ 'value' => date('i', $publish_date),
+ 'class' => 'blog_publish_minute',
+));
+
+echo "$month $day, $year @ $hour:$minute";