Elgg  Version 1.9
date.php
Go to the documentation of this file.
1 <?php
20 //@todo popup_calendar deprecated in 1.8. Remove in 2.0
21 if (isset($vars['class'])) {
22  $vars['class'] = "elgg-input-date popup_calendar {$vars['class']}";
23 } else {
24  $vars['class'] = "elgg-input-date popup_calendar";
25 }
26 
27 $defaults = array(
28  'value' => '',
29  'disabled' => false,
30  'timestamp' => false,
31 );
32 
33 $vars = array_merge($defaults, $vars);
34 
35 $timestamp = $vars['timestamp'];
36 unset($vars['timestamp']);
37 
38 if ($timestamp) {
39  echo elgg_view('input/hidden', array(
40  'name' => $vars['name'],
41  'value' => $vars['value'],
42  ));
43 
44  $vars['class'] = "{$vars['class']} elgg-input-timestamp";
45  $vars['id'] = $vars['name'];
46  unset($vars['name']);
47  unset($vars['internalname']);
48 }
49 
50 // convert timestamps to text for display
51 if (is_numeric($vars['value'])) {
52  $vars['value'] = gmdate('Y-m-d', $vars['value']);
53 }
54 
56 echo "<input type=\"text\" $attributes />";
$timestamp
Definition: date.php:35
if($timestamp) if(is_numeric($vars['value'])) $attributes
Definition: date.php:55
elgg echo
Translates a string.
Definition: languages.js:43
elgg_format_attributes(array $attrs=array())
Converts an associative array into a string of well-formed attributes.
Definition: output.php:118
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
$vars
Definition: date.php:33
$defaults
Definition: date.php:27