<?php
$DEBUG=0;

$serie=15;
$ent = "Réseau <img src='../img/fleche_droite.png' align='bottom'  border='0'> Eléments réseau";
switch ($nat) {
  case 'interv':
  $ent.=" en intervention";
  break;
  case 'intervclo':
  $ent.=" interventions cloturées";
}
if ($nat=="interv" || $nat=="intervclo")
  $ico="../img/intervention.png";
else
  $ico = "../img/reseau.png";
$edition="";
$fiche="";
if ($nat=="interv" || $nat=="intervclo") {
       $href[0]['lien']= "#";
       $href[0]['id']= "";
       $href[0]['lib']= "";
}
if ($nat=="interv" || $nat=="intervclo") {
       $href[2]['lien']= "#";
       $href[2]['id']= "";
       $href[2]['lib']= "";
}
$hiddenid=1;
//
if ($nat=="interv" || $nat=="intervclo") {
    $table="element as e left join intervention as i on e.idelement=i.idperipherique left join batiment
    on e.idbatiment=batiment.idbatiment left join personnel as p1 on i.iddemandeur=p1.idutilisateur
    inner join etatintervention as et on i.idetatintervention=et.idetat inner join typeintervention as ty on i.idtype=ty.idtype
    inner join modeleelement as me on e.idmodele=me.idmodele ";
    $champAffiche=array("e.idelement as id","e.numero as periph","me.libmodele","libbatiment","e.numserie","libtype as type","concat(p1.nom,' ',p1.prenom) as demandeur","dateouverture","observations","libetat");
    $champRecherche=array("e.numero","me.libmodele","libbatiment","e.numserie","nom","prenom","observations","dateouverture");
    $tri= " order by dateouverture desc,e.numero";
} else {
    $table="element inner join modeleelement on element.idmodele=modeleelement.idmodele left join batiment
    on element.idbatiment=batiment.idbatiment";
    $champAffiche=array("idelement as id","numero","libbatiment","nature","libmodele");
    $champRecherche=array("libbatiment","libmodele");
    $tri= " order by libbatiment,nature,libmodele";
}
$selection="where classe = 'reseau'";
if (isset($idx)) { //soustabdyn
  if ($obj=="modelereseau") { //modelereseau
    $selection .= " and element.idmodele = ".$idx;
  } else if ($obj=="batiment") { //batiment
    $selection .= " and element.idbatiment = ".$idx;  
  }
}
switch ($nat) {
  case 'interv':
  $selection.=" and i.idetatintervention in (1,2)";
  break;
  case 'intervclo':
  $selection.=" and i.idetatintervention = 3";
}
// sous formulaire
$sousformulaire=array("tcpip","intervention");
$sousformulaire_class="sousformulaire"; // dans cg => voir customs ???
$soustab="onglet";
?>