cn=$p_cn; $this->id=$p_id; } /*! ************************************************** * \brief Get attribut of a fiche_def * * \return string value of the attribute * none */ function GetAttribut() { $sql="select * from jnt_fic_attr ". " natural join attr_def where fd_id=".$this->id. " order by jnt_order"; $Ret=ExecSql($this->cn,$sql); if ( ($Max=pg_NumRows($Ret)) == 0 ) return ; for ($i=0;$i < $Max;$i++) { $row=pg_fetch_array($Ret,$i); $t = new Attribut($row['ad_id']); $t->ad_text=$row['ad_text']; $t->jnt_order=$row['jnt_order']; $this->attribut[$i]=$t; } return $this->attribut; } /*! ************************************************** * \brief Get attribut of the fiche_def * */ function Get() { if ( $this->id == 0 ) return 0; ExecSqlParam($this->cn,'select fiche_attribut_synchro($1)', array($this->id)); $sql="select * from fiche_def ". " where fd_id=".$this->id; $Ret=ExecSql($this->cn,$sql); if ( ($Max=pg_NumRows($Ret)) == 0 ) return ; $row=pg_fetch_array($Ret,0); $this->label=$row['fd_label']; $this->class_base=$row['fd_class_base']; $this->fiche_def=$row['frd_id']; $this->create_account=$row['fd_create_account']; } /*! ************************************************** * \brief Get all the fiche_def * * \return an array of fiche_def object */ function GetAll() { $sql="select * from fiche_def "; $Ret=ExecSql($this->cn,$sql); if ( ($Max=pg_NumRows($Ret)) == 0 ) return ; for ( $i = 0; $i < $Max;$i++) { $row=pg_fetch_array($Ret,$i); $this->all[$i]=new fiche_def($this->cn,$row['fd_id']); $this->all[$i]->label=$row['fd_label']; $this->all[$i]->class_base=$row['fd_class_base']; $this->all[$i]->fiche_def=$row['frd_id']; $this->all[$i]->create_account=$row['fd_create_account']; } } /*! ************************************************** * \brief Check in vw_fiche_def if a fiche has * a attribut X * * * \param $p_attr attribut to check * \return true or false */ function HasAttribute($p_attr) { return (CountSql($this->cn,"select * from vw_fiche_def where ad_id=$p_attr and fd_id=".$this->id)>0)?true:false; } /*! ************************************************** * \brief Display a fiche_def object into a table * * \return HTML row */ function Display() { $r=sprintf("
| '.$l_line['quick_code'].' | '; echo $span_mod.''.h($l_line['vw_name'])." | "; echo '
| '; // Can change the name if ( $this->attribut[$i]->ad_id == ATTR_DEF_NAME ) { $a=sprintf('Label | ', $this->label); $r.=$a; $r.=' | '; } else { if ( $str == "remove" ) { //Only for the not mandatory attribute (not defined in attr_min) if ( CountSql($this->cn,"select * from attr_min where frd_id=". $this->fiche_def." and ad_id = ".$this->attribut[$i]->ad_id) == 0 && $this->attribut[$i]->ad_id != ATTR_DEF_QUICKCODE && $this->attribut[$i]->ad_id != ATTR_DEF_ACCOUNT ) { $add_action=sprintf( ' | Supprimer ', $this->attribut[$i]->ad_id); } else $add_action=" | "; } // The attribut. $a=sprintf('%s ', $this->attribut[$i]->ad_text); $r.=$a.$add_action; /*---------------------------------------- */ /* ORDER OF THE CARD */ /*---------------------------------------- */ $order=new widget('text'); $order->name='jnt_order'.$this->attribut[$i]->ad_id; $order->size=3; $order->value=$this->attribut[$i]->jnt_order; $r.=' | '.$order->IOValue(); } $r.= ' |
| '; $r.= ''; $r.=" |