<?php
$DEBUG=0;

$serie=15;
$ent = "Bureautique <img src='../img/fleche_droite.png' align='bottom'  border='0'> Périphérique de station";
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="";
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;
$deleteall=0;
if (($nat=="interv" || $nat=="intervclo") && !isset($idx)) {
    $table="element as e left join intervention as i on e.idelement=i.idperipherique 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","e.numserie","libtype as type","concat(p1.nom,' ',p1.prenom) as demandeur","dateouverture","observations","libetat");
    $champRecherche=array("e.numero","me.libmodele","e.numserie","nom","prenom","observations","dateouverture");
    $tri= " order by dateouverture desc,e.numero";
} else {
    $table="element as e inner join modeleelement on e.idmodele=modeleelement.idmodele left join station as s on e.idstation=s.idstation left join etatmateriel on e.idetatelement=etatmateriel.idetat";
    $champAffiche=array("idelement as id","e.numero as periph","nature","libmodele","e.numserie","s.numero as station","e.datescan","libetat");
    $champRecherche=array("e.numero","nature","libmodele","e.numserie","s.numero","libetat");
    $tri= " order by nature,libmodele";
}
if (isset($idx)) //sous-tableau de station
    $selection="where classe = 'peripherique' and e.idstation > 0 and idetatelement=1 and e.idstation =".$idx;
else {  //tableau de peripherique de station
    $selection="where nature in ('clavier','souris','telecommande','ecran','enceintes','micro','hubusb','onduleur','imprimante','lecteurcarte','lecteurzip','scanner','stationaccueil','tablette','webcam')";
    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";
?>