本文整理汇总了PHP中SugarThemeRegistry::get方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarThemeRegistry::get方法的具体用法?PHP SugarThemeRegistry::get怎么用?PHP SugarThemeRegistry::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarThemeRegistry
的用法示例。
在下文中一共展示了SugarThemeRegistry::get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_theme_display
/**
* Return the display name for a theme if it exists.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
*
* @deprecated use SugarThemeRegistry::get($theme)->name instead
*/
function get_theme_display($theme)
{
return SugarThemeRegistry::get($theme)->name;
}
示例2: getAllImages
/**
* 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) {
if (!sugar_is_dir($path)) {
$path = "custom/{$path}";
}
if (sugar_is_dir($path) && is_readable($path) && ($dir = opendir($path))) {
while (($file = readdir($dir)) !== false) {
if ($file == ".." || $file == "." || $file == ".svn" || $file == "CVS" || $file == "Attic") {
continue;
}
if (!isset($imageArray[$file])) {
$imageArray[$file] = $this->getImageURL($file, false);
}
}
closedir($dir);
}
}
ksort($imageArray);
return $imageArray;
}
示例3: setImagePath
function setImagePath($image_path)
{
$this->local_image_path = $image_path;
if (empty($this->local_image_path)) {
$this->local_image_path = SugarThemeRegistry::get($this->local_theme)->getImagePath();
}
if (isset($this->xTemplate)) {
$this->xTemplate->assign("IMAGE_PATH", $this->local_image_path);
}
}
示例4: getAllImages
/**
* 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;
}
示例5: testOldThemeIsNotRecognized
/**
* @ticket 35307
*/
public function testOldThemeIsNotRecognized()
{
$themename = SugarTestThemeUtilities::createAnonymousOldTheme();
$this->assertNull(SugarThemeRegistry::get($themename));
}
示例6: setupThemeTab
protected function setupThemeTab()
{
$user_theme = $this->bean->getPreference('user_theme');
if (isset($user_theme)) {
$this->ss->assign("THEMES", get_select_options_with_id(SugarThemeRegistry::availableThemes(), $user_theme));
} else {
$this->ss->assign("THEMES", get_select_options_with_id(SugarThemeRegistry::availableThemes(), $GLOBALS['sugar_config']['default_theme']));
}
$this->ss->assign("SHOW_THEMES", count(SugarThemeRegistry::availableThemes()) > 1);
$this->ss->assign("USER_THEME_COLOR", $this->bean->getPreference('user_theme_color'));
$this->ss->assign("USER_THEME_FONT", $this->bean->getPreference('user_theme_font'));
$this->ss->assign("USER_THEME", $user_theme);
// Build a list of themes that support group modules
$this->ss->assign("DISPLAY_GROUP_TAB", 'none');
$selectedTheme = $user_theme;
if (!isset($user_theme)) {
$selectedTheme = $GLOBALS['sugar_config']['default_theme'];
}
$themeList = SugarThemeRegistry::availableThemes();
$themeGroupList = array();
foreach ($themeList as $themeId => $themeName) {
$currThemeObj = SugarThemeRegistry::get($themeId);
if (isset($currThemeObj->group_tabs) && $currThemeObj->group_tabs == 1) {
$themeGroupList[$themeId] = true;
if ($themeId == $selectedTheme) {
$this->ss->assign("DISPLAY_GROUP_TAB", '');
}
} else {
$themeGroupList[$themeId] = false;
}
}
$this->ss->assign("themeGroupListJSON", json_encode($themeGroupList));
}
示例7: testCaching
public function testCaching()
{
$this->_themeObject->getCSSURL("style.css");
$themename = $this->_themeObject->__toString();
$pathname = "cache/themes/{$themename}/css/style.css";
// test if it's in the local cache
$this->assertTrue(isset($this->_themeObject->_cssCache['style.css']));
$this->assertEquals($this->_themeObject->_cssCache['style.css'], $pathname);
// destroy object
$this->_themeObject->__destruct();
unset($this->_themeObject);
// now recreate object
SugarThemeRegistry::add($this->_themeDef);
$this->_themeObject = SugarThemeRegistry::get($this->_themeDef['dirName']);
// should still be in local cache
$this->assertTrue(isset($this->_themeObject->_cssCache['style.css']));
$this->assertEquals($this->_themeObject->_cssCache['style.css'], $pathname);
// now, let's tell the theme we want to clear the cache on destroy
$this->_themeObject->clearCache();
// destroy object
$this->_themeObject->__destruct();
unset($this->_themeObject);
// now recreate object
SugarThemeRegistry::add($this->_themeDef);
$this->_themeObject = SugarThemeRegistry::get($this->_themeDef['dirName']);
// should not be in local cache
$this->assertFalse(isset($this->_themeObject->_cssCache['style.css']));
}
示例8: get_select_options_with_id
$sugar_smarty->assign("THEMES", get_select_options_with_id(SugarThemeRegistry::availableThemes(), $GLOBALS['sugar_config']['default_theme']));
}
$sugar_smarty->assign("SHOW_THEMES", count(SugarThemeRegistry::availableThemes()) > 1);
$sugar_smarty->assign("USER_THEME_COLOR", $focus->getPreference('user_theme_color'));
$sugar_smarty->assign("USER_THEME_FONT", $focus->getPreference('user_theme_font'));
$sugar_smarty->assign("USER_THEME", $user_theme);
// Build a list of themes that support group modules
$sugar_smarty->assign("DISPLAY_GROUP_TAB", 'none');
$selectedTheme = $user_theme;
if (!isset($user_theme)) {
$selectedTheme = $GLOBALS['sugar_config']['default_theme'];
}
$themeList = SugarThemeRegistry::availableThemes();
$themeGroupList = array();
foreach ($themeList as $themeId => $themeName) {
$currThemeObj = SugarThemeRegistry::get($themeId);
if (isset($currThemeObj->group_tabs) && $currThemeObj->group_tabs == 1) {
$themeGroupList[$themeId] = true;
if ($themeId == $selectedTheme) {
$sugar_smarty->assign("DISPLAY_GROUP_TAB", '');
}
} else {
$themeGroupList[$themeId] = false;
}
}
$sugar_smarty->assign("themeGroupListJSON", json_encode($themeGroupList));
$sugar_smarty->assign("MAIL_SENDTYPE", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->getPreference('mail_sendtype')));
$reminder_time = $focus->getPreference('reminder_time');
if (empty($reminder_time)) {
$reminder_time = -1;
}
示例9: 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("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.
//.........这里部分代码省略.........
示例10: 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
//.........这里部分代码省略.........