Results 1 to 3 of 3
Like Tree2Likes
  • 2 Post By agcopley

Thread: Dashlet Filters - a minor annoyance

  1. #1
    agcopley is offline Sugar Community Member
    Join Date
    Nov 2007
    Location
    Santiago, Chile
    Posts
    423

    Default Dashlet Filters - a minor annoyance

    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

    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.='&nbsp;&nbsp;&nbsp;&nbsp;TIO:<i style="background-color:yellow;">'.$params.'</i>';
            if(
    $key=='billing_account'){
                
    $bc= new Account();
                
    $bc->retrieve($params[0]);
                
                
    $this->title.='&nbsp;&nbsp;&nbsp;&nbsp;CLIENTE:<i style="background-color:yellow;">'.$bc->name.'</i>';
            }
            if(
    $key=='mm8_tios_accounts_name'){
                
    $bc= new Account();
                
    $bc->retrieve($params[0]);
                
                
    $this->title.='&nbsp;&nbsp;&nbsp;&nbsp;CANAL:<i style="background-color:yellow;">'.$bc->name.'</i>';
            }
            if(
    $key=='order_date' && $params['type']!=""){

                
                
    $this->title.='&nbsp;&nbsp;&nbsp;&nbsp;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$titlefalse) . '</div><div class="tr"></div></div><div class="bd"><div class="ml"></div><div class="bd-center">';
            
            return 
    $str;
        } 
    Its quick and dirty and not upgrade safe, sorry about that!





    Name:  Dashlet.PNG
Views: 217
Size:  35.1 KB
    eggsurplus and Chris_C like this.

  2. #2
    jmertic's Avatar
    jmertic is offline Sugar Community Manager
    Join Date
    Dec 2007
    Posts
    3,996

    Default Re: Dashlet Filters - a minor annoyance

    This is a great idea! Would you mind adding a feature request bug for this at Bug Portal | SugarCRM.com English (Americas), and a pull request with this code to https://github.com/sugarcrm/sugarcrm_dev? Thanks!
    John Mertic
    Sugar Community Manager

  3. #3
    Chris_C's Avatar
    Chris_C is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Connecticut
    Posts
    296

    Default Re: Dashlet Filters - a minor annoyance

    I like this- version 2 of feature could have a jquery live editable filter- let the user click and modify the filter- select a different Client, From, Since, Until...
    -Chris Coleman. IBM Certified Websphere Developer, UML Certified, Oracle Certified in Java
    Fix Permissions for SugarCRM installed on Linux shared web hosting - http://www.espacenetworks.com/downloads.html

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Dashlet filters are not working in ie7 for sugarcrm 6.2
    By mujaffar in forum Developer Help
    Replies: 1
    Last Post: 2011-10-05, 08:09 AM
  2. Custom fields as Dashlet Filters?
    By SilenceIT in forum Developer Help
    Replies: 3
    Last Post: 2011-07-12, 02:09 PM
  3. How to add filters to Cases dashlet
    By bathi74 in forum Developer Help
    Replies: 1
    Last Post: 2010-11-29, 09:51 AM
  4. Sugar6 dashlet filters
    By slindley in forum Help
    Replies: 0
    Last Post: 2010-07-28, 02:49 AM
  5. Dashlet Filters Gone Wild
    By SilenceIT in forum Developer Help
    Replies: 0
    Last Post: 2009-04-22, 03:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •