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 5255 to 5276

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 17th May 2024 21:35 Europe/London time based on the source file dated 16th May 2024 18:10 Europe/London time.