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

Description

Update collection type for one collection or batch

Parameters

ColumnTypeDefaultDescription
$cid integer|array Collection ID -or- list of collection IDs
$type integer Collection type. @see include/definitions.php for available options
$log true

Return

boolean

Location

include/collections_functions.php lines 5349 to 5381

Definition

 
function update_collection_type($cid$type$log true)
    {
    
debug_function_call("update_collection_type"func_get_args());

    if(!
is_array($cid))
        {
        
$cid = array($cid);
        }

    
$cid array_filter($cid"is_numeric");

    if(empty(
$cid))
        {
        return 
false;
        }

    if(!
in_array($typedefinitions_get_by_prefix("COLLECTION_TYPE")))
        {
        return 
false;
        }

    if(
$log)
        {
        foreach(
$cid as $ref)
            {
            
collection_log($refLOG_CODE_EDITED"""Update collection type to '{$type}'");
            }
        }

    
ps_query("UPDATE collection SET `type` = ? WHERE ref IN ("ps_param_insert(count($cid)) .")"array_merge(['i'$type], ps_param_fill($cid'i')));

    return 
true;
    }

This article was last updated 17th November 2024 15:35 Europe/London time based on the source file dated 13th November 2024 15:50 Europe/London time.