Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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 846 to 892

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 30th April 2025 21:35 Europe/London time based on the source file dated 17th April 2025 17:40 Europe/London time.