XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
formdatetime.php
Go to the documentation of this file.
1 <?php
20 defined('XOOPS_ROOT_PATH') or die('Restricted access');
21 
31 {
41  function XoopsFormDateTime($caption, $name, $size = 15, $value = 0, $showtime = true)
42  {
43  $this->XoopsFormElementTray($caption, '&nbsp;');
44  $value = intval($value);
45  $value = ($value > 0) ? $value : time();
46  $datetime = getDate($value);
47  $this->addElement(new XoopsFormTextDateSelect('', $name . '[date]', $size, $value, $showtime));
48  $timearray = array();
49  for ($i = 0; $i < 24; $i ++) {
50  for ($j = 0; $j < 60; $j = $j + 10) {
51  $key = ($i * 3600) + ($j * 60);
52  $timearray[$key] = ($j != 0) ? $i . ':' . $j : $i . ':0' . $j;
53  }
54  }
55  ksort($timearray);
56 
57  $timeselect = new XoopsFormSelect('', $name . '[time]', $datetime['hours'] * 3600 + 600 * ceil($datetime['minutes'] / 10));
58  $timeselect->addOptionArray($timearray);
59  $this->addElement($timeselect);
60  }
61 }
62 
63 ?>