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

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 9214 to 9235

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