function loadModules() { foreach (SugarAutoLoader::getDirFiles("modules", true) as $mdir) { // strip modules/ from name $mname = substr($mdir, 8); if (SugarAutoLoader::existingCustomOne("modules/{$mname}/metadata/studio.php") && $this->isPortalModule($mname)) { $this->modules[$mname] = new SugarPortalModule($mname); } } }
/** * @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')); }
/** * Find all modules with Portal metadata * * @return array List of Portal module names */ protected function getModules() { $modules = array(); foreach (SugarAutoLoader::getDirFiles("modules", true) as $mdir) { // strip modules/ from name $mname = substr($mdir, 8); if (SugarAutoLoader::fileExists("{$mdir}/clients/portal/")) { $modules[] = $mname; } } $modules[] = 'Users'; $modules[] = 'Filters'; return $modules; }
/** * Returns an array of all of the images available for the current theme * * @return array */ public function getAllImages() { // first, lets get all the paths of where to look $pathsToSearch = array($this->getImagePath()); $theme = $this; while (isset($theme->parentTheme) && SugarThemeRegistry::get($theme->parentTheme) instanceof SugarTheme) { $theme = SugarThemeRegistry::get($theme->parentTheme); $pathsToSearch[] = $theme->getImagePath(); } $pathsToSearch[] = $this->getDefaultImagePath(); // now build the array $imageArray = array(); foreach ($pathsToSearch as $path) { // $path goes before custom here, so not using existingCustomOne $paths = SugarAutoLoader::existing("custom/{$path}", $path); if ($paths) { $path = array_pop($paths); } else { continue; } foreach (SugarAutoLoader::getDirFiles($path) as $file) { $file = basename($file); if (!isset($imageArray[$file])) { $imageArray[$file] = $this->getImageURL($file, false); } } } ksort($imageArray); return $imageArray; }
/** * Get a list of files in the given directories. * * @param array $checkPaths A list of directories to include files. * @param MetaDataContextInterface|null $context Metadata context * * @return array */ public static function getClientFileList($checkPaths, MetaDataContextInterface $context = null) { $fileLists = array(); foreach ($checkPaths as $path => $pathInfo) { // Looks at /modules/Accounts/clients/base/views/* // So should pull up "record","list","preview" $dirsInPath = SugarAutoLoader::getDirFiles($path, true, null, true); $fileList = array(); foreach ($dirsInPath as $fullSubPath) { $subPath = basename($fullSubPath); // This should find the files in each view/layout // So it should pull up list.js, list.php, list.hbs $filesInDir = SugarAutoLoader::getDirFiles($fullSubPath, false, null, true); foreach ($filesInDir as $fullFile) { // If this file is an excluded file, skip it if (self::isExcludedClientFile($fullFile)) { continue; } $file = basename($fullFile); $fileIndex = $fullFile; if (!isset($fileList[$fileIndex])) { $fileList[$fileIndex] = array('path' => $fullFile, 'file' => $file, 'subPath' => $subPath, 'platform' => $pathInfo['platform'], 'template' => $pathInfo['template'] && substr($file, -4) == '.php', 'params' => self::getClientFileParams($fullFile)); } } } if ($context) { $fileList = self::filterClientFiles($fileList, $context); } $fileLists[] = $fileList; } return call_user_func_array('array_merge', $fileLists); }
function getModulesWithSubpanels() { $modules = array(); foreach (SugarAutoLoader::getDirFiles("modules", true) as $dir) { if (SugarAutoLoader::fileExists("{$dir}/layout_defs.php")) { $entry = basename($dir); $modules[$entry] = $entry; } } return $modules; }
function extract_plugin_list() { $component_arrays = array(); foreach (SugarAutoLoader::getDirFiles("custom/workflow/plugins", true) as $file) { foreach (SugarAutoLoader::existing("{$file}/component_list.php") as $comp_file) { include $comp_file; //bug 62487 - Corrects the array key that is used in custom/workflow/plugins/plugin_list.php, which makes is compatible with SugarCRM 6.5.x $file = basename($file); //triggers if (!empty($component_list['trigger'])) { foreach ($component_list['trigger'] as $hook => $hook_array) { $component_arrays['trigger'][$hook][$file] = $hook_array; } } //actions if (!empty($component_list['action'])) { foreach ($component_list['action'] as $hook => $hook_array) { $component_arrays['action'][$hook][$file] = $hook_array; } } //vardef_handler hooks if (!empty($component_list['vardef_handler_hook'])) { foreach ($component_list['vardef_handler_hook'] as $def_field => $def_value) { $component_arrays['vardef_handler_hook'][$file][$def_field] = $def_value; } } } } return $component_arrays; }
<?php /* * Your installation or use of this SugarCRM file is subject to the applicable * terms available at * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/. * If you do not agree to all of the applicable terms or do not have the * authority to bind the entity as an authorized representative, then do not * install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ if (!defined('sugarEntry') || !sugarEntry) { die('Not A Valid Entry Point'); } //Custom plugins //Search through the plugins to include any custom_utils.php files $dir_path = "./custom/workflow/plugins"; foreach (SugarAutoLoader::getDirFiles("custom/workflow/plugins", true) as $dir) { if (SugarAutoLoader::existing("{$dir}/custom_utils.php")) { include_once "{$dir}/custom_utils.php"; } }