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

create_dash_tile()

Parameters

ColumnTypeDefaultDescription
$url
$link
$title
$reload_interval
$all_users
$default_order_by
$resource_count
$text ""
$delete 1
$specific_user_groups array array

Location

include/dash_functions.php lines 39 to 89

Definition

 
function create_dash_tile($url,$link,$title,$reload_interval,$all_users,$default_order_by,$resource_count,$text="",$delete=1, array $specific_user_groups = array())
    {
    
    
$rebuild_order=TRUE;

    
# Validate Parameters
    
if(empty($reload_interval) || !is_numeric($reload_interval))
        {
$reload_interval=0;}

    
$delete    $delete 0;
    
$all_users $all_users 0;

    if(!
is_numeric($default_order_by))
        {
        
$default_order_by=append_default_position();
        
$rebuild_order=FALSE;
        }
    
$resource_count $resource_count?1:0;

    
$existing_tile_ref existing_dash_tile($url$link,$title,$text,(int) $reload_interval,$all_users,$resource_count);
    
    if(
$existing_tile_ref 0)
        {
        
$tile=$existing_tile_ref;
        
$rebuild_order=FALSE;
        }
    else
        {
        
$result sql_query("INSERT INTO dash_tile (url,link,title,reload_interval_secs,all_users,default_order_by,resource_count,allow_delete,txt) VALUES ('".$url."','".$link."','".escape_check($title)."',".$reload_interval.",".$all_users.",".$default_order_by.",".$resource_count.",".$delete.",'".escape_check($text)."')");
        
$tile=sql_insert_id();

        foreach(
$specific_user_groups as $user_group_id)
            {
            
add_usergroup_dash_tile($user_group_id$tile$default_order_by);
            
build_usergroup_dash($user_group_id0$tile);
            }
        }

    
# If tile already existed then this no reorder
    
if($rebuild_order){reorder_default_dash();}
    
    if(
$all_users==&& empty($specific_user_groups))
        {
        
sql_query("DELETE FROM user_dash_tile WHERE dash_tile=".$tile);
        
$result sql_query("INSERT user_dash_tile (user,dash_tile,order_by) SELECT user.ref,'".$tile."',5 FROM user");
        }
    
    
hook('after_create_dash_tile''', array($tile));
    
    return 
$tile;
    }

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