XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
searchAction.class.php
1<?php
12
13if (!defined('XOOPS_ROOT_PATH')) {
14 exit();
15}
16
18{
19 private $mActionform;
20 private $listdata;
21 private $mPagenavi = null;
22 private $mService;
23
24 public function __construct()
25 {
26 parent::__construct();
27 $this->mService = $this->root->mServiceManager->getService('UserSearch');
28 }
29
30 private function getData($request)
31 {
32 $client = $this->root->mServiceManager->createClient($this->mService);
33 $this->listdata = $client->call('getUserList', $request);
34 }
35
36 public function execute()
37 {
38 if (!$this->chk_use()) {
39 $this->setUrl('index.php?action=settings');
40 $this->setErr(_MD_MESSAGE_SETTINGS_MSG5);
41 } else {
42 if (null == $this->mService) {
43 $this->setErr('Service Not loaded.');
44 return;
45 }
46 $this->root->mLanguageManager->loadModuleMessageCatalog('usersearch');
47 require_once XOOPS_MODULE_PATH.'/usersearch/forms/UsersearchForm.class.php';
48 $this->mActionform = new UsersearchForm();
49 $this->mActionform->prepare();
50
51 $this->mActionform->fetch();
52 if (1 == $this->mActionform->get('dosearch')) {
53 $this->mActionform->validate();
54 if ($this->mActionform->hasError()) {
55 $this->setErr($this->mActionform->getErrorMessages());
56 return;
57 }
58 $request = [
59 'uname' => $this->mActionform->get('uname'),
60 'stype' => $this->mActionform->get('searchtype'),
61 'page' => 10,
62 'url' => 'index.php?action=search'
63 ];
64 $this->getData($request);
65 } else {
66 $this->mActionform->set('searchtype', 0);
67 }
68 }
69 }
70
71 public function executeView(&$render)
72 {
73 $render->setTemplateName('message_usersearch.html');
74 $render->setAttribute('mActionform', $this->mActionform);
75 $render->setAttribute('listdata', $this->listdata);
76 }
77}