Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

get_theme_headers()

Parameters

ColumnTypeDefaultDescription
$themes array

Location

include/collections_functions.php lines 1011 to 1049

Definition

 
function get_theme_headers($themes=array())
    {
    
# Return a list of theme headers, i.e. theme categories
    #return sql_array("select theme value,count(*) c from collection where public=1 and length(theme)>0 group by theme order by theme");
    # Work out which theme category level we are selecting based on the higher selected levels provided.
    
$selecting="theme";

    
$theme_path "";    
    
$sql="";    
    for (
$x=0;$x<count($themes);$x++){        
        if (
$x>0$theme_path .= "|";        
        
$theme_path .= $themes[$x];        
        if (isset(
$themes[$x])){
            
$selecting="theme".($x+2);
        }    
        if (isset(
$themes[$x]) && $themes[$x]!="" && $x==0) {
            
$sql.=" and theme LIKE '%" escape_check($themes[$x]) . "'";
        }
        else if (isset(
$themes[$x])&& $themes[$x]!=""&& $x!=0) {
            
$sql.=" and theme".($x+1)." LIKE '%" escape_check($themes[$x]) . "'";
        }
    }    
    
$return=array();
    
    
$themes=sql_query("select * from collection where public=1 and $selecting is not null and length($selecting)>0 $sql");
    for (
$n=0;$n<count($themes);$n++)
        {        
        if (
                (!
in_array($themes[$n][$selecting],$return)) &&                    # de-duplicate as there are multiple collections per theme category                
                
(checkperm("j*") || checkperm("j" $themes[$n]["theme"])) &&    # and we have permission to access then add to array                            
                
(!checkperm ("j-${theme_path}|" $themes[$n][$selecting]))        # path must not be in j-<path> exclusion                
            

            {                                            
                
$return[]=$themes[$n][$selecting];
            }
        }
    
usort($return,"themes_comparator");    
    return 
$return;
    }

This article was last updated 7th July 2020 09:05 Europe/London time based on the source file dated 3rd July 2020 14:33 Europe/London time.