<?php
$DEBUG=0;

$serie=15;
$ent = "Bureautique <img src='../img/fleche_droite.png' align='bottom'  border='0'> Périphériques libres";
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/pda.png";
$edition="";
$fiche="peripherique";
$hiddenid=1;
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']= "";
}
         $href[3]['lien'] = "../pdf/pdfetat.php?obj=".$fiche."&idx=";
         $href[3]['id']= "";
         // * custom *
         if(file_exists("../dyn/custom/img/ico_pdf.png")) {
            $href[3]['lib']= "<img src='../dyn/custom/img/ico_pdf.png' border=0>";
         }
         else {
            $href[3]['lib']= "<img src='../img/ico_pdf.png' border=0>";
         } 
//
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 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 as me on e.idmodele=me.idmodele left join personnel on e.idutilisateur=personnel.idutilisateur left join service on e.idservice=service.idservice left join etatmateriel on e.idetatelement=etatmateriel.idetat";
    $champAffiche=array("idelement as id","nature","numero","numserie","libmodele","libservice","concat(nom,' ',prenom) as nom","libetat");
    $champRecherche=array("nature","numero","numserie","libmodele","libservice","nom","libetat");
    $tri= " order by nature,libmodele";
}
$selection="where nature in ('memoireflash','disqueext','appareilphoto','videoprojecteur','organiseur','camescope')";
if (isset($idx))
  if (strstr($obj,"modele")) { //soustab de modele...
    $selection .= " and e.idmodele = ".$idx;
  } else   //soustab de personnel ou service
    if ($obj=="personnel")
      $selection .= " and e.idutilisateur = ".$idx;
    else  
      $selection .= " and e.idservice = ".$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";
?>