Hello,
One of the minor annoyances I have with Dashlets, is that you cant tell what filter is on without opening the config panel.
A simple way around this is to overwrite the getHeader function in <Module>Dashlet.php in your Dashlets folder for that module
Here you can get access to the filters and alter the Header by adding a string based on your filters
I include an example below and a wee picture of what it looks like
Its quick and dirty and not upgrade safe, sorry about that!PHP Code:
public function getHeader($text = '')
{
global $sugar_config, $app_list_strings,$current_language;
include_once('modules/Accounts/Account.php');
$home_mod_strings = return_module_language($current_language, 'Home');
$filterTypes = array(' ' => $app_strings['LBL_NONE'],
'TP_today' => $home_mod_strings['LBL_TODAY'],
'TP_yesterday' => $home_mod_strings['LBL_YESTERDAY'],
'TP_tomorrow' => $home_mod_strings['LBL_TOMORROW'],
'TP_this_month' => $home_mod_strings['LBL_THIS_MONTH'],
'TP_this_year' => $home_mod_strings['LBL_THIS_YEAR'],
'TP_last_30_days' => $home_mod_strings['LBL_LAST_30_DAYS'],
'TP_last_7_days' => $home_mod_strings['LBL_LAST_7_DAYS'],
'TP_last_month' => $home_mod_strings['LBL_LAST_MONTH'],
'TP_last_year' => $home_mod_strings['LBL_LAST_YEAR'],
'TP_next_30_days' => $home_mod_strings['LBL_NEXT_30_DAYS'],
'TP_next_7_days' => $home_mod_strings['LBL_NEXT_7_DAYS'],
'TP_next_month' => $home_mod_strings['LBL_NEXT_MONTH'],
'TP_next_year' => $home_mod_strings['LBL_NEXT_YEAR'],
);
foreach($this->filters as $key=>$params){
if($key=='name')
$this->title.=' TIO:<i style="background-color:yellow;">'.$params.'</i>';
if($key=='billing_account'){
$bc= new Account();
$bc->retrieve($params[0]);
$this->title.=' CLIENTE:<i style="background-color:yellow;">'.$bc->name.'</i>';
}
if($key=='mm8_tios_accounts_name'){
$bc= new Account();
$bc->retrieve($params[0]);
$this->title.=' CANAL:<i style="background-color:yellow;">'.$bc->name.'</i>';
}
if($key=='order_date' && $params['type']!=""){
$this->title.=' EMITIDO:<i style="background-color:yellow;">'.$filterTypes[$params['type']].'</i>';
}
}
$title = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text . '</td>';
$title .= $this->setConfigureIcon();
$title .= $this->setRefreshIcon();
$title .= $this->setDeleteIcon();
$str = '<div ';
if(empty($sugar_config['lock_homepage']) || $sugar_config['lock_homepage'] == false) $str .= 'onmouseover="this.style.cursor = \'move\';" ';
$str .= 'id="dashlet_header_' . $this->id . '" class="hd"><div class="tl"></div><div class="hd-center">' . get_form_header($this->title, $title, false) . '</div><div class="tr"></div></div><div class="bd"><div class="ml"></div><div class="bd-center">';
return $str;
}
![]()


2Likes
LinkBack URL
About LinkBacks




Reply With Quote
Bookmarks