本文整理汇总了PHP中Sugar_Smarty::get_template_vars方法的典型用法代码示例。如果您正苦于以下问题:PHP Sugar_Smarty::get_template_vars方法的具体用法?PHP Sugar_Smarty::get_template_vars怎么用?PHP Sugar_Smarty::get_template_vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sugar_Smarty
的用法示例。
在下文中一共展示了Sugar_Smarty::get_template_vars方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_body
/**
* Implement get_body function to correctly populate the template for the ModuleBuilder/Studio
* Add field page.
*
* @param Sugar_Smarty $ss
* @param array $vardef
*
*/
function get_body(&$ss, $vardef)
{
global $app_list_strings, $mod_strings;
$vars = $ss->get_template_vars();
$fields = $vars['module']->mbvardefs->vardefs['fields'];
$fieldOptions = array();
foreach ($fields as $id => $def) {
$fieldOptions[$id] = $def['name'];
}
$ss->assign('fieldOpts', $fieldOptions);
return $ss->fetch('custom/modules/DynamicFields/templates/Fields/Forms/worklog.tpl');
}
示例2: displayFooter
/**
* Called from process(). This method will display the footer on the page.
*/
public function displayFooter()
{
if (empty($this->responseTime)) {
$this->_calculateFooterMetrics();
}
global $sugar_config;
global $app_strings;
global $mod_strings;
$themeObject = SugarThemeRegistry::current();
//decide whether or not to show themepicker, default is to show
$showThemePicker = true;
if (isset($sugar_config['showThemePicker'])) {
$showThemePicker = $sugar_config['showThemePicker'];
}
echo "<!-- crmprint -->";
$jsalerts = new jsAlerts();
if (!isset($_SESSION['isMobile'])) {
echo $jsalerts->getScript();
}
$ss = new Sugar_Smarty();
$ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"]));
$ss->assign('MOD', return_module_language($GLOBALS['current_language'], 'Users'));
$bottomLinkList = array();
if (isset($this->action) && $this->action != "EditView") {
$bottomLinkList['print'] = array($app_strings['LNK_PRINT'] => getPrintLink());
}
$bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => 'javascript:SUGAR.util.top();');
$bottomLinksStr = "";
foreach ($bottomLinkList as $key => $value) {
foreach ($value as $text => $link) {
$href = $link;
if (substr($link, 0, 11) == "javascript:") {
$onclick = " onclick=\"" . substr($link, 11) . "\"";
$href = "javascript:void(0)";
} else {
$onclick = "";
}
$imageURL = SugarThemeRegistry::current()->getImageURL($key . '.gif');
$bottomLinksStr .= "<a href=\"{$href}\"";
$bottomLinksStr .= isset($onclick) ? $onclick : "";
$bottomLinksStr .= "><img src='{$imageURL}' alt=''>";
//keeping alt blank on purpose for 508 (text will be read instead)
$bottomLinksStr .= " " . $text . "</a>";
}
}
$ss->assign("BOTTOMLINKS", $bottomLinksStr);
if (SugarConfig::getInstance()->get('calculate_response_time', false)) {
$ss->assign('STATISTICS', $this->_getStatistics());
}
// Under the License referenced above, you are required to leave in all copyright statements in both
// the code and end-user application.
$copyright = '© 2004-2012 SugarCRM Inc. The Program is provided AS IS, without warranty. Licensed under <a href="LICENSE.txt" target="_blank" class="copyRightLink">AGPLv3</a>.<br>This program is free software; you can redistribute it and/or modify it under the terms of the <br><a href="LICENSE.txt" target="_blank" class="copyRightLink"> GNU Affero General Public License version 3</a> as published by the Free Software Foundation, including the additional permission set forth in the source code header.<br>';
// The interactive user interfaces in modified source and object code
// versions of this program must display Appropriate Legal Notices, as
// required under Section 5 of the GNU General Public License version
// 3. In accordance with Section 7(b) of the GNU General Public License
// version 3, these Appropriate Legal Notices must retain the display
// of the "Powered by SugarCRM" logo. If the display of the logo is
// not reasonably feasible for technical reasons, the Appropriate
// Legal Notices must display the words "Powered by SugarCRM".
$attribLinkImg = "<img style='margin-top: 2px' border='0' width='120' height='34' src='include/images/poweredby_sugarcrm_65.png' alt='Powered By SugarCRM'>\n";
// handle resizing of the company logo correctly on the fly
$companyLogoURL = $themeObject->getImageURL('company_logo.png');
$companyLogoURL_arr = explode('?', $companyLogoURL);
$companyLogoURL = $companyLogoURL_arr[0];
$company_logo_attributes = sugar_cache_retrieve('company_logo_attributes');
if (!empty($company_logo_attributes)) {
$ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]);
$ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]);
$ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]);
} else {
// Always need to md5 the file
$ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL));
list($width, $height) = getimagesize($companyLogoURL);
if ($width > 212 || $height > 40) {
$resizePctWidth = ($width - 212) / 212;
$resizePctHeight = ($height - 40) / 40;
if ($resizePctWidth > $resizePctHeight) {
$resizeAmount = $width / 212;
} else {
$resizeAmount = $height / 40;
}
$ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount)));
$ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount)));
} else {
$ss->assign("COMPANY_LOGO_WIDTH", $width);
$ss->assign("COMPANY_LOGO_HEIGHT", $height);
}
// Let's cache the results
sugar_cache_put('company_logo_attributes', array($ss->get_template_vars("COMPANY_LOGO_MD5"), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT")));
}
$ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL) . "&logo_md5=" . $ss->get_template_vars("COMPANY_LOGO_MD5"));
// Bug 38594 - Add in Trademark wording
$copyright .= 'SugarCRM is a trademark of SugarCRM, Inc. All other company and product names may be trademarks of the respective companies with which they are associated.<br />';
//rrs bug: 20923 - if this image does not exist as per the license, then the proper image will be displayed regardless, so no need
//to display an empty image here.
if (file_exists('include/images/poweredby_sugarcrm_65.png')) {
//.........这里部分代码省略.........
示例3: displayHeader
/**
* Displays the header on section of the page; basically everything before the content
*/
public function displayHeader()
{
global $theme;
global $max_tabs;
global $app_strings;
global $current_user;
global $sugar_config;
global $app_list_strings;
global $mod_strings;
global $current_language;
$GLOBALS['app']->headerDisplayed = true;
$themeObject = SugarThemeRegistry::current();
$theme = $themeObject->__toString();
$ss = new Sugar_Smarty();
$ss->assign("APP", $app_strings);
$ss->assign("THEME", $theme);
$ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true' : 'false');
$ss->assign("MODULE_NAME", $this->module);
// get browser title
$ss->assign("SYSTEM_NAME", $this->getBrowserTitle());
// get css
$css = $themeObject->getCSS();
if ($this->_getOption('view_print')) {
$css .= '<link rel="stylesheet" type="text/css" href="' . $themeObject->getCSSURL('print.css') . '" media="all" />';
}
$ss->assign("SUGAR_CSS", $css);
// get javascript
ob_start();
$this->renderJavascript();
$ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
ob_end_clean();
// get favicon
if (isset($GLOBALS['sugar_config']['default_module_favicon'])) {
$module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
} else {
$module_favicon = false;
}
$favicon = '';
if ($module_favicon) {
$favicon = $themeObject->getImageURL($this->module . '.gif', false);
}
if (!sugar_is_file($favicon) || !$module_favicon) {
$favicon = $themeObject->getImageURL('sugar_icon.ico', false);
}
$ss->assign('FAVICON_URL', getJSPath($favicon));
// build the shortcut menu
$shortcut_menu = array();
foreach ($this->getMenu() as $key => $menu_item) {
$shortcut_menu[$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "alt='" . $menu_item[1] . "' border='0' align='absmiddle'"));
}
$ss->assign("SHORTCUT_MENU", $shortcut_menu);
// handle rtl text direction
if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') {
$_SESSION['RTL'] = true;
}
if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') {
unset($_SESSION['RTL']);
}
if (isset($_SESSION['RTL']) && $_SESSION['RTL']) {
$ss->assign("DIR", 'dir="RTL"');
}
// handle resizing of the company logo correctly on the fly
$companyLogoURL = $themeObject->getImageURL('company_logo.png');
$companyLogoURL_arr = explode('?', $companyLogoURL);
$companyLogoURL = $companyLogoURL_arr[0];
$company_logo_attributes = sugar_cache_retrieve('company_logo_attributes');
if (!empty($company_logo_attributes)) {
$ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]);
$ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]);
$ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]);
} else {
// Always need to md5 the file
$ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL));
list($width, $height) = getimagesize($companyLogoURL);
if ($width > 212 || $height > 40) {
$resizePctWidth = ($width - 212) / 212;
$resizePctHeight = ($height - 40) / 40;
if ($resizePctWidth > $resizePctHeight) {
$resizeAmount = $width / 212;
} else {
$resizeAmount = $height / 40;
}
$ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount)));
$ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount)));
} else {
$ss->assign("COMPANY_LOGO_WIDTH", $width);
$ss->assign("COMPANY_LOGO_HEIGHT", $height);
}
// Let's cache the results
sugar_cache_put('company_logo_attributes', array($ss->get_template_vars("COMPANY_LOGO_MD5"), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT")));
}
$ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL) . "&logo_md5=" . $ss->get_template_vars("COMPANY_LOGO_MD5"));
// get the global links
$gcls = array();
$global_control_links = array();
require "include/globalControlLinks.php";
foreach ($global_control_links as $key => $value) {
//.........这里部分代码省略.........
示例4: overlib
$chooser->args['right_name'] = 'hide_tabs';
$chooser->args['left_label'] = $mod_strings['LBL_DISPLAY_TABS'];
$chooser->args['right_label'] = $mod_strings['LBL_HIDE_TABS'];
$chooser->args['title'] = $mod_strings['LBL_EDIT_TABS'] . ' <img border="0" src="themes/default/images/helpInline.gif" onmouseover="return overlib(\'Choose which tabs are displayed.\', FGCLASS, \'olFgClass\', CGCLASS, \'olCgClass\', BGCLASS, \'olBgClass\', TEXTFONTCLASS, \'olFontClass\', CAPTIONFONTCLASS, \'olCapFontClass\', CLOSEFONTCLASS, \'olCloseFontClass\', WIDTH, -1, NOFOLLOW, \'ol_nofollow\' );" onmouseout="return nd();"/>';
$sugar_smarty->assign('TAB_CHOOSER', $chooser->display());
$sugar_smarty->assign('CHOOSER_SCRIPT', 'set_chooser();');
$sugar_smarty->assign('CHOOSE_WHICH', $mod_strings['LBL_CHOOSE_WHICH']);
///////////////////////////////////////////////////////////////////////////////
//// EMAIL OPTIONS
// We need to turn off the requiredness of emails if it is a group or portal user
if ($usertype == 'GROUP' || $usertype == 'PORTAL_ONLY') {
global $dictionary;
$dictionary['User']['fields']['email1']['required'] = false;
}
// hack to disable email field being required if it shouldn't be required
if ($sugar_smarty->get_template_vars("REQUIRED_EMAIL_ADDRESS") == '0') {
$GLOBALS['dictionary']['User']['fields']['email1']['required'] = false;
}
$sugar_smarty->assign("NEW_EMAIL", getEmailAddressWidget($focus, "email1", $focus->email1, "EditView"));
// hack to undo that previous hack
if ($sugar_smarty->get_template_vars("REQUIRED_EMAIL_ADDRESS") == '0') {
$GLOBALS['dictionary']['User']['fields']['email1']['required'] = true;
}
$sugar_smarty->assign('EMAIL_LINK_TYPE', get_select_options_with_id($app_list_strings['dom_email_link_type'], $focus->getPreference('email_link_type')));
///// END EMAIL OPTIONS
///////////////////////////////////////////////////////////////////////////////
if ($is_current_admin) {
$employee_status = '<select tabindex="5" name="employee_status">';
$employee_status .= get_select_options_with_id($app_list_strings['employee_status_dom'], $focus->employee_status);
$employee_status .= '</select>';
} else {
示例5: displayHeader
/**
* Displays the header on section of the page; basically everything before the content
* @deprecated since 7.0, will be removed from 7.2.
*/
public function displayHeader($retModTabs = false)
{
global $theme;
global $max_tabs;
global $app_strings;
global $current_user;
global $app_list_strings;
global $mod_strings;
global $current_language;
$GLOBALS['app']->headerDisplayed = true;
$themeObject = SugarThemeRegistry::current();
$theme = $themeObject->__toString();
$ss = new Sugar_Smarty();
$ss->assign("APP", $app_strings);
$ss->assign("THEME", $theme);
$ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true' : 'false');
$ss->assign("MODULE_NAME", $this->module);
$ss->assign("langHeader", get_language_header());
$ss->assign('use_table_container', isset($this->options['use_table_container']) ? $this->options['use_table_container'] : false);
// set ab testing if exists
$testing = isset($_REQUEST["testing"]) ? $_REQUEST['testing'] : "a";
$ss->assign("ABTESTING", $testing);
// get browser title
$ss->assign("SYSTEM_NAME", $this->getBrowserTitle());
// get css
$ss->assign("SUGAR_CSS", $this->getThemeCss());
// get javascript
ob_start();
$this->renderJavascript();
$ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
ob_end_clean();
$favicon = $this->getFavicon();
$ss->assign('FAVICON_URL', $favicon['url']);
// build the shortcut menu
$shortcut_menu = array();
foreach ($this->getMenu() as $key => $menu_item) {
$shortcut_menu[$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "border='0' align='absmiddle'", null, null, '.gif', $menu_item[1]));
}
$ss->assign("SHORTCUT_MENU", $shortcut_menu);
// handle rtl text direction
if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') {
$_SESSION['RTL'] = true;
}
if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') {
unset($_SESSION['RTL']);
}
if (isset($_SESSION['RTL']) && $_SESSION['RTL']) {
$ss->assign("DIR", 'dir="RTL"');
}
// handle resizing of the company logo correctly on the fly
$companyLogoURL = $themeObject->getImageURL('company_logo.png', true, true);
$companyLogoURL_arr = explode('?', $companyLogoURL);
$companyLogoURL = $companyLogoURL_arr[0];
$company_logo_attributes = sugar_cache_retrieve('company_logo_attributes');
if (!empty($company_logo_attributes)) {
$ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]);
$ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]);
$ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]);
} else {
// Always need to md5 the file
$ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL));
list($width, $height) = getimagesize($companyLogoURL);
if ($width > 212 || $height > 40) {
$resizePctWidth = ($width - 212) / 212;
$resizePctHeight = ($height - 40) / 40;
if ($resizePctWidth > $resizePctHeight) {
$resizeAmount = $width / 212;
} else {
$resizeAmount = $height / 40;
}
$ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount)));
$ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount)));
} else {
$ss->assign("COMPANY_LOGO_WIDTH", $width);
$ss->assign("COMPANY_LOGO_HEIGHT", $height);
}
// Let's cache the results
sugar_cache_put('company_logo_attributes', array($ss->get_template_vars("COMPANY_LOGO_MD5"), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT")));
}
$ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL) . "&logo_md5=" . $ss->get_template_vars("COMPANY_LOGO_MD5"));
// get the global links (Currently not used, since we hardcoded the metadata for profileactions
// and upon upgrade, we convert global link in metadataconverter to create custom metadata
// for profileactions, Thus, code below can be removed in the future)
$gcls = array();
$global_control_links = array();
require "include/globalControlLinks.php";
foreach ($global_control_links as $key => $value) {
if ($key == 'users') {
//represents logout link.
$ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]);
$ss->assign("LOGOUT_LABEL", key($value['linkinfo']));
//key value for first element.
continue;
}
foreach ($value as $linkattribute => $attributevalue) {
// get the main link info
//.........这里部分代码省略.........
示例6: change_color
/**
* Determine whether or not to dispay the header on the page.
*/
function displayHeader()
{
global $theme;
global $max_tabs;
global $app_strings;
global $current_user;
global $sugar_config;
global $app_list_strings;
$GLOBALS['app']->headerDisplayed = true;
if (!function_exists('get_new_record_form') && (file_exists('modules/' . $this->module . '/metadata/sidecreateviewdefs.php') || file_exists('custom/modules/' . $this->module . '/metadata/sidecreateviewdefs.php'))) {
require_once 'include/EditView/SideQuickCreate.php';
}
if (!$this->_menuExists($this->module) && !empty($GLOBALS['mod_strings']['LNK_NEW_RECORD'])) {
$GLOBALS['module_menu'][] = array("index.php?module={$this->module}&action=EditView&return_module={$this->module}&return_action=DetailView", $GLOBALS['mod_strings']['LNK_NEW_RECORD'], "{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}{$this->module}", $this->module);
$GLOBALS['module_menu'][] = array("index.php?module={$this->module}&action=index", $GLOBALS['mod_strings']['LNK_LIST'], $this->module, $this->module);
}
$themeObject = SugarThemeRegistry::current();
$theme = $themeObject->__toString();
$ss = new Sugar_Smarty();
$ss->assign("APP", $app_strings);
$ss->assign("THEME", $theme);
$ss->assign("MODULE_NAME", $this->module);
// get css
$css = $themeObject->getCSS();
if ($this->_getOption('view_print')) {
$css .= '\\n<link rel="stylesheet" type="text/css" href="' . $themeObject->getCSSURL('print.css') . '" media="all" />';
}
$ss->assign("SUGAR_CSS", $css);
// get javascript
ob_start();
$this->renderJavascript();
$ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
ob_end_clean();
// get favicon
$user_module_favicon = $current_user->getPreference('module_favicon');
if (!isset($user_module_favicon) && isset($GLOBALS['sugar_config']['default_module_favicon'])) {
$user_module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
} elseif (!isset($user_module_favicon)) {
$user_module_favicon = false;
}
$favicon = $themeObject->getImageURL($this->module . '.gif', false);
if (!sugar_is_file($favicon) || !$user_module_favicon) {
$favicon = $themeObject->getImageURL('sugar_icon.ico', false);
}
$ss->assign('FAVICON_URL', getJSPath($favicon));
// get the module menu
$shortcut_menu = array();
$module_menu = load_menu("modules/" . $this->module . "/");
foreach ($module_menu as $key => $menu_item) {
$shortcut_menu[$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "alt='" . $menu_item[1] . "' border='0' align='absmiddle'"));
}
$ss->assign("SHORTCUT_MENU", $shortcut_menu);
// handle rtl text direction
if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') {
$_SESSION['RTL'] = true;
}
if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') {
unset($_SESSION['RTL']);
}
if (isset($_SESSION['RTL']) && $_SESSION['RTL']) {
$ss->assign("DIR", 'dir="RTL"');
}
// handle resizing of the company logo correctly on the fly
$companyLogoURL = $themeObject->getImageURL('company_logo.png', false);
$ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL));
$company_logo_attributes = sugar_cache_retrieve('company_logo_attributes');
if (!empty($company_logo_attributes) && md5_file($companyLogoURL) == $company_logo_attributes[0]) {
$ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]);
$ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]);
} else {
list($width, $height) = getimagesize($companyLogoURL);
if ($width > 212 || $height > 40) {
$resizePctWidth = ($width - 212) / 212;
$resizePctHeight = ($height - 40) / 40;
if ($resizePctWidth > $resizePctHeight) {
$resizeAmount = $width / 212;
} else {
$resizeAmount = $height / 40;
}
$ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount)));
$ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount)));
sugar_cache_put('company_logo_attributes', array(md5_file($companyLogoURL), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT")));
} else {
$ss->assign("COMPANY_LOGO_WIDTH", $width);
$ss->assign("COMPANY_LOGO_HEIGHT", $height);
}
}
// get the global links
$gcls = array();
$global_control_links = array();
require "include/globalControlLinks.php";
foreach ($global_control_links as $key => $value) {
if ($key == 'users') {
//represents logout link.
$ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]);
$ss->assign("LOGOUT_LABEL", key($value['linkinfo']));
//key value for first element.
//.........这里部分代码省略.........
示例7: displayHeader
/**
* Determine whether or not to dispay the header on the page.
*/
function displayHeader()
{
global $theme;
global $max_tabs;
global $app_strings;
global $current_user;
global $sugar_config;
global $app_list_strings;
$GLOBALS['app']->headerDisplayed = true;
if (!function_exists('get_new_record_form') && (file_exists('modules/' . $this->module . '/metadata/sidecreateviewdefs.php') || file_exists('custom/modules/' . $this->module . '/metadata/sidecreateviewdefs.php'))) {
require_once 'include/EditView/SideQuickCreate.php';
}
if (!$this->_menuExists($this->module) && !empty($GLOBALS['mod_strings']['LNK_NEW_RECORD'])) {
$GLOBALS['module_menu'][] = array("index.php?module={$this->module}&action=EditView&return_module={$this->module}&return_action=DetailView", $GLOBALS['mod_strings']['LNK_NEW_RECORD'], "{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}{$this->module}", $this->module);
$GLOBALS['module_menu'][] = array("index.php?module={$this->module}&action=index", $GLOBALS['mod_strings']['LNK_LIST'], $this->module, $this->module);
}
$themeObject = SugarThemeRegistry::current();
$theme = $themeObject->__toString();
$ss = new Sugar_Smarty();
$ss->assign("APP", $app_strings);
$ss->assign("THEME", $theme);
$ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true' : 'false');
$ss->assign("MODULE_NAME", $this->module);
// get css
$css = $themeObject->getCSS();
if ($this->_getOption('view_print')) {
$css .= '<link rel="stylesheet" type="text/css" href="' . $themeObject->getCSSURL('print.css') . '" media="all" />';
}
$ss->assign("SUGAR_CSS", $css);
// get javascript
ob_start();
$this->renderJavascript();
$ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
ob_end_clean();
// get favicon
if (isset($GLOBALS['sugar_config']['default_module_favicon'])) {
$module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
} else {
$module_favicon = false;
}
$favicon = '';
if ($module_favicon) {
$favicon = $themeObject->getImageURL($this->module . '.gif', false);
}
if (!sugar_is_file($favicon) || !$module_favicon) {
$favicon = $themeObject->getImageURL('sugar_icon.ico', false);
}
$ss->assign('FAVICON_URL', getJSPath($favicon));
// get the module menu
$shortcut_menu = array();
$module_menu = load_menu("modules/" . $this->module . "/");
foreach ($module_menu as $key => $menu_item) {
$shortcut_menu[$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "alt='" . $menu_item[1] . "' border='0' align='absmiddle'"));
}
$ss->assign("SHORTCUT_MENU", $shortcut_menu);
// handle rtl text direction
if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') {
$_SESSION['RTL'] = true;
}
if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') {
unset($_SESSION['RTL']);
}
if (isset($_SESSION['RTL']) && $_SESSION['RTL']) {
$ss->assign("DIR", 'dir="RTL"');
}
// handle resizing of the company logo correctly on the fly
$companyLogoURL = $themeObject->getImageURL('company_logo.png');
$companyLogoURL_arr = explode('?', $companyLogoURL);
$companyLogoURL = $companyLogoURL_arr[0];
$company_logo_attributes = sugar_cache_retrieve('company_logo_attributes');
if (!empty($company_logo_attributes)) {
$ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]);
$ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]);
$ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]);
} else {
// Always need to md5 the file
$ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL));
list($width, $height) = getimagesize($companyLogoURL);
if ($width > 212 || $height > 40) {
$resizePctWidth = ($width - 212) / 212;
$resizePctHeight = ($height - 40) / 40;
if ($resizePctWidth > $resizePctHeight) {
$resizeAmount = $width / 212;
} else {
$resizeAmount = $height / 40;
}
$ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount)));
$ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount)));
} else {
$ss->assign("COMPANY_LOGO_WIDTH", $width);
$ss->assign("COMPANY_LOGO_HEIGHT", $height);
}
// Let's cache the results
sugar_cache_put('company_logo_attributes', array($ss->get_template_vars("COMPANY_LOGO_MD5"), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT")));
}
$ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL) . "&logo_md5=" . $ss->get_template_vars("COMPANY_LOGO_MD5"));
// get the global links
//.........这里部分代码省略.........