本文整理汇总了PHP中ConnectorUtils::getConnectors方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectorUtils::getConnectors方法的具体用法?PHP ConnectorUtils::getConnectors怎么用?PHP ConnectorUtils::getConnectors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectorUtils
的用法示例。
在下文中一共展示了ConnectorUtils::getConnectors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display()
{
global $mod_strings, $app_strings;
require_once 'include/connectors/utils/ConnectorUtils.php';
require_once 'include/connectors/sources/SourceFactory.php';
$sugar_smarty = new Sugar_Smarty();
$sugar_smarty->assign('mod', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors(true);
$required_fields = array();
//Get required fields for first connector only
foreach ($connectors as $id => $entry) {
$s = SourceFactory::getSource($id);
$connector_strings = ConnectorUtils::getConnectorStrings($id);
$fields = $s->getRequiredConfigFields();
foreach ($fields as $field_id) {
$label = isset($connector_strings[$field_id]) ? $connector_strings[$field_id] : $field_id;
$required_fields[$id][$field_id] = $label;
}
break;
}
$sugar_smarty->assign('SOURCES', $connectors);
$sugar_smarty->assign('REQUIRED_FIELDS', $required_fields);
echo get_module_title('Connectors', $mod_strings['LBL_MODIFY_PROPERTIES_PAGE_TITLE'], true);
$sugar_smarty->display('modules/Connectors/tpls/modify_properties.tpl');
}
示例2: display
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_strings;
require_once 'include/connectors/utils/ConnectorUtils.php';
require_once 'include/connectors/sources/SourceFactory.php';
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors(true);
$required_fields = array();
//Get required fields for first connector only
$connectorsToShow = $connectors;
foreach ($connectors as $id => $entry) {
$s = SourceFactory::getSource($id);
$connector_strings = ConnectorUtils::getConnectorStrings($id);
$fields = $s->getRequiredConfigFields();
if (!$s->isEnabledInAdminProperties() || empty($fields)) {
unset($connectorsToShow[$id]);
} else {
if (empty($required_fields)) {
foreach ($fields as $field_id) {
$label = isset($connector_strings[$field_id]) ? $connector_strings[$field_id] : $field_id;
$required_fields[$id][$field_id] = $label;
}
}
}
}
$this->ss->assign('SOURCES', $connectorsToShow);
$this->ss->assign('REQUIRED_FIELDS', $required_fields);
// Handle active tab selection
$active_tab = isset($_REQUEST['active_tab']) ? $_REQUEST['active_tab'] : null;
$this->ss->assign('ACTIVE_TAB', $active_tab);
echo $this->getModuleTitle(false);
$this->ss->display($this->getCustomFilePathIfExists('modules/Connectors/tpls/modify_properties.tpl'));
}
示例3: display
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_strings;
require_once 'include/connectors/utils/ConnectorUtils.php';
require_once 'include/connectors/sources/SourceFactory.php';
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors(true);
$required_fields = array();
//Get required fields for first connector only
$connectorsToShow = $connectors;
foreach ($connectors as $id => $entry) {
$s = SourceFactory::getSource($id);
$connector_strings = ConnectorUtils::getConnectorStrings($id);
$fields = $s->getRequiredConfigFields();
if (empty($fields)) {
unset($connectorsToShow[$id]);
} else {
if (empty($required_fields)) {
foreach ($fields as $field_id) {
$label = isset($connector_strings[$field_id]) ? $connector_strings[$field_id] : $field_id;
$required_fields[$id][$field_id] = $label;
}
}
}
}
$this->ss->assign('SOURCES', $connectorsToShow);
$this->ss->assign('REQUIRED_FIELDS', $required_fields);
echo $this->getModuleTitle();
$this->ss->display('modules/Connectors/tpls/modify_properties.tpl');
}
示例4: testConnectorFailsNullGracefully
function testConnectorFailsNullGracefully()
{
//now write a connector file with missing array info instead of an array for the connector var
file_put_contents($this->custom_path . '/connectors.php', "<?php\n ");
//create the connector and call getConnectors
$cu = new ConnectorUtils();
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $cu->getConnectors(true), 'ConnectorsUtils::getConnectors() failed to return an array when connectors array was missing. ');
}
示例5: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
$source = $_REQUEST['source_id'];
$sources = ConnectorUtils::getConnectors();
$modules_sources = ConnectorUtils::getDisplayConfig();
//$json = getJSONobj();
$enabled_modules = array();
$disabled_modules = array();
//Find all modules this source has been enabled for
foreach ($modules_sources as $module => $mapping) {
foreach ($modules_sources[$module] as $entry) {
if ($entry == $source) {
$enabled_modules[$module] = $module;
}
}
}
global $moduleList, $beanList;
//Do filtering here?
$count = 0;
global $current_user;
$access = $current_user->getDeveloperModules();
$d = dir('modules');
while ($e = $d->read()) {
if (substr($e, 0, 1) == '.' || !is_dir('modules/' . $e)) {
continue;
}
if (empty($enabled_modules[$e]) && file_exists('modules/' . $e . '/metadata/studio.php') && file_exists('modules/' . $e . '/metadata/detailviewdefs.php') && isset($GLOBALS['beanList'][$e]) && (in_array($e, $access) || is_admin($current_user))) {
$disabled_modules[$e] = $e;
}
}
$s = SourceFactory::getSource($source);
// Not all sources can be connected to all modules
$enabled_modules = $s->filterAllowedModules($enabled_modules);
$disabled_modules = $s->filterAllowedModules($disabled_modules);
asort($enabled_modules);
asort($disabled_modules);
//$enabled = $json->encode($enabled_modules);
//$disabled = $json->encode($disabled_modules);
//$script = "addTable('{$module}', '{$enabled}', '{$disabled}', '{$source}', '{$GLOBALS['theme']}');\n";
//$this->ss->assign('new_modules_sources', $modules_sources);
//$this->ss->assign('dynamic_script', $script);
$this->ss->assign('enabled_modules', $enabled_modules);
$this->ss->assign('disabled_modules', $disabled_modules);
$this->ss->assign('source_id', $source);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('theme', $GLOBALS['theme']);
$this->ss->assign('external', !empty($sources[$source]['eapm']));
$this->ss->assign('externalOnly', !empty($sources[$source]['eapm']['only']));
// We don't want to tell the user to set the properties of the connector if there aren't any
$fields = $s->getRequiredConfigFields();
$this->ss->assign('externalHasProperties', !empty($fields));
$this->ss->assign('externalChecked', !empty($sources[$source]['eapm']['enabled']) ? " checked" : "");
echo $this->ss->fetch('modules/Connectors/tpls/display_properties.tpl');
}
示例6: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
$sources = ConnectorUtils::getConnectors();
$this->ss->assign('SOURCES', $sources);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('theme', $GLOBALS['theme']);
echo $this->getModuleTitle();
$this->ss->display('modules/Connectors/tpls/modify_display.tpl');
}
示例7: display
function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
$sources = ConnectorUtils::getConnectors();
$this->ss->assign('SOURCES', $sources);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('theme', $GLOBALS['theme']);
echo get_module_title('Connectors', $GLOBALS['mod_strings']['LBL_MODIFY_DISPLAY_PAGE_TITLE'], true);
$this->ss->display('modules/Connectors/tpls/modify_display.tpl');
}
示例8: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
$source = $_REQUEST['source_id'];
$sources = ConnectorUtils::getConnectors();
$modules_sources = ConnectorUtils::getDisplayConfig();
$enabled_modules = array();
$disabled_modules = array();
//Find all modules this source has been enabled for
foreach ($modules_sources as $module => $mapping) {
foreach ($modules_sources[$module] as $entry) {
if ($entry == $source) {
$enabled_modules[$module] = isset($GLOBALS['app_list_strings']['moduleList'][$module]) ? $GLOBALS['app_list_strings']['moduleList'][$module] : $module;
}
}
}
global $moduleList, $beanList;
//Do filtering here?
$count = 0;
global $current_user;
$access = $current_user->getDeveloperModules();
foreach (SugarAutoLoader::getDirFiles("modules", true) as $e) {
//Strip the 'modules/' portion out from beginning of $e
$e = substr($e, 8);
if (empty($enabled_modules[$e]) && SugarAutoLoader::existingCustomOne("modules/{$e}/metadata/studio.php") && SugarAutoLoader::fileExists('modules/' . $e . '/metadata/detailviewdefs.php') && isset($GLOBALS['beanList'][$e]) && (in_array($e, $access) || is_admin($current_user))) {
$disabled_modules[$e] = isset($GLOBALS['app_list_strings']['moduleList'][$e]) ? $GLOBALS['app_list_strings']['moduleList'][$e] : $e;
}
}
$s = SourceFactory::getSource($source);
// Not all sources can be connected to all modules
$enabled_modules = $s->filterAllowedModules($enabled_modules);
$disabled_modules = $s->filterAllowedModules($disabled_modules);
asort($enabled_modules);
asort($disabled_modules);
//$enabled = $json->encode($enabled_modules);
//$disabled = $json->encode($disabled_modules);
//$script = "addTable('{$module}', '{$enabled}', '{$disabled}', '{$source}', '{$GLOBALS['theme']}');\n";
//$this->ss->assign('new_modules_sources', $modules_sources);
//$this->ss->assign('dynamic_script', $script);
$this->ss->assign('enabled_modules', $enabled_modules);
$this->ss->assign('disabled_modules', $disabled_modules);
$this->ss->assign('source_id', $source);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('theme', $GLOBALS['theme']);
$this->ss->assign('external', !empty($sources[$source]['eapm']));
$this->ss->assign('externalOnly', !empty($sources[$source]['eapm']['only']));
// We don't want to tell the user to set the properties of the connector if there aren't any
$fields = $s->getRequiredConfigFields();
$this->ss->assign('externalHasProperties', !empty($fields));
$this->ss->assign('externalChecked', !empty($sources[$source]['eapm']['enabled']) ? " checked" : "");
echo $this->ss->fetch($this->getCustomFilePathIfExists('modules/Connectors/tpls/display_properties.tpl'));
}
示例9: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
require_once 'include/connectors/sources/SourceFactory.php';
global $mod_strings, $app_strings;
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors(true);
$this->ss->assign('SOURCES', $connectors);
echo $this->getModuleTitle();
$this->ss->display('modules/Connectors/tpls/modify_mapping.tpl');
}
示例10: display
function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
require_once 'include/connectors/sources/SourceFactory.php';
global $mod_strings, $app_strings;
$sugar_smarty = new Sugar_Smarty();
$sugar_smarty->assign('mod', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors(true);
$sugar_smarty->assign('SOURCES', $connectors);
echo get_module_title('Connectors', $mod_strings['LBL_MODIFY_MAPPING_PAGE_TITLE'], true);
$sugar_smarty->display('modules/Connectors/tpls/modify_mapping.tpl');
}
示例11: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
require_once 'include/connectors/sources/SourceFactory.php';
$source_id = $_REQUEST['source_id'];
$connector_strings = ConnectorUtils::getConnectorStrings($source_id);
$is_enabled = ConnectorUtils::isSourceEnabled($source_id);
$modules_sources = array();
$sources = ConnectorUtils::getConnectors();
$display_data = array();
if ($is_enabled) {
$searchDefs = ConnectorUtils::getSearchDefs();
$searchDefs = !empty($searchDefs[$_REQUEST['source_id']]) ? $searchDefs[$_REQUEST['source_id']] : array();
$source = SourceFactory::getSource($_REQUEST['source_id']);
$field_defs = $source->getFieldDefs();
//Create the Javascript code to dynamically add the tables
$json = getJSONobj();
foreach ($searchDefs as $module => $fields) {
$disabled = array();
$enabled = array();
$enabled_fields = array_flip($fields);
$field_keys = array_keys($field_defs);
foreach ($field_keys as $index => $key) {
if (!empty($field_defs[$key]['hidden']) || empty($field_defs[$key]['search'])) {
continue;
}
if (!isset($enabled_fields[$key])) {
$disabled[$key] = !empty($connector_strings[$field_defs[$key]['vname']]) ? $connector_strings[$field_defs[$key]['vname']] : $key;
} else {
$enabled[$key] = !empty($connector_strings[$field_defs[$key]['vname']]) ? $connector_strings[$field_defs[$key]['vname']] : $key;
}
}
$modules_sources[$module] = array_merge($enabled, $disabled);
asort($disabled);
$display_data[$module] = array('enabled' => $enabled, 'disabled' => $disabled);
}
}
$this->ss->assign('no_searchdefs_defined', !$is_enabled);
$this->ss->assign('display_data', $display_data);
$this->ss->assign('modules_sources', $modules_sources);
$this->ss->assign('sources', $sources);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('source_id', $_REQUEST['source_id']);
$this->ss->assign('theme', $GLOBALS['theme']);
$this->ss->assign('connector_language', $connector_strings);
echo $this->ss->fetch('modules/Connectors/tpls/search_properties.tpl');
}
示例12: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
$connectors = ConnectorUtils::getConnectors(true);
foreach ($connectors as $id => $source) {
$s = SourceFactory::getSource($id);
if (!$s->isEnabledInAdminDisplay()) {
unset($connectors[$id]);
}
}
$this->ss->assign('SOURCES', $connectors);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('theme', $GLOBALS['theme']);
echo $this->getModuleTitle(false);
$this->ss->display($this->getCustomFilePathIfExists('modules/Connectors/tpls/modify_display.tpl'));
}
示例13: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
$source = $_REQUEST['source_id'];
$sources = ConnectorUtils::getConnectors();
$modules_sources = ConnectorUtils::getDisplayConfig();
//$json = getJSONobj();
$enabled_modules = array();
$disabled_modules = array();
//Find all modules this source has been enabled for
foreach ($modules_sources as $module => $mapping) {
foreach ($modules_sources[$module] as $entry) {
if ($entry == $source) {
$enabled_modules[$module] = $module;
}
}
}
global $moduleList, $beanList;
//Do filtering here?
$count = 0;
global $current_user;
$access = get_admin_modules_for_user($current_user);
$d = dir('modules');
while ($e = $d->read()) {
if (substr($e, 0, 1) == '.' || !is_dir('modules/' . $e)) {
continue;
}
if (empty($enabled_modules[$e]) && file_exists('modules/' . $e . '/metadata/studio.php') && file_exists('modules/' . $e . '/metadata/detailviewdefs.php') && isset($GLOBALS['beanList'][$e]) && (in_array($e, $access) || is_admin($current_user))) {
$disabled_modules[$e] = $e;
}
}
asort($enabled_modules);
asort($disabled_modules);
//$enabled = $json->encode($enabled_modules);
//$disabled = $json->encode($disabled_modules);
//$script = "addTable('{$module}', '{$enabled}', '{$disabled}', '{$source}', '{$GLOBALS['theme']}');\n";
//$this->ss->assign('new_modules_sources', $modules_sources);
//$this->ss->assign('dynamic_script', $script);
$this->ss->assign('enabled_modules', $enabled_modules);
$this->ss->assign('disabled_modules', $disabled_modules);
$this->ss->assign('source_id', $source);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
$this->ss->assign('theme', $GLOBALS['theme']);
echo $this->ss->fetch('modules/Connectors/tpls/display_properties.tpl');
}
示例14: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
global $mod_strings, $app_strings;
$sugar_smarty = new Sugar_Smarty();
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors();
foreach ($connectors as $id => $source) {
$s = SourceFactory::getSource($id);
if (!$s->isEnabledInAdminSearch() || !$s->isEnabledInWizard()) {
unset($connectors[$id]);
}
}
$this->ss->assign('SOURCES', $connectors);
echo $this->getModuleTitle(false);
$this->ss->display($this->getCustomFilePathIfExists('modules/Connectors/tpls/modify_search.tpl'));
}
示例15: display
/**
* @see SugarView::display()
*/
public function display()
{
require_once 'include/connectors/utils/ConnectorUtils.php';
require_once 'include/connectors/sources/SourceFactory.php';
global $mod_strings, $app_strings;
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('APP', $app_strings);
$connectors = ConnectorUtils::getConnectors(true);
foreach ($connectors as $id => $source) {
$s = SourceFactory::getSource($id);
$mapping = $s->getMapping();
if (!$s->isEnabledInAdminMapping() || empty($mapping)) {
unset($connectors[$id]);
}
}
$this->ss->assign('SOURCES', $connectors);
echo $this->getModuleTitle(false);
$this->ss->display($this->getCustomFilePathIfExists('modules/Connectors/tpls/modify_mapping.tpl'));
}