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

reorder_user_dash()

Parameters

ColumnTypeDefaultDescription
$user

Location

include/dash_functions.php lines 1087 to 1106

Definition

 
function reorder_user_dash($user)
    {
    
$user_tiles ps_query("SELECT user_dash_tile.ref FROM user_dash_tile LEFT JOIN dash_tile ON user_dash_tile.dash_tile = dash_tile.ref WHERE user_dash_tile.user= ? ORDER BY user_dash_tile.order_by", ['i'$user]);
    if (
count($user_tiles) < 2)
        {
        return; 
        }
    
$order_by = (10 count($user_tiles)) + 10# Begin ordering at 10 for first position, not 0.
    
    
$sql="UPDATE user_dash_tile SET order_by = (CASE ";
    
$params = [];
    for(
$i=count($user_tiles)-1;$i>=0;$i--)
        {
        
$sql.=" WHEN ref= ? THEN ? ";
        
$order_by-=10;
        
$params array_merge($params, ['i'$user_tiles[$i]["ref"], 'i'$order_by]);
        }
    
$sql.=" END) WHERE user='" $user "'";
    
ps_query($sql$params);
    }

This article was last updated 4th December 2024 09:05 Europe/London time based on the source file dated 13th November 2024 15:50 Europe/London time.