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()

Parameters

ColumnTypeDefaultDescription
$user_group
$user_id 0
$newtileid ""

Location

include/dash_functions.php lines 835 to 885

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 17th November 2024 15:05 Europe/London time based on the source file dated 13th November 2024 15:50 Europe/London time.