Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

get_collections_resource_count()

Description

Get collection total resource count for a list of collections


note that the returned array might NOT contain keys for all the input IDs (e.g validation failed).

Parameters

ColumnTypeDefaultDescription
$refs array List of collection IDs

Return

array Returns table of collections and their total resource count (taking into account access controls). Please

Location

include/search_functions.php lines 2962 to 2984

Definition

 
function get_collections_resource_count(array $refs)
    {
    
$return = [];

    foreach(
$refs as $ref)
        {
        if(!(
is_int_loose($ref) && $ref 0))
            {
            continue;
            }

        
$sql do_search("!collection{$ref}"'''relevance''0', -1'desc'false0falsefalse''falsefalsetruefalsetruenullfalse);
        if(!(
is_string($sql) && trim($sql) !== ''))
            {
            continue;
            }

        
$resources sql_query($sql'col_total_ref_count_w_perm', -1true2true, ['ref']);
        
$return[$ref] = count($resources);
        }

    return 
$return;
    }

This article was last updated 28th February 2021 14:35 Europe/London time based on the source file dated 18th February 2021 17:00 Europe/London time.