本文整理汇总了PHP中UnifiedSearchAdvanced::saveGlobalSearchSettings方法的典型用法代码示例。如果您正苦于以下问题:PHP UnifiedSearchAdvanced::saveGlobalSearchSettings方法的具体用法?PHP UnifiedSearchAdvanced::saveGlobalSearchSettings怎么用?PHP UnifiedSearchAdvanced::saveGlobalSearchSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnifiedSearchAdvanced
的用法示例。
在下文中一共展示了UnifiedSearchAdvanced::saveGlobalSearchSettings方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
global $beanList, $beanFiles;
include 'include/modules.php';
//Reload langauge strings
$GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']);
$GLOBALS['app_list_strings'] = return_app_list_strings_language($GLOBALS['current_language']);
$GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], 'Accounts');
//Create an anonymous user for login purposes/
$this->_user = new User();
$this->_user->retrieve('1');
$GLOBALS['current_user'] = $this->_user;
self::$helperObject = new APIv3Helper();
if (file_exists(sugar_cached('modules/unified_search_modules.php'))) {
$this->unified_search_modules_content = file_get_contents(sugar_cached('modules/unified_search_modules.php'));
unlink(sugar_cached('modules/unified_search_modules.php'));
}
require_once 'modules/Home/UnifiedSearchAdvanced.php';
$unifiedSearchAdvanced = new UnifiedSearchAdvanced();
$_REQUEST['enabled_modules'] = 'Accounts,Contacts,Opportunities';
$unifiedSearchAdvanced->saveGlobalSearchSettings();
$GLOBALS['db']->query("DELETE FROM accounts WHERE name like 'UNIT TEST%' ");
$GLOBALS['db']->query("DELETE FROM opportunities WHERE name like 'UNIT TEST%' ");
$GLOBALS['db']->query("DELETE FROM contacts WHERE first_name like 'UNIT TEST%' ");
$GLOBALS['db']->query("DELETE FROM calls WHERE name like 'UNIT TEST%' ");
$GLOBALS['db']->query("DELETE FROM tasks WHERE name like 'UNIT TEST%' ");
$GLOBALS['db']->query("DELETE FROM meetings WHERE name like 'UNIT TEST%' ");
//$this->useOutputBuffering = false;
}
示例2: testFisrtUnifiedSearchWithoutUserPreferences
public function testFisrtUnifiedSearchWithoutUserPreferences()
{
//Enable the Tasks, Accounts and Contacts modules
require_once 'modules/Home/UnifiedSearchAdvanced.php';
$_REQUEST = array();
$_REQUEST['enabled_modules'] = 'Tasks,Accounts,Contacts';
$unifiedSearchAdvanced = new UnifiedSearchAdvanced();
$unifiedSearchAdvanced->saveGlobalSearchSettings();
$_REQUEST = array();
$_REQUEST['advanced'] = 'false';
$unifiedSearchAdvanced->query_stirng = 'blah';
$unifiedSearchAdvanced->search();
global $current_user;
$users_modules = $current_user->getPreference('globalSearch', 'search');
$this->assertTrue(!empty($users_modules), 'Assert we have set the user preferences properly');
$this->assertTrue(isset($users_modules['Tasks']), 'Assert that we have added the Tasks module');
$this->assertEquals(count($users_modules), 3, 'Assert that we have 3 modules in user preferences for global search');
}
示例3: setUp
public function setUp()
{
//Create an anonymous user for login purposes/
$this->_user = SugarTestUserUtilities::createAnonymousUser();
$GLOBALS['current_user'] = $this->_user;
self::$helperObject = new APIv3Helper();
if (file_exists(sugar_cached('modules/unified_search_modules.php'))) {
$this->unified_search_modules_content = file_get_contents(sugar_cached('modules/unified_search_modules.php'));
unlink(sugar_cached('modules/unified_search_modules.php'));
}
require_once 'modules/Home/UnifiedSearchAdvanced.php';
$unifiedSearchAdvanced = new UnifiedSearchAdvanced();
$_REQUEST['enabled_modules'] = 'Accounts,Contacts,Opportunities';
$unifiedSearchAdvanced->saveGlobalSearchSettings();
$GLOBALS['db']->query("DELETE FROM accounts WHERE name like 'UNIT TEST%' ");
$GLOBALS['db']->query("DELETE FROM opportunities WHERE name like 'UNIT TEST%' ");
$GLOBALS['db']->query("DELETE FROM contacts WHERE first_name like 'UNIT TEST%' ");
$GLOBALS['db']->query("DELETE FROM calls WHERE name like 'UNIT TEST%' ");
$GLOBALS['db']->query("DELETE FROM tasks WHERE name like 'UNIT TEST%' ");
$GLOBALS['db']->query("DELETE FROM meetings WHERE name like 'UNIT TEST%' ");
$GLOBALS['db']->commit();
//$this->useOutputBuffering = false;
}
示例4: test_create_unified_search_modules_display
public function test_create_unified_search_modules_display()
{
if (file_exists('custom/modules/unified_search_modules_display.php')) {
unlink('custom/modules/unified_search_modules_display.php');
}
require_once 'modules/UpgradeWizard/uw_utils.php';
$usa = new UnifiedSearchAdvanced();
$_REQUEST['enabled_modules'] = 'Accounts,Bug36845Test';
$usa->saveGlobalSearchSettings();
$this->assertTrue(file_exists('custom/modules/unified_search_modules_display.php'), 'Assert that unified_search_modules_display.php file was created');
}
示例5: testUserPreferencesSearch
public function testUserPreferencesSearch()
{
global $mod_strings, $modListHeader, $app_strings, $beanList, $beanFiles, $current_user;
require 'config.php';
require 'include/modules.php';
$usa = new UnifiedSearchAdvanced();
$_REQUEST['enabled_modules'] = 'Accounts,Contacts';
$usa->saveGlobalSearchSettings();
$current_user->setPreference('globalSearch', array('Accounts', 'Contacts'), 0, 'search');
$current_user->savePreferencesToDB();
$_REQUEST = array();
$_REQUEST['query_string'] = $this->_contact->first_name . ' ' . $this->_contact->last_name;
$_REQUEST['module'] = 'Home';
$usa->search();
$modules = $current_user->getPreference('globalSearch', 'search');
$this->assertEquals(count($modules), 2, 'Assert that there are two modules in the user preferences as defined from the global search');
$this->assertEquals('Accounts', $modules[0], 'Assert that the Accounts module has been added');
$this->assertEquals('Contacts', $modules[1], 'Assert that the Contacts module has been added');
}
示例6: action_saveglobalsearchsettings
/**
* action_saveglobalsearchsettings
*
* This method handles saving the selected modules to display in the Global Search Settings.
* It instantiates an instance of UnifiedSearchAdvanced and then calls the saveGlobalSearchSettings
* method.
*
*/
public function action_saveglobalsearchsettings()
{
global $current_user, $app_strings;
if (!is_admin($current_user)) {
sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
}
try {
require_once 'modules/Home/UnifiedSearchAdvanced.php';
$unifiedSearchAdvanced = new UnifiedSearchAdvanced();
$unifiedSearchAdvanced->saveGlobalSearchSettings();
//Save FTS Settings
$type = !empty($_REQUEST['type']) ? $_REQUEST['type'] : '';
$host = !empty($_REQUEST['host']) ? $_REQUEST['host'] : '';
$port = !empty($_REQUEST['port']) ? $_REQUEST['port'] : '';
$ftsConfig = $this->mergeFtsConfig($type, array('port' => $port, 'host' => $host));
$this->cfg = new Configurator();
$this->cfg->config['full_text_engine'] = '';
$this->cfg->saveConfig();
$ftsConnectionValid = TRUE;
if (!empty($type)) {
//Check if the connection is valid on save:
require_once 'include/SugarSearchEngine/SugarSearchEngineFactory.php';
$searchEngine = SugarSearchEngineFactory::getInstance($type, $ftsConfig);
$result = $searchEngine->getServerStatus();
if (!$result['valid']) {
$ftsConnectionValid = FALSE;
}
// bug 54274 -- only bother with an override if we have data to place there, empty string breaks Sugar On-Demand!
$ftsConfig['valid'] = $ftsConnectionValid;
$this->cfg->config['full_text_engine'] = array($type => $ftsConfig);
$this->cfg->handleOverride();
}
// Refresh the server info & module list sections of the metadata
MetaDataManager::refreshSectionCache(array(MetaDataManager::MM_SERVERINFO, MetaDataManager::MM_MODULES));
if (!$ftsConnectionValid) {
echo $GLOBALS['mod_strings']['LBL_FTS_CONNECTION_INVALID'];
} else {
echo "true";
}
} catch (Exception $ex) {
echo "false";
}
}
示例7: action_saveglobalsearchsettings
/**
* action_saveglobalsearchsettings
*
* This method handles saving the selected modules to display in the Global Search Settings.
* It instantiates an instance of UnifiedSearchAdvanced and then calls the saveGlobalSearchSettings
* method.
*
*/
public function action_saveglobalsearchsettings()
{
global $current_user, $app_strings;
if (!is_admin($current_user)) {
sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
}
try {
require_once 'modules/Home/UnifiedSearchAdvanced.php';
$unifiedSearchAdvanced = new UnifiedSearchAdvanced();
$unifiedSearchAdvanced->saveGlobalSearchSettings();
$return = 'true';
echo $return;
} catch (Exception $ex) {
echo "false";
}
}