1: <?php
2:
3: if (!defined('XOOPS_ROOT_PATH')) exit();
4:
5: class XoopsCachetime extends XoopsObject
6: {
7: function XoopsCachetime()
8: {
9: static $initVars;
10: if (isset($initVars)) {
11: $this->vars = $initVars;
12: return;
13: }
14: $this->initVar('cachetime', XOBJ_DTYPE_OTHER, null, false);
15: $this->initVar('label', XOBJ_DTYPE_TXTBOX, null, true, 255);
16: $initVars = $this->vars;
17: }
18: }
19:
20: class XoopsCachetimeHandler extends XoopsObjectHandler
21: {
22: var $_mResult;
23:
24: function XoopsCachetimeHandler(&$db)
25: {
26: parent::XoopsObjectHandler($db);
27:
28:
29:
30:
31: $this->_mResult = array(
32: "0" => _NOCACHE,
33: "30" => sprintf(_SECONDS, 30),
34: "60" => _MINUTE,
35: "300" => sprintf(_MINUTES, 5),
36: "1800" => sprintf(_MINUTES, 30),
37: "3600" => _HOUR,
38: "18000" => sprintf(_HOURS, 5),
39: "86400" => _DAY,
40: "259200" => sprintf(_DAYS, 3),
41: "604800" => _WEEK,
42: "2592000" => _MONTH
43: );
44: }
45:
46: function &create()
47: {
48: $ret =new XoopsCachetime();
49: return $ret;
50: }
51:
52: function &get($cachetime)
53: {
54: if (isset($this->_mResult[$cachetime])) {
55: $obj =new XoopsCachetime();
56: $obj->setVar('cachetime', $cachetime);
57: $obj->setVar('label', $this->_mResult[$cachetime]);
58:
59: return $obj;
60: }
61:
62: $ret = null;
63: return $ret;
64: }
65:
66: function &getObjects($criteria = null, $key_as_id = false)
67: {
68: $ret = array();
69:
70: foreach ($this->_mResult as $cachetime => $label) {
71: $obj =new XoopsCachetime();
72: $obj->setVar('cachetime', $cachetime);
73: $obj->setVar('label', $label);
74: if ($key_as_id) {
75: $ret[$cachetime] =& $obj;
76: }
77: else {
78: $ret[] =& $obj;
79: }
80: unset($obj);
81: }
82:
83: return $ret;
84: }
85:
86: function insert(&$obj)
87: {
88: return false;
89: }
90:
91: function delete(&$obj)
92: {
93: return false;
94: }
95: }
96:
97: ?>
98: