<?php
// +-------------------------------------------------+
// | 2002-2007 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: groupexpls.class.php,v 1.1.2.2 2026/08/04 12:49:52 dgoron Exp $

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

class groupexpls {
    public $info=array();
    public $error_message="";
    public $info_message="";
    
    public function __construct() {
        $this->error_message="";
        $this->info_message="";
        $this->fetch_data();
    }
    
    public function fetch_data() {
        $this->info=array();
        $this->error_message="";
        $this->info_message="";
    }
    
    public function set_error_message($error_message) {
        $this->error_message=$error_message;
    }
    
	public function get_cb_search_form() {
	    global $charset;
	    global $groupexpl_list_tpl;
	    
	    $tpl=$groupexpl_list_tpl;
	    $tpl=str_replace('!!error_message!!',htmlentities($this->error_message, ENT_QUOTES, $charset), $tpl);
	    $tpl=str_replace('!!info_message!!',htmlentities($this->info_message, ENT_QUOTES, $charset), $tpl);
	    return $tpl;
	}
	
    public static function get_group_expl($cb){
		$req="select id_groupexpl from groupexpl, groupexpl_expl, exemplaires where expl_id=groupexpl_expl_num and groupexpl_num=id_groupexpl and expl_cb='".addslashes($cb)."' ";
        $resultat=pmb_mysql_query($req);
        if (!pmb_mysql_num_rows($resultat)){
            return 0;
        }
        $r=pmb_mysql_fetch_object($resultat);
        return $r->id_groupexpl;
    }
    
    public static function get_group_name_expl($cb){
		$req="select groupexpl_name from groupexpl, groupexpl_expl, exemplaires where expl_id=groupexpl_expl_num and groupexpl_num=id_groupexpl and expl_cb='".addslashes($cb)."' ";
        $resultat=pmb_mysql_query($req);
        if (!pmb_mysql_num_rows($resultat)){
            return "";
        }
        $r=pmb_mysql_fetch_object($resultat);
        return $r->groupexpl_name;
    }
} // groupexpls class end