File: time.php

package info (click to toggle)
horde3 3.0.4-4sarge7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 15,980 kB
  • ctags: 16,295
  • sloc: php: 68,726; xml: 2,382; sql: 498; makefile: 74; sh: 63; pascal: 6
file content (59 lines) | stat: -rw-r--r-- 1,575 bytes parent folder | download | duplicates (3)
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
49
50
51
52
53
54
55
56
57
58
59
<?php

$block_name = _("Current Time");

/**
 * $Horde: horde/lib/Block/time.php,v 1.16 2004/11/23 15:17:53 chuck Exp $
 *
 * @package Horde_Block
 */
class Horde_Block_Horde_time extends Horde_Block {

    var $_app = 'horde';

    function _params()
    {
        return $params = array('time' => array('type' => 'enum',
                                               'name' => _("Time format"),
                                               'default' => '24-hour',
                                               'values' => array('24-hour' => _("24 Hour Format"),
                                                                 '12-hour' => _("12 Hour Format"))));
    }

    /**
     * The title to go in this block.
     *
     * @return string   The title text.
     */
    function _title()
    {
        return _("Current Time");
    }

    /**
     * The content to go in this block.
     *
     * @return string   The content
     */
    function _content()
    {
        if (empty($this->_params['time'])) {
            $this->_params['time'] = '24-hour';
        }

        // Set the timezone variable, if available.
        NLS::setTimeZone();

        $html = '<table width="100%" height="100%"><tr><td style="font-family:verdana;font-size:18px;" align="center" valign="middle">';
        $html .= strftime('%A, %B %d, %Y ');
        if ($this->_params['time'] == '24-hour') {
            $html .= strftime('%H:%M');
        } else {
            $html .= strftime('%I:%M %p');
        }
        $html .= '</td></tr></table>';

        return $html;
    }

}