Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

check_view_display_condition()

Parameters

ColumnTypeDefaultDescription
$fields
$n
$fields_all

Location

include/metadata_functions.php lines 277 to 314

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"]!="")
        {
        
$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("|",$checkvalues);
                    
$validvalues array_map("i18n_get_translated",$validvalues);
                    
$validvalues array_map("strtoupper",$validvalues);
                    
$v trim_array(explode(",",$fields_all[$cf]["value"] ?? ""));
                    
$v array_map("i18n_get_translated",$v);
                    
$v array_map("strtoupper",$v);
                    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 17th November 2024 15:35 Europe/London time based on the source file dated 6th March 2024 14:45 Europe/London time.