本文整理汇总了PHP中getTrackerSubstring函数的典型用法代码示例。如果您正苦于以下问题:PHP getTrackerSubstring函数的具体用法?PHP getTrackerSubstring怎么用?PHP getTrackerSubstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getTrackerSubstring函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
$tracker = BeanFactory::getBean('Trackers');
$history = $tracker->get_recently_viewed($GLOBALS['current_user']->id);
foreach ($history as $key => $row) {
$history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']);
$history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle"', null, null, '.gif', $row['item_summary']);
}
$this->ss->assign('LAST_VIEWED', $history);
$this->ss->display('include/MVC/View/tpls/modulelistmenu.tpl');
}
示例2: display
public function display()
{
$tracker = new Tracker();
$history = $tracker->get_recently_viewed($GLOBALS['current_user']->id, array('Emails', 'EmailTemplates'));
foreach ($history as $key => $row) {
$history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']);
$history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle" alt="' . $row['item_summary'] . '"');
}
$this->ss->assign('LAST_VIEWED', $history);
$this->ss->display('include/MVC/View/tpls/modulelistmenu.tpl');
}
示例3: test_get_tracker_substring2
public function test_get_tracker_substring2()
{
global $sugar_config;
$test_string = '"Hello There How Are You? " This has quotes too';
$default_length = 15;
$sugar_config['tracker_max_display_length'] = $default_length;
$display_string = getTrackerSubstring($test_string);
$this->assertEquals(strlen($display_string), $default_length, 'Assert that the string length is equal to ' . $default_length . ' characters (default)');
$test_string = '早前於美國完成民族音樂學博士學位回港後在大專院校的音樂系任教123456789';
$display_string = getTrackerSubstring($test_string);
$this->assertEquals(mb_strlen($display_string, 'UTF-8'), $default_length, 'Assert that the string length is equal to ' . $default_length . ' characters (default)');
}
示例4: testGetTrackerSubstring
/**
* @dataProvider providerTestGetTrackerSubstring
*/
public function testGetTrackerSubstring($value, $expected)
{
// Setup some helper values
$add = "";
$cut = $GLOBALS['sugar_config']['tracker_max_display_length'];
// If the length is longer then the set tracker_max_display_length, the substring length for asserting equal will be
// -3 the length of the tracker_max_display_length, and we should add ...
if (strlen($expected) > $GLOBALS['sugar_config']['tracker_max_display_length']) {
$add = "...";
$cut = $cut - 3;
}
// Test if the values got converted, and if the original string was chopped to the expected string
$this->assertEquals(getTrackerSubstring($value), substr($expected, 0, $cut) . $add, '');
}
示例5: getCurrentUserSidebarFavorites
public function getCurrentUserSidebarFavorites($id = null)
{
global $db, $current_user;
$return_array = array();
if ($id) {
$query = "SELECT parent_id, parent_type FROM favorites WHERE assigned_user_id = '" . $current_user->id . "' AND parent_id = '" . $id . "' AND deleted = 0 ORDER BY date_entered desc";
} else {
$query = "SELECT parent_id, parent_type FROM favorites WHERE assigned_user_id = '" . $current_user->id . "' AND deleted = 0 ORDER BY date_entered desc";
}
$result = $db->query($query);
$i = 0;
while ($row = $db->fetchByAssoc($result)) {
$bean = BeanFactory::getBean($row['parent_type'], $row['parent_id']);
$return_array[$i]['item_summary'] = $bean->name;
$return_array[$i]['item_summary_short'] = to_html(getTrackerSubstring($bean->name));
$return_array[$i]['id'] = $row['parent_id'];
$return_array[$i]['module_name'] = $row['parent_type'];
$return_array[$i]['image'] = SugarThemeRegistry::current()->getImage($row['parent_type'], 'border="0" align="absmiddle"', null, null, '.gif', $bean->name);
$i++;
}
return $return_array;
}
示例6: Tracker
}
if (isset($_SESSION["authenticated_user_id"])) {
$xtpl->assign("LEFT_FORM_OTD", '<td valign="top" style="width: 10px;"><img style="cursor: pointer; cursor: hand;" id="HideHandle" name="HideHandle" src="' . $image_path . 'show.gif" alt="" onclick=\'hideLeftCol("leftCol");closeMenus();\' onmouseover="showSubMenu(\'leftCol\')"></td><td valign="top" style="width: 160px;"><div style="display: none;" id="leftCol"><table cellpadding="0" cellspacing="0" border="0" width="160"><tr><td style="padding-right: 10px;">');
$xtpl->assign("LEFT_FORM_CTD", '<img src="' . $image_path . 'blank.gif" alt="" width="160" height="1" border="0"></td></tr></table></div></td>');
$xtpl->assign("TITLE", $app_strings['LBL_SEARCH']);
require_once "modules/Home/sitemap.php";
$xtpl->assign("SITEMAP", $app_strings['LBL_SITEMAP']);
$xtpl->parse("main.left_form.left_form_search");
$xtpl->parse("main.left_form");
$xtpl->assign("TITLE", $app_strings['LBL_LAST_VIEWED']);
$tracker = new Tracker();
$history = $tracker->get_recently_viewed($current_user->id);
$current_row = 1;
if (count($history) > 0) {
foreach ($history as $row) {
$xtpl->assign("RECENT_LABEL", getTrackerSubstring($row['item_summary']));
$xtpl->assign("RECENT_LABEL_FULL", $row['item_summary']);
$xtpl->assign("MODULE_NAME", $row['module_name']);
$xtpl->assign("ROW_NUMBER", $current_row);
$xtpl->assign("RL_IMAGE", get_image($image_path . $row['module_name'], 'border="0" align="absmiddle" alt="' . $row['item_summary'] . '"'));
$xtpl->assign("RECENT_URL", "index.php?module={$row['module_name']}&action=DetailView&record={$row['item_id']}");
$xtpl->parse("main.hide");
$xtpl->parse("main.left_form.left_form_recent_view.left_form_recent_view_row");
$current_row++;
}
} else {
$xtpl->parse("main.hide_empty");
$xtpl->parse("main.left_form.left_form_recent_view.left_form_recent_view_empty");
}
$xtpl->parse("main.left_form.left_form_recent_view");
$xtpl->parse("main.left_form");
示例7: processRecentRecords
/**
* handles the tracker output, and adds a link and a shortened name.
* given html safe input, it will preserve html safety
*
* @param array $history - returned from the tracker
* @return array augmented history with image link and shortened name
*/
protected function processRecentRecords($history)
{
foreach ($history as $key => $row) {
$history[$key]['item_summary_short'] = to_html(getTrackerSubstring($row['item_summary']));
//bug 56373 - need to re-HTML-encode
$history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle"', null, null, '.gif', $row['item_summary']);
}
return $history;
}
示例8: displayHeader
//.........这里部分代码省略.........
$gcls[$key] = array("LABEL" => key($attributevalue), "URL" => current($attributevalue), "SUBMENU" => array());
if (substr($gcls[$key]["URL"], 0, 11) == "javascript:") {
$gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"], 11);
$gcls[$key]["URL"] = "javascript:void(0)";
}
}
// and now the sublinks
if ($linkattribute == 'submenu' && is_array($attributevalue)) {
foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) {
$gcls[$key]['SUBMENU'][$submenulinkkey] = array("LABEL" => key($submenulinkinfo), "URL" => current($submenulinkinfo));
}
if (substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") {
$gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 11);
$gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)";
}
}
}
}
$ss->assign("GCLS", $gcls);
$ss->assign("SEARCH", isset($_REQUEST['query_string']) ? $_REQUEST['query_string'] : '');
if ($this->action == "EditView" || $this->action == "Login") {
$ss->assign("ONLOAD", 'onload="set_focus()"');
}
$ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"]));
// get other things needed for page style popup
if (isset($_SESSION["authenticated_user_id"])) {
// get the current user name and id
$ss->assign("CURRENT_USER", $current_user->full_name == '' || !showFullName() ? $current_user->user_name : $current_user->full_name);
$ss->assign("CURRENT_USER_ID", $current_user->id);
// get the last viewed records
$tracker = new Tracker();
$history = $tracker->get_recently_viewed($current_user->id);
foreach ($history as $key => $row) {
$history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']);
$history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle"', null, null, '.gif', $row['item_summary']);
}
$ss->assign("recentRecords", $history);
}
$bakModStrings = $mod_strings;
if (isset($_SESSION["authenticated_user_id"])) {
// get the module list
$moduleTopMenu = array();
$max_tabs = $current_user->getPreference('max_tabs');
// Attempt to correct if max tabs count is extremely high.
if (!isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10) {
$max_tabs = $GLOBALS['sugar_config']['default_max_tabs'];
$current_user->setPreference('max_tabs', $max_tabs, 0, 'global');
}
$moduleTab = $this->_getModuleTab();
$ss->assign('MODULE_TAB', $moduleTab);
// See if they are using grouped tabs or not (removed in 6.0, returned in 6.1)
$user_navigation_paradigm = $current_user->getPreference('navigation_paradigm');
if (!isset($user_navigation_paradigm)) {
$user_navigation_paradigm = $GLOBALS['sugar_config']['default_navigation_paradigm'];
}
// Get the full module list for later use
foreach (query_module_access_list($current_user) as $module) {
// Bug 25948 - Check for the module being in the moduleList
if (isset($app_list_strings['moduleList'][$module])) {
$fullModuleList[$module] = $app_list_strings['moduleList'][$module];
}
}
if (!should_hide_iframes()) {
$iFrame = new iFrame();
$frames = $iFrame->lookup_frames('tab');
foreach ($frames as $key => $values) {
示例9: displayHeader
//.........这里部分代码省略.........
// foreach font
if (count($selectedTheme->fonts) > 1) {
$startingFontName = $selectedTheme->fonts[0];
if (!empty($_SESSION['authenticated_user_theme_font']) && in_array($_SESSION['authenticated_user_theme_font'], $themeObject->fonts)) {
$startingFontName = $_SESSION['authenticated_user_theme_font'];
}
$startingFontIcon = $selectedTheme->getImageURL("fonts.{$startingFontName}.icon.gif");
$allThemes[$dirName]['fontSelect'] = <<<EOHTML
<input type="hidden" name="userfont" id="userfont" value="">
<ul id="font_menu">
EOHTML;
foreach ($selectedTheme->fonts as $font) {
$fontIcon = $selectedTheme->getImageURL("fonts.{$font}.icon.gif");
$allThemes[$dirName]['fontSelect'] .= <<<EOHTML
<li style="background: url({$fontIcon}) no-repeat;" onclick="change_font('{$font}');"></li>
EOHTML;
}
$allThemes[$dirName]['fontSelect'] .= '</ul></span>';
}
}
$json = getJSONobj();
$ss->assign('allThemes', $json->encode($allThemes));
$ss->assign("CURRENTTHEME_NAME", $themeObject->name);
$ss->assign("CURRENTTHEME_DESCRIPTION", $themeObject->description);
$ss->assign("CURRENTTHEME_FONTSELECT", $allThemes[$themeObject->dirName]['fontSelect']);
$ss->assign("CURRENTTHEME_COLORSELECT", $allThemes[$themeObject->dirName]['colorSelect']);
// get the current user name and id
$ss->assign("CURRENT_USER", $current_user->first_name != '' ? $current_user->first_name : $current_user->user_name);
$ss->assign("CURRENT_USER_ID", $current_user->id);
// get the last viewed records
$tracker = new Tracker();
$history = $tracker->get_recently_viewed($current_user->id);
foreach ($history as $key => $row) {
$history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']);
$history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle" alt="' . $row['item_summary'] . '"');
}
$ss->assign("recentRecords", $history);
// new record
require_once "modules/" . $this->module . "/Forms.php";
if ($this->action == "index" && function_exists('get_new_record_form')) {
$ss->assign("NEW_RECORD", get_new_record_form());
}
// Get preference for shortcuts and last_viewed list placement
$last_view_swap = $current_user->getPreference('swap_last_viewed');
if (!isset($last_view_swap)) {
$last_view_swap = $GLOBALS['sugar_config']['default_swap_last_viewed'];
}
$ss->assign("LEFT_FORM_LAST_VIEWED", $last_view_swap);
$shortcuts_swap = $current_user->getPreference('swap_shortcuts');
if (!isset($shortcuts_swap)) {
$shortcuts_swap = $GLOBALS['sugar_config']['default_swap_shortcuts'];
}
$ss->assign("LEFT_FORM_SHORTCUTS", !$shortcuts_swap);
}
if (isset($_SESSION["authenticated_user_id"]) || $sugar_config['login_nav']) {
// get the module list
$moduleTopMenu = array();
$max_tabs = $current_user->getPreference('max_tabs');
if (!isset($max_tabs) || $max_tabs <= 0) {
$max_tabs = $GLOBALS['sugar_config']['default_max_tabs'];
}
$user_navigation_paradigm = $current_user->getPreference('navigation_paradigm');
if (!isset($user_navigation_paradigm)) {
$user_navigation_paradigm = $GLOBALS['sugar_config']['default_navigation_paradigm'];
}
if ($user_navigation_paradigm == 'gm') {
示例10: displayHeader
//.........这里部分代码省略.........
if ($this->action == "EditView" || $this->action == "Login") {
$ss->assign("ONLOAD", 'onload="set_focus()"');
}
$ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"]));
// awu: moving allThemes json array out of authenticated if block for IE6 check on Login screen
// build json string of theme properties
$allThemes = array();
foreach (SugarThemeRegistry::availableThemes() as $dirName => $themeName) {
$selectedTheme = SugarThemeRegistry::get($dirName);
$allThemes[$dirName] = array('name' => $themeName, 'description' => $selectedTheme->description, 'ie6compat' => $selectedTheme->ie6compat);
}
// get other things needed for page style popup
$json = getJSONobj();
$ss->assign('allThemes', $json->encode($allThemes));
if (isset($_SESSION["authenticated_user_id"])) {
$ss->assign('currentTheme_fonts', $themeObject->fonts);
$ss->assign('currentTheme_colors', $themeObject->colors);
$ss->assign('currentTheme_groupedTabscompat', $themeObject->group_tabs);
$ss->assign('selectThemeOptions', get_select_options_with_id(SugarThemeRegistry::availableThemes(), SugarThemeRegistry::current()->__toString()));
$ss->assign('USERS_MOD', return_module_language($GLOBALS['current_language'], 'Users'));
$user_navigation_paradigm = $current_user->getPreference('navigation_paradigm');
if (isset($user_navigation_paradigm)) {
$ss->assign("NAVADIGMS", get_select_options_with_id($app_list_strings['navigation_paradigms'], $user_navigation_paradigm));
} else {
$ss->assign("NAVADIGMS", get_select_options_with_id($app_list_strings['navigation_paradigms'], $GLOBALS['sugar_config']['default_navigation_paradigm']));
}
// get the current user name and id
$ss->assign("CURRENT_USER", $current_user->first_name != '' ? $current_user->first_name : $current_user->user_name);
$ss->assign("CURRENT_USER_ID", $current_user->id);
// get the last viewed records
$tracker = new Tracker();
$history = $tracker->get_recently_viewed($current_user->id);
foreach ($history as $key => $row) {
$history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']);
$history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle" alt="' . $row['item_summary'] . '"');
}
$ss->assign("recentRecords", $history);
// new record
require_once "modules/" . $this->module . "/Forms.php";
if ($this->action == "index" && function_exists('get_new_record_form')) {
$ss->assign("NEW_RECORD", get_new_record_form());
}
// Get preference for shortcuts and last_viewed list placement
$last_view_swap = $current_user->getPreference('swap_last_viewed');
if (!isset($last_view_swap)) {
$last_view_swap = $GLOBALS['sugar_config']['default_swap_last_viewed'];
}
$ss->assign("LEFT_FORM_LAST_VIEWED", $last_view_swap);
$shortcuts_swap = $current_user->getPreference('swap_shortcuts');
if (!isset($shortcuts_swap)) {
$shortcuts_swap = $GLOBALS['sugar_config']['default_swap_shortcuts'];
}
$ss->assign("LEFT_FORM_SHORTCUTS", !$shortcuts_swap);
}
if (isset($_SESSION["authenticated_user_id"]) || $sugar_config['login_nav']) {
// get the module list
$moduleTopMenu = array();
$max_tabs = $current_user->getPreference('max_tabs');
if (!isset($max_tabs) || $max_tabs <= 0) {
$max_tabs = $GLOBALS['sugar_config']['default_max_tabs'];
}
$user_navigation_paradigm = $current_user->getPreference('navigation_paradigm');
if (!isset($user_navigation_paradigm)) {
$user_navigation_paradigm = $GLOBALS['sugar_config']['default_navigation_paradigm'];
}
// Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.