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