XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
UserSearchAction.class.php
1<?php
7
8if (!defined('XOOPS_ROOT_PATH')) {
9 exit();
10}
11
12require_once XOOPS_MODULE_PATH . '/user/admin/forms/UserSearchForm.class.php';
13
14class User_UserSearchAction extends User_Action
15{
16 public $mActionForm = null;
17
18 public function prepare(&$controller, &$xoopsUser, $moduleConfig)
19 {
20 $this->mActionForm =new User_UserSearchForm();
21 $this->mActionForm->prepare();
22 }
23
24 public function getDefaultView(&$controller, &$xoopsUser)
25 {
26 $this->mActionForm->fetch();
27
28 return USER_FRAME_VIEW_INPUT;
29 }
30
31 public function executeViewInput(&$controller, &$xoopsUser, &$render)
32 {
33 $render->setTemplateName('user_search.html');
34 $render->setAttribute('actionForm', $this->mActionForm);
35
36 $groupHandler =& xoops_gethandler('group');
37 $groups =& $groupHandler->getObjects(null, true);
38
39 $groupOptions = [];
40 foreach ($groups as $gid => $group) {
41 $groupOptions[$gid] = $group->getVar('name');
42 }
43
44 $matchOptions = [];
45 $matchArray = [XOOPS_MATCH_START => _STARTSWITH, XOOPS_MATCH_END => _ENDSWITH, XOOPS_MATCH_EQUAL => _MATCHES, XOOPS_MATCH_CONTAIN => _CONTAINS];
46 foreach ($matchArray as $key => $value) {
47 $matchOptions[$key] = $value;
48 }
49
50 $render->setAttribute('groupOptions', $groupOptions);
51 $render->setAttribute('matchOptions', $matchOptions);
52
53 $member_handler =& xoops_gethandler('member');
54 $active_total = $member_handler->getUserCount(new Criteria('level', 0, '>'));
55 $inactive_total = $member_handler->getUserCount(new Criteria('level', 0));
56 $render->setAttribute('activeUserTotal', $active_total);
57 $render->setAttribute('inactiveUserTotal', $inactive_total);
58 $render->setAttribute('UserTotal', $active_total+$inactive_total);
59 }
60}