<?php
// +-------------------------------------------------+
// | 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: dynamics_fields.class.php,v 1.1.2.3 2026/04/14 11:47:45 dgoron Exp $

if (stristr($_SERVER['REQUEST_URI'], ".class.php")) die("no access");

class dynamics_fields {
	
    protected static $form_name;
    
    protected static function get_chk_values($name) {
        global ${$name};
        return ${$name};
    }
    
    protected static function has_chk_mandatory() {
        return false;
    }
    
    public static function chk($field,&$check_message) {
        global $msg;
        
        if(static::has_chk_mandatory()) {
            $name=$field['NAME'];
            global ${$name};
            $val=${$name};
            if ($field['MANDATORY']=="yes") {
                if ((!isset($val))||((is_array($val))&&(count($val)==1)&&($val[0]==""))||($val=="")) {
                    $check_message=sprintf($msg["parperso_field_is_needed"],$field['ALIAS'][0]['value']);
                    return 0;
                }
            }
        }
        return 1;
    }
  
    public static function get_form_name() {
        global $categ;
        
        if (!empty(static::$form_name)) {
            return static::$form_name;
        }
        switch ($categ) {
            case "planificateur" :
                return "planificateur_form";
            default :
                return "formulaire";
        }
    }
    
    public static function get_rgaa_label($field, $varname) {
        return '';
    }
    
    public static function set_form_name($form_name) {
        static::$form_name = $form_name;
    }
}