00001 <?
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00030 class fiche_def_ref
00031 {
00032 var $frd_id;
00033 var $frd_text;
00034 var $frd_class_base;
00035 var $attribut;
00036
00037
00038 function fiche_def_ref($p_cn,$p_frd_id=-1)
00039 {
00040 $this->db=$p_cn;
00041 $this->frd_id=$p_frd_id;
00042 $this->attribut=array('frd_id','frd_text','frd_class_base');
00043 }
00051 function LoadAll()
00052 {
00053 $sql="select * from fiche_def_ref order by frd_id";
00054 $Res=ExecSql($this->db,$sql);
00055 $all=pg_fetch_all($Res);
00056 if ( $Res == false ) return array();
00057 $idx=0;
00058 $array=array();
00059 foreach ($all as $row)
00060 {
00061 $o=new fiche_def_ref($this->db);
00062
00063 foreach ( $this->attribut as $value)
00064 {
00065 $o->$value=$row[$value];
00066 }
00067 $array[$idx]=$o;
00068 $idx++;
00069 }
00070 return $array;
00071 }
00078 function Display()
00079 {
00080 $r="";
00081 foreach ( $this->attribut as $value)
00082 {
00083 $r.="<TD>".$this->$value.'</TD>';
00084 }
00085 return $r;
00086 }
00097 function Input()
00098 {
00099 $r="";
00100 $h=new widget('hidden');
00101 $r.='<li>Id :'.$h->IOValue('frd_id',$this->frd_id).$this->frd_id."</li>";
00102 $w=new widget("text");
00103 $r.='<li>Commentaire :'.$w->IOValue('frd_text',$this->frd_text)."</li>";
00104 $t=new widget('text');
00105 $r.='<li>Poste de base:'.$t->IOValue('frd_class_base',$this->frd_class_base)."</li>";
00106
00107 return $r;
00108 }
00117 function Save()
00118 {
00119 $sql="update fiche_def_ref set frd_text='".
00120 $this->frd_text."' , frd_class_base='".$this->frd_class_base."'".
00121 " where frd_id=".$this->frd_id;
00122 $Res=ExecSql($this->db,$sql);
00123 }
00131 function Get()
00132 {
00133 $sql="select * from fiche_def_ref ".
00134 " where frd_id=".$this->frd_id;
00135 $Res=ExecSql($this->db,$sql);
00136 if ( pg_NumRows($Res) == 0 ) return null;
00137 $r=pg_fetch_array($Res,0);
00138 $this->frd_text=$r['frd_text'];
00139 $this->frd_class_base=$r['frd_class_base'];
00140 }
00141
00142 }
00143 ?>