Maintenance Gitlab - Jeudi 09 Décembre 2021 à partir de 10h - Mises à jour de sécurité

Commit 42e2f138 authored by Lea's avatar Lea
Browse files

tracker_js_features

parent 072285df
/**
* Handle add/remove competency links.
*
* @module block/career
* @package career
* @module block_career/suivi
* @package block_career
* @copyright 2021 Léa Marais
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
function($, ajax, templates, str) {
var all_selected=false;
var data=[];
return{
registerFilters:function(){
$("#path-select").on('change', function(e){
changePath();
});
function($, ajax, templates, str) {
var all_selected=false;
var data=[];
return{
registerFilters:function(){
$("#path-select").on('change', function(e){
changePath();
});
},
}
function getOption(){
return ("#path-select").val();
}
function getCompleteUrl(){
url=window.location.search;
urlParams = new URLSearchParams(url);
courseid=urlParams.get('courseid');
pathid=urlParams.get('courseid');
if (!pathid){
pathid=$("#path-select").val();
}
completeUrl='career_tracker.php?courseid='+courseid+'&pathid='+pathid;
return completeUrl;
}
function changeGroup(){
completeUrl=getCompleteUrl();
loadMessage("loading");
$.ajax({ url: completeUrl,
data: {action: 'test'},
type: 'post',
success: function(request) {
console.log(JSON.parse(request));
changeCompletion();
//reloadTable(JSON.parse(request));
}
});
function getCompleteUrl(){
url=window.location.search;
urlParams = new URLSearchParams(url);
courseid=urlParams.get('courseid');
completeUrl='career_tracker.php?courseid='+courseid;
return completeUrl;
}
function changePath(){
var select = $("#path-select").val();
var completeUrl=getCompleteUrl();
$.ajax({
url: completeUrl,
data: {pathid : select},
type: 'post',
success: function(request) {
$("#tracker").html(request);
}
function reloadTable(params){
console.log(params);
url=getCompleteUrl();
templates.render('block_career/career_table_tracker', params)
.done(function(html, js){
console.log("done done");
$("#partial-table").html(html);
templates.runTemplateJS(js);
window.history.pushState('suivi',"", url);
})
.fail(function(){
loadMessage("error");
});
}
\ No newline at end of file
});
}
});
\ No newline at end of file
......@@ -31,7 +31,7 @@ require_login($course, false, NULL);
$PAGE->set_title(get_string('title_plugin', 'block_career'));
$PAGE->set_heading($OUTPUT->heading($COURSE->fullname, 2, 'headingblock header outline'));
echo $OUTPUT->header();
// echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\">";
//$content = new view_career_list();
......@@ -40,10 +40,12 @@ if(!empty($id_path)){
$renderer->get_tracker($id_path);
}
else{
$PAGE->requires->js("/blocks/career/js/suivi_career.js");
//$PAGE->requires->js("/blocks/career/js/suivi_career.js");
//$id_path=getOption();
//print_r($_GET['pathfilter']);
//ici une valeur de parcours en brut pour pas avoir d'erreurs au chargement de la page
echo $OUTPUT->header();
$renderer->get_tracker(1);
echo $OUTPUT->footer();
}
echo $OUTPUT->footer();
console.log('Test');
\ No newline at end of file
<h2>{{track}}</h2>
<div id="tracker"><h2>{{track}}</h2>
{{^isset}}
<form style="clear: right;" class="form-inline" action="" method="GET">
......@@ -18,6 +19,7 @@
</form>
{{/isset}}
<table id="suivi">
<thead style ="height:100%;width:150%;overflow-x: hidden; ">
<tr id="modules">
......@@ -62,3 +64,12 @@
{{/students}}
</tbody>
</table>
</div>
{{#js}}
require(['block_career/suivi'], function(module) {
module.registerFilters();
});
{{/js}}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment