Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

generate_dash_tile_toolbar()

Parameters

ColumnTypeDefaultDescription
$tile array
$tile_id

Location

include/dash_functions.php lines 1719 to 1818

Definition

 
function generate_dash_tile_toolbar(array $tile$tile_id)
    {
    global 
$baseurl_short$lang$managed_home_dash;
    
$editlink $baseurl_short "pages/dash_tile.php?edit=" $tile['ref'];
    if(!
$managed_home_dash && (checkPermission_dashadmin() || checkPermission_dashuser()))
        {
        
?>
        <div id="DashTileActions_ echo substr($tile_id18); ?>" class="DashTileActions"  style="display:none;">
        <div class="tool dash-delete_ echo substr($tile_id18); ?>">
            <a href="#">
                <span> echo LINK_CARET ?> echo escape($lang['action-delete']); ?></span>
            </a>
        </div>
        
        
if((checkPermission_dashadmin() || (isset($tile['all_users']) && $tile['all_users'] == 0)) && !(isset($tile['no_edit']) && $tile['no_edit']))
            {
            
?>
            <div class="tool edit">
                <a href=" echo $editlink ?>" onClick="return CentralSpaceLoad(this,true);">
                    <span> echo LINK_CARET ?> echo escape($lang['action-edit']); ?></span>
                </a>
            </div>
            
            
}
        
?>
        </div>
          
        
}
        
?>

    <script>
    jQuery(document).ready(function ()
        {
        if (pagename == "home")
        {
            var tileid = " echo $tile["ref"]; ?>"; //Needs to be set for delete functionality
            var usertileid = " echo escape(substr($tile_id18)); ?>" //Needs to be set for delete functionality
            var usertileidname = "# echo escape(substr($tile_id9)); ?>";
            var dashtileactionsid = "#DashTileActions_" + usertileid;
            var deletetileid = ".dash-delete_" + usertileid;
            var editlink = " echo isset($tile["url"]) ? $tile["url"] : ""?>";
            var tilehref; //Used to switch off and on tile link to stop issue clicking on tool bar but opening tile link
            var tileonclick; //Used to switch off and on tile link to stop issue clicking on tool bar but opening tile link
    
            jQuery(usertileidname).hover(
            function(e)
                {
                jQuery(dashtileactionsid).stop(true, true).slideDown();
                },
            function(e)
                {
                jQuery(dashtileactionsid).stop(true, true).slideUp();
                });
    
            jQuery(dashtileactionsid).hover(
            function(e)
                {
                tilehref = jQuery(usertileidname).attr("href");
                tileonclick = jQuery(usertileidname).attr("onclick");
                jQuery(usertileidname).attr("href", "#");
                jQuery(usertileidname).attr("onclick", "return false;");
                },
            function(e)
                {
                jQuery(usertileidname).attr("href", tilehref);
                jQuery(usertileidname).attr("onclick", tileonclick);
                tilehref = '';
                tileonclick = '';
                });
    
        jQuery(deletetileid).click(
                function(event,ui) {
                
                
if(checkPermission_dashadmin())
                    {
                    
?>
                    if(jQuery(usertileidname).hasClass("allUsers")) {
                        // This tile is set for all users so provide extra options
                         render_delete_dialog_JS(true); ?>
                    }
                    else {
                        //This tile belongs to this user only
                         render_delete_dialog_JS(false); ?>
                    }
                
                    
}
                else 
#Only show dialog to delete for this user
                    
?>
                    var dialog =  render_delete_dialog_JS(false); 
                    } 
?>
                })
            }
            else
            {
            jQuery("#DashTileActions_").remove();
            }
        });
    </script>
      
    
}

This article was last updated 19th March 2024 06:35 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.