Results 1 to 6 of 6

Thread: Change some row color

  1. #1
    portega is offline Member
    Join Date
    Mar 2008
    Posts
    5

    Default Change some row color

    I've been asked to show those opportunities assigned to the current user with a different background color.

    I should show all opportunities of the company, and those ones with the background color changed.

    This is asked mainly to do on the home page, on a dashlet opportunity, but i don't care if this has to be done for every list of opportunities, or even for every list of any module.

    Any suggestion would be appreciate


    This is how far i have get:
    There are two color sets: $odd_bg and $even_bg

    I was wondering in creating another type, like $owner_bg and whenever is it calculate whether the row is odd or even, check if the current user is the owner and set the color as $owner_bg

    I have two questions:
    First: is possible to access the current user and the assigned user values where the type of row is calculated.
    Second: Which are the files used to calculated this.

    Thanks.

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Change some row color

    Hi, portega.

    Which version are you using?

    To access the current user you have to put this code:

    PHP Code:
    global $current_user
    into the file you will modify.

    --
    André Lopes
    Lâmpada Global Services
    Rua Bela Cintra, 299 conjunto. 51
    São Paulo, SP 01415-000
    tel1. 55 11 3237-3110
    cel. 55 11 7636-5859
    e-mail: info@lampadacrm.com.br

  3. #3
    portega is offline Member
    Join Date
    Mar 2008
    Posts
    5

    Default Re: Change some row color

    The version i'm with is 4.5.1.i

    My main problem is not to access to the current user id; there are two things i can not come up with:
    where to set the type of row as the type i want to be colored?
    Would i be able to access to the value of the assigned user of the opportunity i'm with?

    Thank u!!

  4. #4
    portega is offline Member
    Join Date
    Mar 2008
    Posts
    5

    Default Re: Change some row color

    Finally did it!!

    The logic i put it on include/Dashlets/DashletGenericDisplay.tpl
    After the backcolor of the rows is calculated i added:

    {if $modulo == 'Opportunity' and $myItem != 'true' and $myItem !=1}
    {if $rowData.ASSIGNED_USER_ID == $userID}
    {
    assign var='_bgColor' value="#ff0000"
    assign var='_rowColor' value="#ffffff"
    }
    {/if}
    {/if}

    In my case needed to be done on the opportunities module and decided when was not selected to show "myItems"

    To do on the template needed to assign the vars.
    At include/Dashlet/DashletGeneric.php function process:
    global $current_user;
    $this->lvs->ss->assign('userID', $current_user->id);
    $this->lvs->ss->assign('myItem', $this->myItemsOnly);

    and
    $this->lvs->ss->assign('modulo', $this->lvs->data['pageData']['bean']['objectName']);


    AND FINALLY:

    Was asked instead to custom the font-color: so done at the tpl archive instead of setting the bg_color (the code shown before) this:
    {if $modulo == 'Opportunity' and $myItem != 'true' and $myItem !=1}
    {if $rowData.ASSIGNED_USER_ID == $userID}
    {assign var='_fontColor' value="#ff0000"}
    {else}
    {assign var='_fontColor' value=""}
    {/if}
    {/if}

    And add: style='color:{$_fontColor};' where sets the value of the <td>

    Hope is helpfull

  5. #5
    piccirm2 is offline Sugar Community Member
    Join Date
    Apr 2008
    Posts
    65

    Default Re: Change some row color

    I'm trying to apply your solution
    But if I start with simply changing colors to see the effect

    {foreach name=rowIteration from=$data key=id item=rowData}
    {if $smarty.foreach.rowIteration.iteration is odd}
    {assign var='_bgColor' value="#ff0000"}
    {assign var='_rowColor' value="#ff0000"]}
    {else}
    {assign var='_bgColor' value=$bgColor[3]}
    {assign var='_rowColor' value=$rowColor[3]}
    {/if}

    I do not see any change.
    Where am I wrong ???

  6. #6
    portega is offline Member
    Join Date
    Mar 2008
    Posts
    5

    Default Re: Change some row color

    Hmm, i used the theme SugarCRM. I mean, with some other theme i think it was not working.

    could be that?

    If u are using some other theme, maybe the change should be done in that one.

    I'm sorry; i'm just getting started with this.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 2009-08-07, 11:59 AM
  2. Replies: 5
    Last Post: 2007-11-13, 02:51 PM
  3. View Change Log
    By markoa in forum Developer Help
    Replies: 0
    Last Post: 2007-10-13, 08:55 AM
  4. change listview color
    By souza in forum Help
    Replies: 3
    Last Post: 2007-09-12, 10:51 PM
  5. Serious issue with sugarcrm 3.5.1.c
    By wp.rauchholz in forum Help
    Replies: 17
    Last Post: 2005-12-01, 07:22 AM

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
  •