1: <?php
2:
3: if (!defined('XOOPS_ROOT_PATH')) exit();
4:
5: require_once XOOPS_MODULE_PATH . "/legacyRender/class/AbstractListAction.class.php";
6: require_once XOOPS_MODULE_PATH . "/legacyRender/admin/forms/TplsetFilterForm.class.php";
7: require_once XOOPS_MODULE_PATH . "/legacyRender/admin/forms/TplsetSelectForm.class.php";
8:
9: class LegacyRender_TplsetListAction extends LegacyRender_AbstractListAction
10: {
11: var $mActionForm = null;
12: var $mActiveTemplateSet = null;
13:
14: function prepare(&$controller, &$xoopsUser, $moduleConfig)
15: {
16: LegacyRender_AbstractListAction::prepare($controller, $xoopsUser, $moduleConfig);
17: $this->mActionForm =new LegacyRender_TplsetSelectForm();
18: $this->mActionForm->prepare();
19: }
20:
21: function &_getHandler()
22: {
23: $handler =& xoops_getmodulehandler('tplset');
24: return $handler;
25: }
26:
27: function &_getFilterForm()
28: {
29: $filter =new LegacyRender_TplsetFilterForm($this->_getPageNavi(), $this->_getHandler());
30: return $filter;
31: }
32:
33: function _getBaseUrl()
34: {
35: return "./index.php?action=TplsetList";
36: }
37:
38: function execute(&$controller, &$xoopsUser)
39: {
40: $this->mActionForm->fetch();
41: $this->mActionForm->validate();
42: if (!$this->mActionForm->hasError()) {
43: $configHandler =& xoops_gethandler('config');
44:
45: $criteria =new CriteriaCompo();
46: $criteria->add(new Criteria('conf_name', 'template_set'));
47: $criteria->add(new Criteria('conf_catid', XOOPS_CONF));
48:
49: $configs =& $configHandler->getConfigs($criteria);
50: if (count($configs) > 0) {
51: $configs[0]->set('conf_value', $this->mActionForm->get('tplset_name'));
52: $configHandler->insertConfig($configs[0]);
53: $this->mActiveTemplateSet = $this->mActionForm->get('tplset_name');
54: }
55: }
56:
57: return $this->getDefaultView($controller, $xoopsUser);
58: }
59:
60: function executeViewIndex(&$controller, &$xoopsUser, &$render)
61: {
62:
63:
64:
65: foreach (array_keys($this->mObjects) as $key) {
66: $this->mObjects[$key]->loadModuletpl();
67: }
68:
69: if ($this->mActiveTemplateSet == null) {
70: $this->mActiveTemplateSet = $controller->mRoot->mContext->getXoopsConfig('template_set');
71: }
72:
73: $render->setTemplateName("tplset_list.html");
74: $render->setAttribute('objects', $this->mObjects);
75: $render->setAttribute('pageNavi', $this->mFilter->mNavi);
76: $render->setAttribute('activeTemplateSet', $this->mActiveTemplateSet);
77: $render->setAttribute('actionForm', $this->mActionForm);
78:
79:
80:
81:
82: $handler =& xoops_getmodulehandler('tplfile');
83: $recentObjects =& $handler->getRecentModifyFile();
84:
85: $render->setAttribute('recentObjects', $recentObjects);
86: }
87: }
88:
89: ?>
90: