Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

check_view_display_condition()

Parameters

ColumnTypeDefaultDescription
$fields
$n
$fields_all

Location

include/metadata_functions.php lines 289 to 323

Definition

 
function check_view_display_condition($fields,$n,$fields_all)        
    {
    
#Check if field has a display condition set
    
$displaycondition=true;
    if (
$fields[$n]["display_condition"]!="")
        {
        
$fieldstocheck=array(); #' Set up array to use in jQuery script function
        
$s=explode(";",$fields[$n]["display_condition"]);
        
$condref=0;
        foreach (
$s as $condition# Check each condition
            
{
            
$displayconditioncheck=false;
            
$s=explode("=",$condition);
            for (
$cf=0;$cf<count($fields_all);$cf++) # Check each field to see if needs to be checked
                
{
                if (
$s[0]==$fields_all[$cf]["name"]) # this field needs to be checked
                    
{                    
                    
$checkvalues=$s[1];
                    
$validvalues=explode("|",strtoupper($checkvalues));
                    
$v=trim_array(explode(",",strtoupper($fields_all[$cf]["value"])));
                    foreach (
$validvalues as $validvalue)
                        {
                        if (
in_array($validvalue,$v)) {$displayconditioncheck=true;} # this is  a valid value                        
                        
}
                    if (!
$displayconditioncheck) {$displaycondition=false;}                    
                    }
                    
                } 
# see if next field needs to be checked
                            
            
$condref++;
            } 
# check next condition    
        
        
}
    return 
$displaycondition;
    }

This article was last updated 12th July 2020 06:05 Europe/London time based on the source file dated 5th June 2020 16:33 Europe/London time.