0&&(q=1e5/Math.pow(10,v),r=a.substring(f,f+v),w=parseFloat(r)*q,s=a.substring(f+v),x=parseFloat(s)*q),t=w+j,u=x+l,{easting:t,northing:u,zoneLetter:h,zoneNumber:g,accuracy:q}}function n(a,b){for(var c=r.charCodeAt(b-1),d=1e5,e=!1;c!==a.charCodeAt(0);){if(c++,c===u&&c++,c===v&&c++,c>x){if(e)throw"Bad character: "+a;c=t,e=!0}d+=1e5}return d}function o(a,b){if(a>"V")throw"MGRSPoint given invalid Northing "+a;for(var c=s.charCodeAt(b-1),d=0,e=!1;c!==a.charCodeAt(0);){if(c++,c===u&&c++,c===v&&c++,c>w){if(e)throw"Bad character: "+a;c=t,e=!0}d+=1e5}return d}function p(a){var b;switch(a){case"C":b=11e5;break;case"D":b=2e6;break;case"E":b=28e5;break;case"F":b=37e5;break;case"G":b=46e5;break;case"H":b=55e5;break;case"J":b=64e5;break;case"K":b=73e5;break;case"L":b=82e5;break;case"M":b=91e5;break;case"N":b=0;break;case"P":b=8e5;break;case"Q":b=17e5;break;case"R":b=26e5;break;case"S":b=35e5;break;case"T":b=44e5;break;case"U":b=53e5;break;case"V":b=62e5;break;case"W":b=7e6;break;case"X":b=79e5;break;default:b=-1}if(b>=0)return b;throw"Invalid zone letter: "+a}var q=6,r="AJSAJS",s="AFAFAF",t=65,u=73,v=79,w=86,x=90;c.forward=function(a,b){return b=b||5,i(f({lat:a[1],lon:a[0]}),b)},c.inverse=function(a){var b=g(m(a.toUpperCase()));return[b.left,b.bottom,b.right,b.top]},c.toPoint=function(a){var b=c.inverse(a);return[(b[2]+b[0])/2,(b[3]+b[1])/2]}},{}],68:[function(a,b,c){b.exports={name:"proj4",version:"2.3.6",description:"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",main:"lib/index.js",directories:{test:"test",doc:"docs"},scripts:{test:"./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js"},repository:{type:"git",url:"git://github.com/proj4js/proj4js.git"},author:"",license:"MIT",jam:{main:"dist/proj4.js",include:["dist/proj4.js","README.md","AUTHORS","LICENSE.md"]},devDependencies:{"grunt-cli":"~0.1.13",grunt:"~0.4.2","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~0.8.0",chai:"~1.8.1",mocha:"~1.17.1","grunt-mocha-phantomjs":"~0.4.0",browserify:"~3.24.5","grunt-browserify":"~1.3.0","grunt-contrib-uglify":"~0.3.2",curl:"git://github.com/cujojs/curl.git",istanbul:"~0.2.4",tin:"~0.4.0"},dependencies:{mgrs:"0.0.0"}}},{}],"./includedProjections":[function(a,b,c){b.exports=a("hTEDpn")},{}],hTEDpn:[function(a,b,c){var d=[a("./lib/projections/tmerc"),a("./lib/projections/utm"),a("./lib/projections/sterea"),a("./lib/projections/stere"),a("./lib/projections/somerc"),a("./lib/projections/omerc"),a("./lib/projections/lcc"),a("./lib/projections/krovak"),a("./lib/projections/cass"),a("./lib/projections/laea"),a("./lib/projections/aea"),a("./lib/projections/gnom"),a("./lib/projections/cea"),a("./lib/projections/eqc"),a("./lib/projections/poly"),a("./lib/projections/nzmg"),a("./lib/projections/mill"),a("./lib/projections/sinu"),a("./lib/projections/moll"),a("./lib/projections/eqdc"),a("./lib/projections/vandg"),a("./lib/projections/aeqd")];b.exports=function(proj4){d.forEach(function(a){proj4.Proj.projections.add(a)})}},{"./lib/projections/aea":40,"./lib/projections/aeqd":41,"./lib/projections/cass":42,"./lib/projections/cea":43,"./lib/projections/eqc":44,"./lib/projections/eqdc":45,"./lib/projections/gnom":47,"./lib/projections/krovak":48,"./lib/projections/laea":49,"./lib/projections/lcc":50,"./lib/projections/mill":53,"./lib/projections/moll":54,"./lib/projections/nzmg":55,"./lib/projections/omerc":56,"./lib/projections/poly":57,"./lib/projections/sinu":58,"./lib/projections/somerc":59,"./lib/projections/stere":60,"./lib/projections/sterea":61,"./lib/projections/tmerc":62,"./lib/projections/utm":63,"./lib/projections/vandg":64}]},{},[36])(36)});
\ No newline at end of file
diff --git a/ProjetProgWeb/charts.js b/ProjetProgWeb/charts.js
index 6916f7a..d8ac275 100644
--- a/ProjetProgWeb/charts.js
+++ b/ProjetProgWeb/charts.js
@@ -1,6 +1,7 @@
let chart1State = false
let chart2State = false
let chart3State = false
+let mapState = false
function initYearsChart(results) {
let categories = []
@@ -68,6 +69,7 @@ function initYearsChart(results) {
})
chart1State = true
+ console.log("chargment graphique 1 terminé")
}
function initDisciplinesChart(results) {
@@ -119,7 +121,7 @@ function initEstablishmentsChart(results) {
let disc = Object.keys(elem)[0]
let obj = {
"name" : disc,
- "y" : parseInt(elem[disc])
+ "y" : parseInt(elem[disc]['number'])
}
data.push(obj)
})
@@ -152,6 +154,70 @@ function initEstablishmentsChart(results) {
})
chart3State = true
+ console.log("chargment graphique 3 terminé")
+}
+
+function initMapVisuals(data) {
+ const H = Highcharts, map = H.maps['countries/fr/fr-all'];
+
+ Highcharts.mapChart('map', {
+ "title": {
+ "text": "Nombre de thèses soutenues par établissements et leur géolocalisation"
+ },
+ "tooltip": {
+ "pointFormat": "{point.name}
" +
+ "Thèses: {point.z}"
+ },
+ "series": [{
+ "name": "Basemap",
+ "mapData": map,
+ "showInLegend": false
+ }, {
+ "name": "Separators",
+ "type": "mapline",
+ "showInLegend": false
+ }, {
+ "type": "mapbubble",
+ "dataLabels": {
+ "enabled": true,
+ "format": "{point.capital}"
+ },
+ "name": "Établissements",
+ "data": data
+ }]
+ });
+ mapState = true
+ console.log("chargement map terminé (les ID des établissements sont complètement cassés dans mon jeu de donnée)")
+}
+
+function initMap(results) {
+ let i = 0
+ let result = []
+
+ results.data.forEach(elem => {
+ let establishment = Object.keys(elem)[0]
+ let id = parseInt(elem[establishment]['ID'])
+ let number = parseInt(elem[establishment]['number'])
+
+ fetch(`https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-principaux-etablissements-enseignement-superieur&q=${id}&rows=10&fileds=identifiant_idref&fields=identifiant_idref,coordonnees`)
+ .then(response => response.json())
+ .then(data => {
+ if (data["records"].length > 0) {
+ let coordinates = data["records"][0]["fields"]["coordonnees"]
+ let obj = {
+ "name": establishment,
+ "lat": coordinates[0],
+ "lon": coordinates[1],
+ "z": number
+ }
+ result.push(obj)
+ }
+ i += 1
+ if (i === 10) {
+ initMapVisuals(result)
+ }
+ })
+ })
}
function initCharts(search, option) {
@@ -171,12 +237,13 @@ function initCharts(search, option) {
.then(response => response.json())
.then(results => {
initEstablishmentsChart(results)
+ initMap(results)
})
let waitForChartsToLoad = setInterval(function() {
- if (chart1State && chart2State && chart2State) {
+ if (chart1State && chart2State && chart2State && mapState) {
chartsState = true
clearInterval(waitForChartsToLoad);
}
}, 100)
-}
\ No newline at end of file
+}
diff --git a/ProjetProgWeb/class/dump.php b/ProjetProgWeb/class/dump.php
index 1684501..c8293ca 100644
--- a/ProjetProgWeb/class/dump.php
+++ b/ProjetProgWeb/class/dump.php
@@ -254,6 +254,7 @@ class dump {
return $disciplines_array;
}
+ // SET sql_mode=''; au lieu de SET sql_mode='ONLY_FULL_GROUP_BY';
public static function getThesesEstablishments(string $search, string $option) : array {
$establishments_array = [];
@@ -265,19 +266,20 @@ class dump {
$stmt = match ($option) {
'auto' => $pdo->prepare("
SELECT soutenance_establishment AS Establishment,
- COUNT(soutenance_establishment) AS Number
+ COUNT(soutenance_establishment) AS Number,
+ id_establishment AS ID
FROM theses
WHERE author LIKE :search
OR title LIKE :search
OR these_director LIKE :search
+ OR soutenance_establishment LIKE :search
GROUP BY Establishment
- ORDER BY `Number` DESC
- LIMIT 10;
+ ORDER BY Number DESC LIMIT 10
"),
- 'author' => $pdo->prepare("SELECT soutenance_establishment AS Establishment, COUNT(soutenance_establishment) AS Number FROM theses WHERE author LIKE :search GROUP BY Establishment ORDER BY `Number` DESC LIMIT 10;"),
- 'title' => $pdo->prepare("SELECT soutenance_establishment AS Establishment, COUNT(soutenance_establishment) AS Number FROM theses WHERE title LIKE :search GROUP BY Establishment ORDER BY `Number` DESC LIMIT 10;"),
- 'director' => $pdo->prepare("SELECT soutenance_establishment AS Establishment, COUNT(soutenance_establishment) AS Number FROM theses WHERE these_director LIKE :search GROUP BY Establishment ORDER BY `Number` DESC LIMIT 10;"),
- 'establishment' => $pdo->prepare("SELECT soutenance_establishment AS Establishment, COUNT(soutenance_establishment) AS Number FROM theses WHERE soutenance_establishment LIKE :search GROUP BY Establishment ORDER BY `Number` DESC LIMIT 10;"),
+ 'author' => $pdo->prepare("SELECT soutenance_establishment AS Establishment, COUNT(soutenance_establishment) AS Number, id_establishment AS ID FROM theses WHERE author LIKE :search GROUP BY Establishment ORDER BY `Number` DESC LIMIT 10;"),
+ 'title' => $pdo->prepare("SELECT soutenance_establishment AS Establishment, COUNT(soutenance_establishment) AS Number, id_establishment AS ID FROM theses WHERE title LIKE :search GROUP BY Establishment ORDER BY `Number` DESC LIMIT 10;"),
+ 'director' => $pdo->prepare("SELECT soutenance_establishment AS Establishment, COUNT(soutenance_establishment) AS Number, id_establishment AS ID FROM theses WHERE these_director LIKE :search GROUP BY Establishment ORDER BY `Number` DESC LIMIT 10;"),
+ 'establishment' => $pdo->prepare("SELECT soutenance_establishment AS Establishment, COUNT(soutenance_establishment) AS Number, id_establishment AS ID FROM theses WHERE soutenance_establishment LIKE :search GROUP BY Establishment ORDER BY `Number` DESC LIMIT 10;"),
default => "",
};
@@ -287,7 +289,10 @@ class dump {
$i = 0;
while ($obj = $stmt->fetchObject()) {
$establishments_array[$i] = array(
- $obj->Establishment => $obj->Number
+ $obj->Establishment => array(
+ "number" => $obj->Number,
+ "ID" => $obj->ID
+ )
);
$i++;
}
diff --git a/ProjetProgWeb/index.php b/ProjetProgWeb/index.php
index 6ee95ec..5869a22 100644
--- a/ProjetProgWeb/index.php
+++ b/ProjetProgWeb/index.php
@@ -29,12 +29,6 @@
-
->