1: <?php
2: /**
3: * @package Horde
4: */
5: class Horde_Block_Time extends Horde_Core_Block
6: {
7: /**
8: */
9: public $updateable = true;
10:
11: /**
12: */
13: public function __construct($app, $params = array())
14: {
15: parent::__construct($app, $params);
16:
17: $this->_name = _("Current Time");
18: }
19:
20: /**
21: */
22: protected function _params()
23: {
24: return array(
25: 'time' => array(
26: 'type' => 'enum',
27: 'name' => _("Time format"),
28: 'default' => '24-hour',
29: 'values' => array(
30: '24-hour' => _("24 Hour Format"),
31: '12-hour' => _("12 Hour Format")
32: )
33: )
34: );
35: }
36:
37: /**
38: */
39: protected function _content()
40: {
41: if (empty($this->_params['time'])) {
42: $this->_params['time'] = '24-hour';
43: }
44:
45: // Set the timezone variable, if available.
46: $GLOBALS['registry']->setTimeZone();
47:
48: $html = '<div style="font-size:200%; font-weight:bold; text-align:center">' .
49: strftime('%A, %B %d, %Y ');
50: if ($this->_params['time'] == '24-hour') {
51: $html .= strftime('%H:%M');
52: } else {
53: $html .= strftime('%I:%M %p');
54: }
55: return $html . '</div>';
56: }
57:
58: }
59: