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

build_usergroup_dash()

Description

build_usergroup_dash - rebuild the usergroup tiles for either a specific user or all users.
If a specific tile is passed e.g. if called from create_dash_tile then we just add it to the end

Parameters

ColumnTypeDefaultDescription
$user_group integer ID of group to add tile(s) to
$user_id integer 0 ID of individual user to add tile(s) to
$newtileid integer "" ID of a single tile to add on the end

Return

void

Location

include/dash_functions.php lines 819 to 869

Definition

 
function build_usergroup_dash($user_group$user_id 0$newtileid="")
    {
    if(
$newtileid!="" && is_numeric($newtileid))
        {
        
$user_group_tiles = array($newtileid);
        }
    else
        {
        
$user_group_tiles ps_array"SELECT 
                                            dash_tile.ref AS `value`
                                        FROM
                                            usergroup_dash_tile
                                                JOIN
                                            dash_tile ON usergroup_dash_tile.dash_tile = dash_tile.ref
                                        WHERE
                                            usergroup_dash_tile.usergroup = ?
                                                AND dash_tile.all_users = 1
                                                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_dash_tile.default_order_by;"
,array("i",$user_group));
        }

    
// If client code has specified a user ID, then just add the tiles for it
    
if(is_numeric($user_id) && $user_id)
        {
        
$starting_order 99999;

        foreach(
$user_group_tiles as $tile)
            {
            
add_user_dash_tile($user_id$tile$starting_orderfalse); // No need to reorder as we have already set the position
            
$starting_order += 10;
            }

        return;
        }

    
$user_list ps_array("SELECT ref AS `value` FROM user WHERE usergroup = ?",array("i",$user_group));
    foreach(
$user_list as $user)
        {
        
$starting_order  99999;
        foreach(
$user_group_tiles as $tile)
            {
            
add_user_dash_tile($user$tile$starting_orderfalse); // No need to reorder as we have already set the position
            
$starting_order += 10;
            }
        }
    }

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