Rewriting Module Template Category of card

This commit is contained in:
Dany De Bontridder 2018-01-09 13:30:25 +01:00
parent 74574e07c7
commit db048d3c54
7 changed files with 238 additions and 160 deletions

View file

@ -40,99 +40,7 @@ class Fiche_Def_Ref
$this->frd_id=$p_frd_id;
$this->attribut=array('frd_id','frd_text','frd_class_base');
}
/*!
**************************************************
* \brief Load all the fiche_def_ref data and
* return an array of fiche_def_ref objects
*
* \return array
*/
function LoadAll()
{
$sql="select * from fiche_def_ref order by frd_id";
$Res=$this->db->exec_sql($sql);
$all=Database::fetch_all($Res);
if ( $Res == false ) return array();
$idx=0;
$array=array();
foreach ($all as $row)
{
$o=new Fiche_Def_Ref($this->db);
foreach ( $this->attribut as $value)
{
$o->$value=$row[$value];
}
$array[$idx]=$o;
$idx++;
}
return $array;
}
/*!
**************************************************
* \brief Display data between <TD> tag
*
* \return string
*/
function Display()
{
$r="";
foreach ( $this->attribut as $value)
{
$r.="<TD>".$this->$value.'</TD>';
}
return $r;
}
/*!
**************************************************
* \brief Input Data between <td> tag
*
* \return string
*/
function Input()
{
$r="";
$h=new IHidden();
$r.='<li>Id :'.$h->input('frd_id',$this->frd_id).$this->frd_id."</li>";
$w=new IText();
$r.='<li>'._('Commentaire ').' :'.$w->input('frd_text',$this->frd_text)."</li>";
$t=new IText();
$r.='<li>'._('Poste de base').':'.$t->input('frd_class_base',$this->frd_class_base)."</li>";
return $r;
}
/*!
**************************************************
* \brief Store data into the database: update the
* record
*
* -
* \return none
*/
function Save()
{
$sql="update fiche_def_ref set frd_text=$1 ".
" , frd_class_base=$2 ".
" where frd_id= $3";
$Res=$this->db->exec_sql($sql,array($this->frd_text,$this->frd_class_base,$this->frd_id));
}
/*!
**************************************************
* \brief Get the data with the p_code and complete
* the current object
*
* \return none
*/
function Get()
{
$sql="select * from fiche_def_ref ".
" where frd_id=".$this->frd_id;
$Res=$this->db->exec_sql($sql);
if ( Database::num_row($Res) == 0 ) return null;
$r=Database::fetch_array($Res,0);
$this->frd_text=$r['frd_text'];
$this->frd_class_base=$r['frd_class_base'];
}
/**
* get category of cards by model
* @param $p_modele if the FRD_ID