Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

get_resource_collections()

Parameters

ColumnTypeDefaultDescription
$ref

Location

include/resource_functions.php lines 4934 to 4958

Definition

 
function get_resource_collections($ref)
    {
    global 
$userref$anonymous_user$username;
    if (
checkperm('b') || (isset($anonymous_login) && $username==$anonymous_login))
        {return array();}
    
# Returns a list of collections that a resource is used in for the $view_resource_collections option
    
$sql="";
   
    
# Include themes in my collections? 
    # Only filter out themes if $themes_in_my_collections is set to false in config.php
       
global $themes_in_my_collections;
       if (!
$themes_in_my_collections)
           {
           if (
$sql!="") {$sql.=" and ";}
           
$sql.="(length(c.theme)=0 or c.theme is null) ";
           }
    if (
$sql!="") {$sql="where " $sql;}
   
    
$return=sql_query ("select * from 
    (select c.*,u.username,u.fullname,count(r.resource) count from user u join collection c on u.ref=c.user and c.user='
$userref' left outer join collection_resource r on c.ref=r.collection group by c.ref
    union
    select c.*,u.username,u.fullname,count(r.resource) count from user_collection uc join collection c on uc.collection=c.ref and uc.user='
$userref' and c.user<>'$userref' left outer join collection_resource r on c.ref=r.collection left join user u on c.user=u.ref group by c.ref) clist where clist.ref in (select collection from collection_resource cr where cr.resource=$ref)");
    
    return 
$return;
    }

This article was last updated 11th July 2020 20:35 Europe/London time based on the source file dated 10th July 2020 16:06 Europe/London time.