<?php
// +-------------------------------------------------+
// | 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: interface_element_serialcirc_diff_completion_selection.class.php,v 1.1.4.2 2025/10/23 08:34:01 dgoron Exp $

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

class interface_element_serialcirc_diff_completion_selection extends interface_element_entity_completion_selection {
	
    protected $empr_resp = 0;
    
    public function add_authority_node($value='', $completion='') {
        $node = parent::add_authority_node($value, $completion);
        $node->set_openPopUpFunction($this->selector_function);
        return $node;
    }
    
    protected function get_display_node($indice=0) {
        if (!empty($this->nodes[$indice])) {
            $node_id_empr = $this->nodes[$indice]->get_hidden_value();
            if ($node_id_empr == $this->empr_resp) {
                $checked = "checked='checked'";
            } else {
                $checked = "";
            }
            return "<div class='row'>
                <input type='radio' name='empr_resp'  id='empr_resp_".$indice."' value='".$node_id_empr."' ".$checked." onclick=\"document.getElementById('empr_resp_".$indice."').value=document.getElementById('id_empr_".$indice."').value;\" />
    			".$this->nodes[$indice]->get_display()."
    		</div>";
        }
        return "";
    }
    
    protected function get_display_button_add() {
        if ($this->selector_function) {
            return "<input id='button_add_".$this->hidden_name."' type='button' class='bouton' value='+' onClick=\"serialcirc_diff_group_add_line_empr('".$this->name."', '".$this->hidden_name."', '".$this->completion."', '".$this->selector_function."');\"/>";
        } else {
            return "<input id='button_add_".$this->hidden_name."' type='button' class='bouton' value='+' onClick=\"serialcirc_diff_group_add_line_empr('".$this->name."', '".$this->hidden_name."', '".$this->completion."');\"/>";
        }
    }
    
    public function set_empr_resp($empr_resp) {
        $this->empr_resp = intval($empr_resp);
    }
}