XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
timezone.php
1<?php
11
12
13if (!defined('XOOPS_ROOT_PATH')) {
14 exit();
15}
16
17class XoopsTimezone extends XoopsObject
18{
19 public function __construct()
20 {
21 static $initVars;
22 if (isset($initVars)) {
23 $this->vars = $initVars;
24 return;
25 }
26 $this->initVar('offset', XOBJ_DTYPE_OTHER, null, false);
27 $this->initVar('zone_name', XOBJ_DTYPE_TXTBOX, null, true, 255);
28 $initVars = $this->vars;
29 }
30 public function XoopsTimezone()
31 {
32 return self::__construct();
33 }
34}
35
36class XoopsTimezoneHandler extends XoopsObjectHandler
37{
38 public $_mResult;
39
40 public function __construct(&$db)
41 {
42 parent::__construct($db);
43
44 $root =& XCube_Root::getSingleton();
45
46 //
47 // Because abstract language style is not decided, we load directly. But we must fix.
48 //
49 $root->mLanguageManager->loadPageTypeMessageCatalog('timezone');
50
51 //
52 // This handler not connects to database.
53 //
54 $this->_mResult = [
55 '-12' => _TZ_GMTM12,
56 '-11' => _TZ_GMTM11,
57 '-10' => _TZ_GMTM10,
58 '-9' => _TZ_GMTM9,
59 '-8' => _TZ_GMTM8,
60 '-7' => _TZ_GMTM7,
61 '-6' => _TZ_GMTM6,
62 '-5' => _TZ_GMTM5,
63 '-4.5' => _TZ_GMTM45,
64 '-4' => _TZ_GMTM4,
65 '-3.5' => _TZ_GMTM35,
66 '-3' => _TZ_GMTM3,
67 '-2' => _TZ_GMTM2,
68 '-1' => _TZ_GMTM1,
69 '0' => _TZ_GMT0,
70 '1' => _TZ_GMTP1,
71 '2' => _TZ_GMTP2,
72 '3' => _TZ_GMTP3,
73 '3.5' => _TZ_GMTP35,
74 '4' => _TZ_GMTP4,
75 '4.5' => _TZ_GMTP45,
76 '5' => _TZ_GMTP5,
77 '5.5' => _TZ_GMTP55,
78 '5.75' => _TZ_GMTP575,
79 '6' => _TZ_GMTP6,
80 '6.5' => _TZ_GMTP65,
81 '7' => _TZ_GMTP7,
82 '8' => _TZ_GMTP8,
83 '9' => _TZ_GMTP9,
84 '9.5' => _TZ_GMTP95,
85 '10' => _TZ_GMTP10,
86 '11' => _TZ_GMTP11,
87 '12' => _TZ_GMTP12,
88 '13' => _TZ_GMTP13
89 ];
90 }
91 public function XoopsTimezoneHandler(&$db)
92 {
93 return self::__construct($db);
94 }
95
96 public function &create()
97 {
98 $ret =new XoopsTimezone();
99 return $ret;
100 }
101
102 public function &get($offset)
103 {
104 $ret = null;
105
106 foreach ($this->_mResult as $index => $zone_name) {
107 if ((float)$index == (float)$offset) {
108 $obj =new XoopsTimezone();
109 $obj->set('offset', $index);
110 $obj->set('zone_name', $zone_name);
111
112 return $obj;
113 }
114 }
115
116 return $ret;
117 }
118
119 public function &getObjects($criteria = null, $key_as_id = false)
120 {
121 $ret = [];
122
123 foreach ($this->_mResult as $offset => $zone_name) {
124 $obj =new XoopsTimezone();
125 $obj->setVar('offset', $offset);
126 $obj->setVar('zone_name', $zone_name);
127 if ($key_as_id) {
128 $ret[$offset] =& $obj;
129 } else {
130 $ret[] =& $obj;
131 }
132 unset($obj);
133 }
134
135 return $ret;
136 }
137
138 public function insert(&$obj)
139 {
140 return false;
141 }
142
143 public function delete(&$obj)
144 {
145 return false;
146 }
147}
initVar($key, $data_type, $value=null, $required=false, $maxlength=null, $options='')
Definition object.php:206