1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: if (!defined('XOOPS_ROOT_PATH')) exit();
12:
13: require_once XOOPS_MODULE_PATH . "/legacy/class/AbstractListAction.class.php";
14: require_once XOOPS_MODULE_PATH . "/legacy/admin/forms/BlockInstallFilterForm.class.php";
15:
16: class Legacy_BlockInstallListAction extends Legacy_AbstractListAction
17: {
18:
19: var $mpageArr = array(5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100, 0);
20:
21: function &_getHandler()
22: {
23: $handler =& xoops_getmodulehandler('newblocks');
24: return $handler;
25: }
26:
27: function &_getPageNavi()
28: {
29: $navi =new XCube_PageNavigator($this->_getBaseUrl(), XCUBE_PAGENAVI_START | XCUBE_PAGENAVI_PERPAGE);
30:
31: $root =& XCube_Root::getSingleton();
32: $perpage = $root->mContext->mRequest->getRequest($navi->mPrefix.'perpage');
33:
34: if (isset($perpage) && intval($perpage) == 0) {
35: $navi->setPerpage(0);
36: }
37: return $navi;
38: }
39:
40: function &_getFilterForm()
41: {
42: $filter =new Legacy_BlockInstallFilterForm($this->_getPageNavi(), $this->_getHandler());
43: return $filter;
44: }
45:
46: function _getBaseUrl()
47: {
48: return "./index.php?action=BlockInstallList";
49: }
50:
51: function executeViewIndex(&$controller, &$xoopsUser, &$render)
52: {
53: $render->setTemplateName("blockinstall_list.html");
54:
55:
56:
57:
58: foreach (array_keys($this->mObjects) as $key) {
59: $this->mObjects[$key]->loadModule();
60: }
61:
62: $render->setAttribute("objects", $this->mObjects);
63: $render->setAttribute("pageNavi", $this->mFilter->mNavi);
64: $moduleHandler =& xoops_gethandler('module');
65: $modules =& $moduleHandler->getObjects(new Criteria('isactive', 1));
66: $render->setAttribute('modules', $modules);
67: $render->setAttribute('filterForm', $this->mFilter);
68: $render->setAttribute('pageArr', $this->mpageArr);
69:
70: $block_handler =& $this->_getHandler();
71: $block_total = $block_handler->getCount();
72: $inactive_block_total = $block_handler->getCount(new Criteria('isactive', 0));
73: $active_block_total = $block_total-$inactive_block_total;
74: $render->setAttribute('BlockTotal', $block_total);
75: $render->setAttribute('ActiveBlockTotal', $active_block_total);
76: $render->setAttribute('InactiveBlockTotal', $inactive_block_total);
77:
78: $active_installed_criteria = new CriteriaCompo(new Criteria('visible', 1));
79: $active_installed_criteria->add(new Criteria('isactive', 1));
80: $active_installed_block_total = $block_handler->getCount($active_installed_criteria);
81: $render->setAttribute('ActiveInstalledBlockTotal', $active_installed_block_total);
82: $render->setAttribute('ActiveUninstalledBlockTotal', $active_block_total - $active_installed_block_total);
83:
84: $inactive_installed_criteria = new CriteriaCompo(new Criteria('visible', 1));
85: $inactive_installed_criteria->add(new Criteria('isactive', 0));
86: $inactive_installed_block_total = $block_handler->getCount($inactive_installed_criteria);
87: $render->setAttribute('InactiveInstalledBlockTotal', $inactive_installed_block_total);
88: $render->setAttribute('InactiveUninstalledBlockTotal', $inactive_block_total - $inactive_installed_block_total);
89:
90: }
91: }
92:
93: ?>
94: