noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
class_fiche_def_ref.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS 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  *   NOALYSS 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 NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00020 /*! \file
00021  * \brief fiche_def_ref, a fiche is owned by fiche_def which is owned by 
00022  *        fiche_def_ref
00023  */
00024 /*!
00025  * \brief fiche_def_ref, a fiche is owned by fiche_def which is owned by 
00026  *        fiche_def_ref
00027  */
00028 
00029 class Fiche_Def_Ref
00030 {
00031     var $frd_id;           /*!< $frd_id fiche_def_ref.frd_id */
00032     var $frd_text;         /*!< $frd_text fiche_def_ref.frd_tex */
00033     var $frd_class_base;   /*!< fiche_def_ref.frd_class_base */
00034     var $attribut;         /*!< array which containing list of attr */
00035     /* it is used with dynamic variables */
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      * \brief  Load all the fiche_def_ref data and
00046      *           return an array of  fiche_def_ref objects
00047      *        
00048      * \return array
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      * \brief  Display data between <TD> tag
00074      *        
00075      * \return string
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      * \brief  Input Data between <td> tag
00089      *        
00090      * \return string
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      * \brief  Store data into the database: update the 
00107      *           record
00108      *        
00109      *  -
00110      * \return none
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      * \brief  Get the data with the p_code and complete
00122      *           the current object
00123      *        
00124      * \return none
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 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations