Merge branch 'master' of https://git.xdrm.io/ptut/vhost
This commit is contained in:
commit
9e96d7a84e
|
@ -154,23 +154,19 @@ class PDOWrapper extends \PDO
|
||||||
|
|
||||||
//find the given pattern in the request, then call our function and replace the matched string by the return value of our function
|
//find the given pattern in the request, then call our function and replace the matched string by the return value of our function
|
||||||
$finalStatement .= rtrim(preg_replace_callback("/(:[a-z_\-0-9]*)/is",function($matches) use (&$i,&$tempParametes){
|
$finalStatement .= rtrim(preg_replace_callback("/(:[a-z_\-0-9]*)/is",function($matches) use (&$i,&$tempParametes){
|
||||||
//get next number
|
|
||||||
$i++;
|
|
||||||
|
|
||||||
//delete the ':' at the beginning of the string
|
|
||||||
$tempKey = ltrim($matches[0],':');
|
|
||||||
|
|
||||||
//copy the parameter with the modified index
|
//copy the parameter with the modified index
|
||||||
$tempParametes[$tempKey.$i] = $tempParametes[$tempKey];
|
$tempParametes[":$i"] = $tempParametes[$matches[0]];
|
||||||
|
|
||||||
//delete the old index
|
//delete the old index
|
||||||
unset($tempParametes[$tempKey]);
|
unset($tempParametes[$matches[0]]);
|
||||||
|
|
||||||
//return the modified string for replacement
|
//return the modified string for replacement
|
||||||
return $matches[0].$i;
|
return ":".$i++;
|
||||||
},$statement),';').';';
|
},$statement),';').';';
|
||||||
|
|
||||||
$finalExecute = array_merge($finalExecute,$tempParametes);
|
$finalExecute += $tempParametes;
|
||||||
}
|
}
|
||||||
|
|
||||||
//disable stacking
|
//disable stacking
|
||||||
|
@ -184,6 +180,7 @@ class PDOWrapper extends \PDO
|
||||||
$req = $this->prepare($finalStatement);
|
$req = $this->prepare($finalStatement);
|
||||||
|
|
||||||
$success = $req->execute($finalExecute);
|
$success = $req->execute($finalExecute);
|
||||||
|
|
||||||
//as we execute multiple query that we don't fetch, we have to close the cursor if we want to do other requests later
|
//as we execute multiple query that we don't fetch, we have to close the cursor if we want to do other requests later
|
||||||
$req->closeCursor();
|
$req->closeCursor();
|
||||||
$this->commit();
|
$this->commit();
|
||||||
|
|
|
@ -195,9 +195,9 @@ class ue extends Repo_i {
|
||||||
IFNULL(formlist.nbrCours,0) nbrCours,
|
IFNULL(formlist.nbrCours,0) nbrCours,
|
||||||
IFNULL(formlist.nbrTD,0) nbrTD,
|
IFNULL(formlist.nbrTD,0) nbrTD,
|
||||||
IFNULL(formlist.nbrTP,0) nbrTP,
|
IFNULL(formlist.nbrTP,0) nbrTP,
|
||||||
IFNULL(formlist.modCours,1) modCours,
|
IFNULL(formlist.modCours,0) modCours,
|
||||||
IFNULL(formlist.modTD,1) modTD,
|
IFNULL(formlist.modTD,0) modTD,
|
||||||
IFNULL(formlist.modTP,1) modTP,
|
IFNULL(formlist.modTP,0) modTP,
|
||||||
IFNULL(formlist.nbrProfCours,0) nbrProfCours,
|
IFNULL(formlist.nbrProfCours,0) nbrProfCours,
|
||||||
IFNULL(formlist.nbrProfTD,0) nbrProfTD,
|
IFNULL(formlist.nbrProfTD,0) nbrProfTD,
|
||||||
IFNULL(formlist.nbrProfTP,0) nbrProfTP
|
IFNULL(formlist.nbrProfTP,0) nbrProfTP
|
||||||
|
|
|
@ -1,41 +1,42 @@
|
||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div id='CONTAINER' class='list'>
|
<div id='CONTAINER' class='list'>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg">
|
<svg xmlns="http://www.w3.org/2000/svg" :viewBox="gstore.viewBox">
|
||||||
<path
|
<template v-if="gstore.dimensions">
|
||||||
:d="'m ' + (gstore.dimensions.padding + gstore.dimensions.text.size) + ',' + (gstore.dimensions.padding) + ' ' +
|
<path
|
||||||
|
:d="'m ' + (gstore.dimensions.padding + gstore.dimensions.text.size) + ',' + (gstore.dimensions.padding) + ' ' +
|
||||||
'0,' + (gstore.dimensions.axis.height + gstore.dimensions.padding) + ' ' +
|
'0,' + (gstore.dimensions.axis.height + gstore.dimensions.padding) + ' ' +
|
||||||
(gstore.dimensions.axis.width) + ',0'"></path>
|
(gstore.dimensions.axis.width) + ',0'"></path>
|
||||||
<text
|
<text
|
||||||
class="precision"
|
|
||||||
:x="gstore.dimensions.padding + gstore.dimensions.text.size"
|
|
||||||
:y="gstore.dimensions.text.alignV + gstore.dimensions.axis.height + gstore.dimensions.padding">0</text>
|
|
||||||
<template v-for="i in gstore.dimensions.axis.precision">
|
|
||||||
<path
|
|
||||||
class="precision"
|
class="precision"
|
||||||
:d="'m ' + (gstore.dimensions.padding + gstore.dimensions.text.size + (i*gstore.dimensions.axis.width/gstore.dimensions.axis.precision)) + ',' + (gstore.dimensions.padding) + ' ' +
|
:x="gstore.dimensions.padding + gstore.dimensions.text.size"
|
||||||
|
:y="gstore.dimensions.text.alignV + gstore.dimensions.axis.height + gstore.dimensions.padding">0</text>
|
||||||
|
<template v-for="i in gstore.dimensions.axis.precision">
|
||||||
|
<path
|
||||||
|
class="precision"
|
||||||
|
:d="'m ' + (gstore.dimensions.padding + gstore.dimensions.text.size + (i*gstore.dimensions.axis.width/gstore.dimensions.axis.precision)) + ',' + (gstore.dimensions.padding) + ' ' +
|
||||||
'0,' + (gstore.dimensions.axis.height+gstore.dimensions.padding) + ' '"></path>
|
'0,' + (gstore.dimensions.axis.height+gstore.dimensions.padding) + ' '"></path>
|
||||||
<text
|
<text
|
||||||
class="precision"
|
class="precision"
|
||||||
:x="gstore.dimensions.padding + gstore.dimensions.text.size + (i*gstore.dimensions.axis.width/gstore.dimensions.axis.precision)"
|
:x="gstore.dimensions.padding + gstore.dimensions.text.size + (i*gstore.dimensions.axis.width/gstore.dimensions.axis.precision)"
|
||||||
:y="gstore.dimensions.text.alignV + gstore.dimensions.axis.height + gstore.dimensions.padding">{{ i*gstore.maxValue/gstore.dimensions.axis.precision }}</text>
|
:y="gstore.dimensions.text.alignV + gstore.dimensions.axis.height + gstore.dimensions.padding">{{ i*gstore.maxValue/gstore.dimensions.axis.precision }}</text>
|
||||||
|
</template>
|
||||||
|
<template v-for="(value, key, i) in gstore.stats">
|
||||||
|
<text
|
||||||
|
:x="gstore.dimensions.text.size + gstore.dimensions.padding - gstore.dimensions.text.alignH"
|
||||||
|
:y="i*(gstore.dimensions.bin.width + gstore.dimensions.bin.spacing) + gstore.dimensions.padding + gstore.dimensions.text.alignV"
|
||||||
|
>{{ key }}</text>
|
||||||
|
<rect
|
||||||
|
:class="gstore.colors[i] + ' hiding'"
|
||||||
|
:x="gstore.dimensions.text.size + gstore.dimensions.padding + 1"
|
||||||
|
:y="i*(gstore.dimensions.bin.width+gstore.dimensions.bin.spacing) + gstore.dimensions.padding"
|
||||||
|
:height="gstore.dimensions.bin.width"
|
||||||
|
:width="gstore.dimensions.bin.margin + (gstore.dimensions.axis.width * value)/gstore.maxValue"
|
||||||
|
:data-info="value">
|
||||||
|
<title>{{ (gstore.titles && gstore.titles[key]) ? value + ' ' + gstore.titles[key] : value }}</title>
|
||||||
|
</rect>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(value, key, i) in gstore.stats">
|
|
||||||
<text
|
|
||||||
:x="gstore.dimensions.text.size + gstore.dimensions.padding - gstore.dimensions.text.alignH"
|
|
||||||
:y="i*(gstore.dimensions.bin.width + gstore.dimensions.bin.spacing) + gstore.dimensions.padding + gstore.dimensions.text.alignV"
|
|
||||||
>{{ key }}</text>
|
|
||||||
<rect
|
|
||||||
:class="gstore.colors[i] + ' hiding'"
|
|
||||||
:x="gstore.dimensions.text.size + gstore.dimensions.padding + 1"
|
|
||||||
:y="i*(gstore.dimensions.bin.width+gstore.dimensions.bin.spacing) + gstore.dimensions.padding"
|
|
||||||
:height="gstore.dimensions.bin.width"
|
|
||||||
:width="gstore.dimensions.bin.margin + (gstore.dimensions.axis.width * value)/gstore.maxValue"
|
|
||||||
:data-info="value">
|
|
||||||
<title>{{ value }}</title>
|
|
||||||
</rect>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<section>bla</section>
|
<section>bla</section>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/* (1) Load statistics
|
/* (1) Load statistics
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
/* (1) Initialize list */
|
/* (1) Initialize list */
|
||||||
gstore.add('stats', []);
|
gstore.add('stats', null);
|
||||||
gstore.add('dimensions', null);
|
gstore.add('dimensions', null);
|
||||||
|
|
||||||
/* (2) Get statistics */
|
/* (2) Get statistics */
|
||||||
|
@ -13,31 +13,40 @@ api.call('GET department/stats', {}, function(rs) {
|
||||||
return console.log('No formation found, error: ' + rs.error);
|
return console.log('No formation found, error: ' + rs.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
let maxValue = null;
|
let maxValue = null; // plus haute valeur des stats
|
||||||
let maxKeyLength = null;
|
let maxLabelLength = null; // plus longues chaîne de caractères pour les stats
|
||||||
let data = {};
|
let data = {}; // ensemble des statistiques à transmettre à VueJS
|
||||||
let map = {
|
let map = {
|
||||||
"potentiel" : "Heures dûes",
|
"potentiel" : "Heures potentielles",
|
||||||
"sous_service" : "Heures à faire",
|
"sous_service" : "Heures en sous-services",
|
||||||
"heures_comp" : "Heures comp.",
|
"heures_comp" : "Heures comp.",
|
||||||
"heures_vacataire" : "Heures vacataires",
|
"heures_vacataire" : "Heures vacataires",
|
||||||
"heures_exterieur" : "Heures extérieurs",
|
"heures_exterieur" : "Heures à l'extérieurs",
|
||||||
"heures_ue_desactive" : "Heures UE annulées",
|
"heures_ue_desactive" : "Heures UE annulées",
|
||||||
"nbr_ue_desactive" : "Nombre d'UE annulées"
|
"nbr_ue_desactive" : "Nombre d'UE annulées"
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let stat in rs.data) {
|
for (let stat in rs.data) {
|
||||||
|
// détection de la plus grande valeur statistique
|
||||||
maxValue = rs.data[stat] > maxValue ? rs.data[stat] : maxValue;
|
maxValue = rs.data[stat] > maxValue ? rs.data[stat] : maxValue;
|
||||||
maxKeyLength = stat.length > maxKeyLength ? stat.length : maxKeyLength;
|
// détection du plus grand nom présent
|
||||||
|
maxLabelLength = map[stat].length > maxLabelLength ? map[stat].length : maxLabelLength;
|
||||||
|
|
||||||
data[map[stat]] = Math.round(rs.data[stat] * 100) / 100;
|
data[map[stat]] = Math.round(rs.data[stat] * 100) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// légendes à afficher en plus de la valeur
|
||||||
|
gstore.get.titles = {};
|
||||||
|
gstore.get.titles[map['heures_ue_desactive']] = `sur ${data[map['nbr_ue_desactive']]} UE annulées`;
|
||||||
|
|
||||||
|
// statistiques à ne pas afficher
|
||||||
|
delete data[map['nbr_ue_desactive']];
|
||||||
|
|
||||||
gstore.get.stats = data;
|
gstore.get.stats = data;
|
||||||
gstore.get.dimensions = {
|
gstore.get.dimensions = {
|
||||||
padding: 5,
|
padding: 5,
|
||||||
text: {
|
text: {
|
||||||
size: maxKeyLength * 9.5,
|
size: maxLabelLength * 8.5,
|
||||||
alignH: 5,
|
alignH: 5,
|
||||||
alignV: 20,
|
alignV: 20,
|
||||||
},
|
},
|
||||||
|
@ -62,6 +71,8 @@ api.call('GET department/stats', {}, function(rs) {
|
||||||
width: 500,
|
width: 500,
|
||||||
precision: 4
|
precision: 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gstore.get.viewBox = `0 0 ${gstore.get.dimensions.axis.width + gstore.get.dimensions.text.size + 50} ${gstore.get.dimensions.axis.height + 30}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
gstore.add('colors', ["blue", "yellow", "green", "red", "purple", "lightblue", "lightred", "lightyellow", "lightgreen", "lightpurple"]);
|
gstore.add('colors', ["blue", "yellow", "green", "red", "purple", "lightblue", "lightred", "lightyellow", "lightgreen", "lightpurple"]);
|
|
@ -43,7 +43,7 @@ window.cas_callback = function(cas_login){
|
||||||
// re-activate button
|
// re-activate button
|
||||||
gstore.add('popup_opened', false);
|
gstore.add('popup_opened', false);
|
||||||
|
|
||||||
setTimeout(function(){ gstore.get.login_class = 'neutral'; }, 1500);
|
setTimeout(function(){ gstore.get.login_class = 'neutral'; }, 3000);
|
||||||
|
|
||||||
/* (4) If error code -> display error */
|
/* (4) If error code -> display error */
|
||||||
}else if( !isNaN(cas_login) ){
|
}else if( !isNaN(cas_login) ){
|
||||||
|
@ -71,7 +71,7 @@ window.cas_callback = function(cas_login){
|
||||||
// re-activate button
|
// re-activate button
|
||||||
gstore.add('popup_opened', false);
|
gstore.add('popup_opened', false);
|
||||||
|
|
||||||
setTimeout(function(){ gstore.get.login_class = 'neutral'; }, 1500);
|
setTimeout(function(){ gstore.get.login_class = 'neutral'; }, 3000);
|
||||||
|
|
||||||
/* (4) If login -> reload page */
|
/* (4) If login -> reload page */
|
||||||
}else{
|
}else{
|
||||||
|
@ -81,7 +81,7 @@ window.cas_callback = function(cas_login){
|
||||||
|
|
||||||
var redirect_url = `/${gstore.get.URI.join('/')}`;
|
var redirect_url = `/${gstore.get.URI.join('/')}`;
|
||||||
|
|
||||||
setTimeout(function(){ document.location = redirect_url; }, 1500);
|
setTimeout(function(){ document.location = redirect_url; }, 3000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ $svg-lightpurple: #994499;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
|
|
||||||
width: 50em;
|
width: 100%;
|
||||||
height: 20em;
|
height: 30vh;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
-webkit-touch-callout: none; /* iOS Safari */
|
-webkit-touch-callout: none; /* iOS Safari */
|
||||||
-webkit-user-select: none; /* Safari */
|
-webkit-user-select: none; /* Safari */
|
||||||
|
|
Loading…
Reference in New Issue