Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

class_own.php

Go to the documentation of this file.
00001 <?
00002 /*
00003  *   This file is part of PhpCompta.
00004  *
00005  *   PhpCompta is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   PhpCompta is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with PhpCompta; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 /* $Revision: 1.3 $ */
00020 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00028 class Own {
00029   var $db;
00030   // constructor 
00031   function Own($p_cn) {
00032     $this->db=$p_cn;
00033     $Res=ExecSql($p_cn,"select * from parameter where pr_id like 'MY_%'");
00034     for ($i = 0;$i < pg_NumRows($Res);$i++) {
00035       $row=pg_fetch_array($Res,$i);
00036       $key=$row['pr_id'];
00037       $elt=$row['pr_value'];
00038       // store value here
00039       $this->{"$key"}=$elt;
00040     }
00041 
00042   }
00051   function UpdateRow($p_attr) {
00052     $value=FormatString($this->{"$p_attr"});
00053     $Res=ExecSql($this->db,"update parameter set pr_value='$value' where pr_id='$p_attr'");
00054   }
00055 
00062   function Save() {
00063     $this->UpdateRow('MY_NAME');
00064     $this->UpdateRow('MY_TVA');
00065     $this->UpdateRow('MY_STREET');
00066     $this->UpdateRow('MY_NUMBER');
00067     $this->UpdateRow('MY_CP');
00068     $this->UpdateRow('MY_TEL');
00069     $this->UpdateRow('MY_PAYS');
00070     $this->UpdateRow('MY_COMMUNE');
00071     $this->UpdateRow('MY_FAX');
00072 
00073   }
00074 
00075 }