Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

get_themes_by_resource()

Parameters

ColumnTypeDefaultDescription
$ref

Location

include/resource_functions.php lines 3352 to 3386

Definition

 
function get_themes_by_resource($ref)
    {
    global 
$theme_category_levels;

    
$themestring="";
    for(
$n=1;$n<=$theme_category_levels;$n++){
        if (
$n==1){$themeindex="";}else{$themeindex=$n;}
        
$themestring.=",c.theme".$themeindex;
    }

    
$themes=sql_query("select c.ref $themestring ,c.name,u.fullname from collection_resource cr join collection c on cr.collection=c.ref and cr.resource='$ref' and c.public=1 left outer join user u on c.user=u.ref order by length(theme) desc");
    
# Combine the theme categories into one string so multiple category levels display correctly.
    
$return=array();

    for (
$n=0;$n<count($themes);$n++)
        {
        if (
checkperm("j*") || checkperm("j" $themes[$n]["theme"]))
            {
            
$theme="";
            for (
$x=1;$x<=$theme_category_levels;$x++){
                if (
$x==1){$themeindex="";}else{$themeindex=$x;}
                if (
$themes[$n]["theme".$themeindex]==""){break;}
                if (
$themeindex!=""){$theme.=" / ";}

                if (
$themes[$n]["theme".$themeindex]!="") {
                    
$theme.=$themes[$n]["theme".$themeindex];
                }
            }
            
$themes[$n]["theme"]=$theme;
            
$return[]=$themes[$n];
            }
        }
      
    return 
$return;
    }

This article was last updated 7th July 2020 10:35 Europe/London time based on the source file dated 6th July 2020 18:09 Europe/London time.