';
echo '';
echo '';
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"];
if (isset($_GET['delete'])) {
deleteLignesFicheEvaluation($_GET['id']);
//echo "";
}
if (isset($_GET['fiche'])) {
$ficheEvaluation = getFicheEvaluation($_GET['fiche']);
// $root = $_SERVER['DOCUMENT_ROOT'] . $CFG_GLPI["root_doc"] . "/temp_sophal/";
// $file_name = $root . $_SESSION["glpiID"] . ".json";
// if (file_exists($file_name) == false) {
$fiche = $_GET['fiche'];
if ($_GET['fiche'] === '25')
$fiche = '24';
$resultatLignesFicheEvaluation = getResultatLignesFicheEvaluation($fiche, $idUserCurrent);
$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);
// }
// echo "
";
$allScores = array();
$score = getScore($linges_blocks['id_candidat'], $linges_blocks['reponse'])["score"];
$score = is_numeric($score) ? round($score, 2) * 10 : 0;
if ($row_data[1][1][0]['observation'] != "" && $linges_blocks['id_candidat'] == $idUserCurrent) {
echo "| " . $user['matricule'] . " | ";
echo "" . $user['fullname'] . " | ";
echo "" . $user['fonction'] . " | ";
echo "" . $user['structure'] . " | ";
echo "" . $user['superiorname'] . " | ";
echo "" . $linges_blocks['reponse'] . " | ";
echo " | ";
} else {
echo "" . $user['matricule'] . " | ";
echo "" . $user['fullname'] . " | ";
echo "" . $user['fonction'] . " | ";
echo "" . $user['structure'] . " | ";
echo "" . $user['superiorname'] . " | ";
echo "";
$i = 0;
foreach ($row_data[1][1] as $data) {
if ($data["reponse"] != "") {
echo '- * ' . $data["reponse"] . '
';
$userPerformance["perf" . $i] = array($data["reponse"], $data["observation"]);
$i++;
}
}
echo " | ";
$allScores[1] = $score;
echo "" . $score . "% | ";
$cascore = calcScore(0, 0, $row_data[4][1], 1);
$cascore = is_numeric($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1])) ? round($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1]), 2) * 10 : '';
$allScores[2] = $cascore;
echo "" . $cascore . "% | ";
$cascore = calcScore(0, 0, $row_data[5][1], 1);
$cascore = is_numeric($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1])) ? round($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1]), 2) * 10 : '';
$allScores[3] = $cascore;
echo "" . $cascore . "% | ";
$cascore = calcScore(0, 0, $row_data[6][1], 1);
$cascore = is_numeric($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1])) ? round($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1]), 2) * 10 : '';
$allScores[4] = $cascore;
echo "" . $cascore . "% | ";
$cascore = calcScore(0, 0, $row_data[7][1], 1);
$cascore = is_numeric($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1])) ? round($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1]), 2) * 10 : '';
$allScores[5] = $cascore;
echo "" . $cascore . "% | ";
$cascore = calcScore(0, 0, $row_data[8][1], 1);
$cascore = is_numeric($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1])) ? round($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1]), 2) * 10 : '';
$allScores[6] = $cascore;
echo "" . $cascore . "% | ";
echo "";
$i = 0;
foreach ($row_data[9][1] as $data) {
if ($data["reponse"] != "" && $data["reponse"] != "[,]") {
$rep = explode(",", trim(trim($data["reponse"], '['), ']'));
echo '- * ' . $rep[0] . '
';
$userExams["exam" . $i] = array($rep[0], $rep[1]);
$i++;
}
}
echo " | ";
echo "";
foreach ($row_data[9][1] as $data) {
if ($data["reponse"] != "" && $data["reponse"] != "[,]") {
$rep = explode(",", trim(trim($data["reponse"], '['), ']'));
echo '- * ' . $rep[1] . '
';
}
}
echo " | ";
echo "";
$i = 0;
foreach ($row_data[10][1] as $data) {
if ($data["reponse"] != "" && $data["reponse"] != "[,,,]") {
$rep = explode(",", trim(trim($data["reponse"], '['), ']'));
echo '- * ' . $rep[0] . '
';
$userPlans["plan" . $i] = array($rep[0], $rep[1], $rep[2], $rep[3]);
$i++;
}
}
echo " | ";
echo "";
foreach ($row_data[10][1] as $data) {
if ($data["reponse"] != "" && $data["reponse"] != "[,,,]") {
$rep = explode(",", trim(trim($data["reponse"], '['), ']'));
echo '- * ' . $rep[1] . '
';
}
}
echo " | ";
echo "";
foreach ($row_data[10][1] as $data) {
if ($data["reponse"] != "" && $data["reponse"] != "[,,,]") {
$rep = explode(",", trim(trim($data["reponse"], '['), ']'));
echo '- * ' . $rep[2] . '
';
}
}
echo " | ";
echo "";
foreach ($row_data[10][1] as $data) {
if ($data["reponse"] != "" && $data["reponse"] != "[,,,]") {
$rep = explode(",", trim(trim($data["reponse"], '['), ']'));
echo '- * ' . $rep[3] . '
';
}
}
echo " | ";
$cascore = calcScore(0, 0, $row_data[11][1], 2);
$cascore = is_numeric($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1])) ? round($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1]), 2) : '';
$allScores[7] = $cascore;
echo "" . $cascore . " | ";
$cascore = calcScore(0, 0, $row_data[12][1], 3);
$cascore = is_numeric($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1])) ? round($cascore[0] / ($cascore[1] == 0 ? 1 : $cascore[1]), 2) : '';
$allScores[8] = $cascore;
echo "" . $cascore . " | ";
echo "";
$i = 0;
foreach ($row_data[13][1] as $data) {
if ($data["reponse"] != "") {
echo '- * ' . $data["reponse"] . '
';
$userObjectifs["objec" . $i] = array($data["reponse"]);
$i++;
}
}
echo " | ";
echo "" . $linges_blocks['reponse'] . " | ";
echo " | ";
}
$userarray[] = $user['fullname'];
$userarray[] = $user['fonction'];
$userarray[] = str_replace('ô', 'o', str_replace('é', 'e', $user['structure']));
$userarray[] = $linges_blocks['reponse'];
$statusString = "Employé | ";
if ($row_data[1][1][0]['observation'] != "")
$statusString = "Superviseur | ";
if ($row_data[5][1][0]['reponse'] != "" && $row_data[5][1][0]['reponse'] != "0")
$statusString = "DRH | ";
if ($row_data[$row_data_size - 2][1][0]['reponse'] != "" && $row_data[$row_data_size - 2][1][0]['reponse'] != "0")
$statusString = "HSE | ";
if ($row_data[$row_data_size][1][0]['reponse'] != "" && $row_data[$row_data_size][1][0]['reponse'] != "0")
$statusString = " | ";
//print_r($row_data[$row_data_size][1]);echo "ENDdddddddddddddddddddddddd";
$userarray[] = $statusString;
if ($_SESSION['glpiactiveprofile']['name'] == "Super-Admin")
echo " | ";
else
echo " | ";
echo "
";
if ($row_data[1][1][0]['observation'] != "" && $linges_blocks['id_candidat'] == $idUserCurrent) {
} else
$userarray[] = $idResultatFicheEvaluation;
$results[] = array_merge($userarray, $user, array("perf" => $userPerformance, "perfscore" => $allScores, "exams" => $userExams, "plan" => $userPlans, "objectifs" => $userObjectifs));
}
function result($row_data)
{
$linges_blocks1 = $row_data[0][1];
if (isset($linges_blocks1[0])) {
$idResultatFicheEvaluation = $linges_blocks1[0]['id_resultat_fiche_evaluation'];
echo "