Collections functions
General functions
Render functions
Theme permission 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 8698 to 8719

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 5th October 2022 04:05 Europe/London time based on the source file dated 30th September 2022 14:20 Europe/London time.