diff --git a/competency_iena_competencies_api.php b/competency_iena_competencies_api.php index 4de17f62e7d000c5acb22f5959422d5ec3065715..fb47e0b10ca7793c0a91d3746ca997047eb17ca0 100644 --- a/competency_iena_competencies_api.php +++ b/competency_iena_competencies_api.php @@ -44,13 +44,29 @@ if (isset($_POST["addcomp"])) { $value = $_POST["addcomp"]; + //return var_dump($value); + + $resultInsert=""; + $errorInsert=false; $refI = new block_competency_iena_referentiel(); - $is_insert = $refI->add_competency_in_course($value[0], $value[1]); - if ($is_insert) { - echo 'true'; - } else { - echo 'false'; + + foreach($value[0] as $compid){ + //var_dump($comp); + $is_insert = $refI->add_competency_in_course($compid, $value[1]); + if (!$is_insert) { + $resultInsert.=" ".$compid.","; + $errorInsert=true; + + } + } + if($errorInsert==false){ + echo "true"; + } + else{ + echo get_string('error_insert', 'block_competency_iena').$resultInsert; } + + } // updateTextRef if (isset($_POST["idref"])) { diff --git a/competency_iena_competencies_mgmt.php b/competency_iena_competencies_mgmt.php index 59779a2ee0f2d5c9b57ba689639861130047275f..afd06bc7b1a785d593ca7595f6c07697a2cc98ce 100644 --- a/competency_iena_competencies_mgmt.php +++ b/competency_iena_competencies_mgmt.php @@ -144,6 +144,7 @@ $PAGE->requires->css(new \moodle_url('https://cdn.datatables.net/1.10.16/css/jquery.dataTables.css')); $PAGE->requires->js("/blocks/competency_iena/js/file.js"); $PAGE->requires->js("/blocks/competency_iena/js/matrix.js"); + $PAGE->requires->js("/blocks/competency_iena/js/dropdown.js"); diff --git a/js/dropdown.js b/js/dropdown.js index 5a39ad62363cef6546994e6099b23b0a8cab0710..38edcfb8c00d805eb55031429d9088a5a2c88415 100644 --- a/js/dropdown.js +++ b/js/dropdown.js @@ -1,5 +1,6 @@ (function() { function filter (e) { + console.log("ici ?"); let filter = e.target.value.toUpperCase(); let a = e.target.parentNode.querySelectorAll('a'); for (let k = 0; k < a.length; k++) { @@ -12,18 +13,19 @@ } } window.addEventListener('load', function () { - /* Activation of dropdowns in the page */ let drops = document.querySelectorAll('.iena-dropdown'); for (var i = 0; i < drops.length; i++) { - drops[i].querySelector('.iena-drop-input').addEventListener('focus', function(e) { - let a = e.target.parentNode.querySelectorAll('a'); + console.log("glag2"); + /*let a = e.target.parentNode.querySelectorAll('a'); for (var i = 0; i < a.length; i++) { a[i].style.display = "block"; - } + }*/ + let list = e.target.parentNode.getElementsByClassName('iena-droplist')[0]; + list.style.display="block"; filter(e); }); @@ -37,19 +39,23 @@ true_input.value = value; let input = e.target.parentNode.parentNode.querySelector('.iena-drop-input') input.value = e.target.innerText; - let a = e.target.parentNode.querySelectorAll('a'); + /*let a = e.target.parentNode.querySelectorAll('a'); for (var i = 0; i < a.length; i++) { a[i].style.display = "none"; - } + }*/ + let list = e.target.parentNode.getElementsByClassName('iena-droplist')[0]; + list.style.display="block"; e.target.parentNode.parentNode.parentNode.submit(); }; } drops[i].querySelector('.iena-drop-input').addEventListener('blur', function(e) { - let a = e.target.parentNode.querySelectorAll('a'); + /*let a = e.target.parentNode.querySelectorAll('a'); for (var i = 0; i < a.length; i++) { a[i].style.display = "none"; - } + }*/ + let list = e.target.parentNode.getElementsByClassName('iena-droplist')[0]; + list.style.display="none"; }); drops[i].querySelector('.iena-drop-input').addEventListener('keyup', function(e) { @@ -58,6 +64,48 @@ } + if(document.getElementById('framework_list')!== null){ + let framework_list=document.getElementById('framework_list'); + framework_list.querySelector('.iena-drop-input').addEventListener('focus', function(e) { + console.log("glag2"); + /*let a = e.target.parentNode.querySelectorAll('a'); + for (var i = 0; i < a.length; i++) { + a[i].style.display = "block"; + }*/ + let list = e.target.parentNode.getElementsByClassName('iena-droplist')[0]; + list.style.display="block"; + filter(e); + }); + + let a = framework_list.querySelectorAll('a'); + + for (var j = 0; j < a.length; j++) { + a[j].onmousedown = function(e) { + console.log("iciiii"); + //e.preventDefault(); + let true_input = e.target.parentNode.parentNode.querySelector('.iena-drop-input-value'); + let value = e.target.dataset.value; + true_input.value = value; + let input = e.target.parentNode.parentNode.querySelector('.iena-drop-input') + input.value = e.target.innerText; + let list = e.target.parentNode; + list.style.display="none"; + + updateTextRef(e.target.dataset.value, e.target.dataset.link); + //return false; + }; + } + + framework_list.querySelector('.iena-drop-input').addEventListener('blur', function(e) { + let list = e.target.parentNode.getElementsByClassName('iena-droplist')[0]; + list.style.display="none"; + }); + + framework_list.querySelector('.iena-drop-input').addEventListener('keyup', function(e) { + filter(e); + }); + } + /* Activation of previous and next buttons for dropdowns */ if (document.getElementById('student_list') !== null) { @@ -114,6 +162,8 @@ } } + + }); })() \ No newline at end of file diff --git a/js/file.js b/js/file.js index 21cf0a7eff99c435aec005db8565d74bae6f50c4..6748ba032b80d84516486799d7b5dbde58c9571c 100644 --- a/js/file.js +++ b/js/file.js @@ -13,6 +13,7 @@ function filter() { function updateTextComp(value, url){ + // console.log(value); $.ajax({ url: url, @@ -26,12 +27,12 @@ function updateTextComp(value, url){ $('#name_comp_iena').html(json_res.shortname); $('#desc_comp_iena').html(json_res.description); $('#id-comp-iena').val(json_res.id); - $('#cpt_panel').css("visibility", 'visible') } }); } function updateTextRef(value, url) { + console.log("ON UPDATEEEE ?"); // console.log(value); $.ajax({ url:url, diff --git a/js/matrix.js b/js/matrix.js index 3710e92ad64a1e7246e5307646fe19586a03a2c0..8b0fca1f4079e11c92fc269fde02d269bea7ea21 100644 --- a/js/matrix.js +++ b/js/matrix.js @@ -16,39 +16,6 @@ jQuery(document).ready(function($){ }); $('.fram-iena').hide(); - // $('#btn-comp-iena').hide(); - - $( '#select-framework' ).on( 'change', function () { - $('.fram-iena').hide(); - $('.fram-'+$(this).val()).show(); - }); - - - - - - /*$('#btn-comp-iena').click(function(){ - var idcomp = $('#id-comp-iena').val(); - var idcourse = $('#id-course-iena').val(); - var value = []; - value[0] = idcomp; - value[1] = idcourse; - $.ajax({ - url: '$CFG->wwwroot/blocks/competency_iena/competency_iena_competencies_api.php?courseid='+idcourse, - type: 'POST', - timeout: 10000, - contentType: 'application/x-www-form-urlencoded', - data: {addcomp:value}, - success: function(result) { - if (result.trim() == "true"){ - location.reload(); - } else { - alert('Cette compétence est déja liée au cours.'); - } - } - }); - - });*/ $('#filter-iena-competence').keyup(function(){ var searchText = $(this).val(); @@ -122,47 +89,64 @@ treed({openedClass:'fa-caret-down', closedClass:'fa-caret-right'}); }); -function showFilter(obj){ - var p = obj.parentNode; - var c = p.children; - - if (c[2].dataset.edit == 'editOn') { - c[0].setAttribute("style", "display:inline"); - c[1].setAttribute("style", "display:none"); - c[2].dataset.edit = 'editOff'; - } else { - c[0].setAttribute("style", "display:none"); - c[1].setAttribute("style", "display:inline"); - c[2].dataset.edit = 'editOn'; - } - // console.log(c) +function filter() { + var keyword = document.getElementById("input-framework").value; + var select = document.getElementById("select-framework"); + for (var i = 0; i < select.length; i++) { + var txt = select.options[i].text; + if (txt.substring(0, keyword.length).toLowerCase() !== keyword.toLowerCase() && keyword.trim() !== "") { + $(select.options[i]).attr('disabled', 'disabled').hide(); + } else { + $(select.options[i]).removeAttr('disabled').show(); + } + } +} - // c[2].setAttribute("style", "display:none"); - + + +function showFilter(obj){ + var p = obj.parentNode; + var c = p.children; + + if (c[2].dataset.edit == 'editOn') { + c[0].setAttribute("style", "display:inline"); + c[1].setAttribute("style", "display:none"); + c[2].dataset.edit = 'editOff'; + } else { + c[0].setAttribute("style", "display:none"); + c[1].setAttribute("style", "display:inline"); + c[2].dataset.edit = 'editOn'; } + +} - function addCompetencies(url){ - var idcomp = $('#id-comp-iena').val(); - var idcourse = $('#id-course-iena').val(); - var value = []; - value[0] = idcomp; - value[1] = idcourse; - $.ajax({ - url: url, - type: 'POST', - timeout: 10000, - contentType: 'application/x-www-form-urlencoded', - data: {addcomp:value}, - success: function(result) { - if (result.trim() == "true"){ - location.reload(); - } else { - alert('Cette compétence est déja liée au cours.'); - } - } - }); +function addCompetencies(url, idcourse){ + //var idcomp = $('#id-comp-iena').val(); + var arrayComp=[]; + var comp = $('#tree3').find('.iena-checkbox-cpt:checked'); + for(var i=0; i<comp.length;i++){ + arrayComp.push(comp[i].value); } + var value = []; + value[0]=arrayComp; + value[1] = idcourse; + $.ajax({ + url: url, + type: 'POST', + timeout: 10000, + contentType: 'application/x-www-form-urlencoded', + data: {addcomp:value}, + success: function(result) { + if (result.trim() == "true"){ + location.reload(); + } else { + alert(result); + location.reload(); + } + } + }); +} function supprimer_lien(obj) { var t = obj.parentNode; @@ -173,10 +157,7 @@ function supprimer_lien(obj) { c[1].setAttribute("style", "display:none"); c[2].setAttribute("style", "display:inline"); - // console.log(c[0]); - var div_id = c[0].id; - // console.log(div_id); var module_id = div_id.split('-')[0]; module_id = module_id.replace ( /[^\d.]/g, '' ); @@ -185,16 +166,12 @@ function supprimer_lien(obj) { competency_id = competency_id.replace ( /[^\d.]/g, '' ); var url = window.location.href; - // console.log(url); var info = []; info[0] = module_id ; info[1] = competency_id ; info[2] = "delete" ; - // console.log(info); - - $.ajax({ type: "POST", data: {info:info}, @@ -203,8 +180,6 @@ function supprimer_lien(obj) { contentType: 'application/x-www-form-urlencoded', success: function (data, status) { if (status == "success") { - // console.log(status); - // console.log(data); //changeColor(p); } }, @@ -311,4 +286,37 @@ function changeColor(obj) // obj.style.backgroundColor = newColor; } +//Sélectionne/déselectionne une compétence et ses enfants +function selectCompetency(obj){ + $('#btn-comp-iena').removeAttr('disabled'); + box = $(obj); + if(box.is(':checked')){ + children=$(obj).parent().find('.iena-checkbox-cpt'); + if(children.length>0){ + for(var i=0; i<children.length; i++){ + children.prop('checked', true); + } + + } + } + else if(!box.is(':checked')){ + children=$(obj).parent().find('.iena-checkbox-cpt'); + if(children.length>0){ + for(var i=0; i<children.length; i++){ + children.prop('checked', false); + } + + } + } + var count=countSelectedCompetencies(); + if(count==0){ + $('#btn-comp-iena').addAttr('disabled'); + } + $("#iena-counter-cpt").html(count); +} + +//Compte le nombre de compétences sélectionnées +function countSelectedCompetencies(){ + return $('#tree3').find('.iena-checkbox-cpt:checked').length; +} diff --git a/lang/en/block_competency_iena.php b/lang/en/block_competency_iena.php index a477c14f8a9fcf22252f37f219f6d73409842152..58b50dfd8170dac1cf4316a94a58e531a51e9871 100644 --- a/lang/en/block_competency_iena.php +++ b/lang/en/block_competency_iena.php @@ -37,7 +37,7 @@ $string['referentiel'] = 'Référentiels'; $string['info_ref'] = 'Info Référentiel'; $string['info_comp'] = 'Info Compétence'; - $string['add_comp2'] = 'Ajouter la compétence'; + $string['add_comp2'] = 'Add selected competencies'; $string['student'] = 'Etudiant'; $string['not_eval'] = 'Non évalué'; $string['change_comp'] = 'Switch competency'; @@ -76,4 +76,6 @@ $string['apc_demande_title'] = 'Demande d\'accès ou d\'informations'; $string['send_demande'] = 'Envoyer la demande'; $string['competency_iena:addinstance'] = 'Add a new competency block'; + $string['error_insert']="Some competencies were not added:"; + $string['count_cpt']=" competencies selected"; ?> \ No newline at end of file diff --git a/lang/fr/block_competency_iena.php b/lang/fr/block_competency_iena.php index 997abf53554f7414f0421d7ac8648a0ee003aa39..727873c30e2177461856f80014d79fb95f835693 100644 --- a/lang/fr/block_competency_iena.php +++ b/lang/fr/block_competency_iena.php @@ -36,7 +36,7 @@ $string['referentiel'] = 'Référentiels'; $string['info_ref'] = 'Info Référentiel'; $string['info_comp'] = 'Info Compétence'; - $string['add_comp2'] = 'Ajouter la compétence'; + $string['add_comp2'] = 'Ajouter les compétences'; $string['student'] = 'Etudiant'; $string['not_eval'] = 'Non évalué'; $string['change_comp'] = 'Compétence'; @@ -75,6 +75,8 @@ $string['apc_demande_title'] = 'Demande d\'accès ou d\'informations'; $string['send_demande'] = 'Envoyer la demande'; $string['competency_iena:addinstance'] = 'Ajouter un nouveau bloc Compétences'; + $string['error_insert']="Certaines compétences n'ont pas été ajoutées :"; + $string['count_cpt']=" compétence(s) sélectionnée(s)"; diff --git a/styles.css b/styles.css index 0ef22f3cce6d3598009f18da1ee5076cf8cb55d0..ba9ec96ff4fc4fa6492fd0b39b2783966f016f0a 100644 --- a/styles.css +++ b/styles.css @@ -4,6 +4,11 @@ right: 0; } +.iena-cpt-sel-tree{ + overflow-x: auto; + flex-grow: 5 +} + .iena-cpt-sel-tree .tree, .iena-cpt-sel-tree .tree ul { margin: 0; @@ -41,7 +46,7 @@ .iena-cpt-sel-tree .tree li { margin: 0; padding: 0 1em; - line-height: 2em; + line-height: 1.7em; color: #369; font-weight: 700; position: relative @@ -85,16 +90,96 @@ position: absolute; } -.iena-dropdown a:hover { background-color: #ddd; } +.iena-dropdown a:hover, .framework-dropdown a:hover{ background-color: #ddd; } .iena-droplist { max-height: 250px; - overflow:scroll; + /*overflow:scroll;*/ width: 300px; background-color: #f6f6f6; + overflow-y: auto; + overflow-x: hidden; + border: 1px solid lightgrey; + box-shadow: 1px 1px 4px 0px lightgrey; } .iena-drop-item { text-decoration: none !important; padding: 0.25rem 0.5rem; } + + + +.framework-dropdown .iena-drop-input{ + width: 100%; +} +.framework-dropdown .iena-droplist{ + + width: 100%; + +} + +#cpt-modal .modal-content{ + max-height: 90vh; + min-height: 500px; +} + +#cpt-modal .modal-body{ + height: 78vh; +} + +#cpt-modal .modal-body .row{ + flex-direction: column; + + height: 100%; + flex-wrap: nowrap; +} + +#cpt-modal .modal-body .row .ref-col{ + /*flex-basis:15%;*/ + flex-basis: auto; +} + +#cpt-modal .modal-body .row .cpt-col{ + /*flex-basis:85%; + height: 50%;*/ + flex-basis: auto; + flex-grow: 5; + flex-shrink: 0; + height: 20%; + display: flex; + flex-direction: column; +} + +#btn-comp-iena{ + width: 280px; + align-self: flex-end; + margin-bottom: 0px !important; +} + +.fram-iena .iena-checkbox-cpt{ + margin-right: 5px; + vertical-align: middle; +} + +.fram-iena a{ + vertical-align: middle; + display: inline-block; + cursor: pointer; +} + +.iena-footer-cpt{ + display: flex; +} +.iena-text-counter{ + flex: auto; + align-self: center; +} + +@media (max-height: 700px){ + .iena-cpt-sel-tree{ + /*height: 70%;*/ + + } +} + diff --git a/templates/matrix_competencies.mustache b/templates/matrix_competencies.mustache index cdf7f1440ccff30143c49fbd366d1099bac354ca..92fdf535ea2f582b3fd11b8c31c3fc8badf6334b 100644 --- a/templates/matrix_competencies.mustache +++ b/templates/matrix_competencies.mustache @@ -66,123 +66,7 @@ </tbody> </table> -<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#cpt_modal">{{# str }} add_comp, block_competency_iena {{/ str }}</button> +<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#cpt-modal">{{# str }} add_comp, block_competency_iena {{/ str }}</button> -<div class="modal fade" id="cpt_modal" role="dialog"> - <div class="modal-dialog modal-lg"> - - <!-- Modal content--> - <div class="modal-content"> - <div class="modal-header"> - <h4 class="modal-title">{{# str }}select_comp,block_competency_iena{{/str}}</h4> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - </div> - <div class="modal-body"> - <div class='row'> - <div class='col-md-6'> - <h2>{{# str }}referentiel, block_competency_iena{{/str}}</h2> - <form action='{{form_link}}' method='POST'> - <input type='hidden' id='ref_mod' value='none' name='ref_mod'> - <button type='submit' class='btn btn-primary btn-block mb-3'>{{#str}}modify_ref, block_competency_iena{{/str}}</button> - </form> - <input placeholder='Filtrer les référentiels' type='text' id='input-framework' class='form-control mb-3' onkeyup="filter()"> - <select id='select-framework' size="6" class='form-control mb-3'> - - {{#frameworks}} - <option onclick="updateTextRef('{{id}}','{{update_link}}');" value="{{id}}">{{shortname}}</option> - {{/frameworks}} - </select> - <div class="card" style='visibility: hidden;' id='ref_panel'> - <div class='card-body'> - <h3 class='card-title' id='name_ref_iena'>{{#str}}info_ref, block_competency_iena{{/str}}</h3> - <p class='card-text' id='desc_ref_iena'></p> - </div> - </div> - </div> - <div class='col-md-6'> - <h2>{{# str }}competency, block_competency_iena{{/ str }}</h2> - <button id='btn-comp-iena' disabled='disabled' onclick="addCompetencies('{{update_link}}')" type="button" class="btn btn-success btn-block mb-3">{{# str }}add_comp2, block_competency_iena{{/ str }}</button> - - <input placeholder='Filtrer les compétences du référentiel' type='text' id='filter-iena-competence' class='form-control mb-3'> - <div class="well well-lg iena-cpt-sel-tree mb-3"> - <ul id='tree3'> - <li class='fram-iena'> - {{#ordered_competencies}} - <li class="fram-iena fram-{{frameworkid}}"> - <a onclick="updateTextComp('{{competency.id}}','{{update_link}}')">{{competency.shortname}}</a> - {{#has_children}} - <ul> - {{#children}} - <li> <a onclick="updateTextComp('{{competency.id}}','{{update_link}}')">{{competency.shortname}}</a> - {{#has_children}} - <ul> - {{#children}} - <li> <a onclick="updateTextComp('{{competency.id}}','{{update_link}}')">{{competency.shortname}}</a> - {{#has_children}} - <ul> - {{#children}} - <li> <a href='#' onclick="updateTextComp('{{competency.id}}','{{update_link}}')">{{competency.shortname}}</a></li> - {{/children}} - </ul> - {{/has_children}} - </li> - {{/children}} - </ul> - {{/has_children}} - </li> - {{/children}} - </ul> - {{/has_children}} - - </li> - {{/ordered_competencies}} - </li> - - </ul> - - </div> - <div class="card" style='visibility: hidden;' id='cpt_panel'> - <div class='card-body'> - <h3 class='card-title' id='name_comp_iena'>{{# str }}info_comp, block_competency_iena{{/ str }}</h3> - <p class='card-text' id='desc_comp_iena'></p> - </div> - <input id='id-comp-iena' type='hidden'> - <input id='id-course-iena' value='{{courseid}}' type='hidden'> - - </div> - </div> - - </div> - </div> - - </div> - </div> - - - <div class="modal fade" id="myModalRef" role="dialog"> - <div class="modal-dialog modal-lg" style='top: 33%;max-width: 25%;'> - - <!-- Modal content--> - <div class="modal-content" style='border: 5px solid rgba(0,0,0,.2);'> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal">×</button> - <h4 class="modal-title">{{# str }}confirm, block_competency_iena{{/ str }}</h4> - </div> - <div class="modal-body"> - <p>{{# str }}ask_confirm, block_competency_iena{{/ str }}</p> - <div class='align_center'> - <button class='btn btn-danger' data-dismiss="modal">{{# str }}no, block_competency_iena{{/ str }}</button> - <form action='{{form_link}}' method='POST'> - <input type='hidden' id='ref_mod' value='' name='ref_mod'> - <button type='submit' id='' class='btn btn-success' style='margin-left: 2rem '>{{# str }}yes, block_competency_iena{{/ str }}</button> - </form> - </div> - - - </div> - </div> - </div> - </div> - -</div> \ No newline at end of file +{{> block_competency_iena/modal_competencies}} \ No newline at end of file diff --git a/templates/modal_competencies.mustache b/templates/modal_competencies.mustache new file mode 100644 index 0000000000000000000000000000000000000000..8e6b78b6b88fd1a5e805113664f62c75f66ff00b --- /dev/null +++ b/templates/modal_competencies.mustache @@ -0,0 +1,122 @@ +<div class="modal fade" id="cpt-modal" role="dialog"> + <div class="modal-dialog modal-lg"> + + <!-- Modal content--> + <div class="modal-content"> + <div class="modal-header"> + <h4 class="modal-title">{{# str }}select_comp,block_competency_iena{{/str}}</h4> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + </div> + <div class="modal-body"> + <div class='row'> + <div class='col-md-12 ref-col' style="z-index: 10"> + <h4>{{# str }}referentiel, block_competency_iena{{/str}}</h4> + + + <form action='' id='change_student' class='form-inline m-b-1' autocomplete='off' style='display: block;height: 1.5rem;'> + + + <div id='framework_list' class='framework-dropdown' style='z-index: 10;'> + <input type='text' hidden name='studentid' id='studentid_sel' class='iena-drop-input-value' value=''> + <input type='text' value='' class='form-control iena-drop-input' placeholder='Choisir un référentiel'> + <div class='iena-droplist' style="display: none"> + {{#frameworks}} + <a href='#' data-value='{{id}}', data-link="{{update_link}}" class='iena-drop-item' style='display: none;'>{{shortname}}</a> + {{/frameworks}} + + </div> + </div> + + </form> + + + + </div> + <div class='col-md-12 cpt-col'> + <h4>{{# str }}competency, block_competency_iena{{/ str }}</h4> + + + <input placeholder='Filtrer les compétences du référentiel' type='text' id='filter-iena-competence' class='form-control mb-3'> + + <div class="well well-lg iena-cpt-sel-tree mb-3"> + <ul id='tree3'> + <li class='fram-iena'> + {{#ordered_competencies}} + <li class="fram-iena fram-{{frameworkid}}"> + <input class="iena-checkbox-cpt" onclick="selectCompetency(this)" type="checkbox" id="{{competency.shortname}}" value="{{competency.id}}"><a>{{competency.shortname}}</a> + {{#has_children}} + <ul> + {{#children}} + <li> + <input class="iena-checkbox-cpt" onclick="selectCompetency(this)" type="checkbox" id="{{competency.shortname}}" value="{{competency.id}}"><a>{{competency.shortname}}</a> + {{#has_children}} + <ul> + {{#children}} + <li> + <input class="iena-checkbox-cpt" onclick="selectCompetency(this)" type="checkbox" id="{{competency.shortname}}" value="{{competency.id}}"><a>{{competency.shortname}}</a> + {{#has_children}} + <ul> + {{#children}} + <li> + <input class="iena-checkbox-cpt" onclick="selectCompetency(this)" type="checkbox" id="{{competency.shortname}}" value="{{competency.id}}"><a href='#'>{{competency.shortname}}</a></li> + {{/children}} + </ul> + {{/has_children}} + </li> + {{/children}} + </ul> + {{/has_children}} + </li> + {{/children}} + </ul> + {{/has_children}} + + </li> + {{/ordered_competencies}} + </li> + + </ul> + + </div> + <div class="iena-footer-cpt"> + <div class="iena-text-counter"> + <span id="iena-counter-cpt">0</span> {{#str}} count_cpt, block_competency_iena {{/str}} + </div> + <button id='btn-comp-iena' disabled='disabled' onclick="addCompetencies('{{update_link}}', '{{courseid}}')" type="button" class="btn btn-success btn-block mb-3">{{# str }}add_comp2, block_competency_iena{{/ str }}</button> + </div> + + </div> + + </div> + </div> + + </div> + </div> + + + <div class="modal fade" id="myModalRef" role="dialog"> + <div class="modal-dialog modal-lg" style='top: 33%;max-width: 25%;'> + + <!-- Modal content--> + <div class="modal-content" style='border: 5px solid rgba(0,0,0,.2);'> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal">×</button> + <h4 class="modal-title">{{# str }}confirm, block_competency_iena{{/ str }}</h4> + </div> + <div class="modal-body"> + <p>{{# str }}ask_confirm, block_competency_iena{{/ str }}</p> + <div class='align_center'> + <button class='btn btn-danger' data-dismiss="modal">{{# str }}no, block_competency_iena{{/ str }}</button> + <form action='{{form_link}}' method='POST'> + <input type='hidden' id='ref_mod' value='' name='ref_mod'> + <button type='submit' id='' class='btn btn-success' style='margin-left: 2rem '>{{# str }}yes, block_competency_iena{{/ str }}</button> + </form> + </div> + + + </div> + </div> + </div> + </div> + +</div> \ No newline at end of file