Results 1 to 4 of 4

Thread: How to SubPanel Create Button or Edit/Delete Link Hide depending on condition value?

  1. #1
    bharat12345 is offline Sugar Community Member
    Join Date
    May 2010
    Location
    India
    Posts
    56

    Question How to SubPanel Create Button or Edit/Delete Link Hide depending on condition value?

    Hello Friends,

    How to Sub Panel Create Button or Edit/Delete Link Hide depending on condition value?

    I have used the following code for Create Button for some Condition in Module Detail View in view.details.php file.

    PHP Code:


    protected function _displaySubPanels()
        {
            global 
    $current_user;
            
            if (isset(
    $this->bean) && !empty($this->bean->id) && (file_exists('modules/' $this->module '/metadata/subpaneldefs.php') || file_exists('custom/modules/' $this->module '/metadata/subpaneldefs.php') || file_exists('custom/modules/' $this->module '/Ext/Layoutdefs/layoutdefs.ext.php'))) 
            {
                
    $GLOBALS['focus'] = $this->bean;
                require_once (
    'include/SubPanel/SubPanelTiles.php');
                
    $subpanel = new SubPanelTiles($this->bean$this->module);
                
                echo 
    '<pre>';
                
    //print_r($subpanel->subpanel_definitions);
                
    echo '</pre>';
                
            
    $acl_role_obj = new ACLRole();        
            
    $user_roles   $acl_role_obj->getUserRoles($current_user->id);
            
            
    $userroles =  $user_roles[0];
                
            foreach(
    $subpanel->subpanel_definitions->layout_defs['subpanel_setup']['gtt_program_gtt_batch']['top_buttons'] as $key=>$button)
            {
                 if(
    $userroles != 'Center Manager-CSP')
                 {                
                    unset(
    $subpanel->subpanel_definitions->layout_defs['subpanel_setup']['gtt_program_gtt_batch']['top_buttons'][$key]);
                 }
                 
                  if(!empty(
    $button['widget_class']) && $button['widget_class'] == 'SubPanelTopSelectButton')
                 {  
                  unset(
    $subpanel->subpanel_definitions->layout_defs['subpanel_setup']['gtt_program_gtt_batch']['top_buttons'][$key]);
                 }
                 
            }
            echo 
    $subpanel->display();
           }
       } 
    But how to hide for edit link or Delete link in using condition. ?

    Please guide me

    Thanks
    Bharat

  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,491

    Default Re: How to SubPanel Create Button or Edit/Delete Link Hide depending on condition val

    You need to modify the attribute subpanel_name inside foreach, depending on conditions.
    subpanel_name will identify which subpanel layout to render on given subpanel.

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    bharat12345 is offline Sugar Community Member
    Join Date
    May 2010
    Location
    India
    Posts
    56

    Question Re: How to SubPanel Create Button or Edit/Delete Link Hide depending on condition val

    Hello andopes,

    thanks for guide to me.

    But I'm not getting your answer please elaborate.

    Please could you please give me an example for sub panel hide edit / delete link.

    How to get for Sub panel edit, delete Hide link using condition in following function.

    Please guide me.

    Regards
    Bharat

  4. #4
    bharat12345 is offline Sugar Community Member
    Join Date
    May 2010
    Location
    India
    Posts
    56

    Question Re: How to SubPanel Create Button or Edit/Delete Link Hide depending on condition val

    Hello andopes,

    Please guide me Sugar Team.

    Regards
    Bharat

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 2012-05-07, 02:45 PM
  2. hide create button on subpanel modules
    By Glitch in forum Developer Help
    Replies: 8
    Last Post: 2011-06-22, 01:51 PM
  3. Hide edit icon in list view depending on status
    By mikesolomon in forum Developer Help
    Replies: 6
    Last Post: 2011-03-31, 03:59 PM
  4. Replies: 0
    Last Post: 2011-01-20, 02:34 PM
  5. Subpanel: Row edit/delete button right alignment
    By kenneth.thorman in forum Developer Help
    Replies: 0
    Last Post: 2008-05-19, 07:10 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
  •