当前位置: 首页>>代码示例>>PHP>>正文


PHP ConnectorUtils::isSourceEnabled方法代码示例

本文整理汇总了PHP中ConnectorUtils::isSourceEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectorUtils::isSourceEnabled方法的具体用法?PHP ConnectorUtils::isSourceEnabled怎么用?PHP ConnectorUtils::isSourceEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConnectorUtils的用法示例。


在下文中一共展示了ConnectorUtils::isSourceEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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');
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:51,代码来源:view.searchproperties.php

示例2: display

 /**
  * @see SugarView::display()
  */
 public function display()
 {
     require_once 'include/connectors/utils/ConnectorUtils.php';
     require_once 'include/connectors/sources/SourceFactory.php';
     $connector_strings = ConnectorUtils::getConnectorStrings($_REQUEST['source_id']);
     $sources = ConnectorUtils::getConnectors();
     $source_id = $_REQUEST['source_id'];
     $source = SourceFactory::getSource($source_id);
     $is_enabled = ConnectorUtils::isSourceEnabled($source_id);
     $script = '';
     $display_data = array();
     if ($is_enabled) {
         $mapping = $source->getMapping();
         $source_defs = $source->getFieldDefs();
         //Create the Javascript code to dynamically add the tables
         $json = getJSONobj();
         foreach ($mapping['beans'] as $module => $field_mapping) {
             $mod_strings = return_module_language($GLOBALS['current_language'], $module);
             $bean = loadBean($module);
             if (!is_object($bean)) {
                 continue;
             }
             $field_defs = $bean->getFieldDefinitions();
             $available_fields = array();
             $labels = array();
             $duplicate_labels = array();
             foreach ($field_defs as $id => $def) {
                 //We are filtering out some fields here
                 if ($def['type'] == 'relate' || $def['type'] == 'link' || isset($def['dbType']) && $def['dbType'] == 'id') {
                     continue;
                 }
                 if (isset($def['vname'])) {
                     $available_fields[$id] = !empty($mod_strings[$def['vname']]) ? $mod_strings[$def['vname']] : $id;
                 } else {
                     $available_fields[$id] = $id;
                 }
                 //Remove the ':' character in some labels
                 if (preg_match('/\\:$/', $available_fields[$id])) {
                     $available_fields[$id] = substr($available_fields[$id], 0, strlen($available_fields[$id]) - 1);
                 }
                 if (isset($labels[$available_fields[$id]])) {
                     $duplicate_labels[$labels[$available_fields[$id]]] = $labels[$available_fields[$id]];
                     $duplicate_labels[$id] = $id;
                 } else {
                     $labels[$available_fields[$id]] = $id;
                 }
             }
             foreach ($duplicate_labels as $id) {
                 $available_fields[$id] = $available_fields[$id] . " ({$id})";
             }
             asort($available_fields);
             $field_keys = array();
             $field_values = array();
             $source_fields = array();
             foreach ($field_mapping as $id => $field) {
                 if (!empty($source_defs[$id])) {
                     $source_fields[$id] = $source_defs[$id];
                 }
             }
             $source_fields = array_merge($source_fields, $source_defs);
             foreach ($source_fields as $id => $def) {
                 if (empty($def['hidden'])) {
                     $field_keys[strtolower($id)] = !empty($connector_strings[$source_fields[$id]['vname']]) ? $connector_strings[$source_fields[$id]['vname']] : $id;
                     $field_values[] = !empty($field_mapping[strtolower($id)]) ? $field_mapping[strtolower($id)] : '';
                 }
             }
             $display_data[$module] = array('field_keys' => $field_keys, 'field_values' => $field_values, 'available_fields' => $available_fields, 'field_mapping' => $field_mapping);
         }
     }
     $this->ss->assign('display_data', $display_data);
     $this->ss->assign('empty_mapping', empty($display_data) ? true : false);
     $this->ss->assign('dynamic_script', $script);
     $this->ss->assign('sources', $sources);
     $this->ss->assign('mod', $GLOBALS['mod_strings']);
     $this->ss->assign('APP', $GLOBALS['app_strings']);
     $this->ss->assign('source_id', $source_id);
     $this->ss->assign('source_name', $sources[$source_id]['name']);
     $this->ss->assign('theme', $GLOBALS['theme']);
     echo $this->ss->fetch('modules/Connectors/tpls/mapping_properties.tpl');
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:83,代码来源:view.mappingproperties.php


注:本文中的ConnectorUtils::isSourceEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。