Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 class Fiche_Def_Ref
00030 {
00031 var $frd_id;
00032 var $frd_text;
00033 var $frd_class_base;
00034 var $attribut;
00035
00036
00037 function __construct($p_cn,$p_frd_id=-1)
00038 {
00039 $this->db=$p_cn;
00040 $this->frd_id=$p_frd_id;
00041 $this->attribut=array('frd_id','frd_text','frd_class_base');
00042 }
00043
00044
00045
00046
00047
00048
00049
00050 function LoadAll()
00051 {
00052 $sql="select * from fiche_def_ref order by frd_id";
00053 $Res=$this->db->exec_sql($sql);
00054 $all=Database::fetch_all($Res);
00055 if ( $Res == false ) return array();
00056 $idx=0;
00057 $array=array();
00058 foreach ($all as $row)
00059 {
00060 $o=new Fiche_Def_Ref($this->db);
00061
00062 foreach ( $this->attribut as $value)
00063 {
00064 $o->$value=$row[$value];
00065 }
00066 $array[$idx]=$o;
00067 $idx++;
00068 }
00069 return $array;
00070 }
00071
00072
00073
00074
00075
00076
00077 function Display()
00078 {
00079 $r="";
00080 foreach ( $this->attribut as $value)
00081 {
00082 $r.="<TD>".$this->$value.'</TD>';
00083 }
00084 return $r;
00085 }
00086
00087
00088
00089
00090
00091
00092 function Input()
00093 {
00094 $r="";
00095 $h=new IHidden();
00096 $r.='<li>Id :'.$h->input('frd_id',$this->frd_id).$this->frd_id."</li>";
00097 $w=new IText();
00098 $r.='<li>Commentaire :'.$w->input('frd_text',$this->frd_text)."</li>";
00099 $t=new IText();
00100 $r.='<li>Poste de base:'.$t->input('frd_class_base',$this->frd_class_base)."</li>";
00101
00102 return $r;
00103 }
00104
00105
00106
00107
00108
00109
00110
00111
00112 function Save()
00113 {
00114 $sql="update fiche_def_ref set frd_text=$1 ".
00115 " , frd_class_base=$2 ".
00116 " where frd_id= $3";
00117 $Res=$this->db->exec_sql($sql,array($this->frd_text,$this->frd_class_base,$this->frd_id));
00118 }
00119
00120
00121
00122
00123
00124
00125
00126 function Get()
00127 {
00128 $sql="select * from fiche_def_ref ".
00129 " where frd_id=".$this->frd_id;
00130 $Res=$this->db->exec_sql($sql);
00131 if ( Database::num_row($Res) == 0 ) return null;
00132 $r=Database::fetch_array($Res,0);
00133 $this->frd_text=$r['frd_text'];
00134 $this->frd_class_base=$r['frd_class_base'];
00135 }
00136
00137 }
00138 ?>