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

relate_all_collection()

Parameters

ColumnTypeDefaultDescription
$collection
$checkperms true

Location

include/collections_functions.php lines 4210 to 4232

Definition

 
function relate_all_collection($collection$checkperms true)
    {
    if((string)(int)
$collection != (string)$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
                

                if (
count(sql_query("SELECT 1 FROM resource_related WHERE resource='".$rlist[$n]."' and related='".$rlist[$m]."' LIMIT 1"))!=1
                    {
                    
sql_query("insert into resource_related (resource,related) values ('" $rlist[$n] . "','" $rlist[$m] . "')");
                    }
                }
            }
        }
    return 
true;
    }

This article was last updated 30th November 2020 13:05 Europe/London time based on the source file dated 25th November 2020 10:35 Europe/London time.