1: <?php
2: if (!defined('XOOPS_ROOT_PATH')) exit();
3:
4: class searchAction extends AbstractAction
5: {
6: private $mActionform;
7: private $listdata;
8: private $mPagenavi = null;
9: private $mService;
10:
11: public function __construct()
12: {
13: parent::__construct();
14: $this->mService = $this->root->mServiceManager->getService('UserSearch');
15:
16: }
17:
18: private function getData($request)
19: {
20: $client = $this->root->mServiceManager->createClient($this->mService);
21: $this->listdata = $client->call('getUserList', $request);
22: }
23:
24: public function execute()
25: {
26: if ( !$this->chk_use() ) {
27: $this->setUrl('index.php?action=settings');
28: $this->setErr(_MD_MESSAGE_SETTINGS_MSG5);
29: } else {
30: if ( $this->mService == null ) {
31: $this->setErr('Service Not loaded.');
32: return;
33: }
34: $this->root->mLanguageManager->loadModuleMessageCatalog('usersearch');
35: require_once XOOPS_MODULE_PATH.'/usersearch/forms/UsersearchForm.class.php';
36: $this->mActionform = new UsersearchForm();
37: $this->mActionform->prepare();
38:
39: $this->mActionform->fetch();
40: if ( $this->mActionform->get('dosearch') == 1 ) {
41: $this->mActionform->validate();
42: if ($this->mActionform->hasError()) {
43: $this->setErr($this->mActionform->getErrorMessages());
44: return;
45: }
46: $request = array(
47: 'uname' => $this->mActionform->get('uname'),
48: 'stype' => $this->mActionform->get('searchtype'),
49: 'page' => 10,
50: 'url' => 'index.php?action=search'
51: );
52: $this->getData($request);
53: } else {
54: $this->mActionform->set('searchtype', 0);
55: }
56: }
57: }
58:
59: public function executeView(&$render)
60: {
61: $render->setTemplateName('message_usersearch.html');
62: $render->setAttribute('mActionform', $this->mActionform);
63: $render->setAttribute('listdata', $this->listdata);
64: }
65: }
66: ?>
67: