1: <?php
2:
3: if (!defined('XOOPS_ROOT_PATH')) exit();
4:
5: class XoopsTimezone extends XoopsObject
6: {
7: function XoopsTimezone()
8: {
9: static $initVars;
10: if (isset($initVars)) {
11: $this->vars = $initVars;
12: return;
13: }
14: $this->initVar('offset', XOBJ_DTYPE_OTHER, null, false);
15: $this->initVar('zone_name', XOBJ_DTYPE_TXTBOX, null, true, 255);
16: $initVars = $this->vars;
17: }
18: }
19:
20: class XoopsTimezoneHandler extends XoopsObjectHandler
21: {
22: var $_mResult;
23:
24: function XoopsTimezoneHandler(&$db)
25: {
26: parent::XoopsObjectHandler($db);
27:
28: $root =& XCube_Root::getSingleton();
29:
30:
31:
32:
33: $root->mLanguageManager->loadPageTypeMessageCatalog('timezone');
34:
35:
36:
37:
38: $this->_mResult = array(
39: "-12" => _TZ_GMTM12,
40: "-11" => _TZ_GMTM11,
41: "-10" => _TZ_GMTM10,
42: "-9" => _TZ_GMTM9,
43: "-8" => _TZ_GMTM8,
44: "-7" => _TZ_GMTM7,
45: "-6" => _TZ_GMTM6,
46: "-5" => _TZ_GMTM5,
47: "-4.5" => _TZ_GMTM45,
48: "-4" => _TZ_GMTM4,
49: "-3.5" => _TZ_GMTM35,
50: "-3" => _TZ_GMTM3,
51: "-2" => _TZ_GMTM2,
52: "-1" => _TZ_GMTM1,
53: "0" => _TZ_GMT0,
54: "1" => _TZ_GMTP1,
55: "2" => _TZ_GMTP2,
56: "3" => _TZ_GMTP3,
57: "3.5" => _TZ_GMTP35,
58: "4" => _TZ_GMTP4,
59: "4.5" => _TZ_GMTP45,
60: "5" => _TZ_GMTP5,
61: "5.5" => _TZ_GMTP55,
62: "5.75" => _TZ_GMTP575,
63: "6" => _TZ_GMTP6,
64: "6.5" => _TZ_GMTP65,
65: "7" => _TZ_GMTP7,
66: "8" => _TZ_GMTP8,
67: "9" => _TZ_GMTP9,
68: "9.5" => _TZ_GMTP95,
69: "10" => _TZ_GMTP10,
70: "11" => _TZ_GMTP11,
71: "12" => _TZ_GMTP12,
72: "13" => _TZ_GMTP13
73: );
74: }
75:
76: function &create()
77: {
78: $ret =new XoopsTimezone();
79: return $ret;
80: }
81:
82: function &get($offset)
83: {
84: $ret = null;
85:
86: foreach ($this->_mResult as $index => $zone_name) {
87: if ((float)$index == (float)$offset) {
88: $obj =new XoopsTimezone();
89: $obj->set('offset', $index);
90: $obj->set('zone_name', $zone_name);
91:
92: return $obj;
93: }
94: }
95:
96: return $ret;
97: }
98:
99: function &getObjects($criteria = null, $key_as_id = false)
100: {
101: $ret = array();
102:
103: foreach ($this->_mResult as $offset => $zone_name) {
104: $obj =new XoopsTimezone();
105: $obj->setVar('offset', $offset);
106: $obj->setVar('zone_name', $zone_name);
107: if ($key_as_id) {
108: $ret[$offset] =& $obj;
109: }
110: else {
111: $ret[] =& $obj;
112: }
113: unset($obj);
114: }
115:
116: return $ret;
117: }
118:
119: function insert(&$obj)
120: {
121: return false;
122: }
123:
124: function delete(&$obj)
125: {
126: return false;
127: }
128: }
129:
130: ?>
131: