db=$p_cn; $this->frd_id=$p_frd_id; $this->attribut=array('frd_id','frd_text','frd_class_base'); } /*! ************************************************** * \brief Load all the fiche_def_ref data and * return an array of fiche_def_ref objects * * \return array */ function LoadAll() { $sql="select * from fiche_def_ref order by frd_id"; $Res=ExecSql($this->db,$sql); $all=pg_fetch_all($Res); if ( $Res == false ) return array(); $idx=0; $array=array(); foreach ($all as $row) { $o=new fiche_def_ref($this->db); foreach ( $this->attribut as $value) { $o->$value=$row[$value]; } $array[$idx]=$o; $idx++; } return $array; } /*! ************************************************** * \brief Display data between tag * * \return string */ function Display() { $r=""; foreach ( $this->attribut as $value) { $r.="".$this->$value.''; } return $r; } /*! ************************************************** * \brief Input Data between tag * * \return string */ function Input() { $r=""; $h=new widget('hidden'); $r.='
  • Id :'.$h->IOValue('frd_id',$this->frd_id).$this->frd_id."
  • "; $w=new widget("text"); $r.='
  • Commentaire :'.$w->IOValue('frd_text',$this->frd_text)."
  • "; $t=new widget('text'); $r.='
  • Poste de base:'.$t->IOValue('frd_class_base',$this->frd_class_base)."
  • "; return $r; } /*! ************************************************** * \brief Store data into the database: update the * record * * - * \return none */ function Save() { $sql="update fiche_def_ref set frd_text='". $this->frd_text."' , frd_class_base='".$this->frd_class_base."'". " where frd_id=".$this->frd_id; $Res=ExecSql($this->db,$sql); } /*! ************************************************** * \brief Get the data with the p_code and complete * the current object * * \return none */ function Get() { $sql="select * from fiche_def_ref ". " where frd_id=".$this->frd_id; $Res=ExecSql($this->db,$sql); if ( pg_NumRows($Res) == 0 ) return null; $r=pg_fetch_array($Res,0); $this->frd_text=$r['frd_text']; $this->frd_class_base=$r['frd_class_base']; } } ?>