getButton($shown_sources, $module, $smarty);
}
/**
* Get button for source
*
* @param string $shown_source
* @param mixed $module
* @param mixed $smarty
* @return string
*/
private function getButton(array $shown_sources, $module, $smarty)
{
$code = '';
foreach($shown_sources as $id) {
$formatter = FormatterFactory::getInstance($id);
$formatter->setModule($module);
$formatter->setSmarty($smarty);
$formatter_code = $formatter->getDetailViewFormat();
if (!empty($formatter_code))
{
$iconFilePath = $formatter->getIconFilePath();
$iconFilePath = empty($iconFilePath) ? 'themes/default/images/MoreDetail.png' : $iconFilePath;
$code .= '';
$code .= "";
//$code .= $formatter->getDetailViewFormat();
$code .= $formatter_code;
}
}
return $code;
}
/**
* Get popup for sources
*
* @param array $shown_sources
* @param mixed $module
* @param mixed $smarty
* @return string
*/
private function getPopup(array $shown_sources, $module, $smarty)
{
global $app_strings;
$code = '';
$menuParams = 'var menuParams = "';
$formatterCode = '';
$sourcesDisplayed = 0;
$singleIcon = '';
foreach($shown_sources as $id)
{
$formatter = FormatterFactory::getInstance($id);
$formatter->setModule($module);
$formatter->setSmarty($smarty);
$buttonCode = $formatter->getDetailViewFormat();
if (!empty($buttonCode))
{
$sourcesDisplayed++;
$singleIcon = $formatter->getIconFilePath();
$source = SourceFactory::getSource($id);
$config = $source->getConfig();
$name = !empty($config['name']) ? $config['name'] : $id;
//Create the menu item to call show_[source id] method in javascript
$menuParams .= '';
$formatterCode .= $buttonCode;
}
} //for
if (!empty($formatterCode))
{
if ($sourcesDisplayed > 1)
{
$dswidget_img = SugarThemeRegistry::current()->getImageURL('MoreDetail.png');
$code = '';
}
else
{
$dswidget_img = SugarThemeRegistry::current()->getImageURL('MoreDetail.png');
$singleIcon = empty($singleIcon) ? $dswidget_img : $singleIcon;
$code = '';
}
$code .= "\n";
$code .= "\n";
$code .= $formatterCode;
}
return $code;
}
}