415 lines
16 KiB
PHP
415 lines
16 KiB
PHP
<?php
|
|
|
|
|
|
|
|
require_once 'include/utils/utils.php';
|
|
|
|
require_once 'includes/Loader.php';
|
|
|
|
vimport ('includes.runtime.EntryPoint');
|
|
|
|
require_once 'SUtiles.php';
|
|
|
|
@session_start();
|
|
|
|
|
|
|
|
|
|
|
|
global $adb;
|
|
|
|
|
|
|
|
$id_ligne_formulaire = array();
|
|
|
|
$id_formulaire = array();
|
|
|
|
$inc=1;
|
|
|
|
|
|
|
|
|
|
|
|
function getPicklist($nom){
|
|
|
|
global $adb;
|
|
|
|
$query = "SELECT * FROM picklist_formulaire as pf
|
|
|
|
left join picklist_lignes_formulaire as plf on pf.id = plf.id_picklist_formulaire
|
|
|
|
where pf.nom = '".$nom."' order by plf.ordre";
|
|
|
|
$sql_get_result = $adb->query($query);
|
|
|
|
$res= array();
|
|
|
|
|
|
|
|
while ($recordinfo = $adb->fetch_array($sql_get_result)) {
|
|
|
|
$res[] = $recordinfo;
|
|
|
|
}
|
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getAllQuestions($id_formulaire){
|
|
|
|
global $adb;
|
|
|
|
|
|
|
|
$query5 = "SELECT * FROM `lignes_formulaire` , `formulaire` where formulaire.id_formulaire='".$id_formulaire."' and formulaire.id_formulaire = lignes_formulaire.id_formulaire ";
|
|
|
|
$result5 =$adb->query($query5);
|
|
|
|
$Questions=array();
|
|
|
|
while ($recordinfo = $adb->fetch_array($result5)) {
|
|
|
|
$Questions[] = $recordinfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $Questions;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo '<form id="form" method="post" accept-charset="utf-8">';
|
|
|
|
//tous les ids de formulaires
|
|
|
|
$AllIdsFormulaires =$_GET['formulairesIDs'];
|
|
|
|
$AllIdsFormulaires = explode("," , $AllIdsFormulaires);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ($z = 0; $z< sizeof($AllIdsFormulaires); $z++) {
|
|
|
|
|
|
|
|
$Questions = array();
|
|
|
|
$Questions = getAllQuestions($AllIdsFormulaires[$z]);
|
|
|
|
|
|
|
|
|
|
|
|
echo'<div style="height: 5px; background-color: #596875;margin-top: 8px; "></div>
|
|
|
|
<div class=" detailview-header-block" style="padding: 5px;">
|
|
|
|
<div class="row" style="text-align: center; max-width: 100%;">
|
|
|
|
<h4>'.$Questions[0]['nom_formulaire'].'</h4>
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
// print("<pre>".print_r($Questions,true)."</pre>");
|
|
|
|
foreach ($Questions as $Question) {
|
|
|
|
|
|
|
|
array_push($id_ligne_formulaire , $Question['id_ligne_formulaire']) ;
|
|
|
|
array_push($id_formulaire , $Question['id_formulaire']) ;
|
|
|
|
|
|
|
|
$type = explode("::",$Question['type_formulaire']);
|
|
|
|
$type_formulaire = $type[0];
|
|
|
|
$name_picklist = $type[1];
|
|
|
|
|
|
|
|
if($type_formulaire == "CHOIXMULTIPLES"){
|
|
|
|
|
|
|
|
|
|
|
|
echo '<div class=" detailview-header-block" style="margin-top:15px;">
|
|
|
|
<div class="row" style="margin: 5px 0px 0px 0px;">
|
|
|
|
<div class="fieldBlockContainer" data-block="LBL_ADDRESS_INFORMATION">
|
|
|
|
<h4 class="fieldBlockHeader">'.$Question['question'].'</h4>
|
|
|
|
<hr>
|
|
|
|
<table style="border: none; border-collapse:separate; border-spacing:0 7px; width:100%;" >
|
|
|
|
<input name="type" type="hidden" value="CHOIXMULTIPLES">';
|
|
|
|
echo'<input name="obligatoire" type="hidden" value="'.$Question['obligatoire'].'">';
|
|
|
|
for ($x = 1; $x <= 10; $x++) {
|
|
|
|
$choix = 'choix'.$x;
|
|
|
|
if( $Question[$choix] != null){
|
|
|
|
echo'<tr >
|
|
|
|
<td style="padding-right: 10px;">
|
|
|
|
<label class="muted pull-right">
|
|
|
|
<input type="checkbox" name="'.$choix.$Question['id_ligne_formulaire'].'" id="'.($inc=$inc+1).'" value="'.$Question[$choix].'" >
|
|
|
|
</label>
|
|
|
|
</td>
|
|
|
|
<td style=" width:90%;">
|
|
|
|
<label for="'.$inc.'">
|
|
|
|
'.$Question[$choix].'
|
|
|
|
</label>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '<table>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<label for="exampleFormControlTextarea1'.$Question['id_ligne_formulaire'].'">Commentaire </label>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<textarea style="width:360px;" id="exampleFormControlTextarea1'.$Question['id_ligne_formulaire'].'" name="autres'.$Question['id_ligne_formulaire'].'" rows="3"></textarea>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
if($Question['obligatoire'] == 1){
|
|
|
|
echo'<tr>
|
|
|
|
<td>
|
|
|
|
<i class="fa fa-info-circle fa-2" aria-hidden="true" style="color:red;"></i><span style="padding-left:4px; color: #d93025;">Cette question est obligatoire.
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo'</table>';
|
|
|
|
|
|
|
|
echo ' </table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
$inc=$inc+1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($type_formulaire == "CHOIXUNIQUE"){
|
|
|
|
|
|
|
|
|
|
|
|
echo '<div class=" detailview-header-block" style="margin-top:15px;">
|
|
|
|
<div class="row" style="margin: 5px 0px 0px 0px;">
|
|
|
|
<div class="fieldBlockContainer" data-block="LBL_ADDRESS_INFORMATION">
|
|
|
|
<h4 class="fieldBlockHeader">'.$Question['question'].'</h4>
|
|
|
|
<hr>
|
|
|
|
<table style="border: none; border-collapse:separate; border-spacing:0 7px; width:100%;" >
|
|
|
|
<input name="type" type="hidden" value="CHOIXUNIQUE">';
|
|
|
|
echo'<input name="obligatoire" type="hidden" value="'.$Question['obligatoire'].'">';
|
|
|
|
|
|
|
|
for ($uu = 1; $uu <= 10; $uu++) {
|
|
|
|
$choix = 'choix'.$uu;
|
|
|
|
if( $Question[$choix] != null){
|
|
|
|
echo'<tr >
|
|
|
|
<td style="padding-right: 10px;">
|
|
|
|
<label class="muted pull-right">
|
|
|
|
<input class="form-check-input" type="checkbox" name="'.$choix.$Question['id_ligne_formulaire'].'" id="'.($inc=$inc+1).'" value="'.$Question[$choix].'" data-question-id="'.$Question['id_ligne_formulaire'].'">
|
|
|
|
</label>
|
|
|
|
</td>
|
|
|
|
<td style=" width:90%;">
|
|
|
|
<label for="'.$inc.'">
|
|
|
|
'.$Question[$choix].'
|
|
|
|
</label>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '<table>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<label for="exampleFormControlTextarea1'.$Question['id_ligne_formulaire'].'">Commentaire </label>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<textarea style="width:360px;" id="exampleFormControlTextarea1'.$Question['id_ligne_formulaire'].'" name="autres'.$Question['id_ligne_formulaire'].'" rows="3"></textarea>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
if($Question['obligatoire'] == 1){
|
|
|
|
echo'<tr>
|
|
|
|
<td>
|
|
|
|
<i class="fa fa-info-circle fa-2" aria-hidden="true" style="color:red;"></i><span style="padding-left:4px; color: #d93025;">Cette question est obligatoire.
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo'</table>';
|
|
|
|
|
|
|
|
echo ' </table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
$inc=$inc+1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($type_formulaire == "POURCENTAGE"){
|
|
|
|
|
|
|
|
|
|
|
|
echo '<div class=" detailview-header-block" style="margin-top:15px;">
|
|
|
|
<div class="row" style="margin: 5px 0px 0px 0px;">
|
|
|
|
<div class="fieldBlockContainer" data-block="LBL_ADDRESS_INFORMATION">
|
|
|
|
<h4 class="fieldBlockHeader">'.$Question['question'].'</h4>
|
|
|
|
<hr>
|
|
|
|
<table style=" border-collapse:separate; border-spacing:0 7px;" >
|
|
|
|
<input name="type" type="hidden" value="POURCENTAGE">';
|
|
|
|
echo'<input name="obligatoire" type="hidden" value="'.$Question['obligatoire'].'">';
|
|
|
|
|
|
|
|
for ($k = 1; $k<= 10; $k++) {
|
|
|
|
$choix = 'choix'.$k;
|
|
|
|
if( $Question[$choix] != null){
|
|
|
|
echo'<tr >
|
|
|
|
<td style="width: 70%; " class="fieldLabel alignMiddle">
|
|
|
|
<label>'.$Question[$choix].' </label>
|
|
|
|
</td>
|
|
|
|
<td >
|
|
|
|
<div class="input-group">
|
|
|
|
<input class="inputElement " type="number" min="0" max="100" name="'.$choix.$Question['id_ligne_formulaire'].'" value="" >
|
|
|
|
<span class="input-group-addon relatedPopup"><i>%</i></span>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '<table>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<label for="exampleFormControlTextarea1'.$Question['id_ligne_formulaire'].'">Commentaire </label>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<textarea style="width:360px;" id="exampleFormControlTextarea1'.$Question['id_ligne_formulaire'].'" name="autres'.$Question['id_ligne_formulaire'].'" rows="3"></textarea>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
if($Question['obligatoire'] == 1){
|
|
|
|
echo'<tr>
|
|
|
|
<td>
|
|
|
|
<i class="fa fa-info-circle fa-2" aria-hidden="true" style="color:red;"></i><span style="padding-left:4px; color: #d93025;">Cette question est obligatoire.
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo'</table>';
|
|
|
|
|
|
|
|
echo '</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if($type_formulaire == "NOMBRE"){
|
|
|
|
|
|
|
|
|
|
|
|
echo '<div class=" detailview-header-block" style="margin-top:15px;">
|
|
|
|
<div class="row" style="margin: 5px 0px 0px 0px;">
|
|
|
|
<div class="fieldBlockContainer" data-block="LBL_ADDRESS_INFORMATION">
|
|
|
|
<h4 class="fieldBlockHeader">'.$Question['question'].'</h4>
|
|
|
|
<hr>
|
|
|
|
<table style=" border-collapse:separate; border-spacing:0 7px;" >
|
|
|
|
<input name="type" type="hidden" value="NOMBRE">';
|
|
|
|
echo'<input name="obligatoire" type="hidden" value="'.$Question['obligatoire'].'">';
|
|
|
|
|
|
|
|
for ($k = 1; $k<= 10; $k++) {
|
|
|
|
$choix = 'choix'.$k;
|
|
|
|
if( $Question[$choix] != null){
|
|
|
|
echo'<tr >
|
|
|
|
<td style="width: 70%; " class="fieldLabel alignMiddle">
|
|
|
|
<label>'.$Question[$choix].' </label>
|
|
|
|
</td>
|
|
|
|
<td >
|
|
|
|
<div class="input-group">
|
|
|
|
<input class="inputElement " type="number" min="0" max="100" name="'.$choix.$Question['id_ligne_formulaire'].'" value="" >
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($Question['obligatoire'] == 1){
|
|
|
|
echo'<tr>
|
|
|
|
<td>
|
|
|
|
<i class="fa fa-info-circle fa-2" aria-hidden="true" style="color:red;"></i><span style="padding-left:4px; color: #d93025;">Cette question est obligatoire.
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
echo ' </table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if($type_formulaire == "PICKLISTGROSSISTE"){
|
|
|
|
|
|
|
|
|
|
|
|
echo '<div class=" detailview-header-block" style="margin-top:15px;">
|
|
|
|
<div class="row" style="margin: 5px 0px 0px 0px;">
|
|
|
|
<div class="fieldBlockContainer" data-block="LBL_ADDRESS_INFORMATION">
|
|
|
|
<h4 class="fieldBlockHeader">'.$Question['question'].'</h4>
|
|
|
|
<hr>
|
|
|
|
<table style=" border-collapse:separate; border-spacing:0 7px;" >
|
|
|
|
<input name="type" type="hidden" value="PICKLISTGROSSISTE">';
|
|
|
|
echo'<input name="obligatoire" type="hidden" value="'.$Question['obligatoire'].'">';
|
|
|
|
|
|
|
|
for ($k = 1; $k<= 10; $k++) {
|
|
|
|
$choix = 'choix'.$k;
|
|
|
|
if( $Question[$choix] != null){
|
|
|
|
echo'<tr >
|
|
|
|
<td style="width: 70%; " class="fieldLabel alignMiddle">
|
|
|
|
<label>'.$Question[$choix].' </label>
|
|
|
|
</td>
|
|
|
|
<td >
|
|
|
|
<div class="input-group">
|
|
|
|
<select class="js-example-basic-single form-control" style="width:200px;" name="'.$choix.$Question['id_ligne_formulaire'].'" required>
|
|
|
|
<option value=""></option>';
|
|
|
|
$Grossistes = getPicklist($name_picklist);
|
|
|
|
foreach ($Grossistes as $Grossiste) {
|
|
|
|
|
|
|
|
echo '<option value="'.$Grossiste['valeur'].'">'.$Grossiste['valeur'].'</option>';
|
|
|
|
|
|
|
|
}
|
|
|
|
echo '
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($Question['obligatoire'] == 1){
|
|
|
|
echo'<tr>
|
|
|
|
<td>
|
|
|
|
<i class="fa fa-info-circle fa-2" aria-hidden="true" style="color:red;"></i><span style="padding-left:4px; color: #d93025;">Cette question est obligatoire.
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
echo ' </table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if($type_formulaire == "PARAGRAPHE"){
|
|
|
|
|
|
|
|
|
|
|
|
echo '<div class=" detailview-header-block" style="margin-top:15px;">
|
|
|
|
<div class="row" style="margin: 5px 0px 0px 0px;">
|
|
|
|
<div class="fieldBlockContainer" data-block="LBL_ADDRESS_INFORMATION">
|
|
|
|
<h4 class="fieldBlockHeader">'.$Question['question'].'</h4>
|
|
|
|
<hr>
|
|
|
|
<table style=" border-collapse:separate; border-spacing:0 7px;" >
|
|
|
|
<input name="type" type="hidden" value="PARAGRAPHE">';
|
|
|
|
echo'<input name="obligatoire" type="hidden" value="'.$Question['obligatoire'].'">';
|
|
|
|
|
|
|
|
for ($k = 1; $k<= 10; $k++) {
|
|
|
|
$choix = 'choix'.$k;
|
|
|
|
if( $Question[$choix] != null){
|
|
|
|
echo'<tr >
|
|
|
|
<td style="width: 70%; " class="fieldLabel alignMiddle" colspan="2">
|
|
|
|
<label>'.$Question[$choix].' </label><br>
|
|
|
|
<div class="input-group">
|
|
|
|
<textarea style="width:360px;" name="'.$choix.$Question['id_ligne_formulaire'].'" rows="3"></textarea>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($Question['obligatoire'] == 1){
|
|
|
|
echo'<tr>
|
|
|
|
<td>
|
|
|
|
<i class="fa fa-info-circle fa-2" aria-hidden="true" style="color:red;"></i><span style="padding-left:4px; color: #d93025;">Cette question est obligatoire.
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
echo ' </table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</form>";
|
|
|
|
|
|
|
|
// Nous avons besoin d'eux dans QuestionnaireSaveData.php
|
|
|
|
$_SESSION['id_ligne_formulaire'] = $id_ligne_formulaire;
|
|
|
|
$_SESSION['id_formulaire'] = $id_formulaire;
|
|
|
|
$_SESSION["accountID"] = $_GET['accountID'];
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<!-- script pour liste déroulante -->
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('.js-example-basic-single').select2();
|
|
|
|
});
|
|
|
|
|
|
|
|
//make checkboxes act like radio buttons
|
|
|
|
$("input:checkbox").click(function(){
|
|
|
|
if($(this).attr('data-question-id')) {
|
|
|
|
var group = "input:checkbox[data-question-id='"+$(this).attr("data-question-id")+"']";
|
|
|
|
$(group).attr("checked",false);
|
|
|
|
$(this).attr("checked",true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|