238 lines
8.2 KiB
PHP
238 lines
8.2 KiB
PHP
<?php
|
||
|
||
use Glpi\Event;
|
||
|
||
use function Docopt\dump;
|
||
|
||
include('../model_controller/fiche.resultat.evaluation.php');
|
||
include('../inc/utils.class.php');
|
||
|
||
|
||
Session::checkLoginUser();
|
||
if (Session::getCurrentInterface() == "helpdesk") {
|
||
Html::helpHeader("DRH", '', $_SESSION["glpiname"]);
|
||
} else {
|
||
Html::header("DRH", '', "", "");
|
||
}
|
||
|
||
|
||
$idUserCurrent = "";
|
||
if ($_SESSION['glpiactiveprofile']['name'] != "Super-Admin" && $_SESSION['glpiactiveprofile']['name'] != "DRH" && $_SESSION['glpiactiveprofile']['name'] != "Directeur RH" && $_SESSION['glpiactiveprofile']['name'] != "Charge Des Formations")
|
||
$idUserCurrent = $_SESSION["glpiID"];
|
||
|
||
$ficheEvaluation = getFicheEvaluation(24);
|
||
|
||
$root = $_SERVER['DOCUMENT_ROOT'] . $CFG_GLPI["root_doc"] . "/temp_sophal/";
|
||
|
||
|
||
$file_name = $root . $_SESSION["glpiID"] . ".json";
|
||
if (file_exists($file_name) == false) {
|
||
$resultatLignesFicheEvaluation = getResultatLignesFicheEvaluation(24, "");
|
||
|
||
$mainblocks = [];
|
||
foreach ($resultatLignesFicheEvaluation as $lignesFicheEvaluation) {
|
||
$blocks = [];
|
||
foreach ($lignesFicheEvaluation as $row) {
|
||
if ($row['id_parent'] == 0) {
|
||
$lignesblocks = [];
|
||
foreach ($lignesFicheEvaluation as $row2) {
|
||
if ($row['id_ligne_fiche_evaluation'] == $row2['id_parent'])
|
||
$lignesblocks[] = $row2;
|
||
}
|
||
$blocks[] = [$row, $lignesblocks];
|
||
}
|
||
}
|
||
$mainblocks[] = $blocks;
|
||
}
|
||
|
||
|
||
cache_write($file_name, json_encode($mainblocks));
|
||
} else {
|
||
$mainblocks = json_decode(cache_read($file_name), true);
|
||
}
|
||
|
||
if (isset($mainblocks)) {
|
||
if (sizeof($mainblocks) > 0) {
|
||
foreach ($mainblocks as $mainblock) {
|
||
resultannuel($mainblock);
|
||
}
|
||
echo"1";
|
||
}else{
|
||
echo"0";
|
||
}
|
||
}
|
||
|
||
function resultannuel($row_data)
|
||
{
|
||
//1. Performances
|
||
$linges_blocks = $row_data[0][0];
|
||
$score = 0;
|
||
$scorecount = 0;
|
||
$allscores = array();
|
||
foreach($row_data[1][1] as $data){
|
||
if($data["reponse"]!=""){
|
||
$notesarray = calculeNotes($score, $scorecount, getEvalScore($data["id_resultat_fiche_evaluation"],$data["id_ligne_fiche_evaluation"]));
|
||
$score = $notesarray[0];
|
||
$scorecount = $notesarray[1];
|
||
}
|
||
}
|
||
$scorecount = $scorecount == 0 ? 1 : $scorecount;
|
||
echo'Performances'."<br>";
|
||
echo $score/$scorecount."<br>";
|
||
echo$linges_blocks['id_candidat']."<br>";
|
||
echo$linges_blocks['id_resultat_fiche_evaluation']."<br>";
|
||
echo'<br><br>********************<br><br>';
|
||
insertScore($linges_blocks['id_candidat'],$linges_blocks['id_resultat_fiche_evaluation'],$score/$scorecount,$linges_blocks['reponse']);
|
||
// $allscores[] = $score/$scorecount;
|
||
|
||
// //2.1 AUTONOMIE ET CREATIVITE : Mesure le degré de liberté d’agir et de décider pour atteindre les objectifs fixés dans les délais prescrits
|
||
// $type = 2;
|
||
// $score = 0;
|
||
// $scorecount = 0;
|
||
// foreach($row_data[4][1] as $data){
|
||
// if($data["reponse"]!=""){
|
||
// $notesarray = calculeNotes($score, $scorecount, $data);
|
||
// $score = $notesarray[0];
|
||
// $scorecount = $notesarray[1];
|
||
// }
|
||
// }
|
||
// $scorecount = $scorecount == 0 ? 1 : $scorecount;
|
||
// echo'AUTONOMIE ET CREATIVITE'."<br>";
|
||
// echo $score/$scorecount."<br>";
|
||
// echo$linges_blocks['id_candidat']."<br>";
|
||
// echo$linges_blocks['id_resultat_fiche_evaluation']."<br>";
|
||
// echo'<br><br>********************<br><br>';
|
||
// $allscores[] = $score/$scorecount;
|
||
// // echo(insertScore($linges_blocks['id_candidat'],$type,$linges_blocks['id_resultat_fiche_evaluation'],$score/$scorecount))."<br>";
|
||
|
||
|
||
// //2.2 LA GESTION DES DIIFICULTES : capacité à collecter et analyser des informations, à résoudre des difficultés et à préparer et prendre des décisions
|
||
// $type = 3;
|
||
// $score = 0;
|
||
// $scorecount = 0;
|
||
// foreach($row_data[5][1] as $data){
|
||
// if($data["reponse"]!=""){
|
||
// $notesarray = calculeNotes($score, $scorecount, $data);
|
||
// $score = $notesarray[0];
|
||
// $scorecount = $notesarray[1];
|
||
// }
|
||
// }
|
||
// $scorecount = $scorecount == 0 ? 1 : $scorecount;
|
||
// echo'LA GESTION DES DIIFICULTES'."<br>";
|
||
// echo $score/$scorecount."<br>";
|
||
// echo$linges_blocks['id_candidat']."<br>";
|
||
// echo$linges_blocks['id_resultat_fiche_evaluation']."<br>";
|
||
// echo'<br><br>********************<br><br>';
|
||
// $allscores[] = $score/$scorecount;
|
||
// // echo(insertScore($linges_blocks['id_candidat'],$type,$linges_blocks['id_resultat_fiche_evaluation'],$score/$scorecount))."<br>";
|
||
|
||
// //2.3 DIMENSION RELATIONNELLE : aptitude à entrer en relation avec les personnes de son milieu de travail tout en les respectant
|
||
// $type = 4;
|
||
// $score = 0;
|
||
// $scorecount = 0;
|
||
// foreach($row_data[6][1] as $data){
|
||
// if($data["reponse"]!=""){
|
||
// $notesarray = calculeNotes($score, $scorecount, $data);
|
||
// $score = $notesarray[0];
|
||
// $scorecount = $notesarray[1];
|
||
// }
|
||
// }
|
||
// $scorecount = $scorecount == 0 ? 1 : $scorecount;
|
||
// echo'DIMENSION RELATIONNELLE'."<br>";
|
||
// echo $score/$scorecount."<br>";
|
||
// echo$linges_blocks['id_candidat']."<br>";
|
||
// echo$linges_blocks['id_resultat_fiche_evaluation']."<br>";
|
||
// echo'<br><br>********************<br><br>';
|
||
// $allscores[] = $score/$scorecount;
|
||
// // echo(insertScore($linges_blocks['id_candidat'],$type,$linges_blocks['id_resultat_fiche_evaluation'],$score/$scorecount))."<br>";
|
||
|
||
// //2.4 LA COMPETENCE, LES CONNAISSANCES REQUISES : savoir-faire nécessaires pour remplir les missions principales de la fonction.
|
||
// $type = 5;
|
||
// $score = 0;
|
||
// $scorecount = 0;
|
||
// foreach($row_data[7][1] as $data){
|
||
// if($data["reponse"]!=""){
|
||
// $notesarray = calculeNotes($score, $scorecount, $data);
|
||
// $score = $notesarray[0];
|
||
// $scorecount = $notesarray[1];
|
||
// }
|
||
// }
|
||
// $scorecount = $scorecount == 0 ? 1 : $scorecount;
|
||
// echo'LA COMPETENCE, LES CONNAISSANCES REQUISES'."<br>";
|
||
// echo $score/$scorecount."<br>";
|
||
// echo$linges_blocks['id_candidat']."<br>";
|
||
// echo$linges_blocks['id_resultat_fiche_evaluation']."<br>";
|
||
// echo'<br><br>********************<br><br>';
|
||
// $allscores[] = $score/$scorecount;
|
||
// // echo(insertScore($linges_blocks['id_candidat'],$type,$linges_blocks['id_resultat_fiche_evaluation'],$score/$scorecount))."<br>";
|
||
|
||
// //2.5 Responsabilité : capacité de mesurer la portée de ses actions et d’assumer les conséquences de ses actes
|
||
// $type = 6;
|
||
// $score = 0;
|
||
// $scorecount = 0;
|
||
// foreach($row_data[8][1] as $data){
|
||
// if($data["reponse"]!=""){
|
||
// $notesarray = calculeNotes($score, $scorecount, $data);
|
||
// $score = $notesarray[0];
|
||
// $scorecount = $notesarray[1];
|
||
// }
|
||
// }
|
||
// $scorecount = $scorecount == 0 ? 1 : $scorecount;
|
||
// echo'Responsabilité'."<br>";
|
||
// echo $score/$scorecount."<br>";
|
||
// echo$linges_blocks['id_candidat']."<br>";
|
||
// echo$linges_blocks['id_resultat_fiche_evaluation']."<br>";
|
||
// echo'<br><br>********************<br><br>';
|
||
// $allscores[] = $score/$scorecount;
|
||
|
||
// $finalscore = array_sum($allscores)/count($allscores);
|
||
// insertScore($linges_blocks['id_candidat'],$linges_blocks['id_resultat_fiche_evaluation'],$finalscore,$linges_blocks['reponse']);
|
||
}
|
||
|
||
function calculeNotes($blocnoteP, $blocnotecountP, $rowP)
|
||
{
|
||
|
||
$rbeval =isset($rowP['eval']) ? $rowP['eval'] : '';
|
||
|
||
$resultnote = annuelToNote($blocnoteP, $blocnotecountP, $rbeval);
|
||
$blocnote = $resultnote[0];
|
||
$blocnotecount = $resultnote[1];
|
||
|
||
if ($rbeval == '') {
|
||
$rbreponse = $rowP['reponse'];
|
||
$resultnote = annuelToNote($blocnoteP, $blocnotecountP, $rbreponse);
|
||
$blocnote = $resultnote[0];
|
||
$blocnotecount = $resultnote[1];
|
||
}
|
||
|
||
|
||
// if (strpos($question, '3.') !== false) {
|
||
// $possele = strpos($reponseHTML, 'selected');
|
||
// if ($possele > 0) {
|
||
// $rhabs = $reponseHTML[$possele + 9];
|
||
// $rhabs = $rhabs * 2;
|
||
// if ($rowP['question'] == 'Ponctualité')
|
||
// $rhabs = $rhabs * 2;
|
||
// $blocnote += $rhabs;
|
||
// $blocnotecount = 4;
|
||
// }
|
||
// }
|
||
|
||
// if (strpos($question, '4.') !== false) {
|
||
// $blocnote = $rowP['reponse'] * 5;
|
||
// $blocnotecount = 1;
|
||
// }
|
||
|
||
// $rbdata = $rowP['reponses'];
|
||
// if (isMultiligne($rbdata)) {
|
||
// $rbobservation = $rowP['observation'];
|
||
// $vobservation = substr($rbobservation, 1, strlen($rbobservation) - 2);
|
||
// $ostrings = explode(',', $vobservation);
|
||
// foreach ($ostrings as $ostring) {
|
||
// $resultnote = annuelToNote($blocnote, $blocnotecount, $ostring);
|
||
// $blocnote = $resultnote[0];
|
||
// $blocnotecount = $resultnote[1];
|
||
// }
|
||
// }
|
||
return [$blocnote, $blocnotecount];
|
||
} |