Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

relate_all_collection()

Parameters

ColumnTypeDefaultDescription
$collection
$checkperms true

Location

include/collections_functions.php lines 5299 to 5320

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 November 2024 15:35 Europe/London time based on the source file dated 13th November 2024 15:50 Europe/London time.