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

update_resource_type_order()

Description

Apply a new order to resource types

Parameters

ColumnTypeDefaultDescription
$neworder array Resource type IDs in new order

Return

void

Location

include/resource_functions.php lines 9022 to 9043

Definition

 
function update_resource_type_order($neworder)
    {
    global 
$lang;
    if (!
is_array($neworder)) {
        exit (
"Error: invalid input to update_resource_type_field_order function.");
    }

    
$updatesql"update resource_type set order_by=(case ref ";
    
$counter 10;
    
$params=array();

    foreach (
$neworder as $restype){
        
$updatesql.= "when ? then ? ";
        
$params[]="i";$params[]=$restype;
        
$params[]="i";$params[]=$counter;
        
$counter $counter 10;
    }
    
$updatesql.= "else order_by END)";
    
ps_query($updatesql,$params);
    
clear_query_cache("schema");
    
log_activity($lang['resourcetypereordered'],LOG_CODE_REORDERED,implode(', ',$neworder),'resource_type','order_by');
    }

This article was last updated 19th March 2024 04:35 Europe/London time based on the source file dated 11th March 2024 14:25 Europe/London time.