Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

get_managed_dash()

Parameters

This function accepts no parameters.

Location

include/dash_functions.php lines 591 to 698

Definition

 
function get_managed_dash()
    {
    global 
$baseurl,$baseurl_short,$lang,$anonymous_login,$username,$dash_tile_shadows$anonymous_default_dash$userref$usergroup;
    global 
$dash_tile_colour$dash_tile_colour_options$managed_home_dash$help_modal;
    
#Build Tile Templates
    
if(checkPermission_anonymoususer() && !$anonymous_default_dash)
        {
        
// Anonymous user but may have had dash customised dash configured first
        
$tiles sql_query("SELECT dash_tile.ref AS 'tile',dash_tile.title,dash_tile.url,dash_tile.reload_interval_secs,dash_tile.link,dash_tile.default_order_by as 'order_by'
                       FROM user_dash_tile
                            JOIN dash_tile
                            ON user_dash_tile.dash_tile = dash_tile.ref
                            WHERE user_dash_tile.user='"
.$userref."'
                            ORDER BY user_dash_tile.order_by"
);    
        }
    else
        {
        
$usergroup_escaped escape_check($usergroup);

        
$tiles sql_query("
            SELECT dash_tile.ref AS 'tile',
                   dash_tile.title,
                   dash_tile.url,
                   dash_tile.reload_interval_secs,
                   dash_tile.link,
                   dash_tile.default_order_by,
                   (
                        SELECT ugdt.default_order_by
                          FROM usergroup_dash_tile AS ugdt
                         WHERE ugdt.dash_tile = dash_tile.ref
                           AND ugdt.usergroup = '
{$usergroup_escaped}'
                   ) AS 'usergroup_default_order_by'
              FROM dash_tile
             WHERE dash_tile.all_users = 1
               AND (dash_tile.ref IN (SELECT dash_tile FROM usergroup_dash_tile WHERE usergroup_dash_tile.usergroup = '
{$usergroup_escaped}')
                OR dash_tile.ref NOT IN (SELECT distinct dash_tile FROM usergroup_dash_tile))
               AND (
                    dash_tile.allow_delete = 1
                    OR (
                        dash_tile.allow_delete = 0
                        AND dash_tile.ref IN (SELECT DISTINCT user_dash_tile.dash_tile FROM user_dash_tile)
                       )
                   )
            ORDER BY usergroup_default_order_by ASC, default_order_by ASC
        "
);
        }
    
    foreach(
$tiles as $tile)
        {
        
$tile_custom_style '';
    if(
$dash_tile_colour)
            {
            
$buildstring explode('?'$tile['url']);
            
parse_str(str_replace('&''&'$buildstring[1]), $buildstring);
            
            if(isset(
$buildstring['tltype']) && allow_tile_colour_change($buildstring['tltype']) && isset($buildstring['tlstylecolour']))
                {
                
$tile_custom_style .= get_tile_custom_style($buildstring);
                
                }
            }
        
?>
        <a 
            
            
# Check link for external or internal
            
if('http' == mb_strtolower(substr($tile['link'], 04)))
                {
                
$link   parse_dashtile_link($tile['link']);
                
$newtab true;
                }
            else
                {
                
$link   $baseurl '/' htmlspecialchars(parse_dashtile_link($tile['link']));
                
$newtab false;
                }
                
?>
            href=" echo $link?> echo $newtab "target='_blank'" "";?>
            onClick=" echo (!$newtab 'return ' . (($help_modal && strpos($link,'pages/help.php')!==false)?'ModalLoad(this,true);':'CentralSpaceLoad(this,true);') : ''); ?>"

            
            
# Check if tile is set to double width
            
$tlsize = (isset($buildstring['tlsize']) ? $buildstring['tlsize'] : '');
            
?>
            class="HomePanel DashTile DashTileDraggable  echo ('double' == $tlsize 'DoubleWidthDashTile' ''); ?>
            id="tile echo htmlspecialchars($tile["tile"]);?>"
        >
            <div id="contents_tile echo htmlspecialchars($tile["tile"]);?>" class="HomePanelIN HomePanelDynamicDash  echo ($dash_tile_shadows)? "TileContentShadow":"";?>" style=" echo $tile_custom_style?>">
                 if (strpos($tile["url"],"dash_tile.php")!==false
                    {
                    
# Only pre-render the title if using a "standard" tile and therefore we know the H2 will be in the target data.
                    
?>
                    <h2 class="title"> echo htmlspecialchars($tile["title"]);?></h2>
                     
                    
?>
                <p>Loading...</p>
                <script>
                    height = jQuery("#contents_tile echo htmlspecialchars($tile["tile"]);?>").height();
                    width = jQuery("#contents_tile echo htmlspecialchars($tile["tile"]);?>").width();
                    jQuery("#contents_tile echo htmlspecialchars($tile["tile"]);?>").load(" echo $baseurl."/".$tile["url"]."&tile=".htmlspecialchars($tile["tile"]);?>&tlwidth="+width+"&tlheight="+height);
                </script>
            </div>
        </a>
        
        

    
?>
    <div class="clearerleft"></div>
    
    
}

This article was last updated 25th November 2020 05:05 Europe/London time based on the source file dated 3rd November 2020 16:55 Europe/London time.