Collections functions
General functions
Render functions
Theme permission 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 3083 to 3104

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_a($sql,"PreparedStatementQuery") && trim($sql->sql) !== ''))
            {
            continue;
            }

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

This article was last updated 5th October 2022 11:35 Europe/London time based on the source file dated 5th October 2022 10:30 Europe/London time.