public function display() { require_once "modules/Calendar/CalendarUtils.php"; $module = $this->view_object_map['currentModule']; $_REQUEST['module'] = $module; $base = 'modules/' . $module . '/metadata/'; $source = SugarAutoLoader::existingCustomOne($base . 'editviewdefs.php', $base . 'quickcreatedefs.php'); $GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], $module); $tpl = SugarAutoLoader::existingCustomOne('include/EditView/EditView.tpl'); $this->ev = new EditView(); $this->ev->view = "QuickCreate"; $this->ev->ss = new Sugar_Smarty(); $this->ev->formName = "CalendarEditView"; $this->ev->setup($module, $this->bean, $source, $tpl); $this->ev->defs['templateMeta']['form']['headerTpl'] = "modules/Calendar/tpls/editHeader.tpl"; $this->ev->defs['templateMeta']['form']['footerTpl'] = "modules/Calendar/tpls/empty.tpl"; $this->ev->process(false, "CalendarEditView"); if (!empty($this->bean->id)) { require_once 'include/json_config.php'; $jsonConfig = new json_config(); $grJavascript = $jsonConfig->getFocusData($module, $this->bean->id); } else { $grJavascript = ""; } $jsonArr = array('access' => 'yes', 'module_name' => $this->bean->module_dir, 'record' => $this->bean->id, 'edit' => $this->editable, 'html' => $this->ev->display(false, true), 'gr' => $grJavascript, 'acl' => array('delete' => $this->bean->aclAccess('delete'))); if (!empty($this->view_object_map['repeatData'])) { $jsonArr = array_merge($jsonArr, array("repeat" => $this->view_object_map['repeatData'])); } ob_clean(); echo json_encode($jsonArr); }
/** * @see SugarView::display() */ public function display() { $offset = -1; $modules = array(); if (!empty($_REQUEST['zoom'])) { $modules = array($_REQUEST['zoom']); if (isset($_REQUEST['offset'])) { $offset = $_REQUEST['offset']; } } $limit = !empty($GLOBALS['sugar_config']['max_spotresults_initial']) ? $GLOBALS['sugar_config']['max_spotresults_initial'] : 5; if ($offset !== -1) { $limit = !empty($GLOBALS['sugar_config']['max_spotresults_more']) ? $GLOBALS['sugar_config']['max_spotresults_more'] : 20; } $options = array('current_module' => $this->module, 'modules' => $modules); $searchEngine = SugarSearchEngineFactory::getInstance('', array(), true); $trimmed_query = trim($_REQUEST['q']); $rs = $searchEngine->search($trimmed_query, $offset, $limit, $options); $formattedResults = $this->formatSearchResultsToDisplay($rs, $offset, $trimmed_query); $query_encoded = urlencode($trimmed_query); $displayMoreForModule = $formattedResults['displayMoreForModule']; $displayResults = $formattedResults['displayResults']; $ss = new Sugar_Smarty(); $ss->assign('displayResults', $displayResults); $ss->assign('displayMoreForModule', $displayMoreForModule); $ss->assign('appStrings', $GLOBALS['app_strings']); $ss->assign('appListStrings', $GLOBALS['app_list_strings']); $ss->assign('queryEncoded', $query_encoded); $ss->assign('test', "#bwc/index.php?module=Home&action=UnifiedSearch&search_form=false&advanced=false&query_string=" . $query_encoded); echo $ss->fetch(SugarAutoLoader::existingCustomOne('include/SearchForm/tpls/SugarSpot.tpl')); }
/** * getInstance * This method returns a formatter instance for the given source name and * formatter name. If no formatter name is specified, the default formatter * for the source is used. * * @param $source_name The data source name to retreive formatter for * @param $formatter_name Optional formatter name to use * @param $wrapper_name Optional wrapper name to use * @return $instance The formatter instance */ public static function getInstance($source_name, $formatter_name = '') { require_once 'include/connectors/formatters/default/formatter.php'; $key = $source_name . $formatter_name; if (empty(self::$formatter_map[$key])) { if (empty($formatter_name)) { $formatter_name = $source_name; } $dir = str_replace('_', '/', $formatter_name); $parts = explode("/", $dir); $file = array_pop($parts); if (ConnectorFactory::load($formatter_name, 'formatters')) { $formatter_name .= '_formatter'; } else { //if there is no override wrapper, use the default. $formatter_name = 'default_formatter'; } $component = ConnectorFactory::getInstance($source_name); $formatter = new $formatter_name(); $formatter->setComponent($component); $tpl = SugarAutoLoader::existingCustomOne("modules/Connectors/connectors/formatters/{$dir}/tpls/{$file}.tpl"); if (!empty($tpl)) { $formatter->setTplFileName($tpl); } self::$formatter_map[$key] = $formatter; } //if return self::$formatter_map[$key]; }
/** * @see SugarView::preDisplay() */ public function preDisplay() { $metadataFile = $this->getMetaDataFile(); $this->ev = $this->getEditView(); $this->ev->ss = $this->ss; $this->ev->setup($this->module, $this->bean, $metadataFile, SugarAutoLoader::existingCustomOne('include/EditView/EditView.tpl')); }
function EmailSugarFieldTeamsetCollection($bean, $field_defs, $customMethod = "", $form_name = 'EditView') { parent::ViewSugarFieldTeamsetCollection(false); $this->tpl_path = SugarAutoLoader::existingCustomOne('include/SugarFields/Fields/Teamset/TeamsetCollectionEmailView.tpl'); //$this->module_dir = $module; $this->bean_id = $bean->id; $this->form_name = $form_name; $this->customMethod = $customMethod; $this->bean = $bean; if (empty($this->bean)) { echo "Unable to load module {$module}"; return; } //Initialize displayParams $this->displayParams['formName'] = $this->form_name; $this->displayParams['primaryChecked'] = true; $this->vardef = $field_defs['team_name']; $this->name = $this->vardef['name']; $this->related_module = 'Teams'; $this->value_name = 'team_set_id_values'; $this->numFields = 1; $this->ss = new Sugar_Smarty(); $this->extra_var = array(); $this->field_to_name_array = array(); }
/** * This function will load the meta-data based on a given file path * * Dashlet Meta Data Loading Process * 1. Check if a user customized version exists in user preferences (convert the file path to a guid) and load that one if availble * 2. Check if a system customized version exists in custom/$dashletMetaDataFile and load that one * 3. Otherwise load the provided file path * * If the file path is not found or if the meta-data is invalid it will throw an error and return false * * @param string $filePath path to the meta data * @return bool success or failure of load */ public function load($filePath) { $filePath = SugarAutoLoader::existingCustomOne($filePath); $dashletdefs = array(); include $filePath; $this->dashletdefs = $dashletdefs; }
/** * return the singleton of the SugarField * * @param string $field Field type * @param boolean $returnNullIfBase * @return SugarFieldBase */ static function getSugarField($field, $returnNullIfBase = false) { static $sugarFieldObjects = array(); $field = self::fixupFieldType($field); $field = ucfirst($field); if (!isset($sugarFieldObjects[$field])) { //check custom directory $file = SugarAutoLoader::existingCustomOne("include/SugarFields/Fields/{$field}/SugarField{$field}.php"); if ($file) { $type = $field; } else { // No direct class, check the directories to see if they are defined if ($returnNullIfBase && !SugarAutoLoader::existing('include/SugarFields/Fields/' . $field)) { return null; } $file = 'include/SugarFields/Fields/Base/SugarFieldBase.php'; $type = 'Base'; } require_once $file; $class = SugarAutoLoader::customClass('SugarField' . $type); //could be a custom class check it $sugarFieldObjects[$field] = new $class($field); } return $sugarFieldObjects[$field]; }
/** * load the correct view * @param string $type View Type * @return valid view */ function loadView($type = 'default', $module, $bean = null, $view_object_map = array(), $target_module = '') { $type = strtolower($type); //first let's check if the module handles this view $view = null; //Check to see if we should load a custom parent view instance loadParentView($type); if (!empty($target_module)) { $view_file = SugarAutoLoader::existingCustomOne('modules/' . $target_module . '/views/view.' . $type . '.php'); $view_module = $target_module; } else { $view_module = $module; } if (empty($view_file)) { $view_file = SugarAutoLoader::existingCustomOne('modules/' . $module . '/views/view.' . $type . '.php'); } if (empty($view_file)) { $view_file = SugarAutoLoader::existingCustomOne('include/MVC/View/views/view.' . $type . '.php'); } if (!empty($view_file)) { $view = ViewFactory::_buildFromFile($view_file, $bean, $view_object_map, $type, $view_module); } if (empty($view)) { // Default to SugarView if still nothing found/built $view = new SugarView(); } ViewFactory::_loadConfig($view, $type); return $view; }
function canAddSession() { $this->archiveInactiveSessions(); //we may not even have to check b/c the license could have the //license_enforce_portal_user_limit set to 0 if ($this->getEnforcePortalUserLimit()) { $num_active = $this->getNumActiveSessions(); $num_users = $this->getNumPortalUsers(); $num = $num_users; $config = SugarAutoLoader::existingCustomOne('modules/Administration/ncc_config.php'); if ($config) { require $config; $num = $ncc_config['value']; } if (!isset($num)) { $num = 1.2; } $num = $num * $num_users; $GLOBALS['log']->debug("Number of valid concurrent sessions: " . $num); if ($num_active < $num) { return true; } else { return false; } } else { //if we are not enforcing the portal user limit then //do not worry about how many active sessions we can have, just assume we can add one. return true; } }
public function __construct() { global $dictionary; if (isset($this->module_dir) && isset($this->object_name) && !isset($dictionary[$this->object_name])) { require SugarAutoLoader::existingCustomOne('metadata/workflow_schedulesMetaData.php'); } parent::__construct(); }
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() { // Call SugarController::getActionFilename to handle case sensitive file names $file = SugarController::getActionFilename($this->action); $classic = SugarAutoLoader::existingCustomOne('modules/' . $this->module . '/' . $file . '.php'); if ($classic) { $this->includeClassicFile($classic); return true; } return false; }
/** * @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')); }
/** * searchAndDisplay * * Performs the search and returns the HTML widget containing the results * * @param $query string what we are searching for * @param $modules array modules we are searching in * @param $offset int search result offset * @return string HTML code containing results * * @deprecated deprecated since 6.5 */ public function searchAndDisplay($query, $modules, $offset = -1) { $query_encoded = urlencode($query); $formattedResults = $this->formatSearchResultsToDisplay($query, $modules, $offset); $displayMoreForModule = $formattedResults['displayMoreForModule']; $displayResults = $formattedResults['displayResults']; $ss = new Sugar_Smarty(); $ss->assign('displayResults', $displayResults); $ss->assign('displayMoreForModule', $displayMoreForModule); $ss->assign('appStrings', $GLOBALS['app_strings']); $ss->assign('appListStrings', $GLOBALS['app_list_strings']); $ss->assign('queryEncoded', $query_encoded); return $ss->fetch(SugarAutoLoader::existingCustomOne('include/SearchForm/tpls/SugarSpot.tpl')); }
protected function fetchSmarty() { $source = $this->_component->getSource(); $class = get_class($source); $dir = str_replace('_', '/', $class); $config = $source->getConfig(); $this->_ss->assign('config', $config); $this->_ss->assign('source', $class); $this->_ss->assign('module', $this->_module); $tpl = SugarAutoLoader::existingCustomOne("modules/Connectors/connectors/formatters/{$dir}/tpls/default.tpl", "modules/Connectors/connectors/formatters/{$dir}/tpls/{$this->_module}.tpl"); if (!empty($tpl)) { return $this->_ss->fetch($tpl); } return $this->_ss->fetch("modules/Connectors/connectors/formatters/{$dir}/tpls/default.tpl"); }
/** * @see SugarView::display() */ public function display() { if ($this->bean instanceof SugarBean && isset($this->view_object_map['remap_action']) && !$this->bean->ACLAccess($this->view_object_map['remap_action'])) { ACLController::displayNoAccess(true); return false; } // Call SugarController::getActionFilename to handle case sensitive file names $file = SugarController::getActionFilename($this->action); $classic_file = SugarAutoLoader::existingCustomOne('modules/' . $this->module . '/' . $file . '.php'); if ($classic_file) { $this->includeClassicFile($classic_file); return true; } return false; }
function loadRelatableModules() { $d = dir('modules'); while ($e = $d->read()) { if (isset($_REQUEST['view_module']) && $_REQUEST['view_module'] == 'Project' && $e == 'ProjectTask' && isset($_REQUEST['id']) && $_REQUEST['id'] == 'relEditor' && $_REQUEST['relationship_name'] == '') { continue; } //46141 - disabling creating custom relationship between Projects and ProjectTasks in studio if (substr($e, 0, 1) == '.' || !is_dir('modules/' . $e)) { continue; } if (SugarAutoLoader::existingCustomOne("modules/{$e}/metadata/studio.php") && isset($GLOBALS['beanList'][$e])) { $this->modules[$e] = StudioModuleFactory::getStudioModule($e); } } }
/** * load the correct Tcpdf * @param string $type Tcpdf Type * @return valid Tcpdf */ function loadSugarpdf($type = 'default', $module, $bean = null, $sugarpdf_object_map = array()) { $type = strtolower(basename($type)); //first let's check if the module handles this Tcpdf $sugarpdf = null; $path = '/sugarpdf/sugarpdf.' . $type . '.php'; $pdf_file = SugarAutoLoader::existingCustomOne('include/Sugarpdf' . $path, 'modules/' . $module . $path); if ($pdf_file) { $sugarpdf = SugarpdfFactory::_buildFromFile($pdf_file, $bean, $sugarpdf_object_map, $type, $module); } // Default to Sugarpdf if still nothing found/built if (!isset($sugarpdf)) { $sugarpdf = new Sugarpdf($bean, $sugarpdf_object_map); } return $sugarpdf; }
/** * @see SugarView::display() */ public function display() { require_once 'modules/Home/UnifiedSearchAdvanced.php'; $usa = new UnifiedSearchAdvanced(); global $mod_strings, $app_strings, $app_list_strings, $current_user; $sugar_smarty = new Sugar_Smarty(); $sugar_smarty->assign('APP', $app_strings); $sugar_smarty->assign('MOD', $mod_strings); $sugar_smarty->assign('moduleTitle', $this->getModuleTitle(false)); $modules = $usa->retrieveEnabledAndDisabledModules(); $sugar_smarty->assign('enabled_modules', json_encode($modules['enabled'])); $sugar_smarty->assign('disabled_modules', json_encode($modules['disabled'])); $defaultEngine = SugarSearchEngineFactory::getFTSEngineNameFromConfig(); $config = $GLOBALS['sugar_config']['full_text_engine'][$defaultEngine]; $justRequestedAScheduledIndex = !empty($_REQUEST['sched']) ? true : false; $hide_fts_config = isset($GLOBALS['sugar_config']['hide_full_text_engine_config']) ? $GLOBALS['sugar_config']['hide_full_text_engine_config'] : false; $showSchedButton = $defaultEngine != '' && $this->isFTSConnectionValid() ? true : false; $sugar_smarty->assign("showSchedButton", $showSchedButton); $sugar_smarty->assign("hide_fts_config", $hide_fts_config); $sugar_smarty->assign("fts_type", get_select_options_with_id($app_list_strings['fts_type'], $defaultEngine)); $sugar_smarty->assign("fts_host", $config['host']); $sugar_smarty->assign("fts_port", $config['port']); $sugar_smarty->assign("fts_scheduled", !empty($schedulerID) && !$schedulerCompleted); $sugar_smarty->assign('justRequestedAScheduledIndex', $justRequestedAScheduledIndex); //End FTS if (is_admin($current_user)) { if (!empty($GLOBALS['sugar_config']['fts_disable_notification'])) { displayAdminError(translate('LBL_FTS_DISABLED', 'Administration')); } // if fts indexing is done, show the notification to admin $admin = Administration::getSettings(); if (!empty($admin->settings['info_fts_index_done'])) { displayAdminError(translate('LBL_FTS_INDEXING_DONE', 'Administration')); // reset flag $admin->saveSetting('info', 'fts_index_done', 0); } } echo $sugar_smarty->fetch(SugarAutoLoader::existingCustomOne('modules/Administration/templates/GlobalSearchSettings.tpl')); }
function findTemplate($view) { static $tplCache = array(); if (isset($tplCache[$this->type][$view])) { return $tplCache[$this->type][$view]; } $lastClass = get_class($this); $classList = array($this->type, str_replace('SugarField', '', $lastClass)); while ($lastClass = get_parent_class($lastClass)) { $classList[] = str_replace('SugarField', '', $lastClass); } array_pop($classList); // remove this class - $base handles that $tplName = ''; global $current_language; foreach ($classList as $className) { if (isset($current_language)) { $tplName = SugarAutoLoader::existingCustomOne('include/SugarFields/Fields/' . $className . '/' . $current_language . '.' . $view . '.tpl'); if ($tplName) { break; } } $tplName = SugarAutoLoader::existingCustomOne('include/SugarFields/Fields/' . $className . '/' . $view . '.tpl'); if ($tplName) { break; } } if (empty($tplName)) { $tplName = $this->getBase($view); } $tplCache[$this->type][$view] = $tplName; return $tplName; }
function isQuickCreateValid($module, $panel_id) { //try to retrieve the subpanel defs global $beanList; $isValid = false; $layout_defs = $this->getSubpanelDefs($_REQUEST['module']); //For Sidecar modules return false as we want caller to add an //onClick routed to the SubPanelTiles.js subp_nav_sidecar function if (!isModuleBWC($module)) { return false; } //lets check to see if the subpanel buttons are defined, and if they extend quick create //If no buttons are defined, then the default ones are used which do NOT use quick create if (!empty($panel_id) && !empty($layout_defs) && is_array($layout_defs) && !empty($layout_defs[$_REQUEST['module']]) && !empty($layout_defs[$_REQUEST['module']]['subpanel_setup'][$panel_id]) && !empty($layout_defs[$_REQUEST['module']]['subpanel_setup'][$panel_id]['top_buttons']) && is_array($layout_defs[$_REQUEST['module']]['subpanel_setup'][$panel_id]['top_buttons'])) { //we have the buttons from the definitions, lets see if they enabled for quickcreate foreach ($layout_defs[$_REQUEST['module']]['subpanel_setup'][$panel_id]['top_buttons'] as $buttonClasses) { $buttonClass = ''; //get the button class if (isset($buttonClasses['widget_class'])) { $buttonClass = $buttonClasses['widget_class']; } //include the button class and see if it extends quick create $className = 'SugarWidget' . $buttonClass; if (SugarAutoLoader::requireWithCustom('include/generic/SugarWidgets/' . $className . '.php')) { if (class_exists($className)) { $button = new $className(); //set valid flag to true if this class extends quickcreate button if ($button instanceof SugarWidgetSubPanelTopButtonQuickCreate) { $isValid = true; } } } } } //if only default buttons are used, or none of the buttons extended quick create, then there is no need to proceed if (!$isValid) { return false; } //So our create buttons are defined, now lets check for the proper quick create meta files if (SugarAutoLoader::existingCustomOne('modules/' . $module . '/metadata/quickcreatedefs.php')) { return true; } return false; }
/** * Returns the path for the tpl file in the current theme. If not found in the current theme, will revert * to looking in the base theme. * * @param string $templateName tpl file name * @return string path of tpl file to include */ public function getTemplate($templateName) { if (isset($this->_templateCache[$templateName])) { return $this->_templateCache[$templateName]; } $templatePath = SugarAutoLoader::existingCustomOne($this->getTemplatePath() . '/' . $templateName); if (!$templatePath && isset($this->parentTheme) && SugarThemeRegistry::get($this->parentTheme) instanceof SugarTheme) { $templatePath = SugarThemeRegistry::get($this->parentTheme)->getTemplate($templateName); } if (!$templatePath) { $templatePath = SugarAutoLoader::existingCustomOne($this->getDefaultTemplatePath() . '/' . $templateName); } if (!$templatePath) { $GLOBALS['log']->warn("Template {$templateName} not found"); return false; } $this->_imageCache[$templateName] = $templatePath; return $templatePath; }
/** * This method sets the config file to use and renders the template * */ public function display() { $this->ss->display(SugarAutoLoader::existingCustomOne('include/MVC/View/tpls/sidecar.tpl')); }
/** * get_subpanel_defs * * @param String $module The name of the module to get the subpanel definition for * @param String $type The type of subpanel definition ('wireless' or 'default') * @return array Array of the subpanel definition; empty array if no matching definition found */ function get_subpanel_defs($module, $type) { global $beanList, $beanFiles; $results = array(); switch ($type) { case 'wireless': $defs = SugarAutoLoader::existingCustomOne('modules/' . $module . '/metadata/wireless.subpaneldefs.php'); if ($defs) { require $defs; } //If an Ext/WirelessLayoutdefs/wireless.subpaneldefs.ext.php file exists, then also load it as well $defs = SugarAutoLoader::loadExtension("wireless_subpanels", $module); if ($defs) { require $defs; } break; case 'default': default: $defs = SugarAutoLoader::loadWithMetafiles($module, 'subpaneldefs'); if ($defs) { require $defs; } $defs = SugarAutoLoader::loadExtension("layoutdefs", $module); if ($defs) { require $defs; } } //Filter results for permissions foreach ($layout_defs[$module]['subpanel_setup'] as $subpanel => $subpaneldefs) { $moduleToCheck = $subpaneldefs['module']; $bean = BeanFactory::getBean($moduleToCheck); if (empty($bean)) { continue; } if ($bean->ACLAccess('list')) { $results[$subpanel] = $subpaneldefs; } } return $results; }
function create_wiz_menu_items($type, $mrkt_string, $camp_url, $summ_url) { global $mod_strings; $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN1']] = SugarAutoLoader::existingCustomOne('modules/Campaigns/tpls/WizardCampaignHeader.tpl'); $steps[$mod_strings['LBL_NAVIGATION_MENU_GEN2']] = SugarAutoLoader::existingCustomOne('modules/Campaigns/tpls/WizardCampaignBudget.tpl'); $steps[$mod_strings['LBL_NAVIGATION_MENU_TRACKERS']] = SugarAutoLoader::existingCustomOne('modules/Campaigns/tpls/WizardCampaignTracker.tpl'); if ($type == 'newsletter') { $steps[$mod_strings['LBL_NAVIGATION_MENU_SUBSCRIPTIONS']] = SugarAutoLoader::existingCustomOne('modules/Campaigns/tpls/WizardCampaignTargetList.tpl'); } else { $steps[$mod_strings['LBL_TARGET_LISTS']] = SugarAutoLoader::existingCustomOne('modules/Campaigns/tpls/WizardCampaignTargetListForNonNewsLetter.tpl'); } $nav_html = '<table border="0" cellspacing="0" cellpadding="0" width="100%" >'; if (isset($steps) && !empty($steps)) { $i = 1; foreach ($steps as $name => $step) { $nav_html .= "<tr><td scope='row' nowrap><div id='nav_step{$i}'><a href='" . $camp_url . $i . "'>{$name}</a></div></td></tr>"; $i = $i + 1; } } if ($type == 'newsletter' || $type == 'email') { $nav_html .= "<td scope='row' nowrap><div id='nav_step'" . ($i + 1) . ">{$mrkt_string}</div></td></tr>"; $nav_html .= "<td scope='row' nowrap><div id='nav_step'" . ($i + 2) . ">" . $mod_strings['LBL_NAVIGATION_MENU_SEND_EMAIL'] . "</div></td></tr>"; $nav_html .= "<td scope='row' nowrap><div id='nav_step'" . ($i + 3) . ">" . $summ_url . "</div></td></tr>"; } else { $nav_html .= "<td scope='row' nowrap><div id='nav_step'" . ($i + 1) . ">" . $summ_url . "</div></td></tr>"; } $nav_html .= '</table>'; return $nav_html; }
/** * Write out the new subpanel layout def */ public function handleSave() { if (isset($this->sidecarViewdefs['override_subpanel_list_view']['view']) && isset($this->sidecarViewdefs['override_subpanel_list_view']['link']) && isset(self::$supanelData[$this->module][$this->sidecarViewdefs['override_subpanel_list_view']['link']])) { $subpanelView = $this->sidecarViewdefs['override_subpanel_list_view']['view']; $subpanelLink = self::$supanelData[$this->module][$this->sidecarViewdefs['override_subpanel_list_view']['link']]; $fileName = "modules/{$subpanelLink['module']}/clients/{$this->client}/views/{$subpanelView}/{$subpanelView}.php"; $subpanelFile = "modules/{$subpanelLink['module']}/metadata/subpanels/{$subpanelLink['override_subpanel_name']}.php"; //If no file can be found for either the bwc or sidecar version of override subpanel name, do not save the override if (!SugarAutoLoader::existingCustomOne($fileName, $subpanelFile)) { unset($this->sidecarViewdefs); return true; } } if ($this->collection) { $allviewdefs = $this->sidecarViewdefs; foreach ($allviewdefs as $key => $subpanel) { $this->sidecarViewdefs = $subpanel; if (!$this->handleSaveArray("viewdefs['{$this->module}']['{$this->client}']['layout']['subpanels']['components'][]", "custom/Extension/modules/{$this->module}/Ext/clients/{$this->client}/layouts/subpanels/" . "{$key}_" . basename($this->fullpath))) { return false; } } // save labels for subpanels if (!empty($this->labels)) { $languages = get_languages(); $enstrings = return_app_list_strings_language("en_us"); foreach ($languages as $langKey => $langName) { $strings = return_app_list_strings_language($langKey); $reslabels = array(); foreach ($this->labels as $label => $module) { if (!empty($strings['moduleList'][$module])) { $reslabels[$label] = $strings['moduleList'][$module]; } elseif ($enstrings['moduleList'][$module]) { $reslabels[$label] = $enstrings['moduleList'][$module]; } else { $reslabels[$label] = $module; } } $labeldata = "<?php\n"; foreach ($reslabels as $label => $str) { $labeldata .= "\$mod_strings['{$label}'] = " . var_export($str, true) . ";\n"; } file_put_contents("custom/Extension/modules/{$this->module}/Ext/Language/{$langKey}.{$this->client}_" . basename($this->fullpath), $labeldata); } } return true; } else { return $this->handleSaveArray("viewdefs['{$this->module}']['{$this->client}']['layout']['subpanels']['components'][]", "custom/Extension/modules/{$this->module}/Ext/clients/{$this->client}/layouts/subpanels/" . basename($this->fullpath)); } }
function findTemplate($view, $classList = null) { static $tplCache = array(); if (isset($tplCache[$this->type][$view])) { return $tplCache[$this->type][$view]; } if (!is_array($classList)) { $lastClass = get_class($this); $classList = array($this->type, str_replace('ViewSugarField', '', $lastClass)); while ($lastClass = get_parent_class($lastClass)) { $classList[] = str_replace('ViewSugarField', '', $lastClass); } } $tplName = ''; foreach ($classList as $className) { global $current_language; if (isset($current_language)) { $tplName = SugarAutoLoader::existingCustomOne('include/SugarFields/Fields/' . $className . '/' . $current_language . '.' . $view . '.tpl'); if ($tplName) { break; } } $tplName = SugarAutoLoader::existingCustomOne('include/SugarFields/Fields/' . $className . '/' . $view . '.tpl'); if ($tplName) { break; } } $tplCache[$this->type][$view] = $tplName; return $tplName; }
/** * Finds and returns the best viewdefs to use: * 1. custom/module/quickcreatedefs.php * 2. module/quickcreatedefs.php * 3. custom/module/editviewdefs.php * 4. module/editviewdefs.php * * @param $module * @param $view * @return string The path to the viewdefs file to use */ public function getModuleViewDefsSourceFile($module, $view) { $source = SugarAutoLoader::existingCustomOne("modules/{$module}/metadata/" . strtolower($view) . "defs.php"); if (!$source) { $source = SugarAutoLoader::loadWithMetafiles($module, "editviewdefs"); $this->viewType = 'EditView'; } return $source; }
/** * Loads the var def for the convert lead * @return null */ protected function getVarDefs() { $viewdefs = array(); $metaDataFile = SugarAutoLoader::existingCustomOne($this->fileName); require_once $metaDataFile; return $viewdefs['Leads']['base']['layout']['convert-main']['modules']; }
/** * Returns the query used for the export functionality for a module. Override this method if you wish * to have a custom query to pull this data together instead * * @param string $order_by * @param string $where * @return string SQL query */ public function create_export_query($order_by, $where) { $new_list_params = array(); $filtered_fields = array(); $jtcount = 0; $fields_array = array(); $fields_to_exclude = array(); //include fields_array file if it exists $file = SugarAutoLoader::existingCustomOne("modules/{$this->module_name}/field_arrays.php"); if ($file) { include $file; } //get fields defs to process from either the defined export fields in fields array file, or the bean field array if (!empty($fields_array) && !empty($fields_array[$this->object_name]) && !empty($fields_array[$this->object_name]['export_fields'])) { $fields = array(); foreach ($fields_array[$this->object_name]['export_fields'] as $export_field) { if (!empty($this->field_defs[$export_field])) { $fields[$export_field] = $this->field_defs[$export_field]; } } } else { //if no export list is defined, grab all the field defs from the bean $fields = $this->field_defs; } //iterate through field defs to weed out: //-fields that have export flag set to false //-out of box related fields that have m:m or are the LHS of 1:M relationships foreach ($fields as $field => $data) { //fields including custom fields are exported by default, skip if export flag has been explicitly set to false if (isset($data['exportable']) && $data['exportable'] === false) { continue; } //skip assigned_user_name, and email1 fields as they are handled seperately after the loop if ($field == 'assigned_user_name' || $field == 'email1') { continue; } //process fields of type related if ($this->is_relate_field($field)) { //check to see if the related field name is part of the passed in 'where' statement if (!empty($where) && strpos($where, "{$field} ") !== false) { //initialize fields to exclude array element if not set $module_name_lower = strtolower($this->module_dir); if (empty($fields_to_exclude[$module_name_lower])) { $fields_to_exclude[$module_name_lower] = array(); } //add field to filtered array, this will add the join and allow query to execute $filtered_fields[$field] = $data; //add related field to exclusion array. This will be used to filter out the //field from the export results in export_utils.php get_field_order_mapping() $fields_to_exclude[$module_name_lower][] = $field; //remove fields that create_list_query will add for list view $fields_to_exclude[$module_name_lower][] = $field . '_mod'; $fields_to_exclude[$module_name_lower][] = $field . '_owner'; //if field data has an id_name, then filter out the id field as well if (!empty($data['id_name'])) { $fields_to_exclude[$module_name_lower][] = $data['id_name']; } //if field rname is of type 'name', then add related 'salutation' to exclusion array if ($data['rname'] == 'name') { $fields_to_exclude[$module_name_lower][] = 'rel_' . $field . '_salutation'; } //if field data has concat fields, then add 'salutation' to exclusion array if (!empty($data['db_concat_fields'])) { foreach ($data['db_concat_fields'] as $concat) { $fields_to_exclude[$module_name_lower][] = 'rel_' . $field . '_' . $concat; } } continue; } //unlike regular table fields, fields of type relate including custom relate fields are NOT exported by default. //skip if export flag has not been explicitly to true if (empty($data['exportable']) || $data['exportable'] !== true) { continue; } //check to see that link exists if (!empty($data['link']) && $this->load_relationship($data['link'])) { $type = !empty($data['export_link_type']) ? $data['export_link_type'] : $this->{$data}['link']->getType(); //filter out relationships that can point to multiple records if ($type != "one") { continue; } } } //add field to filtered array $filtered_fields[$field] = $data; } //add the excluded fields to sugarbean. This will be used later by getExportContentFromResult() to exclude fields from export $this->fields_to_exclude = $fields_to_exclude; //retrieve the sql query as an array for easier manipulation //note, we do nothing for email1 field in this method, it is already handled by create_new_list_query $returnArray = $this->create_new_list_query($order_by, $where, $filtered_fields, $new_list_params, 0, '', true, $this, true, true, true); //Process assigned user seperately. They require slightly different query and should be included by default. if (isset($this->field_defs['assigned_user_name']) && !empty($this->field_defs['assigned_user_name']['exportable'])) { $returnArray['select'] .= ', assigned_user.user_name as assigned_user_name'; $returnArray['from'] .= " LEFT JOIN users assigned_user ON {$this->table_name}.assigned_user_id=assigned_user.id"; } return $returnArray['select'] . $returnArray['from'] . $returnArray['where'] . $returnArray['order_by']; }