Go to the source code of this file.
Functions | |
EncodeForm ($p_line, $p_sessid, $p_array=null) | |
Encoding report. | |
ViewForm ($p_cn, $p_sessid, $p_id) | |
Show the details of a report. | |
DeleteForm ($p_cn, $p_id) | |
Remove a report. | |
GetDataForm ($p_cn, $p_id) | |
Get data from a form. | |
GetNumberLine ($p_cn, $p_id) | |
Get the number of line of a form. | |
GetFormName ($p_cn, $p_id) | |
Get the name of the report. | |
UpdateForm ($p_cn, $p_array) | |
Update a report. | |
AddForm ($p_cn, $p_array) | |
Add a report. |
|
Add a report.
Definition at line 267 of file form_inc.php. References $n, $Res, $sql, CheckFormula(), echo_debug(), echo_error(), ExecSql(), FormatString(), and GetSequence(). 00267 { 00268 foreach ($p_array as $key=>$element) { 00269 echo_debug ("AddForm $key = $element"); 00270 ${"$key"}=$element; 00271 } 00272 00273 if ( !isset ($form_nom) || 00274 ! isset ($line) ) { 00275 echo_error("Nom ou ligne non défini"); 00276 return; 00277 } 00278 $form_nom=(FormatString($form_nom)==null)?"NoName":FormatString($form_nom); 00279 $sql="insert into formdef (fr_label) values ('".$form_nom."')"; 00280 $Res=ExecSql($p_cn,$sql); 00281 $n=GetSequence($p_cn,"s_formdef"); 00282 00283 for ($i=0;$i < $line;$i++) { 00284 ${"text$i"}=FormatString(${"text$i"}); 00285 ${"form$i"}=FormatString(${"form$i"}); 00286 if ( ${"text$i"} != null ) { 00287 // ${"form$i"}=(${"form$i"}==null)?${"form$i"}:"'".${"form$i"}."'"; 00288 ${"form$i"}=(${"form$i"}==null)?"null":"'".${"form$i"}."'"; 00289 CheckFormula(${"form$i"}); 00290 $sql=sprintf("insert into form (fo_fr_id, 00291 fo_pos, 00292 fo_label, 00293 fo_formula) values 00294 ( %d, 00295 %d, 00296 '%s', 00297 %s)", 00298 $n,$i+1,${"text$i"},${"form$i"} 00299 ); 00300 $Res=ExecSql($p_cn,$sql); 00301 }//if 00302 }//for $i 00303 }
|
|
Remove a report. parm :
Definition at line 134 of file form_inc.php. References ExecSql(). 00134 { 00135 ExecSql($p_cn,"delete from form where fo_fr_id=$p_id"); 00136 ExecSql($p_cn,"delete from formdef where fr_id=$p_id"); 00137 }
|
|
Encoding report. parm :
Definition at line 34 of file form_inc.php. References $search, echo_debug(), name, size, and value. Referenced by ViewForm(). 00034 { 00035 // echo '<SCRIPT LANGUAGE="javascript" SRC="win_search_poste.js"></SCRIPT>'; 00036 include_once("constant.php"); 00037 echo JS_SEARCH_POSTE; 00038 $search='<INPUT TYPE="BUTTON" VALUE="Cherche" OnClick="SearchPoste(\''.$p_sessid."','not')\">"; 00039 for ( $i =0 ; $i <= $p_line; $i++) { 00040 ${"text$i"}=""; 00041 ${"form$i"}=""; 00042 ${"pos$i"}=""; 00043 } 00044 if ( $p_array != null ) { 00045 foreach ( $p_array as $key=> $element ) { 00046 ${"$key"}=$element; 00047 echo_debug ("EncodeForm $key = $element"); 00048 00049 } 00050 00051 } else { 00052 $form_nom=""; 00053 $text0=""; 00054 $form0=""; 00055 } 00056 echo "<FORM ACTION=\"form.php\" METHOD=\"POST\">"; 00057 printf ("Nom du rapport : <INPUT TYPE=\"TEXT\" NAME=\"form_nom\" VALUE=\"%s\">", 00058 $form_nom); 00059 printf ('<INPUT TYPE="HIDDEN" NAME="line" value="%s"', 00060 $p_line); 00061 if ( isset ($fr_id)) printf ('<INPUT TYPE="HIDDEN" NAME="fr_id" value="%s"', 00062 $fr_id); 00063 00064 echo '<TABLE>'; 00065 echo "<TR>"; 00066 if ( isset($fr_id) ) echo "<TH> Position </TH>"; 00067 echo "<TH> Texte </TH>"; 00068 echo "<TH> Formule</TH>"; 00069 00070 echo '</TR>'; 00071 for ( $i =0 ; $i < $p_line;$i++) { 00072 echo "<TR>"; 00073 // si fr_id != null alors les donnees viennent de 00074 // GetDataForm: ce n'est pas un nouvel enregistrement 00075 // 00076 if ( isset($fr_id)) { 00077 echo "<TD>"; 00078 printf ('<input TYPE="TEXT" NAME="pos%d" size="3" VALUE="%s">', 00079 $i,${"pos$i"}); 00080 echo '</TD>'; 00081 } 00082 00083 echo "<TD>"; 00084 printf ('<input TYPE="TEXT" NAME="text%d" size="25" VALUE="%s">', 00085 $i,${"text$i"}); 00086 echo '</TD>'; 00087 00088 echo "<TD>"; 00089 printf ('<input TYPE="TEXT" NAME="form%d" SIZE="25" VALUE="%s">', 00090 $i,${"form$i"}); 00091 echo $search; 00092 echo '</TD>'; 00093 00094 echo "</TR>"; 00095 } 00096 echo "</TABLE>"; 00097 if ( isset($fr_id)){ 00098 echo '<INPUT TYPE="submit" value="Enregistre" name="update">'; 00099 }else { 00100 echo '<INPUT TYPE="submit" value="Enregistre" name="record">'; 00101 } 00102 echo '<INPUT TYPE="submit" value="Ajoute une ligne" name="add_line">'; 00103 echo '<INPUT TYPE="submit" value="Efface ce rapport" name="del_form">'; 00104 00105 echo "</FORM>"; 00106 00107 }
|
|
Get data from a form.
Definition at line 149 of file form_inc.php. References $array, $l_line, $Max, $p_id, $Res, and ExecSql(). Referenced by ViewForm(). 00149 { 00150 $Res=ExecSql($p_cn,"select fo_id,fo_fr_id,fo_pos,fo_label,fo_formula from form where fo_fr_id=$p_id 00151 order by fo_pos"); 00152 $Max=pg_NumRows($Res); 00153 for ( $i=0;$i<$Max;$i++){ 00154 $l_line=pg_fetch_array($Res,$i); 00155 00156 // get the fo_id 00157 $text=sprintf("fo_id%d",$i); 00158 $array[$text]=$l_line['fo_id']; 00159 // get the fo_label 00160 $text=sprintf("text%d",$i); 00161 $array[$text]=$l_line['fo_label']; 00162 // get the fo_formula 00163 $text=sprintf("form%d",$i); 00164 $array[$text]=$l_line['fo_formula']; 00165 // get the pos 00166 $text=sprintf("pos%d",$i); 00167 $array[$text]=$l_line['fo_pos']; 00168 } //for 00169 $array["fr_id"]=$p_id; 00170 return $array; 00171 }
|
|
Get the name of the report.
Definition at line 195 of file form_inc.php. References $Res, and ExecSql(). Referenced by ViewForm(). 00195 { 00196 $Res=ExecSql($p_cn,"select fr_label from formdef where fr_id=".$p_id); 00197 if ( pg_NumRows($Res) == 0 ) return null; 00198 $name=pg_fetch_array($Res,0); 00199 return $name['fr_label']; 00200 }
|
|
Get the number of line of a form.
Definition at line 180 of file form_inc.php. References $count, $Res, and ExecSql(). Referenced by ViewForm(). 00180 { 00181 $Res=ExecSql($p_cn,"select * from form where fo_fr_id=".$p_id); 00182 $count=pg_NumRows($Res); 00183 return $count; 00184 }
|
|
Update a report.
Definition at line 208 of file form_inc.php. References $i, $o, $Res, $sql, CheckFormula(), echo_debug(), ExecSql(), and FormatString(). 00208 { 00209 foreach ($p_array as $key=>$element) { 00210 echo_debug ("UpdateForm $key = $element"); 00211 ${"$key"}=$element; 00212 } 00213 $Res=ExecSql($p_cn,"update formdef set fr_label='".FormatString($form_nom)."' where fr_id=".$fr_id); 00214 $Res=ExecSql($p_cn,"delete from form where fo_fr_id=".$fr_id); 00215 // Test les positions 00216 for ($i =0; $i <$line;$i++) { 00217 echo_debug ("position =".${"pos$i"}); 00218 if ( (string) ${"pos$i"} != (string) (int) ${"pos$i"}) { 00219 ${"pos$i"}=$i+1; 00220 } 00221 if ( ${"pos$i"} > $line || ${"pos$i"} < 0) { 00222 ${"pos$i"}=$i+1; 00223 echo_debug('form_inc.php',__LINE__,"position trop grand max = $line+1 "); 00224 } 00225 } 00226 for ($i =0; $i <$line;$i++) { 00227 for ( $o=$i+1; $o < $line;$o++) { 00228 if ( ${"pos$i"} == ${"pos$o"} ) { 00229 ${"pos$o"}=$o+1; 00230 } 00231 } 00232 } 00233 for ( $i=0;$i<$line;$i++) { 00234 if ( strlen(trim(${"text$i"})) != 0) { 00235 ${"text$i"}=FormatString(${"text$i"}); 00236 ${"form$i"}=FormatString(${"form$i"}); 00237 if ( ${"text$i"} != null ) { 00238 if ( CheckFormula(${"form$i"}) == false ) 00239 ${"form$i"}="!!!!!!! FORMULE INVALIDE ".${"form$i"}; 00240 00241 ${"form$i"}=(${"form$i"}==null)?"null":"'".${"form$i"}."'"; 00242 $sql=sprintf("insert into form (fo_fr_id, 00243 fo_pos, 00244 fo_label, 00245 fo_formula) values 00246 ( %d, 00247 %d, 00248 '%s', 00249 %s)", 00250 $fr_id,${"pos$i"}, 00251 ${"text$i"}, 00252 ${"form$i"} 00253 ); 00254 $Res=ExecSql($p_cn,$sql); 00255 } 00256 }//if 00257 }//for 00258 00259 }
|
|
Show the details of a report. parm :
Definition at line 117 of file form_inc.php. References $array, $l_line, EncodeForm(), GetDataForm(), GetFormName(), and GetNumberLine(). 00117 { 00118 $array=GetDataForm($p_cn,$p_id); 00119 $l_nom=GetFormName($p_cn,$p_id); 00120 $array['form_nom']=$l_nom; 00121 00122 $l_line=GetNumberLine($p_cn,$p_id); 00123 EncodeForm($l_line,$p_sessid,$array); 00124 00125 }
|