<?php
/*
$Id: modelereseau.class.php,v 1.2 2007-03-14 12:38:11 fgiva Exp $
*/
require_once ("formulaire.class.php");
require_once ("modeleelement.class.php");

class modelereseau extends modeleelement {

function modelereseau($id,&$db,$DEBUG,$nature) {
  $this->constructeur($id,$db,$DEBUG);
  $this->nature=$nature;
  $this->classe="reseau";
} // fin constructeur

function setvalF($val){
  parent::setvalF($val);
  switch ($this->nature) {
  case "modem":
    $this->valF['connecteur'] = $val['connecteur'];
    $this->valF['typecomp'] = $val['typecomp'];
    $this->valF['reseau'] = $val['reseau'];
    break;
  case "elementactif":
    $this->valF['vitesse'] = $val['vitesse'];
    $this->valF['nbbank'] = $val['nbbank'];
    $this->valF['typecomp'] = $val['typecomp'];
  }
}

function setType(&$form,$maj) {
  parent::setType($form,$maj);  //sans& 
  if ($maj < 2) { //ajouter et modifier
    switch ($this->nature) {
    case "modem":
      $form->setType('connecteur','select');
      $form->setType('typecomp','select');
      $form->setType('reseau','select');
      break;
    case "elementactif":
      $form->setType('vitesse','select');
      $form->setType('nbbank','select');
      $form->setType('typecomp','select');
    }
  }
}

function setSelect(&$form, $maj,$db,$debug) {
  parent::setSelect($form, $maj,$db,$debug);  //sans& 
  if($maj<2){
    $contenuON=array();
    $contenuON[0]=array('f','v');
    $contenuON[1]=array('Non','Oui');
    switch ($this->nature) {
    case "modem":
      $contenu=array();
      $contenu[0]=array('RTC','ADSL','ADSL2');
      $contenu[1]=array('RTC','ADSL','ADSL2');
      $form->setSelect("typecomp",$contenu);
      $contenu=array();
      $contenu[0]=array('Integré','USB','Ethernet','WiFi');
      $contenu[1]=array('Integré','USB','Ethernet','WiFi');
      $form->setSelect("connecteur",$contenu);
      $form->setSelect("reseau",$contenuON);
      break;
    case "elementactif":
      $contenu[0]=array("10","11","54","100","1000");
      $contenu[1]=array("10","11","54","100","1000");
      $form->setSelect("vitesse",$contenu);
      $contenu=array();
      $contenu[0]=array('HUB','Switch','Borne WiFi');
      $contenu[1]=array('HUB','Switch','Borne WiFi');
      $form->setSelect("typecomp",$contenu);
      $contenu=array();
      $contenu[0]=array(0,4,8,12,16,24);
      $contenu[1]=array(0,4,8,12,16,24);
      $form->setSelect("nbbank",$contenu);
    }
  }
}

function setLib(&$form,$maj) {
  parent::setLib($form,$maj);  //sans& 
  switch ($this->nature) {
  case "modem":
    $form->setLib('typecomp','Type');
    $form->setLib('reseau','Routeur intégré');
    break;
  case "elementactif":
    $form->setLib('typecomp','Type');
    $form->setLib('nbbank','Nb Ports');
  }
}

}// fin de classe
?>