<?php
$DEBUG=0;

$serie=15;
$ent="Bureautique <img src='../img/fleche_droite.png' align='bottom'  border='0'> Périphériques ";
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/ecran.png";
$edition="";
$fiche="";
$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 personnel as p1 on i.iddemandeur=p1.idutilisateur left join personnel as p2 on i.idintervenant=p2.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","e.numserie","libtype as type","concat(p1.nom,' ',p1.prenom) as demandeur","concat(p2.nom,' ',p2.prenom) as technicien","dateouverture","observations","libetat");
   $champRecherche=array("e.numero","me.libmodele","e.numserie","libtype","p1.nom","p1.prenom","dateouverture");
   $tri= " order by dateouverture desc,e.numero";
} else {
  $table="element inner join modeleelement on element.idmodele=modeleelement.idmodele left join station on element.idstation=station.idstation left join etatmateriel on element.idetatelement=etatmateriel.idetat";
  $champAffiche=array("idelement as id","element.numero","nature","libmodele","station.numero as station","element.numserie","element.dateatelier","libetat");
  $champRecherche=array("element.numero","station.numero","nature","libmodele","element.numserie","libetat");
  $tri= " order by nature,libmodele,numserie";
}
switch ($nat) {
  case 'interv':
  $selection=" where i.idetatintervention in (1,2)";
  break;
  case 'intervclo':
  $selection=" where i.idetatintervention = 3";
  break;
  default:
  $selection="where classe in ('peripherique','reseau','telecom')";
}
// sous formulaire
$sousformulaire=array("tcpip","intervention");
$sousformulaire_class="sousformulaire"; // dans cg => voir customs ???
$soustab="onglet";
?>