本文整理汇总了PHP中ConnectorUtils::getViewDefs方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectorUtils::getViewDefs方法的具体用法?PHP ConnectorUtils::getViewDefs怎么用?PHP ConnectorUtils::getViewDefs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectorUtils
的用法示例。
在下文中一共展示了ConnectorUtils::getViewDefs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* @see SugarView::display()
*/
public function display()
{
if (!empty($_REQUEST['record'])) {
$module = $_SESSION['merge_module'];
$field_count = 1;
$diff_field_count = 0;
require_once 'include/connectors/utils/ConnectorUtils.php';
$sources = ConnectorUtils::getModuleConnectors($module);
$source_names = array();
$source_names['module']['name'] = $this->_leadQual->merge_bean->name;
$result_beans = array();
require_once 'include/connectors/ConnectorFactory.php';
$index = 1;
$viewdef_sources = array();
foreach ($sources as $source_id => $source_info) {
if (!empty($_REQUEST[$source_id . '_id'])) {
$viewdef_sources[$source_id] = true;
$source_instance = ConnectorFactory::getInstance($source_id);
try {
$bean = $source_instance->fillBean(array('id' => $_REQUEST[$source_id . '_id']), $module);
} catch (Exception $ex) {
echo $ex->getMessage();
continue;
}
$result_beans[$index] = $bean;
$source_names[$index]['name'] = $source_info['name'];
$source_names[$index]['color'] = $this->_getRandomColor($index);
$source_names[$index]['id'] = $index;
$index++;
if (!empty($bean->parent_duns) && (!empty($bean->duns) && $bean->parent_duns != $bean->duns)) {
//go get the parent as well.
$parent_bean = $source_instance->fillBean(array('id' => $bean->parent_duns), $module);
$result_beans[$index] = $parent_bean;
$source_names[$index]['name'] = $source_info['name'];
$source_names[$index]['color'] = $this->_getRandomColor($index);
$source_names[$index]['id'] = $index;
$index++;
}
}
}
$viewdefs = ConnectorUtils::getViewDefs($viewdef_sources);
if (empty($viewdefs['Connector']['MergeView'][$module])) {
return;
}
$merge_fields = array();
$focusBean = BeanFactory::getBean($module);
foreach ($viewdefs['Connector']['MergeView'][$module] as $field) {
if ($focusBean->field_defs[$field]['type'] == 'relate') {
continue;
}
$merge_fields[$field] = isset($focusBean->field_defs[$field]['vname']) ? $focusBean->field_defs[$field]['vname'] : $field;
}
//do not show the id on the merge screen
if (!empty($merge_fields['id'])) {
unset($merge_fields['id']);
}
$this->ss->assign('merge_fields', $merge_fields);
$this->ss->assign('record_name', $this->_leadQual->merge_bean->name);
$this->ss->assign('source_names', $source_names);
$this->ss->assign('result_beans', $result_beans);
$this->ss->assign('record', $this->_leadQual->merge_bean);
$this->ss->assign('merge_module', $module);
$this->ss->assign('mod', $GLOBALS['mod_strings']);
echo $this->getModuleTitle(false);
$this->ss->display($this->getCustomFilePathIfExists('modules/Connectors/tpls/step2.tpl'));
}
}