XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
SearchAction.class.php
1<?php
11
12if (!defined('XOOPS_ROOT_PATH')) {
13 exit();
14}
15
16require_once XOOPS_MODULE_PATH . '/legacy/actions/SearchResultsAction.class.php';
17require_once XOOPS_MODULE_PATH . '/legacy/forms/SearchResultsForm.class.php';
18
19
21{
22 public function getDefaultView(&$controller, &$xoopsUser)
23 {
24 $root =& $controller->mRoot;
25 $service =& $root->mServiceManager->getService('LegacySearch');
26
27 if (is_object($service)) {
28 $client =& $root->mServiceManager->createClient($service);
29 $this->mModules = $client->call('getActiveModules', []);
30 }
31
32 return LEGACY_FRAME_VIEW_INDEX;
33 }
34
35 public function _getSelectedMids()
36 {
37 $ret = [];
38 foreach (array_keys($this->mModules) as $key) {
39 $ret[] = $this->mModules[$key]['mid'];
40 }
41
42 return $ret;
43 }
44
45 public function executeViewIndex(&$controller, &$xoopsUser, &$render)
46 {
47 $render->setTemplateName('legacy_search_form.html');
48
49 $render->setAttribute('actionForm', $this->mActionForm);
50
51 $render->setAttribute('moduleArr', $this->mModules);
52
53 //
54 // If the request include $mids, setAttribute it. If it don't include,
55 // setAttribute $mid or $this->mModules.
56 //
57 $render->setAttribute('selectedMidArr', $this->_getSelectedMids());
58 $render->setAttribute('searchRuleMessage', @sprintf(_SR_KEYTOOSHORT, $this->mConfig['keyword_min']));
59 }
60}