/** * Handles displaying the header for classic view modules * * @param $module string to next to the title. Typically used for form buttons. * @param array $params optional, params to display in the breadcrumb, overriding SugarView::_getModuleTitleParams() * These should be in the form of array('label' => '<THE LABEL>', 'link' => '<HREF TO LINK TO>'); * the first breadcrumb should be index at 0, and built from there e.g. * <code> * array( * '<a href="index.php?module=Contacts&action=index">Contacts</a>', * '<a href="index.php?module=Contacts&action=DetailView&record=123">John Smith</a>', * 'Edit', * ); * </code> * would display as: * <a href='index.php?module=Contacts&action=index'>Contacts</a> >> <a href='index.php?module=Contacts&action=DetailView&record=123'>John Smith</a> >> Edit * @param $show_help boolean which determines if the print and help links are shown. * @return string HTML */ function getClassicModuleTitle($module, $params, $show_create, $index_url_override = "") { global $sugar_version, $sugar_flavor, $server_unique_key, $current_language, $action; global $app_strings; $module_title = ''; $count = count($params); $index = 0; $module = preg_replace("/ /", "", $module); $iconPath = ""; $the_title = "<div class='moduleTitle'>\n<h2>"; if (!empty($GLOBALS['app_list_strings']['moduleList'][$module])) { $moduleName = $GLOBALS['app_list_strings']['moduleList'][$module]; } else { $moduleName = $module; } if (is_file(SugarThemeRegistry::current()->getImageURL('icon_' . $module . '_32.png', false))) { $iconPath = SugarThemeRegistry::current()->getImageURL('icon_' . $module . '_32.png'); } else { if (is_file(SugarThemeRegistry::current()->getImageURL('icon_' . ucfirst($module) . '_32.png', false))) { $iconPath = SugarThemeRegistry::current()->getImageURL('icon_' . ucfirst($module) . '_32.png'); } } if (!empty($iconPath)) { $url = !empty($index_url_override) ? $index_url_override : "index.php?module={$module}&action=index"; array_unshift($params, "<a href='{$url}'><img src='{$iconPath}' " . "alt='" . $moduleName . "' title='" . $moduleName . "' align='absmiddle'></a>"); } $new_params = array(); $i = 0; foreach ($params as $value) { if (!is_null($value) && $value !== "") { $new_params[$i] = $value; $i++; } } if (SugarThemeRegistry::current()->directionality == "rtl") { $new_params = array_reverse($new_params); } $module_title = join(SugarView::getBreadCrumbSymbol(), $new_params); $the_title .= $module_title . "</h2>\n"; if ($show_create) { $the_title .= "<span class='utils'>"; $createRecordURL = SugarThemeRegistry::current()->getImageURL('create-record.gif'); $url = ajaxLink("index.php?module={$module}&action=EditView&return_module={$module}&return_action=DetailView"); $the_title .= <<<EOHTML <a href="{$url}" class="utilsLink"> <img src='{$createRecordURL}' alt='{$GLOBALS['app_strings']['LNK_CREATE']}'></a> <a href="{$url}" class="utilsLink"> {$GLOBALS['app_strings']['LNK_CREATE']} </a> EOHTML; $the_title .= '</span>'; } $the_title .= "</div>\n"; return $the_title; }
/** * Wrapper function for the get_module_title function, which is mostly used for pre-MVC modules. * * @deprecated use SugarView::getModuleTitle() for MVC modules, or getClassicModuleTitle() for non-MVC modules * * @param $module string to next to the title. Typically used for form buttons. * @param $module_title string to display as the module title * @param $show_help boolean which determines if the print and help links are shown. * @return string HTML */ function get_module_title($module, $module_title, $show_create, $count = 0) { global $sugar_version, $sugar_flavor, $server_unique_key, $current_language, $action; global $app_strings; $the_title = "<div class='moduleTitle'>\n"; $module = preg_replace("/ /", "", $module); $iconPath = ""; if (is_file(SugarThemeRegistry::current()->getImageURL('icon_' . $module . '_32.png', false))) { $iconPath = SugarThemeRegistry::current()->getImageURL('icon_' . $module . '_32.png'); } else { if (is_file(SugarThemeRegistry::current()->getImageURL('icon_' . ucfirst($module) . '_32.png', false))) { $iconPath = SugarThemeRegistry::current()->getImageURL('icon_' . ucfirst($module) . '_32.png'); } } if (!empty($iconPath)) { $the_title .= '<h2>'; if (SugarThemeRegistry::current()->directionality == "ltr") { $the_title .= "<a href='index.php?module={$module}&action=index'><img src='{$iconPath}' " . "alt='" . $module . "' title='" . $module . "' align='absmiddle'></a>"; $the_title .= $count >= 1 ? SugarView::getBreadCrumbSymbol() : ""; $the_title .= $module_title . ''; } else { $the_title .= $module_title; $the_title .= $count > 1 ? SugarView::getBreadCrumbSymbol() : ""; $the_title .= "<a href='index.php?module={$module}&action=index'><img src='{$iconPath}' " . "alt='" . $module . "' title='" . $module . "' align='absmiddle'></a>"; } $the_title .= '</h2>'; } else { $the_title .= "<h2> {$module_title} </h2>"; } $the_title .= "\n"; if ($show_create) { $the_title .= "<span class='utils'>"; $createRecordURL = SugarThemeRegistry::current()->getImageURL('create-record.gif'); $the_title .= <<<EOHTML <a href="index.php?module={$module}&action=EditView&return_module={$module}&return_action=DetailView" class="utilsLink"> <img src='{$createRecordURL}' alt='{$GLOBALS['app_strings']['LNK_CREATE']}'></a> <a href="index.php?module={$module}&action=EditView&return_module={$module}&return_action=DetailView" class="utilsLink"> {$GLOBALS['app_strings']['LNK_CREATE']} </a> EOHTML; $the_title .= '</span>'; } $the_title .= "</div>\n"; return $the_title; }
public function testgetBreadCrumbSymbol() { $SugarView = new SugarView(); //execute the method. it should return a string. $breadCrumbSymbol = $SugarView->getBreadCrumbSymbol(); $this->assertGreaterThan(0, strlen($breadCrumbSymbol)); }