Plugins  LAST
 All Data Structures Files Functions Variables Pages
class_skel_parameter.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of NOALYSS.
5  *
6  * NOALYSS is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * NOALYSS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with NOALYSS; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 /* $Revision$ */
21 
22 // Copyright (c) 2002 Author Dany De Bontridder dany@alchimerys.be
23 
24 /**
25  * @file
26  * @brief class for the table SKEL.parameter
27  * replace SKEL by the plugin schema
28  *
29  */
31 {
32  // constructor
33  function __construct() {
34  $this->db=$p_cn;
35  $Res=$p_cn->exec_sql("select * from SKEL.parameter ");
36  for ($i = 0;$i < Database::num_row($Res);$i++)
37  {
38  $row=Database::fetch_array($Res,$i);
39  $key=$row['pr_id'];
40  $elt=$row['pr_value'];
41 
42  // store value here
43  $this->{"$key"}=$elt;
44  }
45 
46  }
47  /*!
48  **************************************************
49  * \brief save the parameter into the database by inserting or updating
50  *
51  *
52  * \param $p_attr give the attribut name
53  *
54  */
55  function save($p_option,$p_value)
56  {
57  global $cn;
58  // check if the parameter does exist
59  if ( $this->cn->get_value('select count(*) from SKEL.parameter where pr_id=$1',array($p_option)) != 0 )
60  {
61  $Res=$this->cn->exec_sql("update SKEL.parameter set pr_value=$1 where pr_id=$2",
62  array($p_value,$p_option));
63  }
64  else
65  {
66 
67  $Res=$this->cn->exec_sql("insert into SKEL.parameter (pr_id,pr_value) values( $1,$2)",
68  array($p_option,$p_value));
69 
70  }
71 
72  }
73 
74 }
75 ?>
save($p_option, $p_value)
save the parameter into the database by inserting or updating
for($i=0;$i< Database::num_row($ret);$i++) $row
$key
global $cn