Collections functions
General functions
Render functions
Theme permission functions
Resource functions

get_user_available_tiles()

Parameters

ColumnTypeDefaultDescription
$user
$tile "null"

Location

include/dash_functions.php lines 1076 to 1159

Definition

 
function get_user_available_tiles($user,$tile="null")
    {
    
$tilecheck ''$params = [];
    if(
is_numeric($tile))
        {
        
$tilecheck 'WHERE ref = ?';
        
$params = ['i'$tile];
        }
    return 
ps_query(
            
"
            SELECT 
                result.*
            FROM
            (    (
                SELECT 
                    dash_tile.ref,
                    '' as 'dash_tile',
                    '' as 'usertile', 
                    '' as 'user', 
                    '' as 'order_by',
                    dash_tile.ref as 'tile',
                    dash_tile.title,
                    dash_tile.txt,
                    dash_tile.link,
                    dash_tile.url,
                    dash_tile.resource_count,
                    dash_tile.all_users,
                    dash_tile.allow_delete,
                    dash_tile.default_order_by
                FROM
                    dash_tile
                WHERE
                    dash_tile.all_users = 1
                    AND
                    ref 
                    NOT IN
                    (
                        SELECT 
                            dash_tile.ref
                        FROM
                            user_dash_tile
                        RIGHT OUTER JOIN
                            dash_tile
                        ON 
                            user_dash_tile.dash_tile = dash_tile.ref

                        WHERE
                            user_dash_tile.user = ?
                    )
                AND ref NOT IN (SELECT dash_tile FROM usergroup_dash_tile)
                )
            UNION
                (
                SELECT 
                    dash_tile.ref,
                    user_dash_tile.dash_tile,
                    user_dash_tile.ref as 'usertile', 
                    user_dash_tile.user, 
                    user_dash_tile.order_by,
                    dash_tile.ref as 'tile',
                    dash_tile.title,
                    dash_tile.txt,
                    dash_tile.link,
                    dash_tile.url,
                    dash_tile.resource_count,
                    dash_tile.all_users,
                    dash_tile.allow_delete,
                    dash_tile.default_order_by
                FROM
                    user_dash_tile
                RIGHT OUTER JOIN
                    dash_tile
                ON 
                    user_dash_tile.dash_tile = dash_tile.ref
                WHERE
                    user_dash_tile.user = ?
                )
            ) result
            "
.$tilecheck."
            ORDER BY result.order_by,result.default_order_by

            "
        
array_merge(['i'$user'i'$user], $params));
    }

This article was last updated 5th October 2022 04:05 Europe/London time based on the source file dated 27th September 2022 15:05 Europe/London time.