Collections functions
General functions
Render functions
Theme permission functions
Resource functions

get_resource_types()

Description

Return an array of resource types that this user has access to

blank string returns all available types

Parameters

ColumnTypeDefaultDescription
$types string "" Comma separated list to limit the types that are returned by ref,
$translate boolean true Flag to translate the resource types before returning

Return

array Array of resource types limited by T* permissions and optionally by $types

Location

include/resource_functions.php lines 3591 to 3613

Definition

 
function get_resource_types($types ""$translate true)
    {
    
$resource_types get_all_resource_types();
    
$return=array();

    if (
$types!="")
        {
        
$s=explode(",",$types);
        }

    for (
$n=0;$n<count($resource_types);$n++)
        {
        if ((!isset(
$s) || in_array($resource_types[$n]['ref'],$s)) && !checkperm('T' $resource_types[$n]['ref']))
            {
            if (
$translate==true
                {
                
$resource_types[$n]["name"]=lang_or_i18n_get_translated($resource_types[$n]["name"], "resourcetype-");
                }
            
$return[]=$resource_types[$n];
            }
        }
    return 
$return;
    }

This article was last updated 5th February 2023 08:05 Europe/London time based on the source file dated 3rd February 2023 13:55 Europe/London time.