aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/views/default/input/datetime.php
blob: f4bad188c50efe7680d4dcd0742f7d1727860d9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
 * A date-time view for the blog publication date.
 *
 * not being used
 */

// 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";