noalyss  Version-6.9.1.8
 All Data Structures Namespaces Files Functions Variables Pages
class_fiche_def_ref.php
Go to the documentation of this file.
1 <?php
2 /*
3  * This file is part of NOALYSS.
4  *
5  * NOALYSS is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * NOALYSS is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with NOALYSS; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 // Copyright Author Dany De Bontridder danydb@aevalys.eu
20 /*! \file
21  * \brief fiche_def_ref, a fiche is owned by fiche_def which is owned by
22  * fiche_def_ref
23  */
24 /*!
25  * \brief fiche_def_ref, a fiche is owned by fiche_def which is owned by
26  * fiche_def_ref
27  */
28 
30 {
31  var $frd_id; /*!< $frd_id fiche_def_ref.frd_id */
32  var $frd_text; /*!< $frd_text fiche_def_ref.frd_tex */
33  var $frd_class_base; /*!< fiche_def_ref.frd_class_base */
34  var $attribut; /*!< array which containing list of attr */
35  /* it is used with dynamic variables */
36 
37  function __construct($p_cn,$p_frd_id=-1)
38  {
39  $this->db=$p_cn;
40  $this->frd_id=$p_frd_id;
41  $this->attribut=array('frd_id','frd_text','frd_class_base');
42  }
43  /*!
44  **************************************************
45  * \brief Load all the fiche_def_ref data and
46  * return an array of fiche_def_ref objects
47  *
48  * \return array
49  */
50  function LoadAll()
51  {
52  $sql="select * from fiche_def_ref order by frd_id";
53  $Res=$this->db->exec_sql($sql);
55  if ( $Res == false ) return array();
56  $idx=0;
57  $array=array();
58  foreach ($all as $row)
59  {
60  $o=new Fiche_Def_Ref($this->db);
61 
62  foreach ( $this->attribut as $value)
63  {
64  $o->$value=$row[$value];
65  }
66  $array[$idx]=$o;
67  $idx++;
68  }
69  return $array;
70  }
71  /*!
72  **************************************************
73  * \brief Display data between <TD> tag
74  *
75  * \return string
76  */
77  function Display()
78  {
79  $r="";
80  foreach ( $this->attribut as $value)
81  {
82  $r.="<TD>".$this->$value.'</TD>';
83  }
84  return $r;
85  }
86  /*!
87  **************************************************
88  * \brief Input Data between <td> tag
89  *
90  * \return string
91  */
92  function Input()
93  {
94  $r="";
95  $h=new IHidden();
96  $r.='<li>Id :'.$h->input('frd_id',$this->frd_id).$this->frd_id."</li>";
97  $w=new IText();
98  $r.='<li>'._('Commentaire ').' :'.$w->input('frd_text',$this->frd_text)."</li>";
99  $t=new IText();
100  $r.='<li>'._('Poste de base').':'.$t->input('frd_class_base',$this->frd_class_base)."</li>";
101 
102  return $r;
103  }
104  /*!
105  **************************************************
106  * \brief Store data into the database: update the
107  * record
108  *
109  * -
110  * \return none
111  */
112  function Save()
113  {
114  $sql="update fiche_def_ref set frd_text=$1 ".
115  " , frd_class_base=$2 ".
116  " where frd_id= $3";
117  $Res=$this->db->exec_sql($sql,array($this->frd_text,$this->frd_class_base,$this->frd_id));
118  }
119  /*!
120  **************************************************
121  * \brief Get the data with the p_code and complete
122  * the current object
123  *
124  * \return none
125  */
126  function Get()
127  {
128  $sql="select * from fiche_def_ref ".
129  " where frd_id=".$this->frd_id;
130  $Res=$this->db->exec_sql($sql);
131  if ( Database::num_row($Res) == 0 ) return null;
133  $this->frd_text=$r['frd_text'];
134  $this->frd_class_base=$r['frd_class_base'];
135  }
136  /**
137  * get category of cards by model
138  * @param $p_modele if the FRD_ID
139  * @return array of category (fd_id)
140  */
141  function get_by_modele($p_modele)
142  {
143  $array = array();
144  $result = $this->db->get_array('select fd_id from fiche_def where frd_id=$1', array($p_modele));
145  for ($i = 0; $i < count($result); $i++)
146  {
147  $array[$i] = $result[$i]['fd_id'];
148  }
149  return $array;
150  }
151 
152 }
153 ?>
static fetch_all($ret)
wrapper for the function pg_fetch_all
get_by_modele($p_modele)
get category of cards by model
static num_row($ret)
wrapper for the function pg_NumRows
Input()
Input Data between tag.
$value
foreach($array as $idx=> $m) $w
$idx
Display()
Display data between tag.
static fetch_array($ret, $p_indice=0)
wrapper for the function pg_fetch_array
LoadAll()
Load all the fiche_def_ref data and return an array of fiche_def_ref objects.
$all
__construct($p_cn, $p_frd_id=-1)
$SecUser db
fiche_def_ref, a fiche is owned by fiche_def which is owned by fiche_def_ref
Save()
Store data into the database: update the record.
Get()
Get the data with the p_code and complete the current object.