[*] BO : the global search now looks into the modules

This commit is contained in:
DamienMetzger
2012-11-22 17:40:56 +01:00
parent d2023a5105
commit 849b96ab9c
3 changed files with 46 additions and 2 deletions
@@ -132,6 +132,17 @@ class AdminSearchControllerCore extends AdminController
}
/* IP */
// 6 - but it is included in the customer block
/* Module search */
if (!$searchType || $searchType == 7)
{
/* Handle module name */
if ($searchType == 7 && Validate::isModuleName($this->query) AND ($module = Module::getInstanceByName($this->query)) && Validate::isLoadedObject($module))
Tools::redirectAdmin('index.php?tab=AdminModules&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).'&token='.Tools::getAdminTokenLite('AdminModules'));
/* Normal catalog search */
$this->searchModule();
}
}
$this->display = 'view';
}
@@ -168,6 +179,18 @@ class AdminSearchControllerCore extends AdminController
{
$this->_list['customers'] = Customer::searchByName($this->query);
}
public function searchModule()
{
$this->_list['modules'] = array();
$all_modules = Module::getModulesOnDisk(true, true, Context::getContext()->employee->id);
foreach ($all_modules as $module)
if (stripos($module->name, $this->query) || stripos($module->displayName, $this->query) || stripos($module->description, $this->query))
{
$module->linkto = 'index.php?tab=AdminModules&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).'&token='.Tools::getAdminTokenLite('AdminModules');
$this->_list['modules'][] = $module;
}
}
/**
* Search a feature in all store
@@ -360,6 +383,10 @@ class AdminSearchControllerCore extends AdminController
$view = $helper->generateList($this->_list['orders'], $this->fields_list['orders']);
$this->tpl_view_vars['orders'] = $view;
}
if (isset($this->_list['modules']))
$this->tpl_view_vars['modules'] = $this->_list['modules'];
return parent::renderView();
}
}