XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
AdminBlockOverview.class.php
1<?php
11
12if (!defined('XOOPS_ROOT_PATH')) {
13 exit();
14}
15
17{
18 public function getName()
19 {
20 return 'block_overview';
21 }
22
23 public function getTitle()
24 {
25 return _AD_BLOCK_OVERVIEW;
26 }
27
28 public function getEntryIndex()
29 {
30 return 0;
31 }
32
33 public function isEnableCache()
34 {
35 return false;
36 }
37
38 public function execute()
39 {
40 $root =& XCube_Root::getSingleton();
41 // Catalog Legacy
42 $root->mLanguageManager->loadBlockMessageCatalog('legacy');
43 // Catalog User
44 $root->mLanguageManager->loadModuleAdminMessageCatalog('user');
45
46 $render =& $this->getRenderTarget();
47 // Load theme template ie fallback
48 $render->setAttribute('legacy_module', 'legacy');
49
50 // MODULES OVERVIEW
51 $moduleHandler =& xoops_gethandler('module');
52 //$moduleHandler =& xoops_getmodulehandler('module');
53 $module_total = $moduleHandler->getCount();
54 $active_module_total = $moduleHandler->getCount(new Criteria('isactive', 1));
55 $render->setAttribute('ModuleTotal', $module_total);
56 $render->setAttribute('activeModuleTotal', $active_module_total);
57 $render->setAttribute('inactiveModuleTotal', $module_total - $active_module_total);
58
59 // BLOCKS
60 $block_handler =& xoops_getmodulehandler('newblocks','legacy');
61 $block_total = $block_handler->getCount();
62 $inactive_block_total = $block_handler->getCount(new Criteria('isactive', 0));
63 $active_block_total = $block_total-$inactive_block_total;
64 $render->setAttribute('BlockTotal', $block_total);
65 $render->setAttribute('ActiveBlockTotal', $active_block_total);
66 $render->setAttribute('InactiveBlockTotal', $inactive_block_total);
67
68 $active_installed_criteria = new CriteriaCompo(new Criteria('visible', 1));
69 $active_installed_criteria->add(new Criteria('isactive', 1));
70 $active_installed_block_total = $block_handler->getCount($active_installed_criteria);
71 $render->setAttribute('ActiveInstalledBlockTotal', $active_installed_block_total);
72 $render->setAttribute('ActiveUninstalledBlockTotal', $active_block_total - $active_installed_block_total);
73
74 $inactive_installed_criteria = new CriteriaCompo(new Criteria('visible', 1));
75 $inactive_installed_criteria->add(new Criteria('isactive', 0));
76 $inactive_installed_block_total = $block_handler->getCount($inactive_installed_criteria);
77 $render->setAttribute('InactiveInstalledBlockTotal', $inactive_installed_block_total);
78 $render->setAttribute('InactiveUninstalledBlockTotal', $inactive_block_total - $inactive_installed_block_total);
79
80 // Users
81 $member_handler =& xoops_getmodulehandler('users', 'user');
82 $active_total = $member_handler->getCount(new Criteria('level', 0, '>'));
83 $inactive_total = $member_handler->getCount(new Criteria('level', 0));
84 $render->setAttribute('activeUserTotal', $active_total);
85 $render->setAttribute('inactiveUserTotal', $inactive_total);
86 $render->setAttribute('UserTotal', $active_total+$inactive_total);
87
88 $render->setAttribute('blockid', $this->getName());
89
90 $render->setTemplateName('legacy_admin_block_overview.html');
91
92 $renderSystem =& $root->getRenderSystem($this->getRenderSystemName());
93
94 // Render as block
95 $renderSystem->renderBlock($render);
96 }
97
98 public function hasResult()
99 {
100 return true;
101 }
102
103 public function &getResult()
104 {
105 $dmy = 'dummy';
106 return $dmy;
107 }
108
109 public function getRenderSystemName()
110 {
111 return 'Legacy_AdminRenderSystem';
112 }
113}
114
115