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


PHP ConnectorUtils::getDisplayConfig方法代码示例

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


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

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

示例2: 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'));
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:56,代码来源:view.displayproperties.php

示例3: 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');
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:49,代码来源:view.displayproperties.php

示例4: action_SaveModifyDisplay

 function action_SaveModifyDisplay()
 {
     if (empty($_REQUEST['display_sources'])) {
         return;
     }
     require_once 'include/connectors/utils/ConnectorUtils.php';
     require_once 'include/connectors/sources/SourceFactory.php';
     $connectors = ConnectorUtils::getConnectors();
     $connector_keys = array_keys($connectors);
     $modules_sources = ConnectorUtils::getDisplayConfig();
     if (!is_array($modules_sources)) {
         $modules_sources = (array) $modules_sources;
     }
     $sources = array();
     $values = array();
     $new_modules_sources = array();
     if (!empty($_REQUEST['display_values'])) {
         $display_values = explode(',', $_REQUEST['display_values']);
         foreach ($display_values as $value) {
             $entry = explode(':', $value);
             $new_modules_sources[$entry[1]][$entry[0]] = $entry[0];
         }
     }
     //These are the sources that were modified.
     //We only update entries for these sources that have been changed
     $display_sources = explode(',', $_REQUEST['display_sources']);
     foreach ($display_sources as $source) {
         $sources[$source] = $source;
     }
     //foreach
     $removedModules = array();
     //Unset entries that have all sources removed
     foreach ($modules_sources as $module => $source_entries) {
         foreach ($source_entries as $source_id) {
             if (!empty($sources[$source_id]) && empty($new_modules_sources[$module][$source_id])) {
                 unset($modules_sources[$module][$source_id]);
                 $removedModules[$module] = true;
             }
         }
     }
     $removedModules = array_keys($removedModules);
     foreach ($removedModules as $key) {
         if (empty($new_modules_sources[$key])) {
             ConnectorUtils::cleanMetaDataFile($key);
         }
     }
     //Update based on new_modules_sources
     foreach ($new_modules_sources as $module => $enabled_sources) {
         //If the module is not in $modules_sources add it there
         if (empty($modules_sources[$module])) {
             $modules_sources[$module] = $enabled_sources;
         } else {
             foreach ($enabled_sources as $source_id) {
                 if (empty($modules_sources[$module][$source_id])) {
                     $modules_sources[$module][$source_id] = $source_id;
                 }
             }
             //foreach
         }
     }
     //foreach
     //Should we just remove entries where all sources are disabled?
     $unset_modules = array();
     foreach ($modules_sources as $module => $mapping) {
         if (empty($mapping)) {
             $unset_modules[] = $module;
         }
     }
     foreach ($unset_modules as $mod) {
         unset($modules_sources[$mod]);
     }
     if (!write_array_to_file('modules_sources', $modules_sources, CONNECTOR_DISPLAY_CONFIG_FILE)) {
         //Log error and return empty array
         $GLOBALS['log']->fatal("Cannot write \$modules_sources to " . CONNECTOR_DISPLAY_CONFIG_FILE);
     }
     $sources_modules = array();
     foreach ($modules_sources as $module => $source_entries) {
         foreach ($source_entries as $id) {
             $sources_modules[$id][$module] = $module;
         }
     }
     //Now update the searchdefs and field mapping entries accordingly
     require 'modules/Connectors/metadata/searchdefs.php';
     $originalSearchDefs = $searchdefs;
     $connectorSearchDefs = ConnectorUtils::getSearchDefs();
     $searchdefs = array();
     foreach ($sources_modules as $source_id => $modules) {
         foreach ($modules as $module) {
             $searchdefs[$source_id][$module] = !empty($connectorSearchDefs[$source_id][$module]) ? $connectorSearchDefs[$source_id][$module] : (!empty($originalSearchDefs[$source_id][$module]) ? $originalSearchDefs[$source_id][$module] : array());
         }
     }
     //Write the new searchdefs out
     if (!write_array_to_file('searchdefs', $searchdefs, 'custom/modules/Connectors/metadata/searchdefs.php')) {
         $GLOBALS['log']->fatal("Cannot write file custom/modules/Connectors/metadata/searchdefs.php");
     }
     //Unset the $_SESSION['searchDefs'] variable
     if (isset($_SESSION['searchDefs'])) {
         unset($_SESSION['searchDefs']);
     }
     //Clear mapping file if needed (this happens when all modules are removed from a source
//.........这里部分代码省略.........
开发者ID:nartnik,项目名称:sugarcrm_test,代码行数:101,代码来源:controller.php

示例5: smarty_function_sugar_button


//.........这里部分代码省略.........
                    $view = "form_DCQuickCreate_{$module}";
                } else {
                    if ($view == 'EditView') {
                        $view = "form_DCEditView_{$module}";
                    }
                }
                $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="' . $js_form . ' _form.action.value=\'Save\';if(check_form(\'' . $view . '\'))return DCMenu.save(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_dcmenu_save_button" id="' . $params['module'] . '_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} ';
                break;
            case "DCMENUFULLFORM":
                $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="' . $js_form . ' _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; _form.return_module.value=\'' . $params['module'] . '\';_form.return_id.value=_form.record.value;if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';SUGAR.ajaxUI.submitForm(_form,null,true);DCMenu.closeOverlay();" type="button" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> ';
                $output .= '<input type="hidden" name="full_form" value="full_form">';
                $output .= '<input type="hidden" name="is_admin" value="">';
                break;
            case "POPUPSAVE":
                $view = $view == 'QuickCreate' ? "form_QuickCreate_{$module}" : $view;
                $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" ' . 'class="button primary" onclick="' . $js_form . ' _form.action.value=\'Popup\';' . 'return check_form(\'' . $view . '\')" type="submit" name="' . $params['module'] . '_popupcreate_save_button" id="' . $params['module'] . '_popupcreate_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} ';
                break;
            case "POPUPCANCEL":
                $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" ' . 'class="button" onclick="toggleDisplay(\'addform\');return false;" ' . 'name="' . $params['module'] . '_popup_cancel_button" type="submit"' . 'id="' . $params['module'] . '_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> ';
                break;
            case "AUDIT":
                $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array());
                $json = getJSONobj();
                require_once 'include/SugarFields/Parsers/MetaParser.php';
                $encoded_popup_request_data = MetaParser::parseDelimiters($json->encode($popup_request_data));
                $audit_link = '<input id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" class="button" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name=' . $params['module'] . '", true, false, ' . $encoded_popup_request_data . '); return false;\' type="button" value="{$APP.LNK_VIEW_CHANGE_LOG}">';
                $output = '{if $bean->aclAccess("detail")}{if !empty($fields.id.value) && $isAuditEnabled}' . $audit_link . '{/if}{/if}';
                break;
                //Button for the Connector intergration wizard
            //Button for the Connector intergration wizard
            case "CONNECTOR":
                require_once 'include/connectors/utils/ConnectorUtils.php';
                require_once 'include/connectors/sources/SourceFactory.php';
                $modules_sources = ConnectorUtils::getDisplayConfig();
                if (!is_null($modules_sources) && !empty($modules_sources)) {
                    foreach ($modules_sources as $mod => $entry) {
                        if ($mod == $module && !empty($entry)) {
                            foreach ($entry as $source_id) {
                                $source = SourceFactory::getSource($source_id);
                                if ($source->isEnabledInWizard()) {
                                    $output = '<input title="{$APP.LBL_MERGE_CONNECTORS}" type="button" class="button" onClick="document.location=\'index.php?module=Connectors&action=Step1&record={$fields.id.value}&merge_module={$module}\'" name="merge_connector" value="{$APP.LBL_MERGE_CONNECTORS}">';
                                    if (isset($params['appendTo'])) {
                                        $smarty->append($params['appendTo'], $output);
                                        return;
                                    }
                                    return $output;
                                }
                            }
                        }
                    }
                }
                return '';
            case "PDFVIEW":
                $output = '{sugar_button module="$module" id="REALPDFVIEW" view="$view" form_id="formDetailView" record=$fields.id.value}';
                break;
            case "REALPDFVIEW":
                if (empty($params['record'])) {
                    $smarty->trigger_error("sugar_button: missing required param (record)");
                }
                $record = $params['record'];
                require_once 'modules/PdfManager/PdfManagerHelper.php';
                $pdfManagerList = PdfManagerHelper::getPublishedTemplatesForModule($module);
                //quote legacy templates
                if ($module == "Quotes") {
                    require_once 'modules/Quotes/Layouts.php';
                    $tplLayouts = get_layouts();
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:67,代码来源:function.sugar_button.php

示例6: process

 /**
  * @see SugarView::process()
  */
 public function process()
 {
     //Load Sources Here...
     if (!empty($_REQUEST['merge_module'])) {
         $this->_merge_module = $_REQUEST['merge_module'];
     } else {
         //Error
     }
     $moduleError = false;
     require_once 'include/connectors/utils/ConnectorUtils.php';
     require_once 'include/connectors/sources/SourceFactory.php';
     $modules_sources = ConnectorUtils::getDisplayConfig();
     if (empty($modules_sources)) {
         $moduleError = true;
     } else {
         $this->_modules_sources = $modules_sources;
         if (empty($this->_modules_sources[$this->_merge_module]) || empty($this->_modules_sources[$this->_merge_module])) {
             $moduleError = true;
         }
     }
     if ($moduleError) {
         $GLOBALS['log']->error($GLOBALS['mod_strings']['ERROR_NO_CONNECTOR_DISPLAY_CONFIG_FILE']);
         echo $GLOBALS['mod_strings']['ERROR_NO_CONNECTOR_DISPLAY_CONFIG_FILE'];
         return;
     }
     $_SESSION['merge_module'] = $this->_merge_module;
     $this->seed = BeanFactory::getBean($this->_merge_module, $_REQUEST['record']);
     //search form
     $searchdefs = ConnectorUtils::getSearchDefs();
     $this->_searchDefs = isset($searchdefs) ? $searchdefs : array();
     $mapped_fields = array();
     unset($_SESSION['searchDefs'][$this->_merge_module][$this->seed->id]);
     $sources = $modules_sources[$this->_merge_module];
     $source = array_shift($sources);
     foreach ($sources as $lsource) {
         if (!empty($this->_searchDefs[$lsource][$this->_merge_module])) {
             $s = ConnectorFactory::getInstance($lsource);
             if ($s->getSource()->isEnabledInWizard()) {
                 $source_map = $s->getModuleMapping($this->_merge_module);
                 foreach ($this->_searchDefs[$lsource][$this->_merge_module] as $key) {
                     $beanKey = $key;
                     if (!empty($source_map[$key])) {
                         $beanKey = $source_map[$key];
                     }
                     if (!empty($this->seed->{$beanKey})) {
                         $val = $this->seed->{$beanKey};
                         if (is_object($val) && get_class($val) == 'SugarEmailAddress') {
                             $emailaddress = '';
                             if (!empty($val->addresses)) {
                                 foreach ($val->addresses as $email) {
                                     if (!empty($email['primary_address'])) {
                                         $emailaddress = $email['email_address'];
                                         break;
                                     }
                                 }
                             }
                             $val = $emailaddress;
                         }
                     } else {
                         $val = '';
                     }
                     $_SESSION['searchDefs'][$this->_merge_module][$this->seed->id][$lsource][$key] = $val;
                 }
                 //foreach
             }
         }
         //if
     }
     //end search form
     parent::process();
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:74,代码来源:view.step1.php

示例7: action_SaveModifyDisplay

 function action_SaveModifyDisplay()
 {
     if (empty($_REQUEST['display_sources'])) {
         return;
     }
     require_once 'include/connectors/utils/ConnectorUtils.php';
     require_once 'include/connectors/sources/SourceFactory.php';
     $connectors = ConnectorUtils::getConnectors();
     $connector_keys = array_keys($connectors);
     $modules_sources = ConnectorUtils::getDisplayConfig();
     $sources = array();
     $values = array();
     $new_modules_sources = array();
     if (!empty($_REQUEST['display_values'])) {
         $display_values = split(',', $_REQUEST['display_values']);
         foreach ($display_values as $value) {
             $entry = split(':', $value);
             $new_modules_sources[$entry[1]][$entry[0]] = $entry[0];
         }
     }
     //These are the sources that were modified.
     //We only update entries for these sources that have been changed
     $display_sources = split(',', $_REQUEST['display_sources']);
     foreach ($display_sources as $source) {
         $sources[$source] = $source;
     }
     //foreach
     //Unset entries that have all sources removed
     foreach ($modules_sources as $module => $source_entries) {
         foreach ($source_entries as $source_id) {
             if (!empty($sources[$source_id]) && empty($new_modules_sources[$module][$source_id])) {
                 unset($modules_sources[$module][$source_id]);
             }
         }
     }
     //Update based on new_modules_sources
     foreach ($new_modules_sources as $module => $enabled_sources) {
         //If the module is not in $modules_sources add it there
         if (empty($modules_sources[$module])) {
             $modules_sources[$module] = $enabled_sources;
         } else {
             foreach ($enabled_sources as $source_id) {
                 if (empty($modules_sources[$module][$source_id])) {
                     $modules_sources[$module][$source_id] = $source_id;
                 }
             }
             //foreach
         }
     }
     //foreach
     //Should we just remove entries where all sources are disabled?
     $unset_modules = array();
     foreach ($modules_sources as $module => $mapping) {
         if (empty($mapping)) {
             $unset_modules[] = $module;
         }
     }
     foreach ($unset_modules as $mod) {
         unset($modules_sources[$mod]);
     }
     if (!write_array_to_file('modules_sources', $modules_sources, CONNECTOR_DISPLAY_CONFIG_FILE)) {
         //Log error and return empty array
         $GLOBALS['log']->fatal("Cannot write \$modules_sources to " . CONNECTOR_DISPLAY_CONFIG_FILE);
     }
     $sources_modules = array();
     foreach ($modules_sources as $module => $source_entries) {
         foreach ($source_entries as $id) {
             $sources_modules[$id][$module] = $module;
         }
     }
     //Clear mapping file if needed (this happens when all modules are removed from a source
     foreach ($sources as $id) {
         if (empty($sources_modules[$source])) {
             //Now write the new mapping entry to the custom folder
             $dir = $connectors[$id]['directory'];
             if (!preg_match('/^custom\\//', $dir)) {
                 $dir = 'custom/' . $dir;
             }
             if (!file_exists("{$dir}")) {
                 mkdir_recursive("{$dir}");
             }
             if (!write_array_to_file('mapping', array('beans' => array()), "{$dir}/mapping.php")) {
                 $GLOBALS['log']->fatal("Cannot write file {$dir}/mapping.php");
             }
         }
         //if
     }
     //foreach
     //Now update the field mapping entries
     foreach ($sources_modules as $id => $modules) {
         $source = SourceFactory::getSource($id);
         $mapping = $source->getMapping();
         $mapped_modules = array_keys($mapping['beans']);
         foreach ($mapped_modules as $module) {
             if (empty($sources_modules[$id][$module])) {
                 unset($mapping['beans'][$module]);
             }
         }
         //Remove modules from the mapping entries
         foreach ($modules as $module) {
//.........这里部分代码省略.........
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:101,代码来源:controller.php

示例8: getFieldsWithParams

 public function getFieldsWithParams($param_name, $param_value)
 {
     $modules_sources = ConnectorUtils::getDisplayConfig();
     $cache_file = 'cache/include/twilio/phone_field_map.php';
     //Make the directory for the config file
     if (!file_exists('cache/include/twilio')) {
         mkdir_recursive('cache/include/twilio');
     }
     $module_phone_field_list = array();
     if (!is_file($cache_file)) {
         //            build_phone_field_map($cache_file);
         $module_phone_field_list = get_phone_field_map();
     } else {
         include $cache_file;
     }
     foreach ($module_phone_field_list as $module_name => $phone_fields) {
         if (!isset($modules_sources[$module_name]) || !isset($modules_sources[$module_name]['ext_rest_twilio'])) {
             unset($module_phone_field_list[$module_name]);
         }
     }
     $return_phone_list = array();
     foreach ($module_phone_field_list as $module_name => $fields_list) {
         foreach ($fields_list as $field_name) {
             $return_phone_list[$field_name] = '';
         }
     }
     //        if(empty($this->_field_defs)){
     //            $this->loadVardefs();
     //        }
     //        $fields_with_param = array();
     //        foreach($this->_field_defs as $key => $def){
     //            if(!empty($def[$param_name]) && ($def[$param_name] == $param_value)){
     //                    $fields_with_param[$key] = $def;
     //            }
     //        }
     //
     return $return_phone_list;
 }
开发者ID:anhtuantt,项目名称:sugarcrm-twilio-example,代码行数:38,代码来源:twilio.php

示例9: smarty_function_sugar_actions_link

/**
 * smarty_function_sugar_actions_link
 * This is the constructor for the Smarty plugin.
 *
 * @param $params The runtime Smarty key/value arguments
 * @param $smarty The reference to the Smarty object used in this invocation
 */
function smarty_function_sugar_actions_link($params, &$smarty)
{
    if (empty($params['module'])) {
        $smarty->trigger_error("sugar_button: missing required param (module)");
    } else {
        if (empty($params['id'])) {
            $smarty->trigger_error("sugar_button: missing required param (id)");
        } else {
            if (empty($params['view'])) {
                $smarty->trigger_error("sugar_button: missing required param (view)");
            }
        }
    }
    $type = $params['id'];
    $location = empty($params['location']) ? "" : "_" . $params['location'];
    if (!is_array($type)) {
        $module = $params['module'];
        $view = $params['view'];
        switch (strtoupper($type)) {
            case "SEARCH":
                // TODO review these SUGAR.ajaxUI.* methods
                return '<input tabindex="2" title="{$APP.LBL_SEARCH_BUTTON_TITLE}" accessKey="{$APP.LBL_SEARCH_BUTTON_KEY}" onclick="SUGAR.savedViews.setChooser(); SUGAR.ajaxUI.submitForm(this.form);" class="button" type="button" name="button" value="{$APP.LBL_SEARCH_BUTTON_LABEL}" id="search_form_submit"/>&nbsp;';
                break;
            case "CANCEL":
                $cancelButton = '{capture name="cancelReturnUrl" assign="cancelReturnUrl"}';
                $cancelButton .= '{if !empty($smarty.request.return_action) && $smarty.request.return_action == "DetailView" && !empty($fields.id.value)}';
                $cancelButton .= 'parent.SUGAR.App.router.buildRoute(\'{$smarty.request.return_module|escape:"url"}\', \'{$fields.id.value|escape:"url"}\', \'{$smarty.request.return_action|escape:"url"}\')';
                $cancelButton .= '{elseif !empty($smarty.request.return_module) || !empty($smarty.request.return_action) || !empty($smarty.request.return_id)}';
                $cancelButton .= 'parent.SUGAR.App.router.buildRoute(\'{$smarty.request.return_module|escape:"url"}\', \'{$smarty.request.return_id|escape:"url"}\', \'{$smarty.request.return_action|escape:"url"}\')';
                $cancelButton .= '{else}';
                $cancelButton .= "parent.SUGAR.App.router.buildRoute('{$module}')";
                $cancelButton .= '{/if}';
                $cancelButton .= '{/capture}';
                $cancelButton .= '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="parent.SUGAR.App.router.navigate({$cancelReturnUrl}, {literal}{trigger: true}{/literal}); return false;" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" id="' . $type . $location . '"> ';
                return $cancelButton;
                break;
            case "DELETE":
                return '{if $bean->aclAccess("delete")}<a title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'ListView\'; $(\'#form\')[0].action.value=\'Delete\'; if(confirm(\'{$APP.NTC_DELETE_CONFIRMATION}\')){literal}{$(\'#form\').submit()}{/literal};" name="Delete" id="delete_button">{$APP.LBL_DELETE_BUTTON_LABEL}</a>{/if} ';
                break;
            case "DUPLICATE":
                return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].isDuplicate.value=true; $(\'#form\')[0].action.value=\'' . $view . '\'; $(\'#form\')[0].return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Duplicate" id="duplicate_button">{$APP.LBL_DUPLICATE_BUTTON_LABEL}</a>{/if} ';
                break;
            case "EDIT":
                return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'EditView\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Edit" id="edit_button">{$APP.LBL_EDIT_BUTTON_LABEL}</a>{/if} ';
                break;
            case "EDIT2":
                return '{if $bean->aclAccess("edit")}<a title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'EditView\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Edit">{$APP.LBL_EDIT_BUTTON_LABEL}</a>{/if} ';
                break;
            case "FIND_DUPLICATES":
                return '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<a title="{$APP.LBL_DUP_MERGE}" accessKey="M" onclick="$(\'#form\')[0].return_module.value=\'' . $module . '\'; $(\'#form\')[0].return_action.value=\'DetailView\'; $(\'#form\')[0].return_id.value=\'{$id}\'; $(\'#form\')[0].action.value=\'Step1\'; $(\'#form\')[0].module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm($(\'#form\')[0]);" name="Merge"  id="merge_duplicate_button">{$APP.LBL_DUP_MERGE}</a>{/if} ';
                break;
            case "SAVE":
                $view = $_REQUEST['action'] == 'EditView' ? 'EditView' : ($view == 'EditView' ? 'EditView' : $view);
                return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="{if $isDuplicate}this.form.return_id.value=\'\'; {/if}this.form.action.value=\'Save\'; if(check_form(\'' . $view . '\'))SUGAR.ajaxUI.submitForm(this.form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="' . $type . $location . '">{/if} ';
                break;
            case "SUBPANELSAVE":
                if ($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action'])) == 'quickcreate') {
                    $view = "form_SubpanelQuickCreate_{$module}";
                }
                return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value=\'Save\';if(check_form(\'' . $view . '\'))return SUGAR.subpanelUtils.inlineSave(this.form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_subpanel_save_button" id="' . $params['module'] . '_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} ';
            case "SUBPANELCANCEL":
                return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="return SUGAR.subpanelUtils.cancelCreate($(this).attr(\'id\'));return false;" type="submit" name="' . $params['module'] . '_subpanel_cancel_button" id="' . $params['module'] . '_subpanel_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> ';
            case "SUBPANELFULLFORM":
                $html = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="this.form.return_action.value=\'DetailView\'; this.form.action.value=\'EditView\'; if(typeof(this.form.to_pdf)!=\'undefined\') this.form.to_pdf.value=\'0\';" type="submit" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> ';
                $html .= '<input type="hidden" name="full_form" value="full_form">';
                return $html;
            case "POPUPSAVE":
                $view = $view == 'QuickCreate' ? "form_QuickCreate_{$module}" : $view;
                return '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" ' . 'class="button primary" onclick="this.form.action.value=\'Popup\';' . 'return check_form(\'' . $view . '\')" type="submit" name="' . $params['module'] . '_popupcreate_save_button" id="' . $params['module'] . '_popupcreate_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} ';
            case "POPUPCANCEL":
                return '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" ' . 'class="button" onclick="toggleDisplay(\'addform\');return false;" ' . 'name="' . $params['module'] . '_popup_cancel_button" type="submit"' . 'id="' . $params['module'] . '_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> ';
            case "AUDIT":
                $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array());
                $json = getJSONobj();
                require_once 'include/SugarFields/Parsers/MetaParser.php';
                $encoded_popup_request_data = MetaParser::parseDelimiters($json->encode($popup_request_data));
                $audit_link = '<a id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name=' . $params['module'] . '", true, false, ' . $encoded_popup_request_data . '); return false;\'>{$APP.LNK_VIEW_CHANGE_LOG}</a>';
                $view = '{if $bean->aclAccess("detail")}{if !empty($fields.id.value) && $isAuditEnabled}' . $audit_link . '{/if}{/if}';
                return $view;
                //Button for the Connector intergration wizard
            //Button for the Connector intergration wizard
            case "CONNECTOR":
                require_once 'include/connectors/utils/ConnectorUtils.php';
                require_once 'include/connectors/sources/SourceFactory.php';
                $modules_sources = ConnectorUtils::getDisplayConfig();
                if (!is_null($modules_sources) && !empty($modules_sources)) {
                    foreach ($modules_sources as $mod => $entry) {
                        if ($mod == $module && !empty($entry)) {
                            foreach ($entry as $source_id) {
                                $source = SourceFactory::getSource($source_id);
                                if ($source->isEnabledInWizard()) {
                                    return '<a title="{$APP.LBL_MERGE_CONNECTORS}" accessKey="{$APP.LBL_MERGE_CONNECTORS_BUTTON_KEY}" onClick="document.location=\'index.php?module=Connectors&action=Step1&record={$fields.id.value}&merge_module={$module}\'" name="merge_connector">{$APP.LBL_MERGE_CONNECTORS}</a>';
                                }
//.........这里部分代码省略.........
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:101,代码来源:function.sugar_actions_link.php


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