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 class Own
00028 {
00029 var $db;
00030
00031 function Own($p_cn)
00032 {
00033 $this->db=$p_cn;
00034 $Res=$p_cn->exec_sql("select * from parameter where pr_id like 'MY_%'");
00035 for ($i = 0;$i < Database::num_row($Res);$i++)
00036 {
00037 $row=Database::fetch_array($Res,$i);
00038 $key=$row['pr_id'];
00039 $elt=$row['pr_value'];
00040
00041 $this->{"$key"}=$elt;
00042 }
00043
00044 }
00045 function check(&$p_value)
00046 {
00047 if ($p_value == 'MY_STRICT'
00048 && $this->MY_STRICT != 'Y'
00049 && $this->MY_STRICT != 'N')
00050 $p_value='N';
00051 $p_value=htmlspecialchars($p_value);
00052 }
00053
00054
00055
00056
00057
00058
00059
00060
00061 function save($p_attr)
00062 {
00063 $this->check($p_attr);
00064 $value=$this->$p_attr;
00065
00066 if ( $this->db->get_value('select count(*) from parameter where pr_id=$1',array($p_attr)) != 0 )
00067 {
00068 $Res=$this->db->exec_sql("update parameter set pr_value=$1 where pr_id=$2",
00069 array($value,$p_attr));
00070 }
00071 else
00072 {
00073
00074 $Res=$this->db->exec_sql("insert into parameter (pr_id,pr_value) values( $1,$2)",
00075 array($p_attr,$value));
00076
00077 }
00078
00079 }
00080
00081
00082
00083
00084
00085
00086
00087 function update()
00088 {
00089
00090 $this->save('MY_NAME');
00091 $this->save('MY_TVA');
00092 $this->save('MY_STREET');
00093 $this->save('MY_NUMBER');
00094 $this->save('MY_CP');
00095 $this->save('MY_TEL');
00096 $this->save('MY_PAYS');
00097 $this->save('MY_COMMUNE');
00098 $this->save('MY_FAX');
00099 $this->save('MY_ANALYTIC');
00100 $this->save('MY_STRICT');
00101 $this->save('MY_TVA_USE');
00102 $this->save('MY_PJ_SUGGEST');
00103 $this->save('MY_CHECK_PERIODE');
00104 $this->save('MY_DATE_SUGGEST');
00105 $this->save('MY_ALPHANUM');
00106 $this->save('MY_UPDLAB');
00107 $this->save('MY_STOCK');
00108
00109
00110 }
00111
00112 }