'; 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 "
";
	// print_r($resultatLignesFicheEvaluation);
	// echo "
"; // die(); } $results = array(); $annuel = $ficheEvaluation["annuel"]; //echo $ficheEvaluation["annuel"]; // foreach($mainblocks[89] as $row){ // print_r($row); // echo'

***************

'; // } // die(); echo "

Resultats : " . str_replace('\'', '"', $ficheEvaluation["nom_fiche_evaluation"]) . "



" . sizeof($mainblocks) . " Evaluation(s)

"; // bachir...Mohammed $isDRH = ($_SESSION['glpiactiveprofile']['name'] == "Directeur RH" || $_SESSION['glpiactiveprofile']['name'] == "DRH"); $isMGX = ($_SESSION['glpiactiveprofile']['name'] == "Directeur MGX"); function visibleMenus($rowP) { global $isDRH; global $isMGX; if ($isDRH || $isMGX) return $rowP['ordre'] == 1 || $rowP['ordre'] == 3 || $rowP['ordre'] == 10 || $rowP['ordre'] == 11 || $rowP['ordre'] == 12 || $rowP['ordre'] == 13 || $rowP['ordre'] == 14; return $rowP['ordre'] == 1 || $rowP['ordre'] == 3 || $rowP['ordre'] == 10 || $rowP['ordre'] == 11 || $rowP['ordre'] == 14; } if (isset($_GET["fiche"])) { if ($_GET["fiche"] == 25) { $resultatLignesFicheEvaluation = getHeaders(); $ficheEvaluation = getFicheEvaluation($_GET['fiche']); echo '



Compétences

Evaluation RH et HSE

Performances


'; echo '
'; foreach ($resultatLignesFicheEvaluation as $key => $value) { if (visibleMenus($value)) { echo '
'; } } echo '
'; } } // end bachir...Mohammed if (isset($mainblocks)) { if (sizeof($mainblocks) > 0) { $first_block = $mainblocks[0][0]; //$entete_first_block = $first_block[0]; //print_r($first_block); $lignes_first_block = $first_block[1]; //print_r($lignes_first_block); echo ""; if ($annuel) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } else { foreach ($lignes_first_block as $th) { echo ""; } echo ""; } echo " "; if ($annuel) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo ""; foreach ($mainblocks as $mainblock) { if ($annuel) resultannuel($mainblock); else result($mainblock); } echo ""; } } echo '
MatriculeEmployeeFonctionStructureResponsable DirectAnneeStatus" . $th['question'] . "
'; Html::footer(); //$row_data[blocknumer][zero(blockheader question) or one(all block questions)][block questions number] function resultannuel($row_data) { global $results; $userarray = array(); $userPerformance = array(); $userExams = array(); $userPlans = array(); $userObjectifs = array(); $linges_blocks = $row_data[0][0]; $idResultatFicheEvaluation = $linges_blocks['id_resultat_fiche_evaluation']; $user = getFUser($linges_blocks['id_candidat']); $row_data_size = sizeof($row_data) - 1; global $idUserCurrent; 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 "
"; $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 "
"; echo "
"; echo "
"; echo "
"; echo "
"; 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 "
"; 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 ""; //echo "".$idResultatFicheEvaluation.""; foreach ($linges_blocks1 as $lbrow) { echo "" . $lbrow['reponse'] . "*"; } /* $linges_blocks2 = $row_data[1][1]; foreach ($linges_blocks2 as $lbrow) { echo "".$lbrow['reponse'].""; }*/ echo "
" . "" . "
"; echo ""; } } function calcScore($score, $scoreCount, $rbreponse, $type) { switch ($type) { case 1: foreach ($rbreponse as $data) { if ($data["reponse"] != "" && $data["reponse"] != "0") { $resultnote = annuelToNote($score, $scoreCount, $data["reponse"]); $score = $resultnote[0]; $scoreCount = $resultnote[1]; } } break; case 2: $abs = is_numeric($rbreponse[1]["reponse"]) ? ($rbreponse[1]["reponse"] * 2) : 5; $disip = is_numeric($rbreponse[2]["reponse"]) ? ($rbreponse[2]["reponse"] * 2) : 5; $score = $abs + $disip; $scoreCount = 4; break; case 3: $score = is_numeric($rbreponse[0]["reponse"]) ? ($rbreponse[0]["reponse"] * 5) : 2; $scoreCount = 1; break; } return [$score, $scoreCount]; } ?>