diff --git a/competency_iena_competencies_mgmt.php b/competency_iena_competencies_mgmt.php index ee25f276de03566130a0e4ec76415d73610e0b10..59779a2ee0f2d5c9b57ba689639861130047275f 100644 --- a/competency_iena_competencies_mgmt.php +++ b/competency_iena_competencies_mgmt.php @@ -13,6 +13,8 @@ global $COURSE, $DB, $CFG; + echo "COURSE ID"; + echo $COURSE->id; $courseid = required_param('courseid', PARAM_INT); @@ -24,7 +26,8 @@ if ($_POST) { if ($_POST['info'][0] == "delete_cpt") { - $module_id = htmlspecialchars($_POST['info'][1]); + //$module_id = htmlspecialchars($_POST['info'][1]); + $module_id=$courseid; $cpt_id = htmlspecialchars($_POST['info'][2]); $cpt_api = new \core_competency\api(); @@ -42,7 +45,6 @@ $data_exist = $DB->get_record_sql('select count(*) AS count FROM {competency_modulecomp} WHERE cmid=? AND competencyid =?', array($module_id, $competency_id)); } catch (dml_exception $e) { } - //var_dump($data_exist); if ($data_exist->count > 0) { //$DB->get_record_sql(' delete FROM {competency_modulecomp} WHERE cmid=? AND competencyid =?' , array($module_id, $competency_id)); try { @@ -121,17 +123,124 @@ exit; } + $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST); require_login($course, false, NULL); + + + + $PAGE->set_title(get_string('title_plugin', 'block_competency_iena')); $PAGE->set_heading($OUTPUT->heading($COURSE->fullname, 2, 'headingblock header outline')); - echo $OUTPUT->header(); + $PAGE->requires->js(new \moodle_url('https://code.jquery.com/jquery-3.3.1.min.js'),true); + + + $PAGE->requires->js(new \moodle_url('https://cdn.datatables.net/1.10.16/js/jquery.dataTables.js'),true); + $PAGE->requires->js(new \moodle_url('https://cdn.datatables.net/select/1.2.5/js/dataTables.select.min.js'),true); + $PAGE->requires->js(new \moodle_url('https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js'),true); + $PAGE->requires->js(new \moodle_url('https://cdn.datatables.net/fixedcolumns/3.2.4/js/dataTables.fixedColumns.min.js'),true); + $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"); + + + + /* Compétences*/ + + $competency_instance = new block_competency_iena_competency(); + $competencies = $competency_instance->get_competencies_by_courseID($courseid); + + foreach ($competencies as $competency) { + $competency->link = $CFG->wwwroot . "/blocks/competency_iena/competency_iena_user.php?courseid=" . $courseid . "&competencyid=" . $competency->id; + } + + + + + + $module_instance = new block_competency_iena_module(); + $modules = $module_instance->get_modules_by_courseID($courseid); + + $section_instance = new block_competency_iena_section(); + $sections = $section_instance->get_sections_by_id_course($courseid); + + $index=0; + + //Pour chaque section on va regarder s'il y a des modules, et si oui on formate et on ajoute les modules à la section + foreach ($sections as $section) { + $section->modules=array(); + foreach ($modules as $module) { + if($module->sectionid == $section->id){ + $moduleI = new block_competency_iena_ressource(); + $moduleI->get_ressource_by_id($module->moduleid); + $module->link=$moduleI->link; + $module_competencies = $competency_instance->get_competencies_by_moduleID($module->moduleid); + $module->mcompetencies=array(); + foreach ($competencies as $competency) { + $key=array_search($competency->id, array_column($module_competencies, 'id')); + if($key !== false){ + array_push($module->mcompetencies, $module_competencies[$key]); + } + else{ + array_push($module->mcompetencies, $competency); + } + + } + + array_push($section->modules,$module); + } + } + + if ( $section->name == NULL ) { + $section->name = "Section " . $section->section; + } + if(count($section->modules)==0){ + unset($sections[$index]); + } + $index++; + + } + //Comme on a unset, on réindexe le tableau pour des clés propres + $sections=array_values($sections); + + + //Pour les référentiels + $refI = new block_competency_iena_referentiel(); + $frameworks = $refI->get_referentiels_all(); + foreach ($frameworks as $framework) { + + //$ordered_competencies=$ordered_competencies + $refI->get_competences_order_by_ref($framework->id); + if(isset($ordered_competencies)){ + $ordered_competencies=array_merge($ordered_competencies, $refI->get_competences_order_by_ref($framework->id)); + } + else{ + $ordered_competencies=$refI->get_competences_order_by_ref($framework->id); + + } + } + echo $OUTPUT->header(); echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\">"; - $view = new view_competency_iena_competencies_mgmt(); - echo $view->get_content(htmlspecialchars($courseid)); + //$view = new view_competency_iena_competencies_mgmt(); + //echo $view->get_content(htmlspecialchars($courseid)); + + $data=array(); + $data['competencies']=$competencies; + //$data['modules']=$modules; + $data['sections']=$sections; + $data['frameworks']=array_values($frameworks); + $data['ordered_competencies']=$ordered_competencies; + $data['form_link']= $CFG->wwwroot . "/blocks/competency_iena/competency_iena_competency_mgmt.php?courseid=" . $COURSE->id; + $data['update_link']=$CFG->wwwroot . '/blocks/competency_iena/competency_iena_competencies_api.php?courseid=' . $COURSE->id; + + $data['courseid']=$COURSE->id; + + //$link = $CFG->wwwroot . '/blocks/competency_iena/competency_iena_competency_mgmt.php?courseid=' . $COURSE->id; + + $renderer = $PAGE->get_renderer('block_competency_iena'); + + $renderer->get_competency_matrix($data); echo $OUTPUT->footer(); diff --git a/entity/block_competency_iena_competency.php b/entity/block_competency_iena_competency.php index c826306049dba1aba36a133dd6f45f2b3c338986..8a5333f18636fe8a2629fbf20d791ae20367310f 100644 --- a/entity/block_competency_iena_competency.php +++ b/entity/block_competency_iena_competency.php @@ -252,6 +252,7 @@ list_evidence_in_course return $competencies; } + //Ici ça pose problème avec le new renderer base ? public function get_data($userID, $competenceId, $courseID) { global $CFG; @@ -282,5 +283,17 @@ list_evidence_in_course return $value; } + public function export_for_template(renderer_base $output) { + $data = new stdClass(); + $data->id = $this->id; + $data->shortname=$this->shortname; + $data->description=$this->description; + $data->students=$this->students; + $data->student_proficiency=$this->student_proficiency; + $data->student_grade=$this->student_grade; + $data->module_ruleoutcome=$this->module_ruleoutcome; + $data->module_ruleoutcomestring=$this->module_ruleoutcomestring; + return $data; + } } diff --git a/entity/block_competency_iena_module.php b/entity/block_competency_iena_module.php index 69f3f52eb8fe98af2afa236775e981c5c0e408b8..76c7a151e91a73b133e4d3d3fb45f29db4002e20 100644 --- a/entity/block_competency_iena_module.php +++ b/entity/block_competency_iena_module.php @@ -17,7 +17,9 @@ class block_competency_iena_module { public function get_module_by_id($id_module) { global $COURSE; + $modinfo = get_fast_modinfo($COURSE->id); + foreach ($modinfo->get_cms() as $module) { if($module->id == $id_module) diff --git a/entity/block_competency_iena_referentiel.php b/entity/block_competency_iena_referentiel.php index 9bbdad40efe3b4a5fd5df610c19dd6a0df5afb43..b46060b202fc90b7ee2d451d998a1c30ce821b1c 100644 --- a/entity/block_competency_iena_referentiel.php +++ b/entity/block_competency_iena_referentiel.php @@ -163,37 +163,46 @@ if ($competence->parentid == 0) { $object = new block_competency_iena_referentiel(); $object->fill(1, null, $competence); + $object->frameworkid=$refid; array_push($lvlOne, $object); } } foreach ($lvlOne as $one) { $lvlTwo = array(); + $one->has_children=false; foreach ($competences as $competence) { if ($one->competency->id == $competence->parentid) { $object = new block_competency_iena_referentiel(); $object->fill(2, null, $competence); array_push($lvlTwo, $object); + $one->has_children=true; } } $one->children = $lvlTwo; + foreach ($one->children as $two) { + $two->has_children=false; $lvlTree = array(); foreach ($competences as $competence) { if ($two->competency->id == $competence->parentid) { $object = new block_competency_iena_referentiel(); $object->fill(3, null, $competence); array_push($lvlTree, $object); + $two->has_children=true; } } $two->children = $lvlTree; + foreach ($two->children as $tree) { + $tree->has_children=false; $lvlFour = array(); foreach ($competences as $competence) { if ($tree->competency->id == $competence->parentid) { $object = new block_competency_iena_referentiel(); $object->fill(4, null, $competence); array_push($lvlFour, $object); + $tree->has_children=true; } } $tree->children = $lvlFour; diff --git a/js/file.js b/js/file.js index 66a6546f5b200900a8d44868cdd51d67a628be1c..21cf0a7eff99c435aec005db8565d74bae6f50c4 100644 --- a/js/file.js +++ b/js/file.js @@ -12,10 +12,10 @@ function filter() { } -function updateTextComp(value, idcourse,wwwroot){ +function updateTextComp(value, url){ // console.log(value); $.ajax({ - url: wwwroot+'/blocks/competency_iena/competency_iena_competencies_api.php?courseid='+idcourse, + url: url, type: 'POST', timeout: 10000, contentType: 'application/x-www-form-urlencoded', @@ -31,17 +31,16 @@ function updateTextComp(value, idcourse,wwwroot){ }); } -function updateTextRef(value, idcourse,wwwroot) { +function updateTextRef(value, url) { // console.log(value); $.ajax({ - url: wwwroot + '/blocks/competency_iena/competency_iena_competencies_api.php?courseid=' + idcourse, + url:url, type: 'POST', timeout: 10000, contentType: 'application/x-www-form-urlencoded', data: {idref: value}, success: function (result) { var json_res = JSON.parse(result); - // console.log(json_res.id); $('#btn-comp-iena').attr('disabled', 'disabled'); $('#name_ref_iena').html(json_res.shortname); $('#desc_ref_iena').html(json_res.description); diff --git a/js/matrix.js b/js/matrix.js new file mode 100644 index 0000000000000000000000000000000000000000..3710e92ad64a1e7246e5307646fe19586a03a2c0 --- /dev/null +++ b/js/matrix.js @@ -0,0 +1,314 @@ +jQuery(document).ready(function($){ + $.noConflict(); + $('#tab_mgmt').DataTable({ + responsive: true, + + "language": { + "url": "https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json" + }, + "bSort": false, + scrollCollapse: true, + fixedColumns: { + leftColumns: 1 + }, + 'bFilter': false, + 'bInfo': false + }); + + $('.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(); + $('ul > li').each(function(){ + var reg = new RegExp(searchText, 'gi'); + var currentLiText = $(this).text(); + var showCurrentLi = reg.test(currentLiText); + if (searchText){ + $(this).toggle(showCurrentLi); + } else { + $(this).hide(showCurrentLi); + $('#fram-'+$( '#select-framework' ).val()).show(); + } + }); + }); + + + function treed(o){ + var openedClass = 'glyphicon-minus-sign'; + var closedClass = 'glyphicon-plus-sign'; + + if (typeof o != 'undefined'){ + if (typeof o.openedClass != 'undefined'){ + openedClass = o.openedClass; + } + if (typeof o.closedClass != 'undefined'){ + closedClass = o.closedClass; + } + }; + //initialize each of the top levels + var tree = $('#tree3'); + tree.addClass("tree"); + tree.find('li').has("ul").each(function () { + var branch = $(this); //li with children ul + branch.prepend("<i class='indicator fa " + closedClass + "'></i>"); + branch.addClass('branch'); + branch.on('click', function (e) { + if (this == e.target) { + var icon = $(this).children('i:first'); + icon.toggleClass(openedClass + " " + closedClass); + $(this).children().children().toggle(); + } + }) + branch.children().children().toggle(); + }); +//fire event from the dynamically added icon + tree.find('.branch .indicator').each(function(){ + $(this).on('click', function () { + $(this).closest('li').click(); + }); + }); +//fire event to open branch if the li contains an anchor instead of text + tree.find('.branch>a').each(function () { + $(this).on('click', function (e) { + $(this).closest('li').click(); + e.preventDefault(); + }); + }); +//fire event to open branch if the li contains a button instead of text + tree.find('.branch>button').each(function () { + $(this).on('click', function (e) { + $(this).closest('li').click(); + e.preventDefault(); + }); + }); + } + + +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) + + // c[2].setAttribute("style", "display:none"); + + } + + 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 supprimer_lien(obj) { + var t = obj.parentNode; + var p = t.parentNode; + var c = p.children; + + c[0].setAttribute("style", "display:none"); + 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, '' ); + + var competency_id = div_id.split('-')[1]; + 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}, + url: url, + timeout: 10000, + contentType: 'application/x-www-form-urlencoded', + success: function (data, status) { + if (status == "success") { + // console.log(status); + // console.log(data); + //changeColor(p); + } + }, + error: function (xhr, status, error) { + alert(status); + } + }); + +} + +function supprimer_lien_cpt(cpt_id) { + var res = window.confirm('Etes-vous sûr de vouloir supprimer cette compétence de ce cours ?'); + if (res) { + var info = []; + info[0] = "delete_cpt" ; + info[1] = "7" ; + info[2] = cpt_id ; + $.ajax({ + type: "POST", + data: {info:info}, + url: window.location.href, + timeout: 10000, + contentType: 'application/x-www-form-urlencoded', + success: function (data, status) { + if (status == "success" && data != false) { + location.reload() + } + }, + error: function (xhr, status, error) { + alert(status); + } + }); + } +} + + +function select_update(obj){ + var t = obj.parentNode; + var p = t.parentNode; + var c = p.children; + + c[0].setAttribute("style", "display:inline"); + c[1].setAttribute("style", "display:none"); + c[2].setAttribute("style", "display:inline"); + + c[2].dataset.edit = 'editOff'; + + var tab0_elem = c[1].children; + var select = tab0_elem[0]; + + var choix_ruleoutcome =select.value; + + var select_id =select.id; + + var module_id = select_id.split('-')[0]; + module_id = module_id.replace ( /[^\d.]/g, '' ); + + var competency_id = select_id.split('-')[1]; + competency_id = competency_id.replace ( /[^\d.]/g, '' ); + + var url = window.location.href; + + var info = []; + info[0] = module_id ; + info[1] = competency_id ; + info[2] = choix_ruleoutcome ; + + $.ajax({ + type: "POST", + data: {info:info}, + url: url, + timeout: 10000, + contentType: 'application/x-www-form-urlencoded', + success: function (data, status) { + if (status == "success"){ + var renderer = data.split("/")[1]; + var switchColor = data.split("/")[0]; + /*if (!(switchColor.trim() == "update")){ + changeColor(p); + }*/ + var div_id = c[0].id; + document.getElementById(div_id).firstChild.nextSibling.textContent = renderer; + } + + }, + error: function (xhr, status, error) + { + alert(status); + } + }); + + +} + + +function changeColor(obj) +{ + // if (obj.getAttibute('class').indexOf('text-success') > -1) { + // obj.setAttibute('class', 'text-success'); + // } else { + // obj.setAttibute('class', obj.getAttibute('class').replace('text-success', '')); + // } +// newColor = (obj.getAttibute('class').indexOf('text-success') > -1) ? '#28afa3' : ''; +// obj.style.backgroundColor = newColor; +} + + diff --git a/renderer.php b/renderer.php new file mode 100644 index 0000000000000000000000000000000000000000..d56f5afbda329efc7e0271df6c50b27346eae152 --- /dev/null +++ b/renderer.php @@ -0,0 +1,78 @@ +<?php +/* + * @package block_career + */ + +class block_competency_iena_renderer extends plugin_renderer_base { + function get_career_list(){ + global $DB, $CFG, $COURSE, $USER; + if (!has_capability('moodle/course:update', $context = context_course::instance($COURSE->id), $USER->id)) { + $link = $CFG->wwwroot . '/course/view.php?id=' . $COURSE->id; + header("Location: {$link}"); + exit; + } + $listtitle=get_string('list_title', 'block_career'); + $headingplugin=get_string('heading_plugin', 'block_career'); + $addpath=get_string('add_path', 'block_career'); + $path=$CFG->wwwroot.'/blocks/career/career_setting.php?courseid='.$COURSE->id; + $request = $DB->get_records_sql('SELECT * FROM {block_career} WHERE course = ?', array($_GET["courseid"])); + $courseid=$_GET['courseid']; + $careerlist=array(); + if (empty($request)) { + $emptycareer=get_string('any_carrer', 'block_career'); + $careerlist=false; + $list=['list_title'=>$listtitle, 'heading_plugin'=>$headingplugin,'empty_career'=>$emptycareer,'add_path'=>$addpath, 'path'=>$path,'course_id'=>$courseid]; + } + else { + foreach ($request as $value){ + $careerpath=$CFG->wwwroot.'/blocks/career/career_setting.php?courseid='.$_GET["courseid"].'&pathid='.$value->id; + array_push($careerlist,array('name'=>$value->name,'description'=>$value->description)); + } + $list=['list_title'=>$listtitle, 'heading_plugin'=>$headingplugin,'add_path'=>$addpath, 'path'=>$path,'career_path'=>$careerpath, 'course_id'=>$courseid,'career_list'=>$careerlist]; + + } + //print_r($careerlist); + echo $this->render_from_template('block_career/career_list', $list); + } + function get_career_header($pathid){ + global $DB, $CFG, $COURSE, $USER; + $aboutcareer=get_string('about_this_career','block_career'); + $request = $DB->get_record('block_career',array('id' => $pathid)); + $description=$request->description; + $list=array('about_this_career'=>$aboutcareer,'description'=>$description); + echo $this->render_from_template('block_career/career_header', $list); + } + + function get_career_section($careerId){ + global $DB, $CFG, $COURSE, $USER,$SITE; + $requete = $DB->get_record_sql('SELECT * FROM {block_career} WHERE id = ?', array($careerId)); + $courseid=$requete->course; + $elements = $requete->ressources; + $elements = explode(',', $elements); + $sections = array(); + $ressources = array(); + $i = 0; + foreach ($elements as $value) { + + $ressource = new block_career_ressource(); + $ressource->get_ressource_by_id($value); + $index=array_search($ressource->section->id, array_column($sections, 'id')); + if($index== false){ + array_push($sections,$ressource->section->export_for_template($this)); + $index=count($sections)-1; + } + + array_push($sections[$index]->ressources, $ressource->export_for_template($this)); + + } + + + $link=$CFG->wwwroot.'/blocks/career/career_setting.php?courseid='.$requete->course.'&pathid='.$requete->id; + $list =['lien'=>false,'edit_path_link'=>$link,'edit_path'=>get_string('edit_path', 'block_career'), 'sections'=>$sections]; + echo $this->render_from_template('block_career/sections', $list); + } + + function get_competency_matrix($data){ + echo $this->render_from_template('block_competency_iena/matrix_competencies', $data); + } +} diff --git a/templates/matrix_competencies.mustache b/templates/matrix_competencies.mustache new file mode 100644 index 0000000000000000000000000000000000000000..cdf7f1440ccff30143c49fbd366d1099bac354ca --- /dev/null +++ b/templates/matrix_competencies.mustache @@ -0,0 +1,188 @@ +<h3>{{# str }} manage_comp, block_competency_iena{{/ str }}</h3> +<p>{{# str }} add_comment, block_competency_iena{{/ str }}</p> + +<table id="tab_mgmt" class="table-bordered display dataTable" style="width:100%" > +<thead> + <tr> + <th></th> + {{#competencies}} + <th style="max-width: 70px; overflow: hidden;""> + <i class="fa fa-remove icon-red-iena" style="font-size:24px;color:#dc493a" onclick='supprimer_lien_cpt({{id}})'></i> + <a href='{{link}}' style='color: black;'> + <p style="word-wrap: break-word;">{{#shortentext}} 45, {{shortname}}{{/shortentext}}</p> + </a> + </th> + {{/competencies}} + </tr> +</thead> +<tbody> + {{#sections}} + <tr> + <td class="bg-primary text-white"> + {{name}} + </td> + {{#competencies}} + <td class="td_section"></td> + {{/competencies}} + </tr> + {{#modules}} + <tr> + <td><a href="{{link}}">{{name}}</a></td> + {{#mcompetencies}} + <td class="text-success" align=right> + {{#module_ruleoutcomestring}} + <span style="display:inline" id="divmodule{{moduleid}}-competency{{id}}"> + <p style="margin:0">{{module_ruleoutcomestring}}</p> + + <i class="fa fa-remove icon-red-iena" style="font-size:24px;color:#dc493a" onclick='supprimer_lien(this)'></i> + + </span> + {{/module_ruleoutcomestring}} + {{^module_ruleoutcomestring}} + <span style="display:none" id="divmodule{{moduleid}}-competency{{id}}"> + <p style="margin:0">{{module_ruleoutcomestring}}</p> + + <i class="fa fa-remove icon-red-iena" style="font-size:24px;color:#dc493a" onclick='supprimer_lien(this)'></i> + + </span> + {{/module_ruleoutcomestring}} + <div style="display:none"> + <select id="selmodule{{moduleid}}-competence{{id}}""> + <option value="0">{{# str }} nothing, block_competency_iena{{/ str }}</option> + <option value="1">{{# str }} add_proof, block_competency_iena{{/ str }}</option> + <option value="2">{{# str }} send_valide, block_competency_iena{{/ str }}</option> + <option value="3">{{# str }} mark_ok_competency, block_competency_iena{{/ str }}</option> + </select> + + <i class="fa fa-check icon-green-iena" onclick='select_update(this)'></i> + </div> + <i class="fa fa-edit icon-blue-iena" data-edit='editOff' onclick='showFilter(this)'></i> + + </td> + {{/mcompetencies}} + </tr> + {{/modules}} + {{/sections}} +</tbody> +</table> + +<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 diff --git a/version.php b/version.php index c8826b28ad75c7992527568fa838ecdd8284b003..6a3dc73307c00fb0ceb4552ffb935ccf9385042b 100644 --- a/version.php +++ b/version.php @@ -28,7 +28,7 @@ */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2019102400; +$plugin->version = 2020091500; $plugin->requires = 2014051200; $plugin->component = 'block_competency_iena'; $plugin->release = 'v1.0'; diff --git a/view/view_competency_iena_user.php b/view/view_competency_iena_user.php index b561c77f5b1bb19b895e51b53d56ad70c9319a12..8360e57a8e0acc4c8c48bddaff72f2b5a31ff7be 100644 --- a/view/view_competency_iena_user.php +++ b/view/view_competency_iena_user.php @@ -39,7 +39,7 @@ class view_competency_iena_user $competencyid = $_GET['competencyid']; //$id_student = $_GET['studentid']; - if ($_GET['studentid']) { + if (isset($_GET['studentid'])) { $tmpiduser = $_GET['studentid']; } else { $tmpiduser = $USER->id;