1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: if (!defined('XOOPS_ROOT_PATH')) exit();
12:
13: require_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
14:
15: class LegacyThemeObject extends XoopsSimpleObject
16: {
17: function LegacyThemeObject()
18: {
19: static $initVars;
20: if (isset($initVars)) {
21: $this->mVars = $initVars;
22: return;
23: }
24: $this->initVar('name', XOBJ_DTYPE_STRING, '', true, 255);
25: $this->initVar('dirname', XOBJ_DTYPE_STRING, '', true, 255);
26: $this->initVar('screenshot', XOBJ_DTYPE_STRING, '', false, 255);
27: $this->initVar('description', XOBJ_DTYPE_STRING, '', false, 255);
28: $this->initVar('format', XOBJ_DTYPE_STRING, '', true, 255);
29: $this->initVar('render_system', XOBJ_DTYPE_STRING, '', true, 255);
30: $this->initVar('version', XOBJ_DTYPE_STRING, '', true, 32);
31: $this->initVar('author', XOBJ_DTYPE_STRING, '', true, 64);
32: $this->initVar('url', XOBJ_DTYPE_STRING, '', true, 255);
33: $this->initVar('license', XOBJ_DTYPE_STRING, '', true, 255);
34:
35:
36: $this->initVar('licence', XOBJ_DTYPE_STRING, '', true, 255);
37: $initVars = $this->mVars;
38: }
39: }
40:
41: class LegacyThemeHandler extends XoopsObjectHandler
42: {
43: var $_mResults = array();
44:
45: 46: 47:
48: var $mGetInstalledThemes = null;
49:
50: function LegacyThemeHandler(&$db)
51: {
52: $this->mGetInstalledThemes =new XCube_Delegate();
53: $this->mGetInstalledThemes->register('LegacyThemeHandler.GetInstalledThemes');
54: }
55:
56: function &create()
57: {
58: $ret =new LegacyThemeObject();
59: return $ret;
60: }
61:
62: function &get($name)
63: {
64: $ret = null;
65: $this->_makeCache();
66:
67: foreach (array_keys($this->_mResults) as $key) {
68: if ($this->_mResults[$key]->get('dirname') == $name) {
69: return $this->_mResults[$key];
70: }
71: }
72:
73: return $ret;
74: }
75:
76: function &getObjects($criteria = null, $id_as_key = false)
77: {
78: $this->_makeCache();
79: return $this->_mResults;
80: }
81:
82: 83: 84:
85: function _makeCache()
86: {
87: if (count($this->_mResults) == 0) {
88: $t_themeArr = array();
89: $this->mGetInstalledThemes->call(new XCube_Ref($t_themeArr));
90:
91: foreach ($t_themeArr as $theme) {
92: $obj =& $this->create();
93: $obj->assignVars(array('name' => $theme->mName,
94: 'dirname' => $theme->mDirname,
95: 'screenshot' => $theme->mScreenShot,
96: 'description' => $theme->mDescription,
97: 'format' => $theme->mFormat,
98: 'render_system' => $theme->mRenderSystemName,
99: 'version' => $theme->mVersion,
100: 'author' => $theme->mAuthor,
101: 'url' => $theme->mUrl,
102: 'license' => $theme->mLicence));
103: $this->_mResults[] =& $obj;
104: unset($obj);
105: }
106: }
107: }
108:
109: function insert(&$obj, $force = false)
110: {
111: return false;
112: }
113:
114: function delete(&$obj, $force = false)
115: {
116: return false;
117: }
118: }
119:
120: ?>
121: