Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

relate_all_collection()

Parameters

ColumnTypeDefaultDescription
$collection
$checkperms true

Location

include/collections_functions.php lines 5254 to 5275

Definition

 
function relate_all_collection($collection$checkperms true)
    {
    if(!
is_int_loose($collection) || ($checkperms && !allow_multi_edit($collection)))
        {
        return 
false;
        }

    
$rlist get_collection_resources($collection);
    for (
$n=0;$n<count($rlist);$n++)
        {
        for (
$m=0;$m<count($rlist);$m++)
            {
            if (
                
$rlist[$n] != $rlist[$m# Don't relate a resource to itself
                
&& count(ps_query("SELECT 1 FROM resource_related WHERE resource= ? and related= ? LIMIT 1", ['i'$rlist[$n], 'i'$rlist[$m]])) != 1
            
) { 
                    
ps_query("insert into resource_related (resource,related) values (?, ?)", ['i'$rlist[$n], 'i'$rlist[$m]]);            
                }
            }
        }
    return 
true;
    }

This article was last updated 19th March 2024 08:05 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.