Files
CRM/QCMAjouterExamen.php
BACHIR SOULDI 2794e62571 first commit
2025-09-28 08:49:37 +01:00

503 lines
29 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;
$current_user = Users_Record_Model::getCurrentUserModel();
$roleid = $current_user->get('roleid');
$viewer = new Vtiger_Viewer();
$viewer->assign('MODULE', 'Home');
$viewer->assign('SELECTED_MENU_CATEGORY', 'MARKETING');
$viewer->assign('COMPANY_LOGO', Vtiger_CompanyDetails_Model::getInstanceById()->getLogo());
$viewer->assign('COMPANY_DETAILS_SETTINGS',new Settings_Vtiger_CompanyDetails_Model());
$viewer->assign('USER_MODEL', $current_user);
$viewer->assign('CURRENT_USER_MODEL', $current_user);
$viewer->assign('PAGETITLE','Creation');
$viewer->view('CustomDashboard.tpl');
if(isset($_POST['save'])) {
$reseau = implode("::", $_POST['reseau'] );
$query = "INSERT INTO `ent_qcm` (`libelle_qcm` , `date_debut`, `date_fin`, `heure_debut`, `heure_fin`,`type`,`duree` ,`reseau` ,`forme` ,`memo`)
VALUES ('".$_POST['libelle']."','".$_POST['dateD']."' ,'".$_POST['dateF']."','".$_POST['heureD']."','".$_POST['heureF']."' ,'".$_POST['type']."' ,'".$_POST['duree']."' ,'".$reseau."' ,'".addslashes($_POST['forme'])."' ,'".addslashes($_POST['memo'])."' );";
$adb->query($query);
$query3= "SELECT max(code_qcm) as id FROM `ent_qcm`";
$sql_get_result3 = $adb->query($query3);
while ($recordinfo = $adb->fetch_array($sql_get_result3)) {
$id[] = $recordinfo;
}
$a=1;
for ($x = 0; $x < sizeof($_POST['question']); $x++) {
$tableau="checkboxcChoix".$a;
$comma_separated = implode("::", $_POST[$tableau]);
$checkboxcChoix=$comma_separated;
$query2 = "INSERT INTO `lignes_qcm` (`ordre` , `code_ent_qcm`, `question`, `choix1`, `choix2`,`choix3`, `choix4`, `choix5`,`correction`,`note`)
VALUES ('".$_POST["ordre"][$x]."','".$id[0]['id']."','".htmlentities($_POST['question'][$x], ENT_QUOTES, "UTF-8")."','".htmlentities($_POST['choix1'][$x], ENT_QUOTES, "UTF-8")."','".htmlentities($_POST['choix2'][$x], ENT_QUOTES, "UTF-8")."' ,'".htmlentities($_POST['choix3'][$x], ENT_QUOTES, "UTF-8")."','".htmlentities($_POST['choix4'][$x], ENT_QUOTES, "UTF-8")."' ,'".htmlentities($_POST['choix5'][$x],ENT_QUOTES, "UTF-8")."','". $checkboxcChoix."','".$_POST['note'][$x]."');";
$adb->query($query2);
$a=$a+1;
}
}
echo'<div class="main-container main-container-Accounts">
<form action="?module=QCMAjouterExamen&view=QCMAjouterExamen" method="post" enctype="multipart/form-data">
<div class="container-fluid" style="margin:15px 15px 15px 15px;">
<div class=" detailview-header-block">
<div class="fieldBlockContainer" data-block="LBL_ADDRESS_INFORMATION">
<h4 class="fieldBlockHeader">Details Examen</h4>
<hr>
<table class="table table-borderless addressBlock">
<tbody>
<tr>
<td class="fieldLabel alignMiddle">Libellé&nbsp;&nbsp;</td>
<td class="fieldValue"><input type="text" class="inputElement " name="libelle" value="" required></td>
<td class="fieldLabel alignMiddle">Type&nbsp;&nbsp;</td>
<td class="fieldValue"><input type="text" class="inputElement " name="type" value=""></td>
</tr>
<tr>
<td class="fieldLabel alignMiddle">Date Début&nbsp;</td>
<td class="fieldValue"><input type="date" class="inputElement " name="dateD" value="" required></td>
<td class="fieldLabel alignMiddle">Date fin&nbsp;&nbsp;</td>
<td class="fieldValue"><input type="date" class="inputElement " name="dateF" value="" required></td>
</tr>
<tr>
<td class="fieldLabel alignMiddle">Heure début&nbsp;&nbsp;</td>
<td class="fieldValue"><input type="time" class="inputElement " id="heureD" name="heureD" value="" onchange="CalculerDuree()" required></td>
<td class="fieldLabel alignMiddle">Heure fin&nbsp;&nbsp;</td>
<td class="fieldValue"><input type="time" class="inputElement " id="heureF" name="heureF" value="" onchange="CalculerDuree()" required></td>
</tr>
<tr>
<td class="fieldLabel alignMiddle">Durée&nbsp;&nbsp;</td>
<td class="fieldValue"><input type="time" class="inputElement " id="duree" name="duree" readonly></td>
<td class="fieldLabel alignMiddle">Réseau&nbsp;&nbsp;</td>
<td class="fieldValue">
<label class="checkbox-inline" >
<input name="reseau[]" style="margin-right: 5px;" type="checkbox" value="A">A
</label>
<label class="checkbox-inline" >
<input name="reseau[]" style="margin-right: 5px;" type="checkbox" value="B">B
</label>
<label class="checkbox-inline">
<input name="reseau[]" style="margin-right: 5px;" type="checkbox" value="C">C
</label>
</td>
</tr>
<tr>
<td class="fieldLabel alignMiddle">Forme&nbsp;&nbsp;</td>
<td class="fieldValue">
<select class="js-example-basic-single form-control" style="width:200px;" name="forme" id="forme" required >
<option value="NORMALE">NORMALE</option>
<option value="ENONCE">ENONCE</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class=" detailview-header-block" style="margin-top:15px; margin-bottom:15px; display : none;" id="memo">
<h4 class="fieldBlockHeader">MÉMO</h4>
<hr>
<div class="row" style="margin: 5px 0px 0px 0px;">
<div class="row">
<div class="col-md-12">
<textarea class="form-control" name="memo" rows="10" autocomplete="off" ></textarea>
</div>
</div>
</div>
</div>
<div class=" detailview-header-block" style="margin-top:15px; margin-bottom:50px;">
<h4 class="fieldBlockHeader">Lignes Question</h4>
<hr>
<div class="row" style="margin: 5px 0px 0px 0px;">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
<div class="fa fa-plus" aria-hidden="true"></div>
&nbsp;&nbsp;Ajouter
</button>
</div>
<div class="row" style="margin: 5px 0px 0px 0px;">
<table id="dynamique" class="table table-bordered table-editable">
<thead>
<tr>
<th style="width: 20px;">Ordre</th>
<th>Question</th>
<th>Choix 1</th>
<th>Choix 2</th>
<th>Choix 3</th>
<th>Choix 4</th>
<th>Choix 5</th>
<th>Correction</th>
<th>Note</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="modal-overlay-footer" style="border-left: 42px solid #efefef;">
<div class="row clearfix">
<div class="textAlignCenter col-lg-12 col-md-12 col-sm-12 ">
<button class="btn btn-success saveButton" type="submit" name="save" value="save">Save</button>
<a class="cancelLink" href="javascript:history.back()" type="reset">Annuler</a>
</div>
</div>
</div></form>';
echo '<!-- Modal --><form id="formulaire" class="needs-validation" novalidate>
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Details Question</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row" style="margin: 5px 0px 0px 0px;">
<div class="row">
<div class="col-md-12">
<label for="Date">Question</label>
<textarea class="form-control" id="question" name="question" rows="2" autocomplete="off" required></textarea>
</div>
</div>
<div class="row" style="margin-top: 5px;">
<div class="col-md-12">
<label for="Date">Choix 1</label>
<input class="form-control" type="text" id="choix1" name="choix1" autocomplete="off">
</div>
</div>
<div class="row" style="margin-top: 5px;">
<div class="col-md-12">
<label for="Date">Choix 2</label>
<input class="form-control" type="text" id="choix2" name="choix2" autocomplete="off">
</div>
</div>
<div class="row" style="margin-top: 5px;">
<div class="col-md-12">
<label for="Date">Choix 3</label>
<input class="form-control" type="text" id="choix3" name="choix3" autocomplete="off">
</div>
</div>
<div class="row" style="margin-top: 5px;">
<div class="col-md-12">
<label for="Date">Choix 4</label>
<input class="form-control" type="text" id="choix4" name="choix4" autocomplete="off">
</div>
</div>
<div class="row" style="margin-top: 5px;">
<div class="col-md-12">
<label for="Date">Choix 5</label>
<input class="form-control" type="text" id="choix5" name="choix5" autocomplete="off">
</div>
</div>
<div class="row" style="margin-top: 5px;">
<div class="col-md-12">
<label for="Date">Correction :&nbsp;&nbsp;</label>
<label class="checkbox-inline" >
<input name="checkboxcChoix1" style="margin-right: 5px;" id="checkboxcChoix1" type="checkbox" value="choix1">choix1
</label>
<label class="checkbox-inline" >
<input name="checkboxcChoix[]" style="margin-right: 5px;" id="checkboxcChoix2" type="checkbox" value="choix2">choix2
</label>
<label class="checkbox-inline">
<input name="checkboxcChoix[]" style="margin-right: 5px;" id="checkboxcChoix3" type="checkbox" value="choix3">choix3
</label>
<label class="checkbox-inline">
<input name="checkboxcChoix[]" style="margin-right: 5px;" id="checkboxcChoix4" type="checkbox" value="choix4">choix4
</label>
<label class="checkbox-inline">
<input name="checkboxcChoix[]" style="margin-right: 5px;" id="checkboxcChoix5" type="checkbox" value="choix5">choix5
</label>
</div>
</div>
<div class="row" style="margin-top: 5px;">
<div class="col-md-4">
<label for="Date">Ordre</label>
<input class="form-control" type="numbre" id="ordre" name="ordre" autocomplete="off">
</div>
<div class="col-md-4">
<label for="note">Note</label>
<input class="form-control" type="numbre" id="note" name="note" autocomplete="off">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<input class="add-row btn btn-primary" data-dismiss="modal" type="submit" value="Ajouter">
</div>
</div>
</div>
</div><form>';
$viewer->view('CustomDashboardFooter.tpl');
?>
<!-- script pour calculer le champ duree -->
<script>
function CalculerDuree() {
var heureD = $("input[name='heureD']").val();
var heureF = $("input[name='heureF']").val();
//create date format
var timeStart = new Date("01/01/2007 " + heureD);
var timeEnd = new Date("01/01/2007 " + heureF);
var hourDiff = timeEnd - timeStart;
var timestamp = hourDiff /1000; //seconds
var hours = Math.floor(timestamp / 60 / 60);
var minutes = Math.floor(timestamp / 60) - (hours * 60);
var seconds = timestamp % 60;
if(heureD != "" && heureF != "")
document.getElementById("duree").value =hours.toString().padStart(2, '0') +":"+minutes.toString().padStart(2, '0')+":"+seconds.toString().padStart(2, '0') ;
}
$('#forme').change(function() {
var res=$(this).val();
if(res == "ENONCE"){
document.getElementById("memo").style.display = "block";
}else if(res == "NORMALE"){
document.getElementById("memo").style.display = "none";
}
});
</script>
<!-- script pour liste déroulante -->
<script>
$(document).ready(function() {
$('.js-example-basic-single').select2();
});
$(document).ready(function() {
$('.js-example-basic-multiple').select2();
});
</script>
<script type="text/javascript" src="layouts/v7/lib/jquery/purl.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/select2/select2.min.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/jquery.class.min.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/jquery-ui-1.11.3.custom/jquery-ui.js"></script>
<script type="text/javascript" src="layouts/v7/lib/todc/js/bootstrap.min.js"></script>
<script type="text/javascript" src="libraries/jquery/jstorage.min.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/jquery-validation/jquery.validate.min.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="libraries/jquery/jquery.ba-outside-events.min.js"></script>
<script type="text/javascript" src="libraries/jquery/defunkt-jquery-pjax/jquery.pjax.js"></script>
<script type="text/javascript" src="libraries/jquery/multiplefileupload/jquery_MultiFile.js"></script>
<script type="text/javascript" src="resources/jquery.additions.js"></script>
<script type="text/javascript" src="layouts/v7/lib/bootstrap-notify/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/websockets/reconnecting-websocket.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/jquery-play-sound/jquery.playSound.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/malihu-custom-scrollbar/jquery.mousewheel.min.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/malihu-custom-scrollbar/jquery.mCustomScrollbar.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/autoComplete/jquery.textcomplete.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/jquery.qtip.custom/jquery.qtip.js"></script>
<script type="text/javascript" src="libraries/jquery/jquery-visibility.min.js"></script>
<script type="text/javascript" src="layouts/v7/lib/momentjs/moment.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/daterangepicker/moment.min.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/daterangepicker/jquery.daterangepicker.js"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/jquery.timeago.js"></script>
<script type="text/javascript" src="libraries/jquery/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="libraries/jquery/ckeditor/adapters/jquery.js"></script>
<script type='text/javascript' src='layouts/v7/lib/anchorme_js/anchorme.min.js'></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/Class.js?v=7.1.0"></script>
<script type='text/javascript' src="layouts/v7/resources/helper.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/resources/application.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/Utils.js?v=7.1.0"></script>
<script type='text/javascript' src="layouts/v7/modules/Vtiger/resources/validation.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/lib/bootbox/bootbox.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/Base.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/Vtiger.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Calendar/resources/TaskManagement.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Import/resources/Import.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Emails/resources/EmailPreview.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/Base.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Google/resources/Settings.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/CkEditor.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Documents/resources/Documents.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/bootstrap/js/eternicode-bootstrap-datepicker/js/bootstrap-datepicker.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/bootstrap/js/eternicode-bootstrap-datepicker/js/locales/bootstrap-datepicker.fr.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/timepicker/jquery.timepicker.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/lazyYT/lazyYT.min.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/Header.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/Edit.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/Popup.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/Field.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/jquery_windowmsg.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/BasicSearch.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/AdvanceFilter.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/SearchAdvanceFilter.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/AdvanceSearch.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/BaseList.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/List.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/AdvanceSearchList.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/RecordSelectTracker.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/Pagination.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Import/resources/Popup.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Emails/resources/MassEdit.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/EmailsRelatedPopup.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/sadropdown.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/posabsolute-jQuery-Validation-Engine/js/languages/jquery.validationEngine-fr.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/Vtiger.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/jquery.stickytableheaders.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/gridster/jquery.gridster.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/jqplot/jquery.jqplot.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/jqplot/plugins/jqplot.canvasTextRenderer.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/jqplot/plugins/jqplot.pieRenderer.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/jqplot/plugins/jqplot.barRenderer.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/jqplot/plugins/jqplot.categoryAxisRenderer.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/jqplot/plugins/jqplot.pointLabels.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/jqplot/plugins/jqplot.funnelRenderer.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/jqplot/plugins/jqplot.logAxisRenderer.min.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/VtJqplotInterface.js?v=7.1.0"></script>
<script type="text/javascript" src="libraries/jquery/vtchart.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/lib/jquery/gridster/jquery.gridster.min.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/DashBoard.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/dashboards/Widget.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/Detail.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Reports/resources/Detail.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Reports/resources/ChartDetail.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/modules/Vtiger/resources/CkEditor.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/lib/bootstrap-daterangepicker/moment.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/lib/bootstrap-daterangepicker/daterangepicker.js?v=7.1.0"></script>
<script type="text/javascript" src="layouts/v7/resources/v7_client_compat.js?v=7.1.0"></script>
<!-- Added in the end since it should be after less file loaded -->
<script type="text/javascript" src="libraries/bootstrap/js/less.min.js"></script>
<!-- Enable tracking pageload time -->
<script type="text/javascript">var _REQSTARTTIME = "1589749969";
jQuery(document).ready(function() {
window._PAGEREADYAT = new Date();
}
);
jQuery(window).load(function() {
window._PAGELOADAT = new Date();
window._PAGELOADREQSENT = false;
// Transmit the information to server about page render time now.
if (typeof _REQSTARTTIME != 'undefined') {
// Work with time converting it to GMT (assuming _REQSTARTTIME set by server is also in GMT)
var _PAGEREADYTIME = _PAGEREADYAT.getTime() / 1000.0;
// seconds
var _PAGELOADTIME = _PAGELOADAT.getTime() / 1000.0;
// seconds
var data = {
page_request: _REQSTARTTIME, page_ready: _PAGEREADYTIME, page_load: _PAGELOADTIME };
data['page_xfer'] = (_PAGELOADTIME - _REQSTARTTIME).toFixed(3);
data['client_tzoffset']= -1*_PAGELOADAT.getTimezoneOffset()*60;
data['client_now'] = JSON.parse(JSON.stringify(new Date()));
if (!window._PAGELOADREQSENT) {
// To overcome duplicate firing on Chrome
window._PAGELOADREQSENT = true;
}
}
}
);
</script>
<script>
var checked;
$(document).ready(function(){
var inc=1;
$(".add-row").click(function(){
var question = $("#question").val();
var choix1 = $("#choix1").val();
var choix2 = $("#choix2").val();
var choix3 = $("#choix3").val();
var choix4 = $("#choix4").val();
var choix5 = $("#choix5").val();
var checkboxcChoix1 =$("#checkboxcChoix1 ").is(":checked");
if(checkboxcChoix1 == true){checked1="checked"}else{checked1="";}
var checkboxcChoix2 =$("#checkboxcChoix2 ").is(":checked");
if(checkboxcChoix2 == true){checked2="checked"}else{checked2="";}
var checkboxcChoix3 =$("#checkboxcChoix3 ").is(":checked");
if(checkboxcChoix3 == true){checked3="checked"}else{checked3="";}
var checkboxcChoix4 =$("#checkboxcChoix4 ").is(":checked");
if(checkboxcChoix4 == true){checked4="checked"}else{checked4="";}
var checkboxcChoix5 =$("#checkboxcChoix5 ").is(":checked");
if(checkboxcChoix5 == true){checked5="checked"}else{checked5="";}
var ordre = $("#ordre").val();
var note = $("#note").val();
var markup = "<tr style='height:100px;'>"
+"<td><input type='number' class='qty smallInputBox inputElement' name='ordre[]' value="+ ordre + "></td>"
+"<td><textarea style='height:100px;' name='question[]' class='qty smallInputBox inputElement'>"+ question +"</textarea></td>"
+"<td><textarea style='height:100px;' name='choix1[]' class='qty smallInputBox inputElement'>"+ choix1 +"</textarea></td>"
+"<td><textarea style='height:100px;' name='choix2[]' class='qty smallInputBox inputElement'>"+ choix2 +"</textarea></td>"
+"<td><textarea style='height:100px;' name='choix3[]' class='qty smallInputBox inputElement'>"+ choix3 +"</textarea></td>"
+"<td><textarea style='height:100px;' name='choix4[]' class='qty smallInputBox inputElement'>"+ choix4 +"</textarea></td>"
+"<td><textarea style='height:100px;' name='choix5[]' class='qty smallInputBox inputElement'>"+ choix5 +"</textarea></td>"
+"<td>"
+" <div class='form-check'><input class='form-check-input' type='checkbox' name='checkboxcChoix"+inc+"[]' value='Choix1' "+ checked1 +">"
+" <label class='form-check-label' for='ridRadios1'>Choix1</label></div>"
+" <div class='form-check'><input class='form-check-input' type='checkbox' name='checkboxcChoix"+inc+"[]' value='Choix2' "+ checked2 +">"
+" <label class='form-check-label' for='ridRadios1'>Choix2</label></div>"
+" <div class='form-check'><input class='form-check-input' type='checkbox' name='checkboxcChoix"+inc+"[]' value='Choix3' "+ checked3 +">"
+" <label class='form-check-label' for='ridRadios1'>Choix3</label></div>"
+" <div class='form-check'><input class='form-check-input' type='checkbox' name='checkboxcChoix"+inc+"[]' value='Choix4' "+ checked4 +">"
+" <label class='form-check-label' for='ridRadios1'>Choix4</label></div>"
+" <div class='form-check'><input class='form-check-input' type='checkbox' name='checkboxcChoix"+inc+"[]' value='Choix5' "+ checked5 +">"
+" <label class='form-check-label' for='ridRadios1'>Choix5</label></div>"
+"</td>"
+"<td><input type='number' class='qty smallInputBox inputElement' name='note[]' value="+ note + "></td>"
+"<td style='display: none;'><input type='number' name='ids[]' value='0'></td>"
+"</tr>";
inc=inc+1;
$("#dynamique").append(markup);
viderChamps();
}
);
// Find and remove selected table rows
$(".delete-row").click(function(){
console.log("mm");
$("#dynamique").find('input[name="record"]').each(function(){
if($(this).is(":checked")){
$(this).parents("tr").remove();
}
}
);
}
);
}
);
</script>
<script>
function viderChamps() {
//reinitialiser le formulaire
$("#formulaire")[0].reset();
}
</script>
</html>